Browse Source

[tg3] Fix driver for BCM5719, BCM5720, BCM5764M, BCM57762

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Kevin Tran 12 years ago
parent
commit
a05871d89a
4 changed files with 29 additions and 19 deletions
  1. 14
    10
      src/drivers/net/tg3/tg3.c
  2. 2
    0
      src/drivers/net/tg3/tg3.h
  3. 7
    1
      src/drivers/net/tg3/tg3_hw.c
  4. 6
    8
      src/drivers/net/tg3/tg3_phy.c

+ 14
- 10
src/drivers/net/tg3/tg3.c View File

@@ -247,11 +247,12 @@ static int tg3_open(struct net_device *dev)
247 247
 		return err;
248 248
 
249 249
 	tpr->rx_std_iob_cnt = 0;
250
-	tg3_refill_prod_ring(tp);
251 250
 
252 251
 	err = tg3_init_hw(tp, 1);
253 252
 	if (err != 0)
254 253
 		DBGC(tp->dev, "tg3_init_hw failed: %s\n", strerror(err));
254
+	else
255
+		tg3_refill_prod_ring(tp);
255 256
 
256 257
 	return err;
257 258
 }
@@ -301,7 +302,6 @@ static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
301 302
 	struct tg3 *tp = netdev_priv(dev);
302 303
 	u32 len, entry;
303 304
 	dma_addr_t mapping;
304
-	u32 bmsr;
305 305
 
306 306
 	if (tg3_tx_avail(tp) < 1) {
307 307
 		DBGC(dev, "Transmit ring full\n");
@@ -323,14 +323,10 @@ static int tg3_transmit(struct net_device *dev, struct io_buffer *iob)
323 323
 	/* Packets are ready, update Tx producer idx local and on card. */
324 324
 	tw32_tx_mbox(tp->prodmbox, entry);
325 325
 
326
-	writel(entry, tp->regs + MAILBOX_SNDHOST_PROD_IDX_0 + TG3_64BIT_REG_LOW);
327
-
328 326
 	tp->tx_prod = entry;
329 327
 
330 328
 	mb();
331 329
 
332
-	tg3_readphy(tp, MII_BMSR, &bmsr);
333
-
334 330
 	return 0;
335 331
 }
336 332
 
@@ -422,8 +418,10 @@ static void tg3_refill_prod_ring(struct tg3 *tp)
422 418
 		tpr->rx_std_iob_cnt++;
423 419
 	}
424 420
 
425
-	tpr->rx_std_prod_idx = idx;
426
-	tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, idx);
421
+	if ((u32)idx != tpr->rx_std_prod_idx) {
422
+		tpr->rx_std_prod_idx = idx;
423
+		tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, idx);
424
+	}
427 425
 }
428 426
 
429 427
 static void tg3_rx_complete(struct net_device *dev)
@@ -469,7 +467,10 @@ static void tg3_rx_complete(struct net_device *dev)
469 467
 		tpr->rx_std_iob_cnt--;
470 468
 	}
471 469
 
472
-	tp->rx_rcb_ptr = sw_idx;
470
+	if (tp->rx_rcb_ptr != sw_idx) {
471
+		tw32_rx_mbox(tp->consmbox, sw_idx);
472
+		tp->rx_rcb_ptr = sw_idx;
473
+	}
473 474
 
474 475
 	tg3_refill_prod_ring(tp);
475 476
 }
@@ -480,7 +481,9 @@ static void tg3_poll(struct net_device *dev)
480 481
 	struct tg3 *tp = netdev_priv(dev);
481 482
 
482 483
 	/* ACK interrupts */
483
-	tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00);
484
+	/*
485
+	 *tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00);
486
+	 */
484 487
 	tp->hw_status->status &= ~SD_STATUS_UPDATED;
485 488
 
486 489
 	tg3_poll_link(tp);
@@ -905,6 +908,7 @@ static struct pci_device_id tg3_nics[] = {
905 908
 	PCI_ROM(0x14e4, 0x1684, "14e4-1684", "14e4-1684", 0),
906 909
 	PCI_ROM(0x14e4, 0x165b, "14e4-165b", "14e4-165b", 0),
907 910
 	PCI_ROM(0x14e4, 0x1681, "14e4-1681", "14e4-1681", 0),
911
+	PCI_ROM(0x14e4, 0x1682, "14e4-1682", "14e4-1682", 0),
908 912
 	PCI_ROM(0x14e4, 0x1680, "14e4-1680", "14e4-1680", 0),
909 913
 	PCI_ROM(0x14e4, 0x1688, "14e4-1688", "14e4-1688", 0),
910 914
 	PCI_ROM(0x14e4, 0x1689, "14e4-1689", "14e4-1689", 0),

+ 2
- 0
src/drivers/net/tg3/tg3.h View File

@@ -153,6 +153,7 @@
153 153
 #define TG3_BDINFO_NIC_ADDR		0xcUL /* 32-bit */
154 154
 #define TG3_BDINFO_SIZE			0x10UL
155 155
 
156
+#define RX_STD_MAX_SIZE                 1536
156 157
 #define TG3_RX_STD_MAX_SIZE_5700	512
157 158
 #define TG3_RX_STD_MAX_SIZE_5717	2048
158 159
 #define TG3_RX_JMB_MAX_SIZE_5700	256
@@ -182,6 +183,7 @@
182 183
 #define  TG3PCI_DEVICE_TIGON3_57781	 0x16b1
183 184
 #define  TG3PCI_DEVICE_TIGON3_57785	 0x16b5
184 185
 #define  TG3PCI_DEVICE_TIGON3_57761	 0x16b0
186
+#define  TG3PCI_DEVICE_TIGON3_57762	 0x1682
185 187
 #define  TG3PCI_DEVICE_TIGON3_57765	 0x16b4
186 188
 #define  TG3PCI_DEVICE_TIGON3_57791	 0x16b2
187 189
 #define  TG3PCI_DEVICE_TIGON3_57795	 0x16b6

+ 7
- 1
src/drivers/net/tg3/tg3_hw.c View File

@@ -434,6 +434,7 @@ int tg3_get_invariants(struct tg3 *tp)
434 434
 		else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
435 435
 			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
436 436
 			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761 ||
437
+			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57762 ||
437 438
 			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765 ||
438 439
 			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
439 440
 			 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795)
@@ -2127,9 +2128,12 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
2127 2128
 
2128 2129
 	val = TG3_RX_STD_MAX_SIZE_5700 << BDINFO_FLAGS_MAXLEN_SHIFT;
2129 2130
 
2131
+	if (tg3_flag(tp, 57765_PLUS))
2132
+		val |= (RX_STD_MAX_SIZE << 2);
2133
+
2130 2134
 	tw32(RCVDBDI_STD_BD + TG3_BDINFO_MAXLEN_FLAGS, val);
2131 2135
 
2132
-	tpr->rx_std_prod_idx = TG3_DEF_RX_RING_PENDING;
2136
+	tpr->rx_std_prod_idx = 0;
2133 2137
 
2134 2138
 	/* std prod index is updated by tg3_refill_prod_ring() */
2135 2139
 	tw32_rx_mbox(TG3_RX_STD_PROD_IDX_REG, 0);
@@ -2137,6 +2141,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
2137 2141
 
2138 2142
 	tg3_rings_reset(tp);
2139 2143
 
2144
+	__tg3_set_mac_addr(tp,0);
2145
+
2140 2146
 #define	TG3_MAX_MTU	1522
2141 2147
 	/* MTU + ethernet header + FCS + optional VLAN tag */
2142 2148
 	tw32(MAC_RX_MTU_SIZE, TG3_MAX_MTU);

+ 6
- 8
src/drivers/net/tg3/tg3_phy.c View File

@@ -1008,12 +1008,11 @@ skip_phy_reset:
1008 1008
 void tg3_poll_link(struct tg3 *tp)
1009 1009
 {	DBGP("%s\n", __func__);
1010 1010
 
1011
-	u32 mac_stat;
1012
-
1013
-	mac_stat = tr32(MAC_STATUS);
1014
-
1015
-	if (mac_stat & MAC_STATUS_LNKSTATE_CHANGED)
1011
+	if (tp->hw_status->status & SD_STATUS_LINK_CHG) {
1012
+		DBGC(tp->dev,"link_changed\n");
1013
+		tp->hw_status->status &= ~SD_STATUS_LINK_CHG;
1016 1014
 		tg3_setup_phy(tp, 0);
1015
+	}
1017 1016
 }
1018 1017
 
1019 1018
 static void tg3_aux_stat_to_speed_duplex(struct tg3 *tp, u32 val, u16 *speed, u8 *duplex)
@@ -1506,9 +1505,8 @@ relink:
1506 1505
 	tw32_f(MAC_MODE, tp->mac_mode);
1507 1506
 	udelay(40);
1508 1507
 
1509
-	/* We always use the link change register */
1510
-	/* NOTE: this freezes for mdc? */
1511
-	tw32_f(MAC_EVENT, 0);
1508
+	/* Enabled attention when the link has changed state. */
1509
+	tw32_f(MAC_EVENT, MAC_EVENT_LNKSTATE_CHANGED);
1512 1510
 	udelay(40);
1513 1511
 
1514 1512
 	if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 &&

Loading…
Cancel
Save