tg3: Misc cleanups and fixes.
Subsystems (3)
cover tg3: Misc cleanups and fixes.
Nithin Nayak Sujir (8):
tg3: Add function tg3_phy_shdw_write()
tg3: Add support for new 577xx device ids
tg3: LED in shared mode does not blink during traffic
tg3: Remove if 0'd code
tg3: Remove redundant if check
tg3: Appropriately classify interrupts during request_irq
tg3: Remove unnecessary spinlock
tg3: Update version to 3.134
drivers/net/ethernet/broadcom/tg3.c | 81 ++++++++++++++++++++----------------- drivers/net/ethernet/broadcom/tg3.h | 3 ++ 2 files changed, 47 insertions(+), 37 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/8 tg3: Add function tg3_phy_shdw_write()
For consistency with other register access functions, add shadow register access function of the type (register/val).
--- drivers/net/ethernet/broadcom/tg3.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +10 -8
@@ -1326,6 +1326,12 @@ static int tg3_phy_toggle_auxctl_smdsp(struct tg3 *tp, bool enable)return err; } +static int tg3_phy_shdw_write (struct tg3 *tp,int reg,u32 val) +{ +return tg3_writephy (tp,MII_TG3_MISC_SHDW , + reg | val |MII_TG3_MISC_SHDW_WREN ); +} +static int tg3_bmcr_reset (struct tg3 *tp) {u32 phy_control;
@@ -2218,25 +2224,21 @@ static void tg3_phy_toggle_apd(struct tg3 *tp, bool enable)return ; } - reg =MII_TG3_MISC_SHDW_WREN | -MII_TG3_MISC_SHDW_SCR5_SEL | -MII_TG3_MISC_SHDW_SCR5_LPED | + reg =MII_TG3_MISC_SHDW_SCR5_LPED |MII_TG3_MISC_SHDW_SCR5_DLPTLM |MII_TG3_MISC_SHDW_SCR5_SDTL |MII_TG3_MISC_SHDW_SCR5_C125OE ;if (tg3_asic_rev (tp) !=ASIC_REV_5784 || !enable) reg |=MII_TG3_MISC_SHDW_SCR5_DLLAPD ; -tg3_writephy (tp,MII_TG3_MISC_SHDW , reg); +tg3_phy_shdw_write (tp,MII_TG3_MISC_SHDW_SCR5_SEL , reg); - reg =MII_TG3_MISC_SHDW_WREN | -MII_TG3_MISC_SHDW_APD_SEL | -MII_TG3_MISC_SHDW_APD_WKTM_84MS ; + reg =MII_TG3_MISC_SHDW_APD_WKTM_84MS ;if (enable) reg |=MII_TG3_MISC_SHDW_APD_ENABLE ; -tg3_writephy (tp,MII_TG3_MISC_SHDW , reg); +tg3_phy_shdw_write (tp,MII_TG3_MISC_SHDW_APD_SEL , reg); }static void tg3_phy_toggle_automdix (struct tg3 *tp,bool enable)
Signature · 1 line
1.8.1.4
PATCH 2/8 tg3: Add support for new 577xx device ids
In reply to Nithin Nayak SujirThis patch adds support for 57764, 57765, 57787, 57782 and 57786 devices.
--- drivers/net/ethernet/broadcom/tg3.c | 15 +++++++++++++-- drivers/net/ethernet/broadcom/tg3.h | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +13 -2
@@ -337,6 +337,11 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = { {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)}, {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)}, {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57764)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57767)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57787)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57782)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57786)}, {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -15760,9 +15765,12 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg) tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5718 || tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5719 || tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5720 || + tp->pdev->device ==TG3PCI_DEVICE_TIGON3_57767 || + tp->pdev->device ==TG3PCI_DEVICE_TIGON3_57764 || tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5762 || tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5725 || - tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) + tp->pdev->device ==TG3PCI_DEVICE_TIGON3_5727 || + tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) reg = TG3PCI_GEN2_PRODID_ASICREV; else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 || tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
@@ -17411,9 +17419,12 @@ static int tg3_init_one(struct pci_dev *pdev, tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 || tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 || tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 || + tp->pdev->device == TG3PCI_DEVICE_TIGON3_57767 || + tp->pdev->device == TG3PCI_DEVICE_TIGON3_57764 || tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 || tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 || - tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) { + tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727 || + tp->pdev->device == TG3PCI_DEVICE_TIGON3_57787) {tg3_flag_set (tp,ENABLE_APE ); tp->aperegs =pci_ioremap_bar (pdev,BAR_2 );if (!tp->aperegs) {
drivers/net/ethernet/broadcom/tg3.h +3 -0
@@ -68,6 +68,9 @@#define TG3PCI_DEVICE_TIGON3_5762 0x1687#define TG3PCI_DEVICE_TIGON3_5725 0x1643#define TG3PCI_DEVICE_TIGON3_5727 0x16f3 +#define TG3PCI_DEVICE_TIGON3_57764 0x1642 +#define TG3PCI_DEVICE_TIGON3_57767 0x1683 +#define TG3PCI_DEVICE_TIGON3_57787 0x1641/* 0x04 --> 0x2c unused */ #define TG3PCI_SUBVENDOR_ID_BROADCOM PCI_VENDOR_ID_BROADCOM#define TG3PCI_SUBDEVICE_ID_BROADCOM_95700A6 0x1644
Signature · 1 line
1.8.1.4
PATCH 3/8 tg3: LED in shared mode does not blink during traffic
In reply to Nithin Nayak SujirOn the 5717, 5719, 5720 and 5762 devices, in shared link/activity mode, the blink rate must be overridden with all bits set.
--- drivers/net/ethernet/broadcom/tg3.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/broadcom/tg3.c +6 -0
@@ -14927,6 +14927,12 @@ static void tg3_get_eeprom_hw_cfg(struct tg3 *tp) tg3_chip_rev_id(tp) != CHIPREV_ID_5750_A1) tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |LED_CTRL_MODE_PHY_2 ); + + if (tg3_flag(tp, 5717_PLUS) || +tg3_asic_rev (tp) ==ASIC_REV_5762 ) + tp->led_ctrl |=LED_CTRL_BLINK_RATE_OVERRIDE | +LED_CTRL_BLINK_RATE_MASK ; +break ;case SHASTA_EXT_LED_MAC :
Signature · 1 line
1.8.1.4
PATCH 4/8 tg3: Remove if 0'd code
In reply to Nithin Nayak Sujir--- drivers/net/ethernet/broadcom/tg3.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +0 -18
@@ -17067,10 +17067,6 @@ static int tg3_test_dma(struct tg3 *tp)tw32 (TG3PCI_DMA_RW_CTRL , tp->dma_rwctrl); -#if 0 -/* Unneeded, already done by tg3_get_invariants. */ -tg3_switch_clocks (tp); -#endif if (tg3_asic_rev (tp) !=ASIC_REV_5700 &&tg3_asic_rev (tp) !=ASIC_REV_5701 )
@@ -17098,20 +17094,6 @@ static int tg3_test_dma(struct tg3 *tp)break ; } -#if 0 -/* validate data reached card RAM correctly. */ -for (i =0 ; i <TEST_BUFFER_SIZE /sizeof (u32); i++) { -u32 val; -tg3_read_mem (tp,0x2100 + (i*4 ), &val); -if (le32_to_cpu (val) != p[i]) { -dev_err (&tp->pdev->dev, -"%s: Buffer corrupted on device! " -"(%d != %d)\n" , __func__, val, i); -/* ret = -ENODEV here? */ - } - p[i] =0 ; - } -#endif /* Now read it back. */ ret =tg3_do_test_dma (tp, buf, buf_dma,TEST_BUFFER_SIZE , false);if (ret) {
Signature · 1 line
1.8.1.4
PATCH 5/8 tg3: Remove redundant if check
In reply to Nithin Nayak Sujir--- drivers/net/ethernet/broadcom/tg3.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +1 -4
@@ -9202,10 +9202,7 @@ static int tg3_halt(struct tg3 *tp, int kind, bool silent)memset (tp->hw_stats,0 ,sizeof (struct tg3_hw_stats )); } -if (err) -return err; - -return 0 ; +return err; }static int tg3_set_mac_addr (struct net_device *dev,void *p)
Signature · 1 line
1.8.1.4
PATCH 6/8 tg3: Appropriately classify interrupts during request_irq
In reply to Nithin Nayak SujirDistinguish between tx, rx and txrx interrupts.
--- drivers/net/ethernet/broadcom/tg3.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +12 -1
@@ -11038,7 +11038,18 @@ static int tg3_request_irq(struct tg3 *tp, int irq_num) name = tp->dev->name; else { name = &tnapi->irq_lbl[0 ]; -snprintf (name,IFNAMSIZ ,"%s-%d" , tp->dev->name, irq_num); +if (tnapi->tx_buffers && tnapi->rx_rcb) +snprintf (name,IFNAMSIZ , +"%s-txrx-%d" , tp->dev->name, irq_num); +else if (tnapi->tx_buffers) +snprintf (name,IFNAMSIZ , +"%s-tx-%d" , tp->dev->name, irq_num); +else if (tnapi->rx_rcb) +snprintf (name,IFNAMSIZ , +"%s-rx-%d" , tp->dev->name, irq_num); +else +snprintf (name,IFNAMSIZ , +"%s-%d" , tp->dev->name, irq_num); name[IFNAMSIZ -1 ] =0 ; }
Signature · 1 line
1.8.1.4
PATCH 7/8 tg3: Remove unnecessary spinlock
In reply to Nithin Nayak SujirThe spinlock is not needed after conversion of tg3_flags from array to set_bit().
--- drivers/net/ethernet/broadcom/tg3.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +0 -2
@@ -12107,12 +12107,10 @@ static int tg3_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)device_set_wakeup_enable (dp, wol->wolopts &WAKE_MAGIC ); -spin_lock_bh (&tp->lock);if (device_may_wakeup (dp))tg3_flag_set (tp,WOL_ENABLE );else tg3_flag_clear (tp,WOL_ENABLE ); -spin_unlock_bh (&tp->lock);return 0 ; }
Signature · 1 line
1.8.1.4
PATCH 8/8 tg3: Update version to 3.134
In reply to Nithin Nayak Sujir--- drivers/net/ethernet/broadcom/tg3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -2
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)#define DRV_MODULE_NAME "tg3"#define TG3_MAJ_NUM 3 -#define TG3_MIN_NUM 133 +#define TG3_MIN_NUM 134#define DRV_MODULE_VERSION \ __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM) -#define DRV_MODULE_RELDATE "Jul 29, 2013" +#define DRV_MODULE_RELDATE "Sep 16, 2013"#define RESET_KIND_SHUTDOWN 0#define RESET_KIND_INIT 1
Signature · 1 line
1.8.1.4
David Miller
maintainerFrom: "Nithin Nayak Sujir" <[email protected]>
Date: Fri, 20 Sep 2013 16:46:54 -0700
Quoted 9 lines
Nithin Nayak Sujir (8):
tg3: Add functiontg3_phy_shdw_write()
tg3: Add support for new 577xx device ids
tg3: LED in shared mode does not blink during traffic
tg3: Remove if 0'd code
tg3: Remove redundant if check
tg3: Appropriately classify interrupts duringrequest_irq
tg3: Remove unnecessary spinlock
tg3: Update version to 3.134
All applied, thanks.