Skip to contentSkip to conversation

tg3: Add 57766 device support.

PATCH Superseded Michael Chan 4 participants 9 messages Feb 14, 2013

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 tg3: Add 57766 device support.

From: Matt Carlson <[email protected]>

The patch also adds a couple of fixes

- For the 57766, bootcode needs to setup the PCIE Fast Training Sequence (FTS) value to prevent transmit hangs. Unfortunately, it does not have enough room in the selfboot case (i.e. devices with no NVRAM). The driver needs to implement this.

- For performance reasons, the 2k DMA engine mode on the 57766 should be enabled and dma size limited to 2k for standard sized packets.

---
 drivers/net/ethernet/broadcom/tg3.c |   18 +++++++++++++++++-
 drivers/net/ethernet/broadcom/tg3.h |    2 ++
 2 files changed, 19 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +17 -1
index b1b3bc0..6e676a7 100644
@@ -332,6 +332,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
 	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
+	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57766)},
 	{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)},
@@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		}
 
 		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-			u32 grc_mode = tr32(GRC_MODE);
+			u32 grc_mode;
+
+			/* Fix transmit hangs */
+			val = tr32(TG3_CPMU_PADRNG_CTL);
+			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+			tw32(TG3_CPMU_PADRNG_CTL, val);
+
+			grc_mode = tr32(GRC_MODE);
 
 			/* Access the lower 1K of DL PCIE block registers. */
 			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
@@ -9492,6 +9500,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 	if (tg3_flag(tp, PCI_EXPRESS))
 		rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
 
+	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766) {
+		tp->dma_limit = 0;
+		if (tp->dev->mtu <= ETH_DATA_LEN) {
+			rdmac_mode |= RDMAC_MODE_JMB_2K_MMRR;
+			tp->dma_limit = TG3_TX_BD_DMA_MAX_2K;
+		}
+	}
+
 	if (tg3_flag(tp, HW_TSO_1) ||
 	    tg3_flag(tp, HW_TSO_2) ||
 	    tg3_flag(tp, HW_TSO_3))
drivers/net/ethernet/broadcom/tg3.h +2 -0
index ef6ced2..b676728 100644
@@ -1164,6 +1164,8 @@
 #define  CPMU_MUTEX_GNT_DRIVER		 0x00001000
 #define TG3_CPMU_PHY_STRAP		0x00003664
 #define TG3_CPMU_PHY_STRAP_IS_SERDES	 0x00000020
+#define TG3_CPMU_PADRNG_CTL		0x00003668
+#define  TG3_CPMU_PADRNG_CTL_RDIV2	 0x00040000
 /* 0x3664 --> 0x36b0 unused */
 
 #define TG3_CPMU_EEE_MODE		0x000036b0
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/5 tg3: Add EEE support for 5717 B0

This chip supports Energy Efficient Ethernet.

---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +1 -1
index 6e676a7..3004d69 100644
@@ -14514,7 +14514,7 @@ static int tg3_phy_probe(struct tg3 *tp)
 	    (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
 	     GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
 	     GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762 ||
-	     (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 &&
+	     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
 	      tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) ||
 	     (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 &&
 	      tp->pci_chip_rev_id != CHIPREV_ID_57765_A0)))
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/5 tg3: Fix 5762 NVRAM sizing

Don't set the default size to 128K if it is 5762. Instead, rely on the size we obtain from NVRAM location 0xf0.

---
 drivers/net/ethernet/broadcom/tg3.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +4 -2
index 3004d69..7ac0bd0 100644
@@ -13883,7 +13883,8 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
 			tp->nvram_size = TG3_NVRAM_SIZE_1MB;
 			break;
 		default:
-			tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
+				tp->nvram_size = TG3_NVRAM_SIZE_128KB;
 			break;
 		}
 		break;
@@ -13929,7 +13930,8 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
 			tp->nvram_size = TG3_NVRAM_SIZE_1MB;
 			break;
 		default:
-			tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+			if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
+				tp->nvram_size = TG3_NVRAM_SIZE_128KB;
 			break;
 		}
 		break;
Signature · 1 line
1.7.1
#3 lore raw

PATCH 4/5 tg3: Set initial carrier state to off.

Before the device is opened, the carrier state should be off. It will not race with the link interrupt if we set it before calling register_netdev().

---
 drivers/net/ethernet/broadcom/tg3.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -0
index 7ac0bd0..3829321 100644
@@ -16902,6 +16902,8 @@ static int tg3_init_one(struct pci_dev *pdev,
 
 	tg3_timer_init(tp);
 
+	tg3_carrier_off(tp);
+
 	err = register_netdev(dev);
 	if (err) {
 		dev_err(&pdev->dev, "Cannot register net device, aborting\n");
Signature · 1 line
1.7.1
#4 lore raw

PATCH 5/5 tg3: Update version to 3.130

---
 drivers/net/ethernet/broadcom/tg3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +2 -2
index 3829321..1b59876 100644
@@ -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			129
+#define TG3_MIN_NUM			130
 #define DRV_MODULE_VERSION	\
 	__stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
-#define DRV_MODULE_RELDATE	"January 06, 2013"
+#define DRV_MODULE_RELDATE	"February 14, 2013"
 
 #define RESET_KIND_SHUTDOWN	0
 #define RESET_KIND_INIT		1
Signature · 1 line
1.7.1
#6 lore raw
In reply to Michael Chan
Quoted 8 lines · Michael Chan

From: Matt Carlson <[email protected]>

The patch also adds a couple of fixes

- For the 57766, bootcode needs to setup the PCIE Fast Training Sequence (FTS) value to prevent transmit hangs. Unfortunately, it does not have enough room in the selfboot case (i.e. devices with no NVRAM). The driver needs to implement this.

[]

drivers/net/ethernet/broadcom/tg3.c

Quoted 1 line
drivers/net/ethernet/broadcom/tg3.c +0 -0

[]

drivers/net/ethernet/broadcom/tg3.c static int tg3_reset_hw(struct tg3 *tp, int reset_phy) · line 9189

Quoted 12 lines
drivers/net/ethernet/broadcom/tg3.c +7 -1
@@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 		}
 
 		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-			u32 grc_mode = tr32(GRC_MODE);
+			u32 grc_mode;
+
+			/* Fix transmit hangs */
+			val = tr32(TG3_CPMU_PADRNG_CTL);
+			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+			tw32(TG3_CPMU_PADRNG_CTL, val);
+

This seems to write this val to more devices than just a 57766. Intentional?

Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c +1 -0
+			grc_mode = tr32(GRC_MODE);
 
 			/* Access the lower 1K of DL PCIE block registers. */
 			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
#7 lore raw
Quoted 15 lines · Joe Perches
Quoted 8 lines · Michael Chan

From: Matt Carlson <[email protected]>

The patch also adds a couple of fixes

- For the 57766, bootcode needs to setup the PCIE Fast Training Sequence (FTS) value to prevent transmit hangs. Unfortunately, it does not have enough room in the selfboot case (i.e. devices with no NVRAM). The driver needs to implement this.

[]

drivers/net/ethernet/broadcom/tg3.c

Quoted 1 line
drivers/net/ethernet/broadcom/tg3.c +0 -0

[]

Quoted 3 lines
drivers/net/ethernet/broadcom/tg3.c +0 -0
@@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
  		}
 
Quoted 13 lines

drivers/net/ethernet/broadcom/tg3.c static int tg3_reset_hw(struct tg3 *tp, int reset_phy) · line 9189

Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c +7 -1
  		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-			u32 grc_mode = tr32(GRC_MODE);
+			u32 grc_mode;
+
+			/* Fix transmit hangs */
+			val = tr32(TG3_CPMU_PADRNG_CTL);
+			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+			tw32(TG3_CPMU_PADRNG_CTL, val);
+

This seems to write this val to more devices than just a 57766. Intentional?

Yes. In addition to the 57766, this fix applies to non-AX revisions of the 57765.

It's not apparent from the patch, but this code chunk is inside the conditional -

	if (tg3_flag(tp, 57765_CLASS)) {

which is set for 57765 and 57766 devices.

Quoted 7 lines
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c +1 -0
+			grc_mode = tr32(GRC_MODE);
 
  			/* Access the lower 1K of DL PCIE block registers. */
  			val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
#8 lore raw
Quoted 31 lines · Nithin Nayak Sujir
Quoted 15 lines · Joe Perches
Quoted 8 lines · Michael Chan

From: Matt Carlson <[email protected]>

The patch also adds a couple of fixes

- For the 57766, bootcode needs to setup the PCIE Fast Training Sequence (FTS) value to prevent transmit hangs. Unfortunately, it does not have enough room in the selfboot case (i.e. devices with no NVRAM). The driver needs to implement this.

[]

drivers/net/ethernet/broadcom/tg3.c

Quoted 1 line
drivers/net/ethernet/broadcom/tg3.c +0 -0

[]

Quoted 3 lines
drivers/net/ethernet/broadcom/tg3.c +0 -0
@@ -9179,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
  		}
 
Quoted 13 lines

drivers/net/ethernet/broadcom/tg3.c static int tg3_reset_hw(struct tg3 *tp, int reset_phy) · line 9189

Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c +7 -1
  		if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-			u32 grc_mode = tr32(GRC_MODE);
+			u32 grc_mode;
+
+			/* Fix transmit hangs */
+			val = tr32(TG3_CPMU_PADRNG_CTL);
+			val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+			tw32(TG3_CPMU_PADRNG_CTL, val);
+

This seems to write this val to more devices than just a 57766. Intentional?

Quoted 7 lines

Yes. In addition to the 57766, this fix applies to non-AX revisions of the 57765.

It's not apparent from the patch, but this code chunk is inside the conditional -

	if (tg3_flag(tp, 57765_CLASS)) {

which is set for 57765 and 57766 devices.

I know.

The commit message does not describe the patch correctly. The commit message says "for the 57766".