iPXE
tg3_hw.c
Go to the documentation of this file.
1/*
2 * tg3.c: Broadcom Tigon3 ethernet driver.
3 *
4 * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
5 * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com)
6 * Copyright (C) 2004 Sun Microsystems Inc.
7 * Copyright (C) 2005-2011 Broadcom Corporation.
8 *
9 * Firmware is:
10 * Derived from proprietary unpublished source code,
11 * Copyright (C) 2000-2003 Broadcom Corporation.
12 *
13 * Permission is hereby granted for the distribution of this firmware
14 * data in hexadecimal or equivalent format, provided this copyright
15 * notice is accompanying it.
16 */
17
18FILE_LICENCE ( GPL2_ONLY );
19
20#include <mii.h>
21#include <string.h>
22#include <stdio.h>
23#include <errno.h>
24#include <unistd.h>
25#include <byteswap.h>
26#include <ipxe/pci.h>
27#include <ipxe/iobuf.h>
28#include <ipxe/timer.h>
29#include <ipxe/malloc.h>
30#include <ipxe/if_ether.h>
31#include <ipxe/ethernet.h>
32#include <ipxe/netdevice.h>
33
34#include "tg3.h"
35
36#define RESET_KIND_SHUTDOWN 0
37#define RESET_KIND_INIT 1
38#define RESET_KIND_SUSPEND 2
39
40#define TG3_DEF_MAC_MODE 0
41
43{ DBGP("%s\n", __func__);
44
47}
48
50{ DBGP("%s\n", __func__);
51
52 u32 val;
53
56 return val;
57}
58
59static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off)
60{ DBGP("%s\n", __func__);
61
62 return readl(tp->regs + off + GRCMBOX_BASE);
63}
64
65static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
66{ DBGP("%s\n", __func__);
67
68 writel(val, tp->regs + off + GRCMBOX_BASE);
69}
70
72{ DBGP("%s\n", __func__);
73
77 return;
78 }
79 if (off == TG3_RX_STD_PROD_IDX_REG) {
82 return;
83 }
84
87
88 /* In indirect mode when disabling interrupts, we also need
89 * to clear the interrupt bit in the GRC local ctrl register.
90 */
91 if ((off == (MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW)) &&
92 (val == 0x1)) {
94 tp->grc_local_ctrl|GRC_LCLCTRL_CLEARINT);
95 }
96}
97
99{ DBGP("%s\n", __func__);
100
101 u32 val;
102
103 pci_write_config_dword(tp->pdev, TG3PCI_REG_BASE_ADDR, off + 0x5600);
105
106 return val;
107}
108
109/* usec_wait specifies the wait time in usec when writing to certain registers
110 * where it is unsafe to read back the register without some delay.
111 * GRC_LOCAL_CTRL is one example if the GPIOs are toggled to switch power.
112 * TG3PCI_CLOCK_CTRL is another example if the clock frequencies are changed.
113 */
114void _tw32_flush(struct tg3 *tp, u32 off, u32 val, u32 usec_wait)
115{ DBGP("%s\n", __func__);
116
117 tw32(off, val);
118 if (usec_wait)
119 udelay(usec_wait);
120 tr32(off);
121
122 /* Wait again after the read for the posted method to guarantee that
123 * the wait time is met.
124 */
125 if (usec_wait)
126 udelay(usec_wait);
127}
128
129/* stolen from legacy etherboot tg3 driver */
131{ DBGP("%s\n", __func__);
132
133 uint16_t power_control;
134 int pm = tp->pm_cap;
135
136 /* Make sure register accesses (indirect or otherwise)
137 * will function correctly.
138 */
139 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, tp->misc_host_ctrl);
140
141 pci_read_config_word(tp->pdev, pm + PCI_PM_CTRL, &power_control);
142
143 power_control |= PCI_PM_CTRL_PME_STATUS;
144 power_control &= ~(PCI_PM_CTRL_STATE_MASK);
145 power_control |= 0;
146 pci_write_config_word(tp->pdev, pm + PCI_PM_CTRL, power_control);
147
148 tw32_wait_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl, 100);
149
150 return;
151}
152
153void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
154{ DBGP("%s\n", __func__);
155
156 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
157 (off >= NIC_SRAM_STATS_BLK) && (off < NIC_SRAM_TX_BUFFER_DESC)) {
158 *val = 0;
159 return;
160 }
161
164
165 /* Always leave this as zero. */
167}
168
169#define PCI_VENDOR_ID_ARIMA 0x161f
170
171static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
172{ DBGP("%s\n", __func__);
173
174 u32 val;
175 u16 pmcsr;
176
177 /* On some early chips the SRAM cannot be accessed in D3hot state,
178 * so need make sure we're in D0.
179 */
180 pci_read_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, &pmcsr);
182 pci_write_config_word(tp->pdev, tp->pm_cap + PCI_PM_CTRL, pmcsr);
183 mdelay(1);
184
185 /* Make sure register accesses (indirect or otherwise)
186 * will function correctly.
187 */
189 tp->misc_host_ctrl);
190
191 /* The memory arbiter has to be enabled in order for SRAM accesses
192 * to succeed. Normally on powerup the tg3 chip firmware will make
193 * sure it is enabled, but other entities such as system netboot
194 * code might disable it.
195 */
198
199 tp->phy_id = TG3_PHY_ID_INVALID;
200 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
201
202 /* Assume an onboard device by default. */
203 tg3_flag_set(tp, EEPROM_WRITE_PROT);
204
207 u32 nic_cfg, led_cfg;
208 u32 nic_phy_id, ver, cfg2 = 0, cfg4 = 0, eeprom_phy_id;
209 int eeprom_phy_serdes = 0;
210
212 tp->nic_sram_data_cfg = nic_cfg;
213
216 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700 &&
217 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5701 &&
218 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5703 &&
219 (ver > 0) && (ver < 0x100))
221
222 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
224
225 if ((nic_cfg & NIC_SRAM_DATA_CFG_PHY_TYPE_MASK) ==
227 eeprom_phy_serdes = 1;
228
229 tg3_read_mem(tp, NIC_SRAM_DATA_PHY_ID, &nic_phy_id);
230 if (nic_phy_id != 0) {
231 u32 id1 = nic_phy_id & NIC_SRAM_DATA_PHY_ID1_MASK;
232 u32 id2 = nic_phy_id & NIC_SRAM_DATA_PHY_ID2_MASK;
233
234 eeprom_phy_id = (id1 >> 16) << 10;
235 eeprom_phy_id |= (id2 & 0xfc00) << 16;
236 eeprom_phy_id |= (id2 & 0x03ff) << 0;
237 } else
238 eeprom_phy_id = 0;
239
240 tp->phy_id = eeprom_phy_id;
241 if (eeprom_phy_serdes) {
242 if (!tg3_flag(tp, 5705_PLUS))
243 tp->phy_flags |= TG3_PHYFLG_PHY_SERDES;
244 else
245 tp->phy_flags |= TG3_PHYFLG_MII_SERDES;
246 }
247
248 if (tg3_flag(tp, 5750_PLUS))
249 led_cfg = cfg2 & (NIC_SRAM_DATA_CFG_LED_MODE_MASK |
251 else
252 led_cfg = nic_cfg & NIC_SRAM_DATA_CFG_LED_MODE_MASK;
253
254 switch (led_cfg) {
255 default:
257 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
258 break;
259
261 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
262 break;
263
265 tp->led_ctrl = LED_CTRL_MODE_MAC;
266
267 /* Default to PHY_1_MODE if 0 (MAC_MODE) is
268 * read on some older 5700/5701 bootcode.
269 */
270 if (GET_ASIC_REV(tp->pci_chip_rev_id) ==
272 GET_ASIC_REV(tp->pci_chip_rev_id) ==
274 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
275
276 break;
277
279 tp->led_ctrl = LED_CTRL_MODE_SHARED;
280 if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0 &&
281 tp->pci_chip_rev_id != CHIPREV_ID_5750_A1)
282 tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |
284 break;
285
287 tp->led_ctrl = LED_CTRL_MODE_SHASTA_MAC;
288 break;
289
291 tp->led_ctrl = LED_CTRL_MODE_COMBO;
292 if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0)
293 tp->led_ctrl |= (LED_CTRL_MODE_PHY_1 |
295 break;
296
297 }
298
299 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
300 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5701) &&
301 tp->subsystem_vendor == PCI_VENDOR_ID_DELL)
302 tp->led_ctrl = LED_CTRL_MODE_PHY_2;
303
304 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5784_AX)
305 tp->led_ctrl = LED_CTRL_MODE_PHY_1;
306
307 if (nic_cfg & NIC_SRAM_DATA_CFG_EEPROM_WP) {
308 tg3_flag_set(tp, EEPROM_WRITE_PROT);
309 if ((tp->subsystem_vendor ==
311 (tp->subsystem_device == 0x205a ||
312 tp->subsystem_device == 0x2063))
313 tg3_flag_clear(tp, EEPROM_WRITE_PROT);
314 } else {
315 tg3_flag_clear(tp, EEPROM_WRITE_PROT);
316 tg3_flag_set(tp, IS_NIC);
317 }
318
319 if (nic_cfg & NIC_SRAM_DATA_CFG_ASF_ENABLE) {
320 tg3_flag_set(tp, ENABLE_ASF);
321 if (tg3_flag(tp, 5750_PLUS))
322 tg3_flag_set(tp, ASF_NEW_HANDSHAKE);
323 }
324
325 if ((nic_cfg & NIC_SRAM_DATA_CFG_APE_ENABLE) &&
326 tg3_flag(tp, ENABLE_ASF))
327 tg3_flag_set(tp, ENABLE_APE);
328
329 if (cfg2 & (1 << 17))
331
332 /* serdes signal pre-emphasis in register 0x590 set by */
333 /* bootcode if bit 18 is set */
334 if (cfg2 & (1 << 18))
335 tp->phy_flags |= TG3_PHYFLG_SERDES_PREEMPHASIS;
336
337 if ((tg3_flag(tp, 57765_PLUS) ||
338 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
339 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX)) &&
341 tp->phy_flags |= TG3_PHYFLG_ENABLE_APD;
342
343 if (tg3_flag(tp, PCI_EXPRESS) &&
344 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
345 !tg3_flag(tp, 57765_PLUS)) {
346 u32 cfg3;
347
349 }
350
352 tg3_flag_set(tp, RGMII_INBAND_DISABLE);
354 tg3_flag_set(tp, RGMII_EXT_IBND_RX_EN);
356 tg3_flag_set(tp, RGMII_EXT_IBND_TX_EN);
357 }
358}
359
360static void tg3_switch_clocks(struct tg3 *tp)
361{ DBGP("%s\n", __func__);
362
363 u32 clock_ctrl;
364 u32 orig_clock_ctrl;
365
366 if (tg3_flag(tp, CPMU_PRESENT) || tg3_flag(tp, 5780_CLASS))
367 return;
368
369 clock_ctrl = tr32(TG3PCI_CLOCK_CTRL);
370
371 orig_clock_ctrl = clock_ctrl;
372 clock_ctrl &= (CLOCK_CTRL_FORCE_CLKRUN |
374 0x1f);
375 tp->pci_clock_ctrl = clock_ctrl;
376
377 if (tg3_flag(tp, 5705_PLUS)) {
378 if (orig_clock_ctrl & CLOCK_CTRL_625_CORE) {
380 clock_ctrl | CLOCK_CTRL_625_CORE, 40);
381 }
382 } else if ((orig_clock_ctrl & CLOCK_CTRL_44MHZ_CORE) != 0) {
384 clock_ctrl |
386 40);
388 clock_ctrl | (CLOCK_CTRL_ALTCLK),
389 40);
390 }
391 tw32_wait_f(TG3PCI_CLOCK_CTRL, clock_ctrl, 40);
392}
393
395{ DBGP("%s\n", __func__);
396
397 u32 misc_ctrl_reg;
398 u32 pci_state_reg, grc_misc_cfg;
399 u32 val;
400 u16 pci_cmd;
401 int err;
402
403 /* Force memory write invalidate off. If we leave it on,
404 * then on 5700_BX chips we have to enable a workaround.
405 * The workaround is to set the TG3PCI_DMA_RW_CTRL boundary
406 * to match the cacheline size. The Broadcom driver have this
407 * workaround but turns MWI off all the times so never uses
408 * it. This seems to suggest that the workaround is insufficient.
409 */
410 pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd);
411 pci_cmd &= ~PCI_COMMAND_INVALIDATE;
412 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
413
414 /* It is absolutely critical that TG3PCI_MISC_HOST_CTRL
415 * has the register indirect write enable bit set before
416 * we try to access any of the MMIO registers. It is also
417 * critical that the PCI-X hw workaround situation is decided
418 * before that as well.
419 */
421 &misc_ctrl_reg);
422
423 tp->pci_chip_rev_id = (misc_ctrl_reg >>
425 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_USE_PROD_ID_REG) {
426 u32 prod_id_asic_rev;
427
428 if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717 ||
429 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
430 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
431 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720)
434 &prod_id_asic_rev);
435 else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
436 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
437 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57761 ||
438 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57762 ||
439 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57765 ||
440 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57766 ||
441 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
442 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795)
445 &prod_id_asic_rev);
446 else
448 &prod_id_asic_rev);
449
450 tp->pci_chip_rev_id = prod_id_asic_rev;
451 }
452
453 /* Wrong chip ID in 5752 A0. This code can be removed later
454 * as A0 is not in production.
455 */
456 if (tp->pci_chip_rev_id == CHIPREV_ID_5752_A0_HW)
457 tp->pci_chip_rev_id = CHIPREV_ID_5752_A0;
458
459 /* Initialize misc host control in PCI block. */
460 tp->misc_host_ctrl |= (misc_ctrl_reg &
463 tp->misc_host_ctrl);
464
465 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
466 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
467 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
468 tg3_flag_set(tp, 5717_PLUS);
469
470 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 ||
471 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766 ||
472 tg3_flag(tp, 5717_PLUS))
473 tg3_flag_set(tp, 57765_PLUS);
474
475 /* Intentionally exclude ASIC_REV_5906 */
476 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
477 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
478 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
479 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
480 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
481 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
482 tg3_flag(tp, 57765_PLUS))
483 tg3_flag_set(tp, 5755_PLUS);
484
485 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
486 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
487 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 ||
488 tg3_flag(tp, 5755_PLUS) ||
489 tg3_flag(tp, 5780_CLASS))
490 tg3_flag_set(tp, 5750_PLUS);
491
492 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 ||
493 tg3_flag(tp, 5750_PLUS))
494 tg3_flag_set(tp, 5705_PLUS);
495
496 if (tg3_flag(tp, 5717_PLUS))
497 tg3_flag_set(tp, LRG_PROD_RING_CAP);
498
500 &pci_state_reg);
501
502 tp->pcie_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_EXP);
503 if (tp->pcie_cap != 0) {
504 u16 lnkctl;
505
506 tg3_flag_set(tp, PCI_EXPRESS);
507
509 tp->pcie_cap + PCI_EXP_LNKCTL,
510 &lnkctl);
511 if (lnkctl & PCI_EXP_LNKCTL_CLKREQ_EN) {
512 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
513 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
514 tp->pci_chip_rev_id == CHIPREV_ID_57780_A0 ||
515 tp->pci_chip_rev_id == CHIPREV_ID_57780_A1)
516 tg3_flag_set(tp, CLKREQ_BUG);
517 } else if (tp->pci_chip_rev_id == CHIPREV_ID_5717_A0) {
518 tg3_flag_set(tp, L1PLLPD_EN);
519 }
520 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785) {
521 tg3_flag_set(tp, PCI_EXPRESS);
522 } else if (!tg3_flag(tp, 5705_PLUS) ||
523 tg3_flag(tp, 5780_CLASS)) {
524 tp->pcix_cap = pci_find_capability(tp->pdev, PCI_CAP_ID_PCIX);
525 if (!tp->pcix_cap) {
526 DBGC(&tp->pdev->dev,
527 "Cannot find PCI-X capability, aborting\n");
528 return -EIO;
529 }
530
531 if (!(pci_state_reg & PCISTATE_CONV_PCI_MODE))
532 tg3_flag_set(tp, PCIX_MODE);
533 }
534
535 /* If we have an AMD 762 or VIA K8T800 chipset, write
536 * reordering to the mailbox registers done by the host
537 * controller can cause major troubles. We read back from
538 * every mailbox register write to force the writes to be
539 * posted to the chip in order.
540 */
541
543 &tp->pci_cacheline_sz);
545 &tp->pci_lat_timer);
546 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
547 tp->pci_lat_timer < 64) {
548 tp->pci_lat_timer = 64;
550 tp->pci_lat_timer);
551 }
552
553 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5700_BX) {
554 /* 5700 BX chips need to have their TX producer index
555 * mailboxes written twice to workaround a bug.
556 */
557 tg3_flag_set(tp, TXD_MBOX_HWBUG);
558
559 /* If we are in PCI-X mode, enable register write workaround.
560 *
561 * The workaround is to use indirect register accesses
562 * for all chip writes not to mailbox registers.
563 */
564 if (tg3_flag(tp, PCIX_MODE)) {
565 u32 pm_reg;
566
567 tg3_flag_set(tp, PCIX_TARGET_HWBUG);
568
569 /* The chip can have it's power management PCI config
570 * space registers clobbered due to this bug.
571 * So explicitly force the chip into D0 here.
572 */
574 tp->pm_cap + PCI_PM_CTRL,
575 &pm_reg);
576 pm_reg &= ~PCI_PM_CTRL_STATE_MASK;
577 pm_reg |= PCI_PM_CTRL_PME_ENABLE | 0 /* D0 */;
579 tp->pm_cap + PCI_PM_CTRL,
580 pm_reg);
581
582 /* Also, force SERR#/PERR# in PCI command. */
583 pci_read_config_word(tp->pdev, PCI_COMMAND, &pci_cmd);
585 pci_write_config_word(tp->pdev, PCI_COMMAND, pci_cmd);
586 }
587 }
588
589 if ((pci_state_reg & PCISTATE_BUS_SPEED_HIGH) != 0)
590 tg3_flag_set(tp, PCI_HIGH_SPEED);
591 if ((pci_state_reg & PCISTATE_BUS_32BIT) != 0)
592 tg3_flag_set(tp, PCI_32BIT);
593
594 /* Chip-specific fixup from Broadcom driver */
595 if ((tp->pci_chip_rev_id == CHIPREV_ID_5704_A0) &&
596 (!(pci_state_reg & PCISTATE_RETRY_SAME_DMA))) {
597 pci_state_reg |= PCISTATE_RETRY_SAME_DMA;
598 pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, pci_state_reg);
599 }
600
601 tp->write32_mbox = tg3_write_indirect_reg32;
602 tp->write32_rx_mbox = tg3_write_indirect_mbox;
603 tp->write32_tx_mbox = tg3_write_indirect_mbox;
604 tp->read32_mbox = tg3_read_indirect_mbox;
605
606 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
607 tp->read32_mbox = tg3_read32_mbox_5906;
608 tp->write32_mbox = tg3_write32_mbox_5906;
609 tp->write32_tx_mbox = tg3_write32_mbox_5906;
610 tp->write32_rx_mbox = tg3_write32_mbox_5906;
611 }
612
613 /* Get eeprom hw config before calling tg3_set_power_state().
614 * In particular, the TG3_FLAG_IS_NIC flag must be
615 * determined before calling tg3_set_power_state() so that
616 * we know whether or not to switch out of Vaux power.
617 * When the flag is set, it means that GPIO1 is used for eeprom
618 * write protect and also implies that it is a LOM where GPIOs
619 * are not used to switch power.
620 */
622
623 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
624 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
625 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
626 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
627 tg3_flag(tp, 57765_PLUS))
628 tg3_flag_set(tp, CPMU_PRESENT);
629
630 /* Set up tp->grc_local_ctrl before calling tg3_power_up().
631 * GPIO1 driven high will bring 5700's external PHY out of reset.
632 * It is also used as eeprom write protect on LOMs.
633 */
635 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
636 tg3_flag(tp, EEPROM_WRITE_PROT))
637 tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
639 /* Unused GPIO3 must be driven as output on 5752 because there
640 * are no pull-up resistors on unused GPIO pins.
641 */
642 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
643 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE3;
644
645 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
646 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
647 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
648 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
649
650 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5761 ||
651 tp->pdev->device == TG3PCI_DEVICE_TIGON3_5761S) {
652 /* Turn off the debug UART. */
653 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_UART_SEL;
654 if (tg3_flag(tp, IS_NIC))
655 /* Keep VMain power. */
656 tp->grc_local_ctrl |= GRC_LCLCTRL_GPIO_OE0 |
658 }
659
660 /* Force the chip into D0. */
662
663 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
664 tp->phy_flags |= TG3_PHYFLG_IS_FET;
665
666 /* A few boards don't want Ethernet@WireSpeed phy feature */
667 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700 ||
668 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
669 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) &&
670 (tp->pci_chip_rev_id != CHIPREV_ID_5705_A1)) ||
671 (tp->phy_flags & TG3_PHYFLG_IS_FET) ||
672 (tp->phy_flags & TG3_PHYFLG_ANY_SERDES))
673 tp->phy_flags |= TG3_PHYFLG_NO_ETH_WIRE_SPEED;
674
675 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5703_AX ||
676 GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5704_AX)
677 tp->phy_flags |= TG3_PHYFLG_ADC_BUG;
678 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0)
679 tp->phy_flags |= TG3_PHYFLG_5704_A0_BUG;
680
681 if (tg3_flag(tp, 5705_PLUS) &&
682 !(tp->phy_flags & TG3_PHYFLG_IS_FET) &&
683 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
684 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57780 &&
685 !tg3_flag(tp, 57765_PLUS)) {
686 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
687 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787 ||
688 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
689 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761) {
690 if (tp->pdev->device != PCI_DEVICE_ID_TIGON3_5756 &&
691 tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722)
692 tp->phy_flags |= TG3_PHYFLG_JITTER_BUG;
693 if (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5755M)
694 tp->phy_flags |= TG3_PHYFLG_ADJUST_TRIM;
695 } else
696 tp->phy_flags |= TG3_PHYFLG_BER_BUG;
697 }
698
699 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 &&
700 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5784_AX) {
701 tp->phy_otp = tg3_read_otp_phycfg(tp);
702 if (tp->phy_otp == 0)
703 tp->phy_otp = TG3_OTP_DEFAULT;
704 }
705
706 if (tg3_flag(tp, CPMU_PRESENT))
707 tp->mi_mode = MAC_MI_MODE_500KHZ_CONST;
708 else
709 tp->mi_mode = MAC_MI_MODE_BASE;
710
711 tp->coalesce_mode = 0;
712 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_AX &&
713 GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_5700_BX)
714 tp->coalesce_mode |= HOSTCC_MODE_32BYTE;
715
716 /* Set these bits to enable statistics workaround. */
717 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
718 tp->pci_chip_rev_id == CHIPREV_ID_5719_A0 ||
719 tp->pci_chip_rev_id == CHIPREV_ID_5720_A0) {
720 tp->coalesce_mode |= HOSTCC_MODE_ATTN;
721 tp->grc_mode |= GRC_MODE_IRQ_ON_FLOW_ATTN;
722 }
723
725
726 /* Initialize data/descriptor byte/word swapping. */
727 val = tr32(GRC_MODE);
728 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
734 else
736
737 tw32(GRC_MODE, val | tp->grc_mode);
738
740
741 /* Clear this out for sanity. */
743
745 &pci_state_reg);
746 if ((pci_state_reg & PCISTATE_CONV_PCI_MODE) == 0 &&
747 !tg3_flag(tp, PCIX_TARGET_HWBUG)) {
748 u32 chiprevid = GET_CHIP_REV_ID(tp->misc_host_ctrl);
749
750 if (chiprevid == CHIPREV_ID_5701_A0 ||
751 chiprevid == CHIPREV_ID_5701_B0 ||
752 chiprevid == CHIPREV_ID_5701_B2 ||
753 chiprevid == CHIPREV_ID_5701_B5) {
754 void *sram_base;
755
756 /* Write some dummy words into the SRAM status block
757 * area, see if it reads back correctly. If the return
758 * value is bad, force enable the PCIX workaround.
759 */
760 sram_base = tp->regs + NIC_SRAM_WIN_BASE + NIC_SRAM_STATS_BLK;
761
762 writel(0x00000000, sram_base);
763 writel(0x00000000, sram_base + 4);
764 writel(0xffffffff, sram_base + 4);
765 if (readl(sram_base) != 0x00000000)
766 tg3_flag_set(tp, PCIX_TARGET_HWBUG);
767 }
768 }
769
770 udelay(50);
771 /* FIXME: do we need nvram access? */
772/// tg3_nvram_init(tp);
773
774 grc_misc_cfg = tr32(GRC_MISC_CFG);
775 grc_misc_cfg &= GRC_MISC_CFG_BOARD_ID_MASK;
776
777 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
778 (grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788 ||
779 grc_misc_cfg == GRC_MISC_CFG_BOARD_ID_5788M))
780 tg3_flag_set(tp, IS_5788);
781
782 if (!tg3_flag(tp, IS_5788) &&
783 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
784 tg3_flag_set(tp, TAGGED_STATUS);
785 if (tg3_flag(tp, TAGGED_STATUS)) {
786 tp->coalesce_mode |= (HOSTCC_MODE_CLRTICK_RXBD |
788
789 tp->misc_host_ctrl |= MISC_HOST_CTRL_TAGGED_STATUS;
791 tp->misc_host_ctrl);
792 }
793
794 /* Preserve the APE MAC_MODE bits */
795 if (tg3_flag(tp, ENABLE_APE))
797 else
798 tp->mac_mode = TG3_DEF_MAC_MODE;
799
800 /* these are limited to 10/100 only */
801 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 &&
802 (grc_misc_cfg == 0x8000 || grc_misc_cfg == 0x4000)) ||
803 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
804 tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
805 (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901 ||
806 tp->pdev->device == PCI_DEVICE_ID_TIGON3_5901_2 ||
807 tp->pdev->device == PCI_DEVICE_ID_TIGON3_5705F)) ||
808 (tp->pdev->vendor == PCI_VENDOR_ID_BROADCOM &&
809 (tp->pdev->device == PCI_DEVICE_ID_TIGON3_5751F ||
810 tp->pdev->device == PCI_DEVICE_ID_TIGON3_5753F ||
811 tp->pdev->device == PCI_DEVICE_ID_TIGON3_5787F)) ||
812 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57790 ||
813 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57791 ||
814 tp->pdev->device == TG3PCI_DEVICE_TIGON3_57795 ||
815 (tp->phy_flags & TG3_PHYFLG_IS_FET))
816 tp->phy_flags |= TG3_PHYFLG_10_100_ONLY;
817
818 err = tg3_phy_probe(tp);
819 if (err) {
820 DBGC(&tp->pdev->dev, "phy probe failed, err: %s\n", strerror(err));
821 /* ... but do not return immediately ... */
822 }
823
824 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
825 tp->phy_flags &= ~TG3_PHYFLG_USE_MI_INTERRUPT;
826 } else {
827 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5700)
828 tp->phy_flags |= TG3_PHYFLG_USE_MI_INTERRUPT;
829 else
830 tp->phy_flags &= ~TG3_PHYFLG_USE_MI_INTERRUPT;
831 }
832
833 /* For all SERDES we poll the MAC status register. */
834 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
835 tg3_flag_set(tp, POLL_SERDES);
836 else
837 tg3_flag_clear(tp, POLL_SERDES);
838
839 /* Increment the rx prod index on the rx std ring by at most
840 * 8 for these chips to workaround hw errata.
841 */
842 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
843 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
844 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
845 tp->rx_std_max_post = 8;
846
847 return err;
848}
849
851{ DBGP("%s\n", __func__);
852
853 if (tg3_flag(tp, 57765_PLUS)) {
854 tp->bufmgr_config.mbuf_read_dma_low_water =
856 tp->bufmgr_config.mbuf_mac_rx_low_water =
858 tp->bufmgr_config.mbuf_high_water =
860
861 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
863 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo =
865 tp->bufmgr_config.mbuf_high_water_jumbo =
867 } else if (tg3_flag(tp, 5705_PLUS)) {
868 tp->bufmgr_config.mbuf_read_dma_low_water =
870 tp->bufmgr_config.mbuf_mac_rx_low_water =
872 tp->bufmgr_config.mbuf_high_water =
874 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
875 tp->bufmgr_config.mbuf_mac_rx_low_water =
877 tp->bufmgr_config.mbuf_high_water =
879 }
880
881 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
883 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo =
885 tp->bufmgr_config.mbuf_high_water_jumbo =
887 } else {
888 tp->bufmgr_config.mbuf_read_dma_low_water =
890 tp->bufmgr_config.mbuf_mac_rx_low_water =
892 tp->bufmgr_config.mbuf_high_water =
894
895 tp->bufmgr_config.mbuf_read_dma_low_water_jumbo =
897 tp->bufmgr_config.mbuf_mac_rx_low_water_jumbo =
899 tp->bufmgr_config.mbuf_high_water_jumbo =
901 }
902
903 tp->bufmgr_config.dma_low_water = DEFAULT_DMA_LOW_WATER;
904 tp->bufmgr_config.dma_high_water = DEFAULT_DMA_HIGH_WATER;
905}
906
907#define TG3_FW_EVENT_TIMEOUT_USEC 2500
908
910{ DBGP("%s\n", __func__);
911
912 int i;
913
914 for (i = 0; i < TG3_FW_EVENT_TIMEOUT_USEC / 10; i++) {
916 break;
917
918 udelay(10);
919 }
920}
921
922void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
923{ DBGP("%s\n", __func__);
924
925 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906 &&
927 return;
928
931
932 /* Always leave this as zero. */
934}
935
936static void tg3_stop_fw(struct tg3 *tp)
937{ DBGP("%s\n", __func__);
938
939 if (tg3_flag(tp, ENABLE_ASF) && !tg3_flag(tp, ENABLE_APE)) {
940 /* Wait for RX cpu to ACK the previous event. */
942
944
946
947 /* Wait for RX cpu to ACK this event. */
949 }
950}
951
952static void tg3_write_sig_pre_reset(struct tg3 *tp)
953{ DBGP("%s\n", __func__);
954
957}
958
960{ DBGP("%s\n", __func__);
961
963 (tp->misc_host_ctrl | MISC_HOST_CTRL_MASK_PCI_INT));
964
965 tw32_mailbox_f(tp->int_mbox, 0x00000001);
966}
967
968void tg3_enable_ints(struct tg3 *tp)
969{ DBGP("%s\n", __func__);
970
972 (tp->misc_host_ctrl & ~MISC_HOST_CTRL_MASK_PCI_INT));
973
974 tp->coal_now = tp->coalesce_mode | HOSTCC_MODE_ENABLE;
975
976 tw32_mailbox_f(tp->int_mbox, tp->last_tag << 24);
977
978 /* Force an initial interrupt */
979 if (!tg3_flag(tp, TAGGED_STATUS) &&
980 (tp->hw_status->status & SD_STATUS_UPDATED))
981 tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl | GRC_LCLCTRL_SETINT);
982 else
983 tw32(HOSTCC_MODE, tp->coal_now);
984}
985
986#define MAX_WAIT_CNT 1000
987
988/* To stop a block, clear the enable bit and poll till it clears. */
989static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit)
990{ DBGP("%s\n", __func__);
991
992 unsigned int i;
993 u32 val;
994
995 if (tg3_flag(tp, 5705_PLUS)) {
996 switch (ofs) {
997 case RCVLSC_MODE:
998 case DMAC_MODE:
999 case MBFREE_MODE:
1000 case BUFMGR_MODE:
1001 case MEMARB_MODE:
1002 /* We can't enable/disable these bits of the
1003 * 5705/5750, just say success.
1004 */
1005 return 0;
1006
1007 default:
1008 break;
1009 }
1010 }
1011
1012 val = tr32(ofs);
1013 val &= ~enable_bit;
1014 tw32_f(ofs, val);
1015
1016 for (i = 0; i < MAX_WAIT_CNT; i++) {
1017 udelay(100);
1018 val = tr32(ofs);
1019 if ((val & enable_bit) == 0)
1020 break;
1021 }
1022
1023 if (i == MAX_WAIT_CNT) {
1024 DBGC(&tp->pdev->dev,
1025 "tg3_stop_block timed out, ofs=%lx enable_bit=%x\n",
1026 ofs, enable_bit);
1027 return -ENODEV;
1028 }
1029
1030 return 0;
1031}
1032
1033static int tg3_abort_hw(struct tg3 *tp)
1034{ DBGP("%s\n", __func__);
1035
1036 int i, err;
1037
1039
1040 tp->rx_mode &= ~RX_MODE_ENABLE;
1041 tw32_f(MAC_RX_MODE, tp->rx_mode);
1042 udelay(10);
1043
1050
1058
1059 tp->mac_mode &= ~MAC_MODE_TDE_ENABLE;
1060 tw32_f(MAC_MODE, tp->mac_mode);
1061 udelay(40);
1062
1063 tp->tx_mode &= ~TX_MODE_ENABLE;
1064 tw32_f(MAC_TX_MODE, tp->tx_mode);
1065
1066 for (i = 0; i < MAX_WAIT_CNT; i++) {
1067 udelay(100);
1069 break;
1070 }
1071 if (i >= MAX_WAIT_CNT) {
1072 DBGC(&tp->pdev->dev,
1073 "%s timed out, TX_MODE_ENABLE will not clear "
1074 "MAC_TX_MODE=%08x\n", __func__, tr32(MAC_TX_MODE));
1075 err |= -ENODEV;
1076 }
1077
1081
1082 tw32(FTQ_RESET, 0xffffffff);
1083 tw32(FTQ_RESET, 0x00000000);
1084
1087
1088 if (tp->hw_status)
1089 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
1090
1091 return err;
1092}
1093
1094void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
1095{ DBGP("%s\n", __func__);
1096
1097 u32 addr_high, addr_low;
1098 int i;
1099
1100 addr_high = ((tp->dev->ll_addr[0] << 8) |
1101 tp->dev->ll_addr[1]);
1102 addr_low = ((tp->dev->ll_addr[2] << 24) |
1103 (tp->dev->ll_addr[3] << 16) |
1104 (tp->dev->ll_addr[4] << 8) |
1105 (tp->dev->ll_addr[5] << 0));
1106 for (i = 0; i < 4; i++) {
1107 if (i == 1 && skip_mac_1)
1108 continue;
1109 tw32(MAC_ADDR_0_HIGH + (i * 8), addr_high);
1110 tw32(MAC_ADDR_0_LOW + (i * 8), addr_low);
1111 }
1112
1113 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
1114 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
1115 for (i = 0; i < 12; i++) {
1116 tw32(MAC_EXTADDR_0_HIGH + (i * 8), addr_high);
1117 tw32(MAC_EXTADDR_0_LOW + (i * 8), addr_low);
1118 }
1119 }
1120
1121 addr_high = (tp->dev->ll_addr[0] +
1122 tp->dev->ll_addr[1] +
1123 tp->dev->ll_addr[2] +
1124 tp->dev->ll_addr[3] +
1125 tp->dev->ll_addr[4] +
1126 tp->dev->ll_addr[5]) &
1128 tw32(MAC_TX_BACKOFF_SEED, addr_high);
1129}
1130
1131/* Save PCI command register before chip reset */
1132static void tg3_save_pci_state(struct tg3 *tp)
1133{ DBGP("%s\n", __func__);
1134
1135 pci_read_config_word(tp->pdev, PCI_COMMAND, &tp->pci_cmd);
1136}
1137
1138/* Restore PCI state after chip reset */
1139static void tg3_restore_pci_state(struct tg3 *tp)
1140{ DBGP("%s\n", __func__);
1141
1142 u32 val;
1143
1144 /* Re-enable indirect register accesses. */
1146 tp->misc_host_ctrl);
1147
1148 /* Set MAX PCI retry to zero. */
1150 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
1151 tg3_flag(tp, PCIX_MODE))
1153
1155
1156 pci_write_config_word(tp->pdev, PCI_COMMAND, tp->pci_cmd);
1157
1158 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785) {
1160 tp->pci_cacheline_sz);
1162 tp->pci_lat_timer);
1163 }
1164
1165
1166 /* Make sure PCI-X relaxed ordering bit is clear. */
1167 if (tg3_flag(tp, PCIX_MODE)) {
1168 u16 pcix_cmd;
1169
1170 pci_read_config_word(tp->pdev, tp->pcix_cap + PCI_X_CMD,
1171 &pcix_cmd);
1172 pcix_cmd &= ~PCI_X_CMD_ERO;
1173 pci_write_config_word(tp->pdev, tp->pcix_cap + PCI_X_CMD,
1174 pcix_cmd);
1175 }
1176}
1177
1178static int tg3_poll_fw(struct tg3 *tp)
1179{ DBGP("%s\n", __func__);
1180
1181 int i;
1182 u32 val;
1183
1184 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
1185 /* Wait up to 20ms for init done. */
1186 for (i = 0; i < 200; i++) {
1188 return 0;
1189 udelay(100);
1190 }
1191 return -ENODEV;
1192 }
1193
1194 /* Wait for firmware initialization to complete. */
1195 for (i = 0; i < 100000; i++) {
1198 break;
1199 udelay(10);
1200 }
1201
1202 /* Chip might not be fitted with firmware. Some Sun onboard
1203 * parts are configured like that. So don't signal the timeout
1204 * of the above loop as an error, but do report the lack of
1205 * running firmware once.
1206 */
1207 if (i >= 100000 && !tg3_flag(tp, NO_FWARE_REPORTED)) {
1208 tg3_flag_set(tp, NO_FWARE_REPORTED);
1209
1210 DBGC(tp->dev, "No firmware running\n");
1211 }
1212
1213 if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0) {
1214 /* The 57765 A0 needs a little more
1215 * time to do some important work.
1216 */
1217 mdelay(10);
1218 }
1219
1220 return 0;
1221}
1222
1223static int tg3_nvram_lock(struct tg3 *tp)
1224{ DBGP("%s\n", __func__);
1225
1226 if (tg3_flag(tp, NVRAM)) {
1227 int i;
1228
1229 if (tp->nvram_lock_cnt == 0) {
1231 for (i = 0; i < 8000; i++) {
1233 break;
1234 udelay(20);
1235 }
1236 if (i == 8000) {
1238 return -ENODEV;
1239 }
1240 }
1241 tp->nvram_lock_cnt++;
1242 }
1243 return 0;
1244}
1245
1246static void tg3_nvram_unlock(struct tg3 *tp)
1247{ DBGP("%s\n", __func__);
1248
1249 if (tg3_flag(tp, NVRAM)) {
1250 if (tp->nvram_lock_cnt > 0)
1251 tp->nvram_lock_cnt--;
1252 if (tp->nvram_lock_cnt == 0)
1254 }
1255}
1256
1257static int tg3_chip_reset(struct tg3 *tp)
1258{ DBGP("%s\n", __func__);
1259
1260 u32 val;
1261 int err;
1262
1264
1265
1266 /* No matching tg3_nvram_unlock() after this because
1267 * chip reset below will undo the nvram lock.
1268 */
1269 tp->nvram_lock_cnt = 0;
1270
1271 /* GRC_MISC_CFG core clock reset will clear the memory
1272 * enable bit in PCI register 4 and the MSI enable bit
1273 * on some chips, so we save relevant registers here.
1274 */
1276
1277 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
1278 tg3_flag(tp, 5755_PLUS))
1280
1281#if 0
1282 /*
1283 * We must avoid the readl() that normally takes place.
1284 * It locks machines, causes machine checks, and other
1285 * fun things. So, temporarily disable the 5701
1286 * hardware workaround, while we do the reset.
1287 */
1288 write_op = tp->write32;
1289 if (write_op == tg3_write_flush_reg32)
1290 tp->write32 = tg3_write32;
1291#endif
1292
1293 /* Prevent the irq handler from reading or writing PCI registers
1294 * during chip reset when the memory enable bit in the PCI command
1295 * register may be cleared. The chip does not generate interrupt
1296 * at this time, but the irq handler may still be called due to irq
1297 * sharing or irqpoll.
1298 */
1299 tg3_flag_set(tp, CHIP_RESETTING);
1300
1301 if (tp->hw_status) {
1302 tp->hw_status->status = 0;
1303 tp->hw_status->status_tag = 0;
1304 }
1305 tp->last_tag = 0;
1306 tp->last_irq_tag = 0;
1307
1308 mb();
1309
1310 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) {
1313 }
1314
1315 /* do the reset */
1317
1318 if (tg3_flag(tp, PCI_EXPRESS)) {
1319 /* Force PCIe 1.0a mode */
1320 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
1321 !tg3_flag(tp, 57765_PLUS) &&
1325
1326 if (tp->pci_chip_rev_id != CHIPREV_ID_5750_A0) {
1327 tw32(GRC_MISC_CFG, (1 << 29));
1328 val |= (1 << 29);
1329 }
1330 }
1331
1332 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
1336 }
1337
1338 /* Manage gphy power for all CPMU absent PCIe devices. */
1339 if (tg3_flag(tp, 5705_PLUS) && !tg3_flag(tp, CPMU_PRESENT))
1341
1343
1344 /* Unfortunately, we have to delay before the PCI read back.
1345 * Some 575X chips even will not respond to a PCI cfg access
1346 * when the reset command is given to the chip.
1347 *
1348 * How do these hardware designers expect things to work
1349 * properly if the PCI write is posted for a long period
1350 * of time? It is always necessary to have some method by
1351 * which a register read back can occur to push the write
1352 * out which does the reset.
1353 *
1354 * For most tg3 variants the trick below was working.
1355 * Ho hum...
1356 */
1357 udelay(120);
1358
1359 /* Flush PCI posted writes. The normal MMIO registers
1360 * are inaccessible at this time so this is the only
1361 * way to make this reliably (actually, this is no longer
1362 * the case, see above). I tried to use indirect
1363 * register read/write but this upset some 5701 variants.
1364 */
1366
1367 udelay(120);
1368
1369 if (tg3_flag(tp, PCI_EXPRESS) && tp->pcie_cap) {
1370 u16 val16;
1371
1372 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A0) {
1373 int i;
1374 u32 cfg_val;
1375
1376 /* Wait for link training to complete. */
1377 for (i = 0; i < 5000; i++)
1378 udelay(100);
1379
1380 pci_read_config_dword(tp->pdev, 0xc4, &cfg_val);
1381 pci_write_config_dword(tp->pdev, 0xc4,
1382 cfg_val | (1 << 15));
1383 }
1384
1385 /* Clear the "no snoop" and "relaxed ordering" bits. */
1387 tp->pcie_cap + PCI_EXP_DEVCTL,
1388 &val16);
1389 val16 &= ~(PCI_EXP_DEVCTL_RELAX_EN |
1391 /*
1392 * Older PCIe devices only support the 128 byte
1393 * MPS setting. Enforce the restriction.
1394 */
1395 if (!tg3_flag(tp, CPMU_PRESENT))
1396 val16 &= ~PCI_EXP_DEVCTL_PAYLOAD;
1398 tp->pcie_cap + PCI_EXP_DEVCTL,
1399 val16);
1400
1401 /* Clear error status */
1403 tp->pcie_cap + PCI_EXP_DEVSTA,
1408 }
1409
1411
1412 tg3_flag_clear(tp, CHIP_RESETTING);
1413 tg3_flag_clear(tp, ERROR_PROCESSED);
1414
1415 val = 0;
1416 if (tg3_flag(tp, 5780_CLASS))
1417 val = tr32(MEMARB_MODE);
1419
1420 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) {
1421 tg3_stop_fw(tp);
1422 tw32(0x5000, 0x400);
1423 }
1424
1425 tw32(GRC_MODE, tp->grc_mode);
1426
1427 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) {
1428 val = tr32(0xc4);
1429
1430 tw32(0xc4, val | (1 << 15));
1431 }
1432
1433 if ((tp->nic_sram_data_cfg & NIC_SRAM_DATA_CFG_MINI_PCI) != 0 &&
1434 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
1435 tp->pci_clock_ctrl |= CLOCK_CTRL_CLKRUN_OENABLE;
1436 if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0)
1437 tp->pci_clock_ctrl |= CLOCK_CTRL_FORCE_CLKRUN;
1438 tw32(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
1439 }
1440
1441 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
1442 tp->mac_mode |= MAC_MODE_PORT_MODE_TBI;
1443 val = tp->mac_mode;
1444 } else if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) {
1445 tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
1446 val = tp->mac_mode;
1447 } else
1448 val = 0;
1449
1451 udelay(40);
1452
1453 err = tg3_poll_fw(tp);
1454 if (err)
1455 return err;
1456
1457 if (tg3_flag(tp, PCI_EXPRESS) &&
1458 tp->pci_chip_rev_id != CHIPREV_ID_5750_A0 &&
1459 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5785 &&
1460 !tg3_flag(tp, 57765_PLUS)) {
1461 val = tr32(0x7c00);
1462
1463 tw32(0x7c00, val | (1 << 25));
1464 }
1465
1466 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
1469 }
1470
1471 if (tg3_flag(tp, CPMU_PRESENT)) {
1476 }
1477
1478 return 0;
1479}
1480
1481int tg3_halt(struct tg3 *tp)
1482{ DBGP("%s\n", __func__);
1483
1484 int err;
1485
1486 tg3_stop_fw(tp);
1487
1489
1491 err = tg3_chip_reset(tp);
1492
1494
1495 if (err)
1496 return err;
1497
1498 return 0;
1499}
1500
1502 u32 offset, u32 *val)
1503{ DBGP("%s\n", __func__);
1504
1505 u32 tmp;
1506 int i;
1507
1508 if (offset > EEPROM_ADDR_ADDR_MASK || (offset % 4) != 0)
1509 return -EINVAL;
1510
1515 tmp |
1520
1521 for (i = 0; i < 1000; i++) {
1523
1525 break;
1526 mdelay(1);
1527 }
1528 if (!(tmp & EEPROM_ADDR_COMPLETE))
1529 return -EBUSY;
1530
1532
1533 /*
1534 * The data will always be opposite the native endian
1535 * format. Perform a blind byteswap to compensate.
1536 */
1537 *val = bswap_32(tmp);
1538
1539 return 0;
1540}
1541
1543{ DBGP("%s\n", __func__);
1544
1545 if (tg3_flag(tp, NVRAM) &&
1546 tg3_flag(tp, NVRAM_BUFFERED) &&
1547 tg3_flag(tp, FLASH) &&
1548 !tg3_flag(tp, NO_NVRAM_ADDR_TRANS) &&
1549 (tp->nvram_jedecnum == JEDEC_ATMEL))
1550
1551 addr = ((addr / tp->nvram_pagesize) <<
1553 (addr % tp->nvram_pagesize);
1554
1555 return addr;
1556}
1557
1558static void tg3_enable_nvram_access(struct tg3 *tp)
1559{ DBGP("%s\n", __func__);
1560
1561 if (tg3_flag(tp, 5750_PLUS) && !tg3_flag(tp, PROTECTED_NVRAM)) {
1562 u32 nvaccess = tr32(NVRAM_ACCESS);
1563
1564 tw32(NVRAM_ACCESS, nvaccess | ACCESS_ENABLE);
1565 }
1566}
1567
1568static void tg3_disable_nvram_access(struct tg3 *tp)
1569{ DBGP("%s\n", __func__);
1570
1571 if (tg3_flag(tp, 5750_PLUS) && !tg3_flag(tp, PROTECTED_NVRAM)) {
1572 u32 nvaccess = tr32(NVRAM_ACCESS);
1573
1574 tw32(NVRAM_ACCESS, nvaccess & ~ACCESS_ENABLE);
1575 }
1576}
1577
1578#define NVRAM_CMD_TIMEOUT 10000
1579
1580static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd)
1581{ DBGP("%s\n", __func__);
1582
1583 int i;
1584
1585 tw32(NVRAM_CMD, nvram_cmd);
1586 for (i = 0; i < NVRAM_CMD_TIMEOUT; i++) {
1587 udelay(10);
1588 if (tr32(NVRAM_CMD) & NVRAM_CMD_DONE) {
1589 udelay(10);
1590 break;
1591 }
1592 }
1593
1594 if (i == NVRAM_CMD_TIMEOUT)
1595 return -EBUSY;
1596
1597 return 0;
1598}
1599
1600/* NOTE: Data read in from NVRAM is byteswapped according to
1601 * the byteswapping settings for all other register accesses.
1602 * tg3 devices are BE devices, so on a BE machine, the data
1603 * returned will be exactly as it is seen in NVRAM. On a LE
1604 * machine, the 32-bit value will be byteswapped.
1605 */
1606static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
1607{ DBGP("%s\n", __func__);
1608
1609 int ret;
1610
1611 if (!tg3_flag(tp, NVRAM))
1613
1615
1616 if (offset > NVRAM_ADDR_MSK)
1617 return -EINVAL;
1618
1619 ret = tg3_nvram_lock(tp);
1620 if (ret)
1621 return ret;
1622
1624
1628
1629 if (ret == 0)
1630 *val = tr32(NVRAM_RDDATA);
1631
1633
1635
1636 return ret;
1637}
1638
1639/* Ensures NVRAM data is in bytestream format. */
1641{ DBGP("%s\n", __func__);
1642
1643 u32 v = 0;
1644 int res = tg3_nvram_read(tp, offset, &v);
1645 if (!res)
1646 *val = cpu_to_be32(v);
1647 return res;
1648}
1649
1651{ DBGP("%s\n", __func__);
1652
1653 struct net_device *dev = tp->dev;
1654 u32 hi, lo, mac_offset;
1655 int addr_ok = 0;
1656
1657 mac_offset = 0x7c;
1658 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
1659 tg3_flag(tp, 5780_CLASS)) {
1661 mac_offset = 0xcc;
1662 if (tg3_nvram_lock(tp))
1664 else
1666 } else if (tg3_flag(tp, 5717_PLUS)) {
1667 if (PCI_FUNC(tp->pdev->busdevfn) & 1)
1668 mac_offset = 0xcc;
1669 if (PCI_FUNC(tp->pdev->busdevfn) > 1)
1670 mac_offset += 0x18c;
1671 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
1672 mac_offset = 0x10;
1673
1674 /* First try to get it from MAC address mailbox. */
1676 if ((hi >> 16) == 0x484b) {
1677 dev->hw_addr[0] = (hi >> 8) & 0xff;
1678 dev->hw_addr[1] = (hi >> 0) & 0xff;
1679
1681 dev->hw_addr[2] = (lo >> 24) & 0xff;
1682 dev->hw_addr[3] = (lo >> 16) & 0xff;
1683 dev->hw_addr[4] = (lo >> 8) & 0xff;
1684 dev->hw_addr[5] = (lo >> 0) & 0xff;
1685
1686 /* Some old bootcode may report a 0 MAC address in SRAM */
1687 addr_ok = is_valid_ether_addr(&dev->hw_addr[0]);
1688 }
1689 if (!addr_ok) {
1690 /* Next, try NVRAM. */
1691 if (!tg3_flag(tp, NO_NVRAM) &&
1692 !tg3_nvram_read_be32(tp, mac_offset + 0, &hi) &&
1693 !tg3_nvram_read_be32(tp, mac_offset + 4, &lo)) {
1694 memcpy(&dev->hw_addr[0], ((char *)&hi) + 2, 2);
1695 memcpy(&dev->hw_addr[2], (char *)&lo, sizeof(lo));
1696 }
1697 /* Finally just fetch it out of the MAC control regs. */
1698 else {
1699 hi = tr32(MAC_ADDR_0_HIGH);
1700 lo = tr32(MAC_ADDR_0_LOW);
1701
1702 dev->hw_addr[5] = lo & 0xff;
1703 dev->hw_addr[4] = (lo >> 8) & 0xff;
1704 dev->hw_addr[3] = (lo >> 16) & 0xff;
1705 dev->hw_addr[2] = (lo >> 24) & 0xff;
1706 dev->hw_addr[1] = hi & 0xff;
1707 dev->hw_addr[0] = (hi >> 8) & 0xff;
1708 }
1709 }
1710
1711 if (!is_valid_ether_addr(&dev->hw_addr[0])) {
1712 return -EINVAL;
1713 }
1714
1715 return 0;
1716}
1717
1719{ DBGP("%s\n", __func__);
1720
1721 struct tg3 *tp = dev->priv;
1722 u32 rx_mode;
1723
1724 rx_mode = tp->rx_mode & ~(RX_MODE_PROMISC |
1726
1728
1729 /* Accept all multicast. */
1730 tw32(MAC_HASH_REG_0, 0xffffffff);
1731 tw32(MAC_HASH_REG_1, 0xffffffff);
1732 tw32(MAC_HASH_REG_2, 0xffffffff);
1733 tw32(MAC_HASH_REG_3, 0xffffffff);
1734
1735 if (rx_mode != tp->rx_mode) {
1736 tp->rx_mode = rx_mode;
1738 udelay(10);
1739 }
1740}
1741
1742static void __tg3_set_coalesce(struct tg3 *tp)
1743{ DBGP("%s\n", __func__);
1744
1745
1749 /* FIXME: mix between TXMAX and RXMAX taken from legacy driver */
1753
1754 if (!tg3_flag(tp, 5705_PLUS)) {
1756
1759
1760 if (!netdev_link_ok(tp->dev))
1761 val = 0;
1762
1764 }
1765}
1766
1767static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr,
1768 dma_addr_t mapping, u32 maxlen_flags,
1769 u32 nic_addr)
1770{ DBGP("%s\n", __func__);
1771
1773 (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH),
1774 ((u64) mapping >> 32));
1776 (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW),
1777 ((u64) mapping & 0xffffffff));
1779 (bdinfo_addr + TG3_BDINFO_MAXLEN_FLAGS),
1780 maxlen_flags);
1781
1782 if (!tg3_flag(tp, 5705_PLUS))
1784 (bdinfo_addr + TG3_BDINFO_NIC_ADDR),
1785 nic_addr);
1786}
1787
1788static void tg3_rings_reset(struct tg3 *tp)
1789{ DBGP("%s\n", __func__);
1790
1791 int i;
1792 u32 txrcb, rxrcb, limit;
1793
1794 /* Disable all transmit rings but the first. */
1795 if (!tg3_flag(tp, 5705_PLUS))
1797 else if (tg3_flag(tp, 5717_PLUS))
1799 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
1801 else
1803
1804 for (txrcb = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE;
1805 txrcb < limit; txrcb += TG3_BDINFO_SIZE)
1808
1809
1810 /* Disable all receive return rings but the first. */
1811 if (tg3_flag(tp, 5717_PLUS))
1813 else if (!tg3_flag(tp, 5705_PLUS))
1815 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
1816 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
1818 else
1820
1822 rxrcb < limit; rxrcb += TG3_BDINFO_SIZE)
1825
1826 /* Disable interrupts */
1827 tw32_mailbox_f(tp->int_mbox, 1);
1828
1829 tp->tx_prod = 0;
1830 tp->tx_cons = 0;
1831 tw32_mailbox(tp->prodmbox, 0);
1832 tw32_rx_mbox(tp->consmbox, 0);
1833
1834 /* Make sure the NIC-based send BD rings are disabled. */
1835 if (!tg3_flag(tp, 5705_PLUS)) {
1837 for (i = 0; i < 16; i++)
1838 tw32_tx_mbox(mbox + i * 8, 0);
1839 }
1840
1841 txrcb = NIC_SRAM_SEND_RCB;
1842 rxrcb = NIC_SRAM_RCV_RET_RCB;
1843
1844 /* Clear status block in ram. */
1845 memset(tp->hw_status, 0, TG3_HW_STATUS_SIZE);
1846
1847 /* Set status block DMA address */
1849 ((u64) tp->status_mapping >> 32));
1851 ((u64) tp->status_mapping & 0xffffffff));
1852
1853 if (tp->tx_ring) {
1854 tg3_set_bdinfo(tp, txrcb, tp->tx_desc_mapping,
1858 txrcb += TG3_BDINFO_SIZE;
1859 }
1860
1861 /* FIXME: will TG3_RX_RET_MAX_SIZE_5705 work on all cards? */
1862 if (tp->rx_rcb) {
1863 tg3_set_bdinfo(tp, rxrcb, tp->rx_rcb_mapping,
1866 rxrcb += TG3_BDINFO_SIZE;
1867 }
1868}
1869
1871{ DBGP("%s\n", __func__);
1872
1873 u32 val, bdcache_maxcnt;
1874
1875 if (!tg3_flag(tp, 5750_PLUS) ||
1876 tg3_flag(tp, 5780_CLASS) ||
1877 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5750 ||
1878 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
1879 bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5700;
1880 else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
1881 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
1882 bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5755;
1883 else
1884 bdcache_maxcnt = TG3_SRAM_RX_STD_BDCACHE_SIZE_5906;
1885
1886
1887 /* NOTE: legacy driver uses RX_PENDING / 8, we only use 4 descriptors
1888 * for now, use / 4 so the result is > 0
1889 */
1892
1893 if (tg3_flag(tp, 57765_PLUS))
1894 tw32(STD_REPLENISH_LWM, bdcache_maxcnt);
1895}
1896
1897static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
1898{ DBGP("%s\n", __func__);
1899
1900 u32 val, rdmac_mode;
1901 int i, err, limit;
1902 struct tg3_rx_prodring_set *tpr = &tp->prodring;
1903
1904 tg3_stop_fw(tp);
1905
1907
1908 if (tg3_flag(tp, INIT_COMPLETE))
1910
1911 if (reset_phy)
1913
1914 err = tg3_chip_reset(tp);
1915 if (err)
1916 return err;
1917
1918 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780) {
1923
1926
1928
1931 }
1932
1933 if (tg3_flag(tp, L1PLLPD_EN)) {
1934 u32 grc_mode = tr32(GRC_MODE);
1935
1936 /* Access the lower 1K of PL PCIE block registers. */
1937 val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
1939
1943
1944 tw32(GRC_MODE, grc_mode);
1945 }
1946
1947 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765) {
1948 if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0) {
1949 u32 grc_mode = tr32(GRC_MODE);
1950
1951 /* Access the lower 1K of PL PCIE block registers. */
1952 val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
1954
1959
1960 tw32(GRC_MODE, grc_mode);
1961 }
1962
1963 if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
1964 u32 grc_mode = tr32(GRC_MODE);
1965
1966 /* Access the lower 1K of DL PCIE block registers. */
1967 val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
1969
1975
1976 tw32(GRC_MODE, grc_mode);
1977 }
1978
1983 }
1984
1985 /* This works around an issue with Athlon chipsets on
1986 * B3 tigon3 silicon. This bit has no effect on any
1987 * other revision. But do not set this on PCI Express
1988 * chips and don't even touch the clocks if the CPMU is present.
1989 */
1990 if (!tg3_flag(tp, CPMU_PRESENT)) {
1991 if (!tg3_flag(tp, PCI_EXPRESS))
1992 tp->pci_clock_ctrl |= CLOCK_CTRL_DELAY_PCI_GRANT;
1993 tw32_f(TG3PCI_CLOCK_CTRL, tp->pci_clock_ctrl);
1994 }
1995
1996 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
1997 tg3_flag(tp, PCIX_MODE)) {
2001 }
2002
2003 if (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5704_BX) {
2004 /* Enable some hw fixes. */
2006 val |= (1 << 26) | (1 << 28) | (1 << 29);
2008 }
2009
2010 /* Descriptor ring init may make accesses to the
2011 * NIC SRAM area to setup the TX descriptors, so we
2012 * can only do this after the hardware has been
2013 * successfully reset.
2014 */
2015 err = tg3_init_rings(tp);
2016 if (err)
2017 return err;
2018
2019 if (tg3_flag(tp, 57765_PLUS)) {
2022 if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0)
2024 if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_57765 &&
2025 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717)
2027 tw32(TG3PCI_DMA_RW_CTRL, val | tp->dma_rwctrl);
2028 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
2029 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5761) {
2030 /* This value is determined during the probe time DMA
2031 * engine test, tg3_test_dma.
2032 */
2033 tw32(TG3PCI_DMA_RW_CTRL, tp->dma_rwctrl);
2034 }
2035
2036 tp->grc_mode &= ~(GRC_MODE_HOST_SENDBDS |
2040 tp->grc_mode |= GRC_MODE_HOST_SENDBDS;
2041 tp->grc_mode |= GRC_MODE_NO_RX_PHDR_CSUM;
2042
2043 /* Pseudo-header checksum is done by hardware logic and not
2044 * the offload processers, so make the chip do the pseudo-
2045 * header checksums on receive. For transmit it is more
2046 * convenient to do the pseudo-header checksum in software
2047 * as Linux does that on transmit for us in all cases.
2048 */
2049 tp->grc_mode |= GRC_MODE_NO_TX_PHDR_CSUM;
2050
2051 tw32(GRC_MODE,
2052 tp->grc_mode |
2054
2055 /* Setup the timer prescalar register. Clock is always 66Mhz. */
2057 val &= ~0xff;
2060
2061 /* Initialize MBUF/DESC pool. */
2062 if (tg3_flag(tp, 5750_PLUS)) {
2063 /* Do nothing. */
2064 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5705) {
2066 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
2068 else
2072 }
2073
2075 tp->bufmgr_config.mbuf_read_dma_low_water);
2077 tp->bufmgr_config.mbuf_mac_rx_low_water);
2079 tp->bufmgr_config.mbuf_high_water);
2080
2082 tp->bufmgr_config.dma_low_water);
2084 tp->bufmgr_config.dma_high_water);
2085
2087 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
2089 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
2090 tp->pci_chip_rev_id == CHIPREV_ID_5719_A0 ||
2091 tp->pci_chip_rev_id == CHIPREV_ID_5720_A0)
2094 for (i = 0; i < 2000; i++) {
2096 break;
2097 udelay(10);
2098 }
2099 if (i >= 2000) {
2100 DBGC(tp->dev, "%s cannot enable BUFMGR\n", __func__);
2101 return -ENODEV;
2102 }
2103
2104 if (tp->pci_chip_rev_id == CHIPREV_ID_5906_A1)
2105 tw32(ISO_PKT_TX, (tr32(ISO_PKT_TX) & ~0x3) | 0x2);
2106
2108
2109 /* Initialize TG3_BDINFO's at:
2110 * RCVDBDI_STD_BD: standard eth size rx ring
2111 * RCVDBDI_JUMBO_BD: jumbo frame rx ring
2112 * RCVDBDI_MINI_BD: small frame rx ring (??? does not work)
2113 *
2114 * like so:
2115 * TG3_BDINFO_HOST_ADDR: high/low parts of DMA address of ring
2116 * TG3_BDINFO_MAXLEN_FLAGS: (rx max buffer size << 16) |
2117 * ring attribute flags
2118 * TG3_BDINFO_NIC_ADDR: location of descriptors in nic SRAM
2119 *
2120 * Standard receive ring @ NIC_SRAM_RX_BUFFER_DESC, 512 entries.
2121 * Jumbo receive ring @ NIC_SRAM_RX_JUMBO_BUFFER_DESC, 256 entries.
2122 *
2123 * The size of each ring is fixed in the firmware, but the location is
2124 * configurable.
2125 */
2127 ((u64) tpr->rx_std_mapping >> 32));
2129 ((u64) tpr->rx_std_mapping & 0xffffffff));
2130 if (!tg3_flag(tp, 5717_PLUS))
2133
2134 /* Disable the mini ring */
2135 if (!tg3_flag(tp, 5705_PLUS))
2138
2140
2141 if (tg3_flag(tp, 57765_PLUS))
2142 val |= (RX_STD_MAX_SIZE << 2);
2143
2145
2146 tpr->rx_std_prod_idx = 0;
2147
2148 /* std prod index is updated by tg3_refill_prod_ring() */
2151
2153
2155
2156#define TG3_MAX_MTU 1522
2157 /* MTU + ethernet header + FCS + optional VLAN tag */
2159
2160 /* The slot time is changed by tg3_setup_phy if we
2161 * run at gigabit with half duplex.
2162 */
2163 val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
2164 (6 << TX_LENGTHS_IPG_SHIFT) |
2166
2167 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
2168 val |= tr32(MAC_TX_LENGTHS) &
2171
2173
2174 /* Receive rules. */
2176 tw32(RCVLPC_CONFIG, 0x0181);
2177
2178 /* Calculate RDMAC_MODE setting early, we need it to determine
2179 * the RCVLPC_STATE_ENABLE mask.
2180 */
2186
2187 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
2188 rdmac_mode |= RDMAC_MODE_MULT_DMA_RD_DIS;
2189
2190 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
2191 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
2192 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
2193 rdmac_mode |= RDMAC_MODE_BD_SBD_CRPT_ENAB |
2196
2197 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705 &&
2198 tp->pci_chip_rev_id != CHIPREV_ID_5705_A0) {
2199 if (tg3_flag(tp, TSO_CAPABLE) &&
2200 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
2201 rdmac_mode |= RDMAC_MODE_FIFO_SIZE_128;
2202 } else if (!(tr32(TG3PCI_PCISTATE) & PCISTATE_BUS_SPEED_HIGH) &&
2203 !tg3_flag(tp, IS_5788)) {
2204 rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
2205 }
2206 }
2207
2208 if (tg3_flag(tp, PCI_EXPRESS))
2209 rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
2210
2211 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
2212 rdmac_mode |= tr32(RDMAC_MODE) & RDMAC_MODE_H2BNC_VLAN_DET;
2213
2214 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
2215 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5784 ||
2216 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
2217 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
2218 tg3_flag(tp, 57765_PLUS)) {
2220 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
2221 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
2228 }
2231 }
2232
2233 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
2234 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
2239 }
2240
2241 /* Receive/send statistics. */
2242 if (tg3_flag(tp, 5750_PLUS)) {
2246 } else if ((rdmac_mode & RDMAC_MODE_FIFO_SIZE_128) &&
2247 tg3_flag(tp, TSO_CAPABLE)) {
2251 } else {
2252 tw32(RCVLPC_STATS_ENABLE, 0xffffff);
2253 }
2255 tw32(SNDDATAI_STATSENAB, 0xffffff);
2259
2260 /* Setup host coalescing engine. */
2261 tw32(HOSTCC_MODE, 0);
2262 for (i = 0; i < 2000; i++) {
2264 break;
2265 udelay(10);
2266 }
2267
2269
2270 if (!tg3_flag(tp, 5705_PLUS)) {
2271 /* Status/statistics block address. See tg3_timer,
2272 * the tg3_periodic_fetch_stats call there, and
2273 * tg3_get_stats to see how this works for 5705/5750 chips.
2274 * NOTE: stats block removed for iPXE
2275 */
2277
2278 /* Clear statistics and status block memory areas */
2279 for (i = NIC_SRAM_STATS_BLK;
2281 i += sizeof(u32)) {
2282 tg3_write_mem(tp, i, 0);
2283 udelay(40);
2284 }
2285 }
2286
2287 tw32(HOSTCC_MODE, HOSTCC_MODE_ENABLE | tp->coalesce_mode);
2288
2291 if (!tg3_flag(tp, 5705_PLUS))
2293
2294 if (tp->phy_flags & TG3_PHYFLG_MII_SERDES) {
2295 tp->phy_flags &= ~TG3_PHYFLG_PARALLEL_DETECT;
2296 /* reset to prevent losing 1st rx packet intermittently */
2298 udelay(10);
2299 }
2300
2301 if (tg3_flag(tp, ENABLE_APE))
2303 else
2304 tp->mac_mode = 0;
2307 if (!tg3_flag(tp, 5705_PLUS) &&
2308 !(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
2309 GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5700)
2310 tp->mac_mode |= MAC_MODE_LINK_POLARITY;
2312 udelay(40);
2313
2314 /* tp->grc_local_ctrl is partially set up during tg3_get_invariants().
2315 * If TG3_FLAG_IS_NIC is zero, we should read the
2316 * register to preserve the GPIO settings for LOMs. The GPIOs,
2317 * whether used as inputs or outputs, are set by boot code after
2318 * reset.
2319 */
2320 if (!tg3_flag(tp, IS_NIC)) {
2321 u32 gpio_mask;
2322
2326
2327 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752)
2328 gpio_mask |= GRC_LCLCTRL_GPIO_OE3 |
2330
2331 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755)
2332 gpio_mask |= GRC_LCLCTRL_GPIO_UART_SEL;
2333
2334 tp->grc_local_ctrl &= ~gpio_mask;
2335 tp->grc_local_ctrl |= tr32(GRC_LOCAL_CTRL) & gpio_mask;
2336
2337 /* GPIO1 must be driven high for eeprom write protect */
2338 if (tg3_flag(tp, EEPROM_WRITE_PROT))
2339 tp->grc_local_ctrl |= (GRC_LCLCTRL_GPIO_OE1 |
2341 }
2342 tw32_f(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
2343 udelay(100);
2344
2345 if (!tg3_flag(tp, 5705_PLUS)) {
2347 udelay(40);
2348 }
2349
2355
2356 /* Enable host coalescing bug fix */
2357 if (tg3_flag(tp, 5755_PLUS))
2359
2360 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785)
2362
2364 udelay(40);
2365
2366 if (tg3_flag(tp, PCIX_MODE)) {
2367 u16 pcix_cmd;
2368
2369 pci_read_config_word(tp->pdev, tp->pcix_cap + PCI_X_CMD,
2370 &pcix_cmd);
2371 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703) {
2372 pcix_cmd &= ~PCI_X_CMD_MAX_READ;
2373 pcix_cmd |= PCI_X_CMD_READ_2K;
2374 } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) {
2375 pcix_cmd &= ~(PCI_X_CMD_MAX_SPLIT | PCI_X_CMD_MAX_READ);
2376 pcix_cmd |= PCI_X_CMD_READ_2K;
2377 }
2378 pci_write_config_word(tp->pdev, tp->pcix_cap + PCI_X_CMD,
2379 pcix_cmd);
2380 }
2381
2382 tw32_f(RDMAC_MODE, rdmac_mode);
2383 udelay(40);
2384
2386 if (!tg3_flag(tp, 5705_PLUS))
2388
2389 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761)
2392 else
2394
2398 if (tg3_flag(tp, LRG_PROD_RING_CAP))
2402
2404 if (tg3_flag(tp, ENABLE_TSS))
2408
2409
2410 /* FIXME: 5701 firmware fix? */
2411#if 0
2412 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0) {
2413 err = tg3_load_5701_a0_firmware_fix(tp);
2414 if (err)
2415 return err;
2416 }
2417#endif
2418
2419 tp->tx_mode = TX_MODE_ENABLE;
2420
2421 if (tg3_flag(tp, 5755_PLUS) ||
2422 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
2423 tp->tx_mode |= TX_MODE_MBUF_LOCKUP_FIX;
2424
2425 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
2427 tp->tx_mode &= ~val;
2428 tp->tx_mode |= tr32(MAC_TX_MODE) & val;
2429 }
2430
2431 tw32_f(MAC_TX_MODE, tp->tx_mode);
2432 udelay(100);
2433
2434 tp->rx_mode = RX_MODE_ENABLE;
2435
2436 tw32_f(MAC_RX_MODE, tp->rx_mode);
2437 udelay(10);
2438
2439 tw32(MAC_LED_CTRL, tp->led_ctrl);
2440
2442 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
2444 udelay(10);
2445 }
2446 tw32_f(MAC_RX_MODE, tp->rx_mode);
2447 udelay(10);
2448
2449 if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) {
2450 if ((GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704) &&
2451 !(tp->phy_flags & TG3_PHYFLG_SERDES_PREEMPHASIS)) {
2452 /* Set drive transmission level to 1.2V */
2453 /* only if the signal pre-emphasis bit is not set */
2455 val &= 0xfffff000;
2456 val |= 0x880;
2458 }
2459 if (tp->pci_chip_rev_id == CHIPREV_ID_5703_A1)
2460 tw32(MAC_SERDES_CFG, 0x616000);
2461 }
2462
2463 /* Prevent chip from dropping frames when flow control
2464 * is enabled.
2465 */
2466 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765)
2467 val = 1;
2468 else
2469 val = 2;
2471
2472 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 &&
2473 (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)) {
2474 /* Use hardware link auto-negotiation */
2475 tg3_flag_set(tp, HW_AUTONEG);
2476 }
2477
2478 if ((tp->phy_flags & TG3_PHYFLG_MII_SERDES) &&
2479 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5714) {
2480 u32 tmp;
2481
2484 tp->grc_local_ctrl &= ~GRC_LCLCTRL_USE_EXT_SIG_DETECT;
2485 tp->grc_local_ctrl |= GRC_LCLCTRL_USE_SIG_DETECT;
2486 tw32(GRC_LOCAL_CTRL, tp->grc_local_ctrl);
2487 }
2488
2489 err = tg3_setup_phy(tp, 0);
2490 if (err)
2491 return err;
2492
2493 if (!(tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
2494 !(tp->phy_flags & TG3_PHYFLG_IS_FET)) {
2495 u32 tmp;
2496
2497 /* Clear CRC stats. */
2498 if (!tg3_readphy(tp, MII_TG3_TEST1, &tmp)) {
2502 }
2503 }
2504
2505 __tg3_set_rx_mode(tp->dev);
2506
2507 /* Initialize receive rules. */
2512
2513 if (tg3_flag(tp, 5705_PLUS) && !tg3_flag(tp, 5780_CLASS))
2514 limit = 8;
2515 else
2516 limit = 16;
2517 if (tg3_flag(tp, ENABLE_ASF))
2518 limit -= 4;
2519 switch (limit) {
2520 case 16:
2522 /* Fall through */
2523 case 15:
2525 /* Fall through */
2526 case 14:
2528 /* Fall through */
2529 case 13:
2531 /* Fall through */
2532 case 12:
2534 /* Fall through */
2535 case 11:
2537 /* Fall through */
2538 case 10:
2540 /* Fall through */
2541 case 9:
2543 /* Fall through */
2544 case 8:
2546 /* Fall through */
2547 case 7:
2549 /* Fall through */
2550 case 6:
2552 /* Fall through */
2553 case 5:
2555 /* Fall through */
2556 case 4:
2557 /* tw32(MAC_RCV_RULE_3, 0); tw32(MAC_RCV_VALUE_3, 0); */
2558 case 3:
2559 /* tw32(MAC_RCV_RULE_2, 0); tw32(MAC_RCV_VALUE_2, 0); */
2560 case 2:
2561 case 1:
2562
2563 default:
2564 break;
2565 }
2566
2567 return 0;
2568}
2569
2570/* Called at device open time to get the chip ready for
2571 * packet processing. Invoked with tp->lock held.
2572 */
2573int tg3_init_hw(struct tg3 *tp, int reset_phy)
2574{ DBGP("%s\n", __func__);
2575
2577
2579
2580 return tg3_reset_hw(tp, reset_phy);
2581}
2582
2583void tg3_set_txd(struct tg3 *tp, int entry,
2584 dma_addr_t mapping, int len, u32 flags)
2585{ DBGP("%s\n", __func__);
2586
2587 struct tg3_tx_buffer_desc *txd = &tp->tx_ring[entry];
2588
2589 txd->addr_hi = ((u64) mapping >> 32);
2590 txd->addr_lo = ((u64) mapping & 0xffffffff);
2591 txd->len_flags = (len << TXD_LEN_SHIFT) | flags;
2592 txd->vlan_tag = 0;
2593}
2594
2595int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device)
2596{ DBGP("%s\n", __func__);
2597
2598 struct tg3_internal_buffer_desc test_desc;
2599 u32 sram_dma_descs;
2600 int ret;
2601 unsigned int i;
2602
2603 sram_dma_descs = NIC_SRAM_DMA_DESC_POOL_BASE;
2604
2607 tw32(RDMAC_STATUS, 0);
2608 tw32(WDMAC_STATUS, 0);
2609
2610 tw32(BUFMGR_MODE, 0);
2611 tw32(FTQ_RESET, 0);
2612
2613 test_desc.addr_hi = ((u64) buf_dma) >> 32;
2614 test_desc.addr_lo = buf_dma & 0xffffffff;
2615 test_desc.nic_mbuf = 0x00002100;
2616 test_desc.len = size;
2617
2618 /*
2619 * HP ZX1 was seeing test failures for 5701 cards running at 33Mhz
2620 * the *second* time the tg3 driver was getting loaded after an
2621 * initial scan.
2622 *
2623 * Broadcom tells me:
2624 * ...the DMA engine is connected to the GRC block and a DMA
2625 * reset may affect the GRC block in some unpredictable way...
2626 * The behavior of resets to individual blocks has not been tested.
2627 *
2628 * Broadcom noted the GRC reset will also reset all sub-components.
2629 */
2630 if (to_device) {
2631 test_desc.cqid_sqid = (13 << 8) | 2;
2632
2634 udelay(40);
2635 } else {
2636 test_desc.cqid_sqid = (16 << 8) | 7;
2637
2639 udelay(40);
2640 }
2641 test_desc.flags = 0x00000005;
2642
2643 for (i = 0; i < (sizeof(test_desc) / sizeof(u32)); i++) {
2644 u32 val;
2645
2646 val = *(((u32 *)&test_desc) + i);
2648 sram_dma_descs + (i * sizeof(u32)));
2650 }
2652
2653 if (to_device)
2654 tw32(FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, sram_dma_descs);
2655 else
2656 tw32(FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, sram_dma_descs);
2657
2658 ret = -ENODEV;
2659 for (i = 0; i < 40; i++) {
2660 u32 val;
2661
2662 if (to_device)
2664 else
2666 if ((val & 0xffff) == sram_dma_descs) {
2667 ret = 0;
2668 break;
2669 }
2670
2671 udelay(100);
2672 }
2673
2674 return ret;
2675}
unsigned short uint16_t
Definition stdint.h:11
#define PCI_X_CMD
Definition bnx2.h:36
#define PCI_CAP_ID_PCIX
Definition bnx2.h:35
#define PCI_X_CMD_ERO
Definition bnx2.h:37
uint16_t offset
Offset to command line.
Definition bzimage.h:3
#define txd
Definition davicom.c:144
ring len
Length.
Definition dwmac.h:226
uint32_t addr
Buffer address.
Definition dwmac.h:9
uint8_t flags
Flags.
Definition ena.h:7
Error codes.
#define dma_addr_t
Ethernet protocol.
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
Definition ethernet.h:78
#define __unused
Declare a variable or data structure as unused.
Definition compiler.h:573
#define DBGP(...)
Definition compiler.h:532
#define DBGC(...)
Definition compiler.h:505
uint16_t size
Buffer size.
Definition dwmac.h:3
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
#define EINVAL
Invalid argument.
Definition errno.h:429
#define EIO
Input/output error.
Definition errno.h:434
#define EBUSY
Device or resource busy.
Definition errno.h:339
#define ENODEV
No such device.
Definition errno.h:510
#define bswap_32(value)
Definition byteswap.h:71
#define cpu_to_be32(value)
Definition byteswap.h:111
void mb(void)
Memory barrier.
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
int pci_read_config_word(struct pci_device *pci, unsigned int where, uint16_t *value)
Read 16-bit word from PCI configuration space.
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte to PCI configuration space.
int pci_write_config_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
iPXE timers
void __asmcall int val
Definition setjmp.h:12
uint64_t u64
Definition stdint.h:26
String functions.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void * memset(void *dest, int character, size_t len) __nonnull
I/O buffers.
uint16_t limit
Limit.
Definition librm.h:1
unsigned long tmp
Definition linux_pci.h:65
Dynamic memory allocation.
Media Independent Interface constants.
Network device management.
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition netdevice.h:640
PCI bus.
#define PCI_COMMAND_PARITY
Parity error response.
Definition pci.h:31
#define PCI_COMMAND_INVALIDATE
Mem.
Definition pci.h:30
#define PCI_COMMAND_SERR
SERR# enable.
Definition pci.h:32
#define PCI_PM_CTRL_STATE_MASK
Current power state.
Definition pci.h:107
#define PCI_FUNC(busdevfn)
Definition pci.h:286
#define PCI_PM_CTRL
Power management control and status.
Definition pci.h:106
#define PCI_EXP_DEVCTL
PCI Express.
Definition pci.h:112
#define PCI_CAP_ID_EXP
PCI Express.
Definition pci.h:98
#define PCI_CACHE_LINE_SIZE
PCI cache line size.
Definition pci.h:48
#define PCI_PM_CTRL_PME_ENABLE
PME pin enable.
Definition pci.h:108
#define PCI_COMMAND
PCI command.
Definition pci.h:26
#define PCI_LATENCY_TIMER
PCI latency timer.
Definition pci.h:51
#define PCI_PM_CTRL_PME_STATUS
PME pin status.
Definition pci.h:109
int pci_find_capability(struct pci_device *pci, int cap)
Look for a PCI capability.
Definition pciextra.c:39
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
Definition golan.c:120
A network device.
Definition netdevice.h:353
void * priv
Driver private data.
Definition netdevice.h:432
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
dma_addr_t rx_std_mapping
Definition tg3.h:2957
Definition tg3.h:3047
u32 rx_mode
Definition tg3.h:3158
struct net_device * dev
Definition tg3.h:3091
int tg3_init_rings(struct tg3 *tp)
Definition tg3.c:204
#define NIC_SRAM_DATA_CFG_2_APD_EN
Definition tg3.h:2268
#define GRC_MISC_CFG
Definition tg3.h:1819
#define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K
Definition tg3.h:1517
#define BUFMGR_MODE_NO_TX_UNDERRUN
Definition tg3.h:1425
#define PCISTATE_BUS_32BIT
Definition tg3.h:387
#define RDMAC_MODE_ENABLE
Definition tg3.h:1475
#define NVRAM_CMD_RESET
Definition tg3.h:1907
#define TG3_PHYFLG_MII_SERDES
Definition tg3.h:3238
#define GRC_MISC_CFG_BOARD_ID_5788M
Definition tg3.h:1833
#define TX_LENGTHS_CNT_DWN_VAL_MSK
Definition tg3.h:650
#define TG3_PCIE_LNKCTL_L1_PLL_PD_EN
Definition tg3.h:2094
#define GRC_LCLCTRL_GPIO_OUTPUT1
Definition tg3.h:1855
#define RX_MODE_ENABLE
Definition tg3.h:653
#define RCVLPC_STATSENAB_LNGBRST_RFIX
Definition tg3.h:1114
#define RDMAC_MODE
Definition tg3.h:1473
#define NIC_SRAM_DATA_PHY_ID1_MASK
Definition tg3.h:2231
#define BDINFO_FLAGS_DISABLED
Definition tg3.h:166
#define TG3_CPMU_D0_CLCK_POLICY
Definition tg3.h:1237
#define RDMAC_STATUS
Definition tg3.h:1495
#define BUFMGR_MB_MACRX_LOW_WATER
Definition tg3.h:1436
#define DEFAULT_DMA_LOW_WATER
Definition tg3.h:1460
#define SNDDATAI_MODE
Definition tg3.h:980
#define LED_CTRL_MODE_SHASTA_MAC
Definition tg3.h:568
#define SERDES_RX_SIG_DETECT
Definition tg3.h:862
#define DEFAULT_MB_RDMA_LOW_WATER_5705
Definition tg3.h:1433
#define TG3_CPMU_CLCK_ORIDE_EN
Definition tg3.h:1248
#define TG3_PHYFLG_PHY_SERDES
Definition tg3.h:3237
#define HOSTCC_STAT_COAL_TICKS
Definition tg3.h:1350
#define RX_STD_MAX_SIZE
Definition tg3.h:172
#define ASIC_REV_5701
Definition tg3.h:300
#define tw32_tx_mbox(reg, val)
Definition tg3.h:3336
#define CHIPREV_ID_5705_A0
Definition tg3.h:279
#define TG3_PCIE_DL_LO_FTSMAX_MSK
Definition tg3.h:2111
#define PCI_EXP_DEVSTA_NFED
Definition tg3.h:67
#define GRC_MODE_HOST_SENDBDS
Definition tg3.h:1799
#define DEFAULT_MB_HIGH_WATER_JUMBO_57765
Definition tg3.h:1451
#define MAILBOX_INTERRUPT_0
Definition tg3.h:431
#define TG3_LSO_RD_DMA_CRPTEN_CTRL
Definition tg3.h:1516
#define CLOCK_CTRL_DELAY_PCI_GRANT
Definition tg3.h:405
#define TG3PCI_DMA_RW_CTRL
Definition tg3.h:340
#define ASIC_REV_57765
Definition tg3.h:317
#define TG3PCI_DEVICE_TIGON3_57795
Definition tg3.h:206
#define TG3_BDINFO_HOST_ADDR
Definition tg3.h:163
#define GRC_EEPROM_DATA
Definition tg3.h:1893
int tg3_writephy(struct tg3 *tp, int reg, u32 val)
Definition tg3_phy.c:222
#define SERDES_RX_CTRL
Definition tg3.h:861
#define BUFMGR_MB_POOL_ADDR
Definition tg3.h:1429
#define CHIPREV_ID_5906_A1
Definition tg3.h:291
#define NIC_SRAM_DATA_CFG_4
Definition tg3.h:2278
#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO
Definition tg3.h:1434
#define RCVDBDI_MODE
Definition tg3.h:1132
#define RCVBDI_MODE_ENABLE
Definition tg3.h:1181
#define SNDDATAI_SCTRL_ENABLE
Definition tg3.h:987
#define MAC_MODE
Definition tg3.h:501
#define GRC_LCLCTRL_USE_EXT_SIG_DETECT
Definition tg3.h:1844
#define GRC_LCLCTRL_GPIO_OE0
Definition tg3.h:1851
#define NIC_SRAM_MBUF_POOL_SIZE96
Definition tg3.h:2292
#define TG3PCI_DEVICE_TIGON3_5720
Definition tg3.h:208
#define SNDDATAC_MODE
Definition tg3.h:1023
#define RX_MODE_PROMISC
Definition tg3.h:660
#define NIC_SRAM_DATA_CFG_3
Definition tg3.h:2275
#define GRC_MODE_IRQ_ON_MAC_ATTN
Definition tg3.h:1808
#define TG3PCI_PCISTATE
Definition tg3.h:382
#define GRC_MISC_CFG_CORECLK_RESET
Definition tg3.h:1820
#define GRC_RX_CPU_EVENT
Definition tg3.h:1870
#define ASIC_REV_5906
Definition tg3.h:310
#define tr32(reg)
Definition tg3.h:3339
#define EEPROM_ADDR_DEVID_MASK
Definition tg3.h:1885
#define PCI_EXP_DEVCTL_NOSNOOP_EN
Definition tg3.h:63
#define ASIC_REV_5705
Definition tg3.h:303
#define CHIPREV_ID_5703_A1
Definition tg3.h:272
#define RCVLSC_MODE
Definition tg3.h:1210
#define PCI_X_CMD_READ_2K
Definition tg3.h:21
#define TG3_HW_STATUS_SIZE
Definition tg3.h:2669
#define GRC_MODE_PCIE_PORT_MASK
Definition tg3.h:1815
#define CHIPREV_ID_5719_A0
Definition tg3.h:296
#define SNDBDS_MODE_ATTN_ENABLE
Definition tg3.h:1033
#define GRC_MODE_PCIE_DL_SEL
Definition tg3.h:1812
#define RCVDCC_MODE_ENABLE
Definition tg3.h:1174
#define NIC_SRAM_SEND_RCB
Definition tg3.h:2198
#define MII_TG3_TEST1
Definition tg3.h:2414
#define RCVBDI_MODE_RCB_ATTN_ENAB
Definition tg3.h:1182
#define LED_CTRL_MODE_COMBO
Definition tg3.h:570
#define GRC_MODE_HTX2B_ENABLE
Definition tg3.h:1800
#define TG3_PHYFLG_5704_A0_BUG
Definition tg3.h:3249
#define PCI_DEVICE_ID_TIGON3_5755M
Definition tg3.h:105
#define PCI_VENDOR_ID_DELL
Definition tg3.h:142
#define WDMAC_MODE_BURST_ALL_DATA
Definition tg3.h:1535
#define MAC_HASH_REG_2
Definition tg3.h:676
#define CPMU_LSPD_10MB_MACCLK_6_25
Definition tg3.h:1226
#define GRC_MODE_HOST_STACKUP
Definition tg3.h:1798
#define TG3_PCIE_LNKCTL_L1_PLL_PD_DIS
Definition tg3.h:2095
#define CHIPREV_ID_57765_A0
Definition tg3.h:295
#define HOSTCC_MODE_CLRTICK_RXBD
Definition tg3.h:1307
#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN
Definition tg3.h:1246
#define TG3PCI_DEVICE_TIGON3_57790
Definition tg3.h:193
#define MBFREE_MODE
Definition tg3.h:1292
#define ASIC_REV_5720
Definition tg3.h:320
#define GRC_LCLCTRL_GPIO_OUTPUT0
Definition tg3.h:1854
#define TX_LENGTHS_IPG_CRS_SHIFT
Definition tg3.h:648
#define DMA_RWCTRL_TAGGED_STAT_WA
Definition tg3.h:342
#define BUFMGR_MB_RDMA_LOW_WATER
Definition tg3.h:1431
#define PCI_DEVICE_ID_TIGON3_5787F
Definition tg3.h:114
#define TG3_PCIE_EIDLE_DELAY_13_CLKS
Definition tg3.h:2104
#define DMAC_MODE_ENABLE
Definition tg3.h:1778
#define NIC_SRAM_RX_BUFFER_DESC
Definition tg3.h:2289
#define CHIPREV_ID_5701_B5
Definition tg3.h:270
#define GET_ASIC_REV(CHIP_REV_ID)
Definition tg3.h:298
#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ
Definition tg3.h:1700
#define TG3_PHYFLG_ADJUST_TRIM
Definition tg3.h:3247
#define GRC_RX_CPU_DRIVER_EVENT
Definition tg3.h:1871
#define RCVLPC_MODE
Definition tg3.h:1090
#define SNDDATAC_MODE_ENABLE
Definition tg3.h:1025
#define NIC_SRAM_DATA_CFG_PHY_TYPE_MASK
Definition tg3.h:2215
#define tw32_f(reg, val)
Definition tg3.h:3333
#define WDMAC_MODE_FIFOURUN_ENAB
Definition tg3.h:1530
#define FTQ_RESET
Definition tg3.h:1692
#define GRC_MODE_NO_RX_PHDR_CSUM
Definition tg3.h:1805
#define NVRAM_CMD
Definition tg3.h:1906
#define MAC_MODE_PORT_MODE_TBI
Definition tg3.h:505
#define tg3_flag(tp, flag)
Definition tg3.h:3365
#define HOSTCC_RXCOAL_TICK_INT
Definition tg3.h:1336
#define DEFAULT_DMA_HIGH_WATER
Definition tg3.h:1462
#define RX_MODE_RESET
Definition tg3.h:652
#define CLOCK_CTRL_FORCE_CLKRUN
Definition tg3.h:403
#define SNDDATAC_MODE_CDELAY
Definition tg3.h:1026
#define NIC_SRAM_DATA_CFG
Definition tg3.h:2210
#define SNDDATAI_MODE_ENABLE
Definition tg3.h:982
#define TX_LENGTHS_SLOT_TIME_SHIFT
Definition tg3.h:644
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_57765
Definition tg3.h:1443
#define TG3_RDMA_RSRVCTRL_REG
Definition tg3.h:1506
#define tw32_wait_f(reg, val, us)
Definition tg3.h:3334
#define TG3_PHYFLG_SERDES_PREEMPHASIS
Definition tg3.h:3251
#define NIC_SRAM_FW_CMD_MBOX
Definition tg3.h:2234
#define NIC_SRAM_RCV_RET_RCB
Definition tg3.h:2199
#define GRC_LCLCTRL_AUTO_SEEPROM
Definition tg3.h:1868
#define LED_CTRL_MODE_PHY_2
Definition tg3.h:567
#define NIC_SRAM_DATA_CFG_EEPROM_WP
Definition tg3.h:2221
#define TG3PCI_MEM_WIN_BASE_ADDR
Definition tg3.h:407
#define MAC_RCV_RULE_0
Definition tg3.h:678
#define GET_CHIP_REV_ID(MISC_HOST_CTRL)
Definition tg3.h:257
#define TX_BACKOFF_SEED_MASK
Definition tg3.h:590
#define MAC_RCV_RULE_CFG
Definition tg3.h:711
#define RCVLPC_STATSCTRL
Definition tg3.h:1108
int tg3_phy_reset(struct tg3 *tp)
Definition tg3_phy.c:622
#define BUFMGR_DMA_LOW_WATER
Definition tg3.h:1459
#define GRC_MISC_CFG_BOARD_ID_5788
Definition tg3.h:1832
#define VCPU_STATUS_INIT_DONE
Definition tg3.h:1611
#define TG3_RDMA_RSRVCTRL_FIFO_LWM_1_5K
Definition tg3.h:1508
#define RDMAC_MODE_FIFOOREAD_ENAB
Definition tg3.h:1482
#define ASIC_REV_5755
Definition tg3.h:308
#define LOW_TXCOL_TICKS
Definition tg3.h:1321
#define NVRAM_SWARB
Definition tg3.h:2039
#define TG3_PCIE_PHY_TSTCTL_PSCRAM
Definition tg3.h:2100
#define CLOCK_CTRL_625_CORE
Definition tg3.h:402
#define TG3_BDINFO_NIC_ADDR
Definition tg3.h:169
#define TG3PCI_DEVICE_TIGON3_5719
Definition tg3.h:207
#define NVRAM_ADDR_MSK
Definition tg3.h:1920
#define CHIPREV_5704_BX
Definition tg3.h:328
#define WDMAC_STATUS
Definition tg3.h:1536
#define BUFMGR_MODE_ENABLE
Definition tg3.h:1421
#define GRC_MODE_WORD_SWAP_B2HRX_DATA
Definition tg3.h:1789
#define TG3PCI_RCV_RET_RING_CON_IDX
Definition tg3.h:413
#define TX_MODE_CNT_DN_MODE
Definition tg3.h:634
#define NVRAM_CMD_RD
Definition tg3.h:1911
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780
Definition tg3.h:1442
#define MISC_HOST_CTRL_MASK_PCI_INT
Definition tg3.h:246
#define ASIC_REV_57780
Definition tg3.h:315
#define TG3_PHYFLG_ADC_BUG
Definition tg3.h:3248
#define HOSTCC_TXMAX_FRAMES
Definition tg3.h:1331
void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:71
#define GRC_LCLCTRL_CLEARINT
Definition tg3.h:1839
#define NVRAM_ADDR
Definition tg3.h:1919
#define TX_MODE_MBUF_LOCKUP_FIX
Definition tg3.h:632
#define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K
Definition tg3.h:1518
void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:42
#define LED_CTRL_MODE_PHY_1
Definition tg3.h:566
#define MBFREE_MODE_ENABLE
Definition tg3.h:1294
#define GRC_MISC_CFG_BOARD_ID_MASK
Definition tg3.h:1823
#define FTQ_RCVBD_COMP_FIFO_ENQDEQ
Definition tg3.h:1744
#define NIC_SRAM_DATA_CFG_LED_MODE_PHY_1
Definition tg3.h:2213
#define TG3PCI_DEVICE_TIGON3_5761S
Definition tg3.h:189
#define RDMAC_MODE_FIFOURUN_ENAB
Definition tg3.h:1481
#define HOSTCC_STATUS_BLK_NIC_ADDR
Definition tg3.h:1358
#define RCVLSC_MODE_ATTN_ENABLE
Definition tg3.h:1213
#define TX_LENGTHS_IPG_SHIFT
Definition tg3.h:646
#define PCI_EXP_DEVSTA_FED
Definition tg3.h:68
#define RDMAC_MODE_LNGREAD_ENAB
Definition tg3.h:1483
#define TG3PCI_DEVICE_TIGON3_5718
Definition tg3.h:198
#define TG3PCI_REG_BASE_ADDR
Definition tg3.h:406
#define TG3PCI_DEVICE_TIGON3_57781
Definition tg3.h:199
#define ASIC_REV_5785
Definition tg3.h:314
#define tw32(reg, val)
Definition tg3.h:3329
#define TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX
Definition tg3.h:1507
#define TG3_PHYFLG_NO_ETH_WIRE_SPEED
Definition tg3.h:3245
#define EEPROM_ADDR_ADDR_SHIFT
Definition tg3.h:1890
#define GRC_EEPROM_ADDR
Definition tg3.h:1880
#define TG3PCI_DEVICE_TIGON3_57785
Definition tg3.h:200
#define TG3_OTP_DEFAULT
Definition tg3.h:2138
#define DMA_RWCTRL_CRDRDR_RDMA_MRRS_MSK
Definition tg3.h:343
#define GRC_LCLCTRL_GPIO_OE2
Definition tg3.h:1853
u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off)
Definition tg3_hw.c:98
#define GRC_MODE
Definition tg3.h:1782
#define TG3_PHYFLG_PARALLEL_DETECT
Definition tg3.h:3252
#define WDMAC_MODE_MSTABORT_ENAB
Definition tg3.h:1526
#define PCISTATE_BUS_SPEED_HIGH
Definition tg3.h:386
#define ASIC_REV_5717
Definition tg3.h:316
#define TXD_LEN_SHIFT
Definition tg3.h:2571
#define HOSTCC_RXMAX_FRAMES
Definition tg3.h:1326
#define RCVDBDI_STD_BD
Definition tg3.h:1146
#define RCVDCC_MODE_ATTN_ENABLE
Definition tg3.h:1175
#define TX_LENGTHS_JMB_FRM_LEN_MSK
Definition tg3.h:649
int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
Definition tg3_phy.c:86
#define TG3PCI_PRODID_ASICREV
Definition tg3.h:418
#define BUFMGR_DMA_DESC_POOL_SIZE
Definition tg3.h:1458
#define GRC_MISC_CFG_PRESCALAR_SHIFT
Definition tg3.h:1822
#define RCVLPC_STATS_ENABLE
Definition tg3.h:1111
#define SHASTA_EXT_LED_SHARED
Definition tg3.h:2271
#define NIC_SRAM_DATA_VER_SHIFT
Definition tg3.h:2228
#define TG3_RX_STD_PROD_IDX_REG
Definition tg3.h:445
#define HOSTCC_MODE
Definition tg3.h:1299
#define ASIC_REV_5750
Definition tg3.h:304
#define MAC_MI_MODE_500KHZ_CONST
Definition tg3.h:622
#define TG3_DEF_RX_RING_PENDING
Definition tg3.h:2949
#define ASIC_REV_5761
Definition tg3.h:313
#define MAC_RCV_RULE_6
Definition tg3.h:690
#define MAC_RCV_RULE_12
Definition tg3.h:702
#define RCVLPC_STATSCTRL_ENABLE
Definition tg3.h:1109
#define TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK
Definition tg3.h:1509
#define GRC_MODE_BYTE_SWAP_B2HRX_DATA
Definition tg3.h:1788
#define CHIPREV_ID_57780_A1
Definition tg3.h:293
#define NIC_SRAM_DATA_CFG_LED_MODE_MAC
Definition tg3.h:2212
#define MAC_RX_MODE
Definition tg3.h:651
#define EEPROM_ADDR_START
Definition tg3.h:1887
#define GRC_LCLCTRL_USE_SIG_DETECT
Definition tg3.h:1843
#define ASIC_REV_5719
Definition tg3.h:319
#define TG3PCI_REG_DATA
Definition tg3.h:408
#define PCI_EXP_DEVSTA
Definition tg3.h:65
#define NVRAM_CMD_GO
Definition tg3.h:1909
#define LOW_RXMAX_FRAMES
Definition tg3.h:1327
#define TG3_PHYFLG_ANY_SERDES
Definition tg3.h:3239
#define NIC_SRAM_DATA_CFG_APE_ENABLE
Definition tg3.h:2225
#define ASIC_REV_5703
Definition tg3.h:301
#define TG3_RDMA_RSRVCTRL_TXMRGN_MASK
Definition tg3.h:1513
#define DEFAULT_MB_HIGH_WATER_JUMBO
Definition tg3.h:1449
#define MISC_HOST_CTRL_CHIPREV_SHIFT
Definition tg3.h:256
#define NIC_SRAM_RGMII_INBAND_DISABLE
Definition tg3.h:2280
#define PCIE_PWR_MGMT_EXT_ASPM_TMR_EN
Definition tg3.h:2090
#define GRC_LCLCTRL_GPIO_UART_SEL
Definition tg3.h:1842
#define RDMAC_MODE_FIFO_LONG_BURST
Definition tg3.h:1490
#define TX_MODE_ENABLE
Definition tg3.h:628
#define SNDDATAI_STATSENAB
Definition tg3.h:992
#define MAC_HASH_REG_0
Definition tg3.h:674
#define CHIPREV_ID_5752_A0
Definition tg3.h:288
#define CHIPREV_5703_AX
Definition tg3.h:326
#define DEFAULT_MB_MACRX_LOW_WATER
Definition tg3.h:1437
#define GRC_LOCAL_CTRL
Definition tg3.h:1837
#define SNDBDC_MODE
Definition tg3.h:1083
#define PCI_DEVICE_ID_TIGON3_5705F
Definition tg3.h:103
#define TG3_PCIE_PHY_TSTCTL
Definition tg3.h:2098
#define TG3PCI_CLOCK_CTRL
Definition tg3.h:395
#define SWARB_REQ_SET1
Definition tg3.h:2041
#define RCVDBDI_MODE_LRG_RING_SZ
Definition tg3.h:1138
#define TG3_CPMU_LSPD_10MB_CLK
Definition tg3.h:1224
#define RCVDBDI_MODE_ENABLE
Definition tg3.h:1134
#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ
Definition tg3.h:1756
#define RCVBDI_MODE
Definition tg3.h:1179
#define NIC_SRAM_DATA_CFG_LED_MODE_MASK
Definition tg3.h:2211
#define RDMAC_MODE_BD_SBD_CRPT_ENAB
Definition tg3.h:1485
#define MAC_MODE_RXSTAT_ENABLE
Definition tg3.h:514
#define WDMAC_MODE_TGTABORT_ENAB
Definition tg3.h:1525
#define HOSTCC_MODE_ATTN
Definition tg3.h:1302
#define SNDBDS_MODE_ENABLE
Definition tg3.h:1032
#define TG3_RX_JMB_PROD_IDX_REG
Definition tg3.h:448
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO
Definition tg3.h:1441
#define ASIC_REV_57766
Definition tg3.h:318
#define SWARB_REQ_CLR1
Definition tg3.h:2045
#define MAC_RCV_VALUE_12
Definition tg3.h:703
#define DEFAULT_MB_HIGH_WATER_5906
Definition tg3.h:1447
#define NVRAM_CMD_LAST
Definition tg3.h:1914
#define PCISTATE_ROM_RETRY_ENABLE
Definition tg3.h:389
#define MAC_RCV_RULE_14
Definition tg3.h:706
#define DEFAULT_MB_MACRX_LOW_WATER_5705
Definition tg3.h:1438
#define NIC_SRAM_DATA_PHY_ID
Definition tg3.h:2230
#define TG3PCI_DEVICE_TIGON3_57761
Definition tg3.h:201
#define NIC_SRAM_RGMII_EXT_IBND_TX_EN
Definition tg3.h:2282
#define PCI_DEVICE_ID_TIGON3_5901
Definition tg3.h:136
#define NIC_SRAM_FIRMWARE_MBOX
Definition tg3.h:2203
#define LED_CTRL_MODE_SHARED
Definition tg3.h:569
#define TG3_RDMA_RSRVCTRL_TXMRGN_320B
Definition tg3.h:1512
#define WDMAC_MODE_ADDROFLOW_ENAB
Definition tg3.h:1528
#define PCI_DEVICE_ID_TIGON3_5756
Definition tg3.h:106
#define WDMAC_MODE_STATUS_TAG_FIX
Definition tg3.h:1534
#define NIC_SRAM_MAC_ADDR_HIGH_MBOX
Definition tg3.h:2257
#define CHIPREV_5784_AX
Definition tg3.h:331
#define TG3_64BIT_REG_HIGH
Definition tg3.h:159
#define MAC_RCV_RULE_8
Definition tg3.h:694
#define RDMAC_MODE_FIFOOFLOW_ENAB
Definition tg3.h:1480
#define CHIPREV_ID_5752_A0_HW
Definition tg3.h:287
#define TG3_PHYFLG_ENABLE_APD
Definition tg3.h:3243
#define TG3_PHYFLG_BER_BUG
Definition tg3.h:3250
#define BUFMGR_MB_HIGH_WATER
Definition tg3.h:1444
#define TG3PCI_GEN2_PRODID_ASICREV
Definition tg3.h:422
#define CHIPREV_5700_AX
Definition tg3.h:322
#define TG3_PCIE_PL_LO_PHYCTL5
Definition tg3.h:2115
#define SNDDATAI_SCTRL_FASTUPD
Definition tg3.h:988
#define tg3_flag_set(tp, flag)
Definition tg3.h:3367
#define TG3PCI_MISC_HOST_CTRL
Definition tg3.h:244
#define TG3_PCIE_LNKCTL
Definition tg3.h:2093
#define SNDDATAI_STATSCTRL
Definition tg3.h:986
#define DEFAULT_MB_HIGH_WATER
Definition tg3.h:1445
#define RCVCC_MODE_ATTN_ENABLE
Definition tg3.h:1201
static void tg3_generate_fw_event(struct tg3 *tp)
Definition tg3.h:3403
#define TG3_PCIE_PL_LO_PHYCTL1
Definition tg3.h:2113
#define TX_MODE_JMB_FRM_LEN
Definition tg3.h:633
#define VCPU_STATUS_DRV_RESET
Definition tg3.h:1612
#define WDMAC_MODE_LNGREAD_ENAB
Definition tg3.h:1532
#define CHIPREV_ID_5720_A0
Definition tg3.h:297
#define SD_STATUS_UPDATED
Definition tg3.h:2672
#define RCVLSC_MODE_ENABLE
Definition tg3.h:1212
#define TG3_PHY_ID_INVALID
Definition tg3.h:3209
#define NVRAM_CMD_FIRST
Definition tg3.h:1913
#define SNDBDC_MODE_ATTN_ENABLE
Definition tg3.h:1086
#define NIC_SRAM_STATUS_BLK
Definition tg3.h:2201
#define GRC_LCLCTRL_GPIO_OE3
Definition tg3.h:1846
#define MAILBOX_RCVRET_CON_IDX_0
Definition tg3.h:451
#define PCI_EXP_LNKCTL
Definition tg3.h:17
#define MAC_RCV_RULE_10
Definition tg3.h:698
#define TG3_PHYFLG_IS_FET
Definition tg3.h:3241
#define NVRAM_ACCESS
Definition tg3.h:2056
#define CHIPREV_5704_AX
Definition tg3.h:327
#define PCI_EXP_DEVSTA_URD
Definition tg3.h:69
#define MAC_RCV_RULE_1
Definition tg3.h:680
#define CHIPREV_57765_AX
Definition tg3.h:333
#define tg3_flag_clear(tp, flag)
Definition tg3.h:3369
#define MAC_HASH_REG_3
Definition tg3.h:677
#define NIC_SRAM_DATA_CFG_MINI_PCI
Definition tg3.h:2222
#define SHASTA_EXT_LED_COMBO
Definition tg3.h:2273
#define GRC_MODE_NO_TX_PHDR_CSUM
Definition tg3.h:1801
#define MISC_HOST_CTRL_CHIPREV
Definition tg3.h:255
#define MAC_RCV_VALUE_6
Definition tg3.h:691
#define WDMAC_MODE_ENABLE
Definition tg3.h:1524
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5906
Definition tg3.h:2299
#define MAC_RCV_VALUE_7
Definition tg3.h:693
#define NIC_SRAM_STATS_BLK
Definition tg3.h:2200
#define MAC_TX_MODE
Definition tg3.h:626
#define ASIC_REV_5752
Definition tg3.h:305
#define GRCMBOX_BASE
Definition tg3.h:1620
#define BUFMGR_DMA_HIGH_WATER
Definition tg3.h:1461
#define PCI_EXP_DEVCTL_RELAX_EN
Definition tg3.h:62
#define ATMEL_AT45DB0X1B_PAGE_POS
Definition tg3.h:3294
#define CHIPREV_ID_5750_A3
Definition tg3.h:285
#define SNDBDI_MODE_MULTI_TXQ_EN
Definition tg3.h:1061
#define RCVLPC_MODE_ENABLE
Definition tg3.h:1092
#define RDMAC_MODE_MULT_DMA_RD_DIS
Definition tg3.h:1491
#define MAC_MODE_TDE_ENABLE
Definition tg3.h:524
#define HOSTCC_TXCOL_TICKS
Definition tg3.h:1320
#define RCVDBDI_MINI_BD
Definition tg3.h:1147
#define CHIPREV_ID_5750_A0
Definition tg3.h:283
#define TG3_CORR_ERR_STAT_CLEAR
Definition tg3.h:427
#define NIC_SRAM_DATA_CFG_LED_MODE_PHY_2
Definition tg3.h:2214
#define MAC_RCV_RULE_4
Definition tg3.h:686
#define TG3_PHYFLG_USE_MI_INTERRUPT
Definition tg3.h:3236
#define WDMAC_MODE_PARITYERR_ENAB
Definition tg3.h:1527
#define PCI_VENDOR_ID_BROADCOM
Definition tg3.h:73
#define DEFAULT_MB_HIGH_WATER_57765
Definition tg3.h:1448
#define MISC_HOST_CTRL_TAGGED_STATUS
Definition tg3.h:254
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5755
Definition tg3.h:2298
#define CLOCK_CTRL_CLKRUN_OENABLE
Definition tg3.h:404
#define RX_MODE_KEEP_VLAN_TAG
Definition tg3.h:662
#define BUFMGR_MODE_MBLOW_ATTN_ENAB
Definition tg3.h:1424
#define TG3PCI_GEN15_PRODID_ASICREV
Definition tg3.h:423
#define PCISTATE_ROM_ENABLE
Definition tg3.h:388
#define CHIPREV_ID_5701_B2
Definition tg3.h:269
#define PCISTATE_RETRY_SAME_DMA
Definition tg3.h:391
#define TG3_PHYFLG_CAPACITIVE_COUPLING
Definition tg3.h:3244
#define PCI_DEVICE_ID_TIGON3_5753F
Definition tg3.h:135
#define MAC_RCV_RULE_11
Definition tg3.h:700
#define HOSTCC_MODE_32BYTE
Definition tg3.h:1306
#define MAC_RCV_VALUE_9
Definition tg3.h:697
#define PCISTATE_CONV_PCI_MODE
Definition tg3.h:385
#define TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK
Definition tg3.h:1511
#define TG3_PCIE_EIDLE_DELAY_MASK
Definition tg3.h:2103
#define RDMAC_MODE_H2BNC_VLAN_DET
Definition tg3.h:1494
#define NVRAM_CMD_DONE
Definition tg3.h:1908
#define GRC_FASTBOOT_PC
Definition tg3.h:1901
#define TG3PCI_DEVICE_TIGON3_57762
Definition tg3.h:202
#define NIC_SRAM_DMA_DESC_POOL_BASE
Definition tg3.h:2286
#define NIC_SRAM_RGMII_EXT_IBND_RX_EN
Definition tg3.h:2281
#define GRC_MODE_IRQ_ON_FLOW_ATTN
Definition tg3.h:1810
#define RDMAC_MODE_FIFO_SIZE_128
Definition tg3.h:1489
#define MAC_RCV_RULE_5
Definition tg3.h:688
#define SNDBDI_MODE_ATTN_ENABLE
Definition tg3.h:1060
#define GRC_LCLCTRL_GPIO_OUTPUT3
Definition tg3.h:1847
#define PCI_DEVICE_ID_TIGON3_5751F
Definition tg3.h:113
#define RDMAC_MODE_MSTABORT_ENAB
Definition tg3.h:1477
#define NIC_SRAM_DMA_DESC_POOL_SIZE
Definition tg3.h:2287
#define EEPROM_ADDR_ADDR_MASK
Definition tg3.h:1889
#define TG3_RX_STD_MAX_SIZE_5700
Definition tg3.h:173
#define TG3_PCIE_TLDLPL_PORT
Definition tg3.h:2109
#define NIC_SRAM_TX_BUFFER_DESC
Definition tg3.h:2288
#define SWARB_GNT1
Definition tg3.h:2049
#define WDMAC_MODE_FIFOOREAD_ENAB
Definition tg3.h:1531
#define PCIE_PWR_MGMT_L1_THRESH_MSK
Definition tg3.h:2088
#define MII_TG3_RXR_COUNTERS
Definition tg3.h:2331
#define MAC_MODE_RXSTAT_CLEAR
Definition tg3.h:515
#define GRC_VCPU_EXT_CTRL_HALT_CPU
Definition tg3.h:1899
#define MAC_LOW_WMARK_MAX_RX_FRAME
Definition tg3.h:713
#define DEFAULT_MB_MACRX_LOW_WATER_57765
Definition tg3.h:1440
#define MAC_MODE_APE_RX_EN
Definition tg3.h:528
#define SNDBDI_MODE_ENABLE
Definition tg3.h:1059
#define GRC_VCPU_EXT_CTRL
Definition tg3.h:1898
#define CHIPREV_ID_5750_A1
Definition tg3.h:284
#define MAC_LED_CTRL
Definition tg3.h:553
#define MAC_ADDR_0_HIGH
Definition tg3.h:575
#define MAC_ADDR_0_LOW
Definition tg3.h:576
#define HOSTCC_RXCOAL_MAXF_INT
Definition tg3.h:1344
void tg3_mdio_init(struct tg3 *tp)
Definition tg3_phy.c:14
#define RCVCC_MODE
Definition tg3.h:1198
#define MAC_EXTADDR_0_LOW
Definition tg3.h:720
#define CHIPREV_ID_5717_A0
Definition tg3.h:294
#define PCIE_PWR_MGMT_L1_THRESH_4MS
Definition tg3.h:2089
#define MEMARB_MODE
Definition tg3.h:1410
#define DEFAULT_STAT_COAL_TICKS
Definition tg3.h:1351
#define TG3PCI_DEVICE_TIGON3_57791
Definition tg3.h:205
#define ASIC_REV_5784
Definition tg3.h:312
#define NIC_SRAM_FIRMWARE_MBOX_MAGIC1
Definition tg3.h:2204
#define DEFAULT_MB_HIGH_WATER_5705
Definition tg3.h:1446
#define ASIC_REV_5700
Definition tg3.h:299
#define BUFMGR_DMA_DESC_POOL_ADDR
Definition tg3.h:1457
#define NIC_SRAM_MAC_ADDR_LOW_MBOX
Definition tg3.h:2258
#define NIC_SRAM_DATA_SIG
Definition tg3.h:2207
#define NIC_SRAM_WIN_BASE
Definition tg3.h:2194
#define WDMAC_MODE_FIFOOFLOW_ENAB
Definition tg3.h:1529
#define MAILBOX_SNDNIC_PROD_IDX_0
Definition tg3.h:483
#define RCVDBDI_MODE_INV_RING_SZ
Definition tg3.h:1137
#define DEFAULT_RXCOAL_TICK_INT
Definition tg3.h:1337
#define GRC_MODE_4X_NIC_SEND_RINGS
Definition tg3.h:1811
#define ISO_PKT_TX
Definition tg3.h:994
#define PCI_DEVICE_ID_TIGON3_5901_2
Definition tg3.h:137
#define CHIPREV_ID_5705_A1
Definition tg3.h:280
#define HOSTCC_RXCOL_TICKS
Definition tg3.h:1314
#define DEFAULT_MB_MACRX_LOW_WATER_5906
Definition tg3.h:1439
#define BUFMGR_MODE_ATTN_ENABLE
Definition tg3.h:1422
#define SHASTA_EXT_LED_MODE_MASK
Definition tg3.h:2269
#define GRC_LCLCTRL_GPIO_OE1
Definition tg3.h:1852
#define NIC_SRAM_DATA_CFG_2
Definition tg3.h:2266
#define MII_TG3_TEST1_CRC_EN
Definition tg3.h:2416
#define ASIC_REV_5704
Definition tg3.h:302
#define EEPROM_ADDR_READ
Definition tg3.h:1882
#define GRC_MISC_CFG_KEEP_GPHY_POWER
Definition tg3.h:1836
int tg3_setup_phy(struct tg3 *tp, int force_reset)
Definition tg3_phy.c:2521
#define RCVDCC_MODE
Definition tg3.h:1172
#define CPMU_CLCK_ORIDE_MAC_CLCK_ORIDE_EN
Definition tg3.h:1249
#define TG3_RX_RET_MAX_SIZE_5705
Definition tg3.h:178
#define PCI_EXP_LNKCTL_CLKREQ_EN
Definition tg3.h:18
#define PCIE_PWR_MGMT_THRESH
Definition tg3.h:2087
#define MAC_RCV_VALUE_11
Definition tg3.h:701
#define MAC_MODE_APE_TX_EN
Definition tg3.h:529
#define TG3PCI_DEVICE_TIGON3_57766
Definition tg3.h:204
#define RDMAC_MODE_MBUF_RBD_CRPT_ENAB
Definition tg3.h:1487
int tg3_phy_probe(struct tg3 *tp)
Definition tg3_phy.c:896
#define MAC_RCV_VALUE_10
Definition tg3.h:699
#define MAC_HASH_REG_1
Definition tg3.h:675
#define TG3_RDMA_RSRVCTRL_FIFO_HWM_1_5K
Definition tg3.h:1510
#define RCVLPC_CONFIG
Definition tg3.h:1107
#define DEFAULT_TXCOAL_TICK_INT
Definition tg3.h:1341
#define RCV_RULE_CFG_DEFAULT_CLASS
Definition tg3.h:712
#define CHIPREV_ID_5704_A0
Definition tg3.h:275
#define RCVLPC_STATSENAB_DACK_FIX
Definition tg3.h:1113
#define MAC_RCV_VALUE_15
Definition tg3.h:709
#define MAC_TX_BACKOFF_SEED
Definition tg3.h:589
#define MAC_TX_LENGTHS
Definition tg3.h:642
#define TG3_PCIE_DL_LO_FTSMAX
Definition tg3.h:2110
#define MAC_MI_STAT_LNKSTAT_ATTN_ENAB
Definition tg3.h:616
#define MAC_MI_MODE_BASE
Definition tg3.h:623
#define EEPROM_ADDR_DEVID_SHIFT
Definition tg3.h:1886
#define CPMU_LSPD_10MB_MACCLK_MASK
Definition tg3.h:1225
#define TG3PCI_MSI_DATA
Definition tg3.h:242
#define SHASTA_EXT_LED_MAC
Definition tg3.h:2272
#define tw32_rx_mbox(reg, val)
Definition tg3.h:3337
#define HOSTCC_STATUS_BLK_HOST_ADDR
Definition tg3.h:1356
#define GRC_MODE_PCIE_PL_SEL
Definition tg3.h:1804
#define NIC_SRAM_DATA_CFG_ASF_ENABLE
Definition tg3.h:2220
#define NIC_SRAM_DATA_PHY_ID2_MASK
Definition tg3.h:2232
#define MAC_SERDES_CFG
Definition tg3.h:743
#define TG3_PCIE_DL_LO_FTSMAX_VAL
Definition tg3.h:2112
#define DMA_RWCTRL_DIS_CACHE_ALIGNMENT
Definition tg3.h:341
#define RCVCC_MODE_ENABLE
Definition tg3.h:1200
#define PCI_EXP_DEVSTA_CED
Definition tg3.h:66
#define GRC_LCLCTRL_INT_ON_ATTN
Definition tg3.h:1841
#define PCI_DEVICE_ID_TIGON3_5761
Definition tg3.h:116
#define FWCMD_NICDRV_PAUSE_FW
Definition tg3.h:2236
#define HOSTCC_MODE_ENABLE
Definition tg3.h:1301
#define MAC_RCV_VALUE_14
Definition tg3.h:707
#define DUAL_MAC_CTRL_ID
Definition tg3.h:417
#define TG3_BDINFO_MAXLEN_FLAGS
Definition tg3.h:164
#define MAC_RCV_VALUE_4
Definition tg3.h:687
#define TG3_PCIE_PL_LO_PHYCTL5_DIS_L2CLKREQ
Definition tg3.h:2116
#define tw32_mailbox(reg, val)
define tw32_mailbox(reg, val) tg3_write_indirect_mbox(((val) & 0xffffffff), tp->regs + (reg))
Definition tg3.h:3331
#define MAC_RCV_VALUE_5
Definition tg3.h:689
#define MAC_MODE_RDE_ENABLE
Definition tg3.h:525
#define TG3PCI_MISC_LOCAL_CTRL
Definition tg3.h:410
#define BUFMGR_MODE
Definition tg3.h:1419
#define MEMARB_MODE_ENABLE
Definition tg3.h:1412
#define SNDBDI_MODE
Definition tg3.h:1057
#define MAC_RCV_RULE_9
Definition tg3.h:696
#define GRC_MODE_B2HRX_ENABLE
Definition tg3.h:1797
#define JEDEC_ATMEL
Definition tg3.h:3280
#define MAC_MI_STAT
Definition tg3.h:615
#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780
Definition tg3.h:1435
#define TG3_PHYFLG_10_100_ONLY
Definition tg3.h:3242
#define SNDBDC_MODE_ENABLE
Definition tg3.h:1085
#define GRC_LCLCTRL_SETINT
Definition tg3.h:1840
#define CLOCK_CTRL_ALTCLK
Definition tg3.h:399
#define NVRAM_RDDATA
Definition tg3.h:1921
#define TG3_PCIE_EIDLE_DELAY
Definition tg3.h:2102
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5700
Definition tg3.h:2297
#define MAC_EXTADDR_0_HIGH
Definition tg3.h:719
#define MAC_RCV_VALUE_13
Definition tg3.h:705
#define RCV_RULE_DISABLE_MASK
Definition tg3.h:710
#define TG3_64BIT_REG_LOW
Definition tg3.h:160
#define ASIC_REV_5787
Definition tg3.h:309
#define NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER
Definition tg3.h:2218
#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ
Definition tg3.h:1720
#define PCI_X_CMD_MAX_SPLIT
Definition tg3.h:24
#define RDMAC_MODE_MBUF_SBD_CRPT_ENAB
Definition tg3.h:1488
#define ASIC_REV_USE_PROD_ID_REG
Definition tg3.h:311
#define TG3PCI_DEVICE_TIGON3_57765
Definition tg3.h:203
#define MAC_MODE_PORT_MODE_GMII
Definition tg3.h:506
#define MAC_MODE_LINK_POLARITY
Definition tg3.h:513
#define RDMAC_MODE_ADDROFLOW_ENAB
Definition tg3.h:1479
#define TG3_BDINFO_SIZE
Definition tg3.h:170
#define DEFAULT_MB_HIGH_WATER_JUMBO_5780
Definition tg3.h:1450
#define NIC_SRAM_DATA_SIG_MAGIC
Definition tg3.h:2208
#define PCI_X_CMD_MAX_READ
Definition tg3.h:22
#define MAC_MODE_FHDE_ENABLE
Definition tg3.h:526
#define MAC_MODE_TXSTAT_ENABLE
Definition tg3.h:517
#define HOSTCC_TXCOAL_MAXF_INT
Definition tg3.h:1347
#define NIC_SRAM_MBUF_POOL_BASE
Definition tg3.h:2291
#define NIC_SRAM_MBUF_POOL_SIZE64
Definition tg3.h:2293
#define MAC_MODE_TXSTAT_CLEAR
Definition tg3.h:518
#define TG3_PHYFLG_JITTER_BUG
Definition tg3.h:3246
#define TG3_CPMU_CLCK_ORIDE
Definition tg3.h:1245
#define GET_CHIP_REV(CHIP_REV_ID)
Definition tg3.h:321
#define PCI_DEVICE_ID_TIGON3_5722
Definition tg3.h:93
#define DMAC_MODE
Definition tg3.h:1776
u32 tg3_read_otp_phycfg(struct tg3 *tp)
int tg3_rx_prodring_init(struct tg3 *tp, struct tg3_rx_prodring_set *tpr);
Definition tg3_phy.c:57
#define CHIPREV_ID_5701_A0
Definition tg3.h:267
#define NIC_SRAM_DATA_VER
Definition tg3.h:2227
#define CHIPREV_5700_BX
Definition tg3.h:323
#define STD_REPLENISH_LWM
Definition tg3.h:1193
#define TG3_PCIE_PHY_TSTCTL_PCIE10
Definition tg3.h:2099
#define GRC_LCLCTRL_GPIO_OUTPUT2
Definition tg3.h:1856
#define VCPU_STATUS
Definition tg3.h:1610
#define ASIC_REV_5714
Definition tg3.h:307
#define ACCESS_ENABLE
Definition tg3.h:2057
#define DEFAULT_MB_RDMA_LOW_WATER
Definition tg3.h:1432
#define RDMAC_MODE_PARITYERR_ENAB
Definition tg3.h:1478
#define MAC_RCV_RULE_15
Definition tg3.h:708
#define PCI_EXP_DEVCTL_PAYLOAD
Definition tg3.h:64
#define TG3PCI_STD_RING_PROD_IDX
Definition tg3.h:412
#define TG3PCI_MEM_WIN_DATA
Definition tg3.h:409
#define TG3PCI_DEVICE_TIGON3_5717
Definition tg3.h:197
#define TG3PCI_DUAL_MAC_CTRL
Definition tg3.h:415
#define TG3_CORR_ERR_STAT
Definition tg3.h:426
#define tw32_mailbox_f(reg, val)
Definition tg3.h:3332
#define MAC_RCV_VALUE_0
Definition tg3.h:679
#define TG3_TX_RING_SIZE
Definition tg3.h:3310
#define CHIPREV_ID_57780_A0
Definition tg3.h:292
#define RCVBDI_STD_THRESH
Definition tg3.h:1189
#define CHIPREV_ID_5701_B0
Definition tg3.h:268
#define CLOCK_CTRL_44MHZ_CORE
Definition tg3.h:401
#define MAC_RCV_VALUE_1
Definition tg3.h:681
#define EEPROM_ADDR_COMPLETE
Definition tg3.h:1883
#define MAC_RCV_RULE_13
Definition tg3.h:704
#define TG3_PCIE_PL_LO_PHYCTL1_L1PLLPD_EN
Definition tg3.h:2114
#define MAC_RX_MTU_SIZE
Definition tg3.h:591
#define HOSTCC_MODE_CLRTICK_TXBD
Definition tg3.h:1308
#define BUFMGR_MB_POOL_SIZE
Definition tg3.h:1430
#define MAC_RCV_RULE_7
Definition tg3.h:692
#define BDINFO_FLAGS_MAXLEN_SHIFT
Definition tg3.h:168
#define LED_CTRL_MODE_MAC
Definition tg3.h:565
#define RDMAC_MODE_TGTABORT_ENAB
Definition tg3.h:1476
#define WDMAC_MODE
Definition tg3.h:1522
#define SNDBDS_MODE
Definition tg3.h:1030
#define HOSTCC_TXCOAL_TICK_INT
Definition tg3.h:1340
#define MAC_RCV_VALUE_8
Definition tg3.h:695
static int tg3_nvram_lock(struct tg3 *tp)
Definition tg3_hw.c:1223
void tg3_set_power_state_0(struct tg3 *tp)
Definition tg3_hw.c:130
void _tw32_flush(struct tg3 *tp, u32 off, u32 val, u32 usec_wait)
Definition tg3_hw.c:114
int tg3_init_hw(struct tg3 *tp, int reset_phy)
Definition tg3_hw.c:2573
static int tg3_nvram_read_using_eeprom(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1501
static void tg3_save_pci_state(struct tg3 *tp)
Definition tg3_hw.c:1132
int tg3_do_test_dma(struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device)
Definition tg3_hw.c:2595
static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1606
static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
Definition tg3_hw.c:171
#define TG3_FW_EVENT_TIMEOUT_USEC
Definition tg3_hw.c:907
static void tg3_disable_nvram_access(struct tg3 *tp)
Definition tg3_hw.c:1568
void tg3_enable_ints(struct tg3 *tp)
Definition tg3_hw.c:968
void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:71
#define TG3_MAX_MTU
void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:42
#define MAX_WAIT_CNT
Definition tg3_hw.c:986
u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off)
Definition tg3_hw.c:98
static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, dma_addr_t mapping, u32 maxlen_flags, u32 nic_addr)
Definition tg3_hw.c:1767
#define PCI_VENDOR_ID_ARIMA
Definition tg3_hw.c:169
static void tg3_enable_nvram_access(struct tg3 *tp)
Definition tg3_hw.c:1558
static int tg3_poll_fw(struct tg3 *tp)
Definition tg3_hw.c:1178
void tg3_set_txd(struct tg3 *tp, int entry, dma_addr_t mapping, int len, u32 flags)
Definition tg3_hw.c:2583
static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit)
Definition tg3_hw.c:989
static int tg3_chip_reset(struct tg3 *tp)
Definition tg3_hw.c:1257
static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
Definition tg3_hw.c:1897
static int tg3_abort_hw(struct tg3 *tp)
Definition tg3_hw.c:1033
u32 tg3_read_indirect_reg32(struct tg3 *tp, u32 off)
Definition tg3_hw.c:49
void tg3_init_bufmgr_config(struct tg3 *tp)
Definition tg3_hw.c:850
void tg3_wait_for_event_ack(struct tg3 *tp)
Definition tg3_hw.c:909
static void tg3_switch_clocks(struct tg3 *tp)
Definition tg3_hw.c:360
void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
Definition tg3_hw.c:153
int tg3_get_invariants(struct tg3 *tp)
Definition tg3_hw.c:394
static int tg3_nvram_read_be32(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1640
int tg3_halt(struct tg3 *tp)
Definition tg3_hw.c:1481
static void tg3_write_sig_pre_reset(struct tg3 *tp)
Definition tg3_hw.c:952
static void tg3_restore_pci_state(struct tg3 *tp)
Definition tg3_hw.c:1139
static void tg3_rings_reset(struct tg3 *tp)
Definition tg3_hw.c:1788
static void __tg3_set_rx_mode(struct net_device *dev)
Definition tg3_hw.c:1718
static void __tg3_set_coalesce(struct tg3 *tp)
Definition tg3_hw.c:1742
void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
Definition tg3_hw.c:1094
#define NVRAM_CMD_TIMEOUT
Definition tg3_hw.c:1578
#define TG3_DEF_MAC_MODE
Definition tg3_hw.c:40
void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:922
static void tg3_stop_fw(struct tg3 *tp)
Definition tg3_hw.c:936
static u32 tg3_nvram_phys_addr(struct tg3 *tp, u32 addr)
Definition tg3_hw.c:1542
void tg3_disable_ints(struct tg3 *tp)
Definition tg3_hw.c:959
int tg3_get_device_address(struct tg3 *tp)
Definition tg3_hw.c:1650
static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd)
Definition tg3_hw.c:1580
static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:65
static void tg3_nvram_unlock(struct tg3 *tp)
Definition tg3_hw.c:1246
static void tg3_setup_rxbd_thresholds(struct tg3 *tp)
Definition tg3_hw.c:1870
static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off)
Definition tg3_hw.c:59
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition timer.c:79
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61
static struct tulip_private * tp
Definition tulip.c:442
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
#define readl
Definition w89c840.c:157
#define writel
Definition w89c840.c:160