diff options
Diffstat (limited to 'drivers/net/ethernet/broadcom/tg3.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 154 |
1 files changed, 84 insertions, 70 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 12d961c4ebca..00c5be8c55b8 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits) | |||
94 | 94 | ||
95 | #define DRV_MODULE_NAME "tg3" | 95 | #define DRV_MODULE_NAME "tg3" |
96 | #define TG3_MAJ_NUM 3 | 96 | #define TG3_MAJ_NUM 3 |
97 | #define TG3_MIN_NUM 133 | 97 | #define TG3_MIN_NUM 134 |
98 | #define DRV_MODULE_VERSION \ | 98 | #define DRV_MODULE_VERSION \ |
99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) | 99 | __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) |
100 | #define DRV_MODULE_RELDATE "Jul 29, 2013" | 100 | #define DRV_MODULE_RELDATE "Sep 16, 2013" |
101 | 101 | ||
102 | #define RESET_KIND_SHUTDOWN 0 | 102 | #define RESET_KIND_SHUTDOWN 0 |
103 | #define RESET_KIND_INIT 1 | 103 | #define RESET_KIND_INIT 1 |
@@ -337,6 +337,11 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = { | |||
337 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, | 337 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, |
338 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, | 338 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, |
339 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, | 339 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, |
340 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57764)}, | ||
341 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57767)}, | ||
342 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57787)}, | ||
343 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57782)}, | ||
344 | {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57786)}, | ||
340 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, | 345 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, |
341 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, | 346 | {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, |
342 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, | 347 | {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)}, |
@@ -1326,6 +1331,12 @@ static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable) | |||
1326 | return err; | 1331 | return err; |
1327 | } | 1332 | } |
1328 | 1333 | ||
1334 | static int tg3_phy_shdw_write(struct tg3 *tp, int reg, u32 val) | ||
1335 | { | ||
1336 | return tg3_writephy(tp, MII_TG3_MISC_SHDW, | ||
1337 | reg | val | MII_TG3_MISC_SHDW_WREN); | ||
1338 | } | ||
1339 | |||
1329 | static int tg3_bmcr_reset(struct tg3 *tp) | 1340 | static int tg3_bmcr_reset(struct tg3 *tp) |
1330 | { | 1341 | { |
1331 | u32 phy_control; | 1342 | u32 phy_control; |
@@ -1364,7 +1375,7 @@ static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg) | |||
1364 | 1375 | ||
1365 | spin_lock_bh(&tp->lock); | 1376 | spin_lock_bh(&tp->lock); |
1366 | 1377 | ||
1367 | if (tg3_readphy(tp, reg, &val)) | 1378 | if (__tg3_readphy(tp, mii_id, reg, &val)) |
1368 | val = -EIO; | 1379 | val = -EIO; |
1369 | 1380 | ||
1370 | spin_unlock_bh(&tp->lock); | 1381 | spin_unlock_bh(&tp->lock); |
@@ -1379,7 +1390,7 @@ static int tg3_mdio_write(struct mii_bus *bp, int mii_id, int reg, u16 val) | |||
1379 | 1390 | ||
1380 | spin_lock_bh(&tp->lock); | 1391 | spin_lock_bh(&tp->lock); |
1381 | 1392 | ||
1382 | if (tg3_writephy(tp, reg, val)) | 1393 | if (__tg3_writephy(tp, mii_id, reg, val)) |
1383 | ret = -EIO; | 1394 | ret = -EIO; |
1384 | 1395 | ||
1385 | spin_unlock_bh(&tp->lock); | 1396 | spin_unlock_bh(&tp->lock); |
@@ -1397,7 +1408,7 @@ static void tg3_mdio_config_5785(struct tg3 *tp) | |||
1397 | u32 val; | 1408 | u32 val; |
1398 | struct phy_device *phydev; | 1409 | struct phy_device *phydev; |
1399 | 1410 | ||
1400 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 1411 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
1401 | switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { | 1412 | switch (phydev->drv->phy_id & phydev->drv->phy_id_mask) { |
1402 | case PHY_ID_BCM50610: | 1413 | case PHY_ID_BCM50610: |
1403 | case PHY_ID_BCM50610M: | 1414 | case PHY_ID_BCM50610M: |
@@ -1502,6 +1513,13 @@ static int tg3_mdio_init(struct tg3 *tp) | |||
1502 | TG3_CPMU_PHY_STRAP_IS_SERDES; | 1513 | TG3_CPMU_PHY_STRAP_IS_SERDES; |
1503 | if (is_serdes) | 1514 | if (is_serdes) |
1504 | tp->phy_addr += 7; | 1515 | tp->phy_addr += 7; |
1516 | } else if (tg3_flag(tp, IS_SSB_CORE) && tg3_flag(tp, ROBOSWITCH)) { | ||
1517 | int addr; | ||
1518 | |||
1519 | addr = ssb_gige_get_phyaddr(tp->pdev); | ||
1520 | if (addr < 0) | ||
1521 | return addr; | ||
1522 | tp->phy_addr = addr; | ||
1505 | } else | 1523 | } else |
1506 | tp->phy_addr = TG3_PHY_MII_ADDR; | 1524 | tp->phy_addr = TG3_PHY_MII_ADDR; |
1507 | 1525 | ||
@@ -1522,7 +1540,7 @@ static int tg3_mdio_init(struct tg3 *tp) | |||
1522 | tp->mdio_bus->read = &tg3_mdio_read; | 1540 | tp->mdio_bus->read = &tg3_mdio_read; |
1523 | tp->mdio_bus->write = &tg3_mdio_write; | 1541 | tp->mdio_bus->write = &tg3_mdio_write; |
1524 | tp->mdio_bus->reset = &tg3_mdio_reset; | 1542 | tp->mdio_bus->reset = &tg3_mdio_reset; |
1525 | tp->mdio_bus->phy_mask = ~(1 << TG3_PHY_MII_ADDR); | 1543 | tp->mdio_bus->phy_mask = ~(1 << tp->phy_addr); |
1526 | tp->mdio_bus->irq = &tp->mdio_irq[0]; | 1544 | tp->mdio_bus->irq = &tp->mdio_irq[0]; |
1527 | 1545 | ||
1528 | for (i = 0; i < PHY_MAX_ADDR; i++) | 1546 | for (i = 0; i < PHY_MAX_ADDR; i++) |
@@ -1543,7 +1561,7 @@ static int tg3_mdio_init(struct tg3 *tp) | |||
1543 | return i; | 1561 | return i; |
1544 | } | 1562 | } |
1545 | 1563 | ||
1546 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 1564 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
1547 | 1565 | ||
1548 | if (!phydev || !phydev->drv) { | 1566 | if (!phydev || !phydev->drv) { |
1549 | dev_warn(&tp->pdev->dev, "No PHY devices\n"); | 1567 | dev_warn(&tp->pdev->dev, "No PHY devices\n"); |
@@ -1953,7 +1971,7 @@ static void tg3_setup_flow_control(struct tg3 *tp, u32 lcladv, u32 rmtadv) | |||
1953 | u32 old_tx_mode = tp->tx_mode; | 1971 | u32 old_tx_mode = tp->tx_mode; |
1954 | 1972 | ||
1955 | if (tg3_flag(tp, USE_PHYLIB)) | 1973 | if (tg3_flag(tp, USE_PHYLIB)) |
1956 | autoneg = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]->autoneg; | 1974 | autoneg = tp->mdio_bus->phy_map[tp->phy_addr]->autoneg; |
1957 | else | 1975 | else |
1958 | autoneg = tp->link_config.autoneg; | 1976 | autoneg = tp->link_config.autoneg; |
1959 | 1977 | ||
@@ -1989,7 +2007,7 @@ static void tg3_adjust_link(struct net_device *dev) | |||
1989 | u8 oldflowctrl, linkmesg = 0; | 2007 | u8 oldflowctrl, linkmesg = 0; |
1990 | u32 mac_mode, lcl_adv, rmt_adv; | 2008 | u32 mac_mode, lcl_adv, rmt_adv; |
1991 | struct tg3 *tp = netdev_priv(dev); | 2009 | struct tg3 *tp = netdev_priv(dev); |
1992 | struct phy_device *phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 2010 | struct phy_device *phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
1993 | 2011 | ||
1994 | spin_lock_bh(&tp->lock); | 2012 | spin_lock_bh(&tp->lock); |
1995 | 2013 | ||
@@ -2078,7 +2096,7 @@ static int tg3_phy_init(struct tg3 *tp) | |||
2078 | /* Bring the PHY back to a known state. */ | 2096 | /* Bring the PHY back to a known state. */ |
2079 | tg3_bmcr_reset(tp); | 2097 | tg3_bmcr_reset(tp); |
2080 | 2098 | ||
2081 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 2099 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
2082 | 2100 | ||
2083 | /* Attach the MAC to the PHY. */ | 2101 | /* Attach the MAC to the PHY. */ |
2084 | phydev = phy_connect(tp->dev, dev_name(&phydev->dev), | 2102 | phydev = phy_connect(tp->dev, dev_name(&phydev->dev), |
@@ -2105,7 +2123,7 @@ static int tg3_phy_init(struct tg3 *tp) | |||
2105 | SUPPORTED_Asym_Pause); | 2123 | SUPPORTED_Asym_Pause); |
2106 | break; | 2124 | break; |
2107 | default: | 2125 | default: |
2108 | phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); | 2126 | phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]); |
2109 | return -EINVAL; | 2127 | return -EINVAL; |
2110 | } | 2128 | } |
2111 | 2129 | ||
@@ -2123,7 +2141,7 @@ static void tg3_phy_start(struct tg3 *tp) | |||
2123 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 2141 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
2124 | return; | 2142 | return; |
2125 | 2143 | ||
2126 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 2144 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
2127 | 2145 | ||
2128 | if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) { | 2146 | if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) { |
2129 | tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER; | 2147 | tp->phy_flags &= ~TG3_PHYFLG_IS_LOW_POWER; |
@@ -2143,13 +2161,13 @@ static void tg3_phy_stop(struct tg3 *tp) | |||
2143 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 2161 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
2144 | return; | 2162 | return; |
2145 | 2163 | ||
2146 | phy_stop(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); | 2164 | phy_stop(tp->mdio_bus->phy_map[tp->phy_addr]); |
2147 | } | 2165 | } |
2148 | 2166 | ||
2149 | static void tg3_phy_fini(struct tg3 *tp) | 2167 | static void tg3_phy_fini(struct tg3 *tp) |
2150 | { | 2168 | { |
2151 | if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { | 2169 | if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { |
2152 | phy_disconnect(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); | 2170 | phy_disconnect(tp->mdio_bus->phy_map[tp->phy_addr]); |
2153 | tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED; | 2171 | tp->phy_flags &= ~TG3_PHYFLG_IS_CONNECTED; |
2154 | } | 2172 | } |
2155 | } | 2173 | } |
@@ -2218,25 +2236,21 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable) | |||
2218 | return; | 2236 | return; |
2219 | } | 2237 | } |
2220 | 2238 | ||
2221 | reg = MII_TG3_MISC_SHDW_WREN | | 2239 | reg = MII_TG3_MISC_SHDW_SCR5_LPED | |
2222 | MII_TG3_MISC_SHDW_SCR5_SEL | | ||
2223 | MII_TG3_MISC_SHDW_SCR5_LPED | | ||
2224 | MII_TG3_MISC_SHDW_SCR5_DLPTLM | | 2240 | MII_TG3_MISC_SHDW_SCR5_DLPTLM | |
2225 | MII_TG3_MISC_SHDW_SCR5_SDTL | | 2241 | MII_TG3_MISC_SHDW_SCR5_SDTL | |
2226 | MII_TG3_MISC_SHDW_SCR5_C125OE; | 2242 | MII_TG3_MISC_SHDW_SCR5_C125OE; |
2227 | if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable) | 2243 | if (tg3_asic_rev(tp) != ASIC_REV_5784 || !enable) |
2228 | reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD; | 2244 | reg |= MII_TG3_MISC_SHDW_SCR5_DLLAPD; |
2229 | 2245 | ||
2230 | tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); | 2246 | tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_SCR5_SEL, reg); |
2231 | 2247 | ||
2232 | 2248 | ||
2233 | reg = MII_TG3_MISC_SHDW_WREN | | 2249 | reg = MII_TG3_MISC_SHDW_APD_WKTM_84MS; |
2234 | MII_TG3_MISC_SHDW_APD_SEL | | ||
2235 | MII_TG3_MISC_SHDW_APD_WKTM_84MS; | ||
2236 | if (enable) | 2250 | if (enable) |
2237 | reg |= MII_TG3_MISC_SHDW_APD_ENABLE; | 2251 | reg |= MII_TG3_MISC_SHDW_APD_ENABLE; |
2238 | 2252 | ||
2239 | tg3_writephy(tp, MII_TG3_MISC_SHDW, reg); | 2253 | tg3_phy_shdw_write(tp, MII_TG3_MISC_SHDW_APD_SEL, reg); |
2240 | } | 2254 | } |
2241 | 2255 | ||
2242 | static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable) | 2256 | static void tg3_phy_toggle_automdix(struct tg3 *tp, bool enable) |
@@ -4027,7 +4041,7 @@ static int tg3_power_down_prepare(struct tg3 *tp) | |||
4027 | struct phy_device *phydev; | 4041 | struct phy_device *phydev; |
4028 | u32 phyid, advertising; | 4042 | u32 phyid, advertising; |
4029 | 4043 | ||
4030 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 4044 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
4031 | 4045 | ||
4032 | tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER; | 4046 | tp->phy_flags |= TG3_PHYFLG_IS_LOW_POWER; |
4033 | 4047 | ||
@@ -6848,12 +6862,6 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6848 | pci_unmap_single(tp->pdev, dma_addr, skb_size, | 6862 | pci_unmap_single(tp->pdev, dma_addr, skb_size, |
6849 | PCI_DMA_FROMDEVICE); | 6863 | PCI_DMA_FROMDEVICE); |
6850 | 6864 | ||
6851 | skb = build_skb(data, frag_size); | ||
6852 | if (!skb) { | ||
6853 | tg3_frag_free(frag_size != 0, data); | ||
6854 | goto drop_it_no_recycle; | ||
6855 | } | ||
6856 | skb_reserve(skb, TG3_RX_OFFSET(tp)); | ||
6857 | /* Ensure that the update to the data happens | 6865 | /* Ensure that the update to the data happens |
6858 | * after the usage of the old DMA mapping. | 6866 | * after the usage of the old DMA mapping. |
6859 | */ | 6867 | */ |
@@ -6861,6 +6869,12 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
6861 | 6869 | ||
6862 | ri->data = NULL; | 6870 | ri->data = NULL; |
6863 | 6871 | ||
6872 | skb = build_skb(data, frag_size); | ||
6873 | if (!skb) { | ||
6874 | tg3_frag_free(frag_size != 0, data); | ||
6875 | goto drop_it_no_recycle; | ||
6876 | } | ||
6877 | skb_reserve(skb, TG3_RX_OFFSET(tp)); | ||
6864 | } else { | 6878 | } else { |
6865 | tg3_recycle_rx(tnapi, tpr, opaque_key, | 6879 | tg3_recycle_rx(tnapi, tpr, opaque_key, |
6866 | desc_idx, *post_ptr); | 6880 | desc_idx, *post_ptr); |
@@ -9196,10 +9210,7 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent) | |||
9196 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); | 9210 | memset(tp->hw_stats, 0, sizeof(struct tg3_hw_stats)); |
9197 | } | 9211 | } |
9198 | 9212 | ||
9199 | if (err) | 9213 | return err; |
9200 | return err; | ||
9201 | |||
9202 | return 0; | ||
9203 | } | 9214 | } |
9204 | 9215 | ||
9205 | static int tg3_set_mac_addr(struct net_device *dev, void *p) | 9216 | static int tg3_set_mac_addr(struct net_device *dev, void *p) |
@@ -11035,7 +11046,18 @@ static int tg3_request_irq(struct tg3 *tp, int irq_num) | |||
11035 | name = tp->dev->name; | 11046 | name = tp->dev->name; |
11036 | else { | 11047 | else { |
11037 | name = &tnapi->irq_lbl[0]; | 11048 | name = &tnapi->irq_lbl[0]; |
11038 | snprintf(name, IFNAMSIZ, "%s-%d", tp->dev->name, irq_num); | 11049 | if (tnapi->tx_buffers && tnapi->rx_rcb) |
11050 | snprintf(name, IFNAMSIZ, | ||
11051 | "%s-txrx-%d", tp->dev->name, irq_num); | ||
11052 | else if (tnapi->tx_buffers) | ||
11053 | snprintf(name, IFNAMSIZ, | ||
11054 | "%s-tx-%d", tp->dev->name, irq_num); | ||
11055 | else if (tnapi->rx_rcb) | ||
11056 | snprintf(name, IFNAMSIZ, | ||
11057 | "%s-rx-%d", tp->dev->name, irq_num); | ||
11058 | else | ||
11059 | snprintf(name, IFNAMSIZ, | ||
11060 | "%s-%d", tp->dev->name, irq_num); | ||
11039 | name[IFNAMSIZ-1] = 0; | 11061 | name[IFNAMSIZ-1] = 0; |
11040 | } | 11062 | } |
11041 | 11063 | ||
@@ -11907,7 +11929,7 @@ static int tg3_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
11907 | struct phy_device *phydev; | 11929 | struct phy_device *phydev; |
11908 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 11930 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
11909 | return -EAGAIN; | 11931 | return -EAGAIN; |
11910 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 11932 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
11911 | return phy_ethtool_gset(phydev, cmd); | 11933 | return phy_ethtool_gset(phydev, cmd); |
11912 | } | 11934 | } |
11913 | 11935 | ||
@@ -11974,7 +11996,7 @@ static int tg3_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
11974 | struct phy_device *phydev; | 11996 | struct phy_device *phydev; |
11975 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 11997 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
11976 | return -EAGAIN; | 11998 | return -EAGAIN; |
11977 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 11999 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
11978 | return phy_ethtool_sset(phydev, cmd); | 12000 | return phy_ethtool_sset(phydev, cmd); |
11979 | } | 12001 | } |
11980 | 12002 | ||
@@ -12093,12 +12115,10 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
12093 | 12115 | ||
12094 | device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC); | 12116 | device_set_wakeup_enable(dp, wol->wolopts & WAKE_MAGIC); |
12095 | 12117 | ||
12096 | spin_lock_bh(&tp->lock); | ||
12097 | if (device_may_wakeup(dp)) | 12118 | if (device_may_wakeup(dp)) |
12098 | tg3_flag_set(tp, WOL_ENABLE); | 12119 | tg3_flag_set(tp, WOL_ENABLE); |
12099 | else | 12120 | else |
12100 | tg3_flag_clear(tp, WOL_ENABLE); | 12121 | tg3_flag_clear(tp, WOL_ENABLE); |
12101 | spin_unlock_bh(&tp->lock); | ||
12102 | 12122 | ||
12103 | return 0; | 12123 | return 0; |
12104 | } | 12124 | } |
@@ -12131,7 +12151,7 @@ static int tg3_nway_reset(struct net_device *dev) | |||
12131 | if (tg3_flag(tp, USE_PHYLIB)) { | 12151 | if (tg3_flag(tp, USE_PHYLIB)) { |
12132 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 12152 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
12133 | return -EAGAIN; | 12153 | return -EAGAIN; |
12134 | r = phy_start_aneg(tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]); | 12154 | r = phy_start_aneg(tp->mdio_bus->phy_map[tp->phy_addr]); |
12135 | } else { | 12155 | } else { |
12136 | u32 bmcr; | 12156 | u32 bmcr; |
12137 | 12157 | ||
@@ -12247,7 +12267,7 @@ static int tg3_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam | |||
12247 | u32 newadv; | 12267 | u32 newadv; |
12248 | struct phy_device *phydev; | 12268 | struct phy_device *phydev; |
12249 | 12269 | ||
12250 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 12270 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
12251 | 12271 | ||
12252 | if (!(phydev->supported & SUPPORTED_Pause) || | 12272 | if (!(phydev->supported & SUPPORTED_Pause) || |
12253 | (!(phydev->supported & SUPPORTED_Asym_Pause) && | 12273 | (!(phydev->supported & SUPPORTED_Asym_Pause) && |
@@ -13194,8 +13214,8 @@ static int tg3_run_loopback(struct tg3 *tp, u32 pktsz, bool tso_loopback) | |||
13194 | return -ENOMEM; | 13214 | return -ENOMEM; |
13195 | 13215 | ||
13196 | tx_data = skb_put(skb, tx_len); | 13216 | tx_data = skb_put(skb, tx_len); |
13197 | memcpy(tx_data, tp->dev->dev_addr, 6); | 13217 | memcpy(tx_data, tp->dev->dev_addr, ETH_ALEN); |
13198 | memset(tx_data + 6, 0x0, 8); | 13218 | memset(tx_data + ETH_ALEN, 0x0, 8); |
13199 | 13219 | ||
13200 | tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN); | 13220 | tw32(MAC_RX_MTU_SIZE, tx_len + ETH_FCS_LEN); |
13201 | 13221 | ||
@@ -13683,7 +13703,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
13683 | struct phy_device *phydev; | 13703 | struct phy_device *phydev; |
13684 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) | 13704 | if (!(tp->phy_flags & TG3_PHYFLG_IS_CONNECTED)) |
13685 | return -EAGAIN; | 13705 | return -EAGAIN; |
13686 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 13706 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
13687 | return phy_mii_ioctl(phydev, ifr, cmd); | 13707 | return phy_mii_ioctl(phydev, ifr, cmd); |
13688 | } | 13708 | } |
13689 | 13709 | ||
@@ -14921,6 +14941,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp) | |||
14921 | tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) | 14941 | tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) |
14922 | tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 | | 14942 | tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 | |
14923 | LED_CTRL_MODE_PHY_2); | 14943 | LED_CTRL_MODE_PHY_2); |
14944 | |||
14945 | if (tg3_flag(tp, 5717_PLUS) || | ||
14946 | tg3_asic_rev(tp) == ASIC_REV_5762) | ||
14947 | tp->led_ctrl |= LED_CTRL_BLINK_RATE_OVERRIDE | | ||
14948 | LED_CTRL_BLINK_RATE_MASK; | ||
14949 | |||
14924 | break; | 14950 | break; |
14925 | 14951 | ||
14926 | case SHASTA_EXT_LED_MAC: | 14952 | case SHASTA_EXT_LED_MAC: |
@@ -15759,9 +15785,12 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg) | |||
15759 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | 15785 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || |
15760 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || | 15786 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || |
15761 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || | 15787 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || |
15788 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 || | ||
15789 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 || | ||
15762 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || | 15790 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || |
15763 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || | 15791 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || |
15764 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) | 15792 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 || |
15793 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) | ||
15765 | reg = TG3PCI_GEN2_PRODID_ASICREV; | 15794 | reg = TG3PCI_GEN2_PRODID_ASICREV; |
15766 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || | 15795 | else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || |
15767 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 || | 15796 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 || |
@@ -16632,8 +16661,8 @@ static int tg3_get_macaddr_sparc(struct tg3 *tp) | |||
16632 | int len; | 16661 | int len; |
16633 | 16662 | ||
16634 | addr = of_get_property(dp, "local-mac-address", &len); | 16663 | addr = of_get_property(dp, "local-mac-address", &len); |
16635 | if (addr && len == 6) { | 16664 | if (addr && len == ETH_ALEN) { |
16636 | memcpy(dev->dev_addr, addr, 6); | 16665 | memcpy(dev->dev_addr, addr, ETH_ALEN); |
16637 | return 0; | 16666 | return 0; |
16638 | } | 16667 | } |
16639 | return -ENODEV; | 16668 | return -ENODEV; |
@@ -16643,7 +16672,7 @@ static int tg3_get_default_macaddr_sparc(struct tg3 *tp) | |||
16643 | { | 16672 | { |
16644 | struct net_device *dev = tp->dev; | 16673 | struct net_device *dev = tp->dev; |
16645 | 16674 | ||
16646 | memcpy(dev->dev_addr, idprom->id_ethaddr, 6); | 16675 | memcpy(dev->dev_addr, idprom->id_ethaddr, ETH_ALEN); |
16647 | return 0; | 16676 | return 0; |
16648 | } | 16677 | } |
16649 | #endif | 16678 | #endif |
@@ -17052,10 +17081,6 @@ static int tg3_test_dma(struct tg3 *tp) | |||
17052 | 17081 | ||
17053 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); | 17082 | tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl); |
17054 | 17083 | ||
17055 | #if 0 | ||
17056 | /* Unneeded, already done by tg3_get_invariants. */ | ||
17057 | tg3_switch_clocks(tp); | ||
17058 | #endif | ||
17059 | 17084 | ||
17060 | if (tg3_asic_rev(tp) != ASIC_REV_5700 && | 17085 | if (tg3_asic_rev(tp) != ASIC_REV_5700 && |
17061 | tg3_asic_rev(tp) != ASIC_REV_5701) | 17086 | tg3_asic_rev(tp) != ASIC_REV_5701) |
@@ -17083,20 +17108,6 @@ static int tg3_test_dma(struct tg3 *tp) | |||
17083 | break; | 17108 | break; |
17084 | } | 17109 | } |
17085 | 17110 | ||
17086 | #if 0 | ||
17087 | /* validate data reached card RAM correctly. */ | ||
17088 | for (i = 0; i < TEST_BUFFER_SIZE / sizeof(u32); i++) { | ||
17089 | u32 val; | ||
17090 | tg3_read_mem(tp, 0x2100 + (i*4), &val); | ||
17091 | if (le32_to_cpu(val) != p[i]) { | ||
17092 | dev_err(&tp->pdev->dev, | ||
17093 | "%s: Buffer corrupted on device! " | ||
17094 | "(%d != %d)\n", __func__, val, i); | ||
17095 | /* ret = -ENODEV here? */ | ||
17096 | } | ||
17097 | p[i] = 0; | ||
17098 | } | ||
17099 | #endif | ||
17100 | /* Now read it back. */ | 17111 | /* Now read it back. */ |
17101 | ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false); | 17112 | ret = tg3_do_test_dma(tp, buf, buf_dma, TEST_BUFFER_SIZE, false); |
17102 | if (ret) { | 17113 | if (ret) { |
@@ -17362,8 +17373,10 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17362 | tg3_flag_set(tp, FLUSH_POSTED_WRITES); | 17373 | tg3_flag_set(tp, FLUSH_POSTED_WRITES); |
17363 | if (ssb_gige_one_dma_at_once(pdev)) | 17374 | if (ssb_gige_one_dma_at_once(pdev)) |
17364 | tg3_flag_set(tp, ONE_DMA_AT_ONCE); | 17375 | tg3_flag_set(tp, ONE_DMA_AT_ONCE); |
17365 | if (ssb_gige_have_roboswitch(pdev)) | 17376 | if (ssb_gige_have_roboswitch(pdev)) { |
17377 | tg3_flag_set(tp, USE_PHYLIB); | ||
17366 | tg3_flag_set(tp, ROBOSWITCH); | 17378 | tg3_flag_set(tp, ROBOSWITCH); |
17379 | } | ||
17367 | if (ssb_gige_is_rgmii(pdev)) | 17380 | if (ssb_gige_is_rgmii(pdev)) |
17368 | tg3_flag_set(tp, RGMII_MODE); | 17381 | tg3_flag_set(tp, RGMII_MODE); |
17369 | } | 17382 | } |
@@ -17409,9 +17422,12 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17409 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || | 17422 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || |
17410 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || | 17423 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || |
17411 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || | 17424 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || |
17425 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 || | ||
17426 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 || | ||
17412 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || | 17427 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || |
17413 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || | 17428 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || |
17414 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) { | 17429 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 || |
17430 | tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) { | ||
17415 | tg3_flag_set(tp, ENABLE_APE); | 17431 | tg3_flag_set(tp, ENABLE_APE); |
17416 | tp->aperegs = pci_ioremap_bar(pdev, BAR_2); | 17432 | tp->aperegs = pci_ioremap_bar(pdev, BAR_2); |
17417 | if (!tp->aperegs) { | 17433 | if (!tp->aperegs) { |
@@ -17628,7 +17644,7 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
17628 | 17644 | ||
17629 | if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { | 17645 | if (tp->phy_flags & TG3_PHYFLG_IS_CONNECTED) { |
17630 | struct phy_device *phydev; | 17646 | struct phy_device *phydev; |
17631 | phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR]; | 17647 | phydev = tp->mdio_bus->phy_map[tp->phy_addr]; |
17632 | netdev_info(dev, | 17648 | netdev_info(dev, |
17633 | "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", | 17649 | "attached PHY driver [%s] (mii_bus:phy_addr=%s)\n", |
17634 | phydev->drv->name, dev_name(&phydev->dev)); | 17650 | phydev->drv->name, dev_name(&phydev->dev)); |
@@ -17685,7 +17701,6 @@ err_out_free_res: | |||
17685 | err_out_disable_pdev: | 17701 | err_out_disable_pdev: |
17686 | if (pci_is_enabled(pdev)) | 17702 | if (pci_is_enabled(pdev)) |
17687 | pci_disable_device(pdev); | 17703 | pci_disable_device(pdev); |
17688 | pci_set_drvdata(pdev, NULL); | ||
17689 | return err; | 17704 | return err; |
17690 | } | 17705 | } |
17691 | 17706 | ||
@@ -17717,7 +17732,6 @@ static void tg3_remove_one(struct pci_dev *pdev) | |||
17717 | free_netdev(dev); | 17732 | free_netdev(dev); |
17718 | pci_release_regions(pdev); | 17733 | pci_release_regions(pdev); |
17719 | pci_disable_device(pdev); | 17734 | pci_disable_device(pdev); |
17720 | pci_set_drvdata(pdev, NULL); | ||
17721 | } | 17735 | } |
17722 | } | 17736 | } |
17723 | 17737 | ||