[linux-yocto] [PATCH 037/161] drivers/net/ethernet: Use ntohl() instead of #defines and swab32().
Cristian Bercaru
cristian.bercaru at windriver.com
Thu May 21 12:20:19 PDT 2015
From: John Jacques <john.jacques at lsi.com>
Get the auto-negotiate mode working on ARM.
Signed-off-by: John Jacques <john.jacques at lsi.com>
---
drivers/net/ethernet/lsi/lsi_acp_net.c | 36 ++++++++++++++------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/net/ethernet/lsi/lsi_acp_net.c b/drivers/net/ethernet/lsi/lsi_acp_net.c
index d5204f1..1753efd 100644
--- a/drivers/net/ethernet/lsi/lsi_acp_net.c
+++ b/drivers/net/ethernet/lsi/lsi_acp_net.c
@@ -92,6 +92,7 @@
/* Define to disable full duplex mode on Amarillo boards */
#undef AMARILLO_WA
+/*#define AMARILLO_WA*/
#define LSI_DRV_NAME "acp-femac"
#define LSI_MDIO_NAME "acp-femac-mdio"
@@ -261,6 +262,8 @@ skip_first:
0 == pdata->phy_link_speed ? SPEED_10 : SPEED_100;
phydev->duplex =
0 == pdata->phy_link_duplex ? DUPLEX_HALF : DUPLEX_FULL;
+ } else {
+ phydev->autoneg = AUTONEG_ENABLE;
}
ret = phy_connect_direct(dev, phydev,
@@ -283,15 +286,18 @@ skip_first:
/* Enable access to shadow register @ 0x1d */
rc = acp_mdio_read(phydev->addr, PHY_BCM_TEST_REG, &val);
val |= 0x80;
- rc = acp_mdio_write(phydev->addr, PHY_BCM_TEST_REG, val);
+ rc |= acp_mdio_write(phydev->addr, PHY_BCM_TEST_REG, val);
/* Set RX FIFO size to 0x7 */
- rc = acp_mdio_write(phydev->addr, PHY_AUXILIARY_MODE3, 0x7);
+ rc |= acp_mdio_read(phydev->addr, PHY_AUXILIARY_MODE3, &val);
+ val &= 0xf;
+ val |= 0x7;
+ rc |= acp_mdio_write(phydev->addr, PHY_AUXILIARY_MODE3, val);
/* Disable access to shadow register @ 0x1d */
- rc = acp_mdio_read(phydev->addr, PHY_BCM_TEST_REG, &val);
+ rc |= acp_mdio_read(phydev->addr, PHY_BCM_TEST_REG, &val);
val &= ~0x80;
- rc = acp_mdio_write(phydev->addr, PHY_BCM_TEST_REG, val);
+ rc |= acp_mdio_write(phydev->addr, PHY_BCM_TEST_REG, val);
}
#endif
netdev_info(dev,
@@ -1831,35 +1837,24 @@ static int __devinit appnic_probe_config_dt(struct net_device *dev,
else
pdata->dma_interrupt = field[0];
#endif
+
field = of_get_property(np, "mdio-clock", NULL);
if (!field)
goto device_tree_failed;
else
-#ifdef CONFIG_ARM
- pdata->mdio_clock = swab32(field[0]);
-#else
- pdata->mdio_clock = field[0];
-#endif
+ pdata->mdio_clock = ntohl(field[0]);
field = of_get_property(np, "phy-address", NULL);
if (!field)
goto device_tree_failed;
else
-#ifdef CONFIG_ARM
- pdata->phy_address = swab32(field[0]);
-#else
- pdata->phy_address = field[0];
-#endif
+ pdata->phy_address = ntohl(field[0]);
field = of_get_property(np, "ad-value", NULL);
if (!field)
goto device_tree_failed;
else
-#ifdef CONFIG_ARM
- pdata->ad_value = swab32(field[0]);
-#else
- pdata->ad_value = field[0];
-#endif
+ pdata->ad_value = ntohl(field[0]);
macspeed = of_get_property(np, "phy-link", NULL);
@@ -1883,7 +1878,8 @@ static int __devinit appnic_probe_config_dt(struct net_device *dev,
pdata->phy_link_speed = 0;
pdata->phy_link_duplex = 0;
} else {
- pr_err("Invalid phy-link value \"%s\" in DTS. Defaulting to \"auto\".\n",
+ pr_err("Invalid phy-link value \"%s\" "
+ "in DTS. Defaulting to \"auto\".\n",
macspeed);
pdata->phy_link_auto = 1;
}
--
1.7.9.5
More information about the linux-yocto
mailing list