iPXE
tg3_hw.c File Reference
#include <mii.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <byteswap.h>
#include <ipxe/pci.h>
#include <ipxe/iobuf.h>
#include <ipxe/timer.h>
#include <ipxe/malloc.h>
#include <ipxe/if_ether.h>
#include <ipxe/ethernet.h>
#include <ipxe/netdevice.h>
#include "tg3.h"

Go to the source code of this file.

Macros

#define RESET_KIND_SHUTDOWN   0
#define RESET_KIND_INIT   1
#define RESET_KIND_SUSPEND   2
#define TG3_DEF_MAC_MODE   0
#define PCI_VENDOR_ID_ARIMA   0x161f
#define TG3_FW_EVENT_TIMEOUT_USEC   2500
#define MAX_WAIT_CNT   1000
#define NVRAM_CMD_TIMEOUT   10000
#define TG3_MAX_MTU   1522

Functions

 FILE_LICENCE (GPL2_ONLY)
void tg3_write_indirect_reg32 (struct tg3 *tp, u32 off, u32 val)
u32 tg3_read_indirect_reg32 (struct tg3 *tp, u32 off)
static u32 tg3_read32_mbox_5906 (struct tg3 *tp, u32 off)
static void tg3_write32_mbox_5906 (struct tg3 *tp, u32 off, u32 val)
void tg3_write_indirect_mbox (struct tg3 *tp, u32 off, u32 val)
u32 tg3_read_indirect_mbox (struct tg3 *tp, u32 off)
void _tw32_flush (struct tg3 *tp, u32 off, u32 val, u32 usec_wait)
void tg3_set_power_state_0 (struct tg3 *tp)
void tg3_read_mem (struct tg3 *tp, u32 off, u32 *val)
static void tg3_get_eeprom_hw_cfg (struct tg3 *tp)
static void tg3_switch_clocks (struct tg3 *tp)
int tg3_get_invariants (struct tg3 *tp)
void tg3_init_bufmgr_config (struct tg3 *tp)
void tg3_wait_for_event_ack (struct tg3 *tp)
void tg3_write_mem (struct tg3 *tp, u32 off, u32 val)
static void tg3_stop_fw (struct tg3 *tp)
static void tg3_write_sig_pre_reset (struct tg3 *tp)
void tg3_disable_ints (struct tg3 *tp)
void tg3_enable_ints (struct tg3 *tp)
static int tg3_stop_block (struct tg3 *tp, unsigned long ofs, u32 enable_bit)
static int tg3_abort_hw (struct tg3 *tp)
void __tg3_set_mac_addr (struct tg3 *tp, int skip_mac_1)
static void tg3_save_pci_state (struct tg3 *tp)
static void tg3_restore_pci_state (struct tg3 *tp)
static int tg3_poll_fw (struct tg3 *tp)
static int tg3_nvram_lock (struct tg3 *tp)
static void tg3_nvram_unlock (struct tg3 *tp)
static int tg3_chip_reset (struct tg3 *tp)
int tg3_halt (struct tg3 *tp)
static int tg3_nvram_read_using_eeprom (struct tg3 *tp, u32 offset, u32 *val)
static u32 tg3_nvram_phys_addr (struct tg3 *tp, u32 addr)
static void tg3_enable_nvram_access (struct tg3 *tp)
static void tg3_disable_nvram_access (struct tg3 *tp)
static int tg3_nvram_exec_cmd (struct tg3 *tp, u32 nvram_cmd)
static int tg3_nvram_read (struct tg3 *tp, u32 offset, u32 *val)
static int tg3_nvram_read_be32 (struct tg3 *tp, u32 offset, u32 *val)
int tg3_get_device_address (struct tg3 *tp)
static void __tg3_set_rx_mode (struct net_device *dev)
static void __tg3_set_coalesce (struct tg3 *tp)
static void tg3_set_bdinfo (struct tg3 *tp, u32 bdinfo_addr, dma_addr_t mapping, u32 maxlen_flags, u32 nic_addr)
static void tg3_rings_reset (struct tg3 *tp)
static void tg3_setup_rxbd_thresholds (struct tg3 *tp)
static int tg3_reset_hw (struct tg3 *tp, int reset_phy)
int tg3_init_hw (struct tg3 *tp, int reset_phy)
void tg3_set_txd (struct tg3 *tp, int entry, dma_addr_t mapping, int len, u32 flags)
int tg3_do_test_dma (struct tg3 *tp, u32 __unused *buf, dma_addr_t buf_dma, int size, int to_device)

Macro Definition Documentation

◆ RESET_KIND_SHUTDOWN

#define RESET_KIND_SHUTDOWN   0

Definition at line 36 of file tg3_hw.c.

◆ RESET_KIND_INIT

#define RESET_KIND_INIT   1

Definition at line 37 of file tg3_hw.c.

◆ RESET_KIND_SUSPEND

#define RESET_KIND_SUSPEND   2

Definition at line 38 of file tg3_hw.c.

◆ TG3_DEF_MAC_MODE

#define TG3_DEF_MAC_MODE   0

Definition at line 40 of file tg3_hw.c.

Referenced by tg3_get_invariants().

◆ PCI_VENDOR_ID_ARIMA

#define PCI_VENDOR_ID_ARIMA   0x161f

Definition at line 169 of file tg3_hw.c.

Referenced by tg3_get_eeprom_hw_cfg().

◆ TG3_FW_EVENT_TIMEOUT_USEC

#define TG3_FW_EVENT_TIMEOUT_USEC   2500

Definition at line 907 of file tg3_hw.c.

Referenced by tg3_wait_for_event_ack().

◆ MAX_WAIT_CNT

#define MAX_WAIT_CNT   1000

Definition at line 986 of file tg3_hw.c.

Referenced by tg3_abort_hw(), and tg3_stop_block().

◆ NVRAM_CMD_TIMEOUT

#define NVRAM_CMD_TIMEOUT   10000

Definition at line 1578 of file tg3_hw.c.

Referenced by tg3_nvram_exec_cmd().

◆ TG3_MAX_MTU

#define TG3_MAX_MTU   1522

Referenced by tg3_reset_hw().

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_ONLY )

◆ tg3_write_indirect_reg32()

void tg3_write_indirect_reg32 ( struct tg3 * tp,
u32 off,
u32 val )

Definition at line 42 of file tg3_hw.c.

43{ DBGP("%s\n", __func__);
44
47}
#define DBGP(...)
Definition compiler.h:532
int pci_write_config_dword(struct pci_device *pci, unsigned int where, uint32_t value)
Write 32-bit dword to PCI configuration space.
void __asmcall int val
Definition setjmp.h:12
#define TG3PCI_REG_BASE_ADDR
Definition tg3.h:406
#define TG3PCI_REG_DATA
Definition tg3.h:408
static struct tulip_private * tp
Definition tulip.c:442

References DBGP, pci_write_config_dword(), TG3PCI_REG_BASE_ADDR, TG3PCI_REG_DATA, tp, u32, and val.

Referenced by tg3_get_invariants().

◆ tg3_read_indirect_reg32()

u32 tg3_read_indirect_reg32 ( struct tg3 * tp,
u32 off )

Definition at line 49 of file tg3_hw.c.

50{ DBGP("%s\n", __func__);
51
52 u32 val;
53
56 return val;
57}
int pci_read_config_dword(struct pci_device *pci, unsigned int where, uint32_t *value)
Read 32-bit dword from PCI configuration space.
#define u32
Definition vga.h:21

References DBGP, pci_read_config_dword(), pci_write_config_dword(), TG3PCI_REG_BASE_ADDR, TG3PCI_REG_DATA, tp, u32, and val.

◆ tg3_read32_mbox_5906()

u32 tg3_read32_mbox_5906 ( struct tg3 * tp,
u32 off )
static

Definition at line 59 of file tg3_hw.c.

60{ DBGP("%s\n", __func__);
61
62 return readl(tp->regs + off + GRCMBOX_BASE);
63}
#define GRCMBOX_BASE
Definition tg3.h:1620
#define readl
Definition w89c840.c:157

References DBGP, GRCMBOX_BASE, readl, tp, and u32.

Referenced by tg3_get_invariants().

◆ tg3_write32_mbox_5906()

void tg3_write32_mbox_5906 ( struct tg3 * tp,
u32 off,
u32 val )
static

Definition at line 65 of file tg3_hw.c.

66{ DBGP("%s\n", __func__);
67
68 writel(val, tp->regs + off + GRCMBOX_BASE);
69}
#define writel
Definition w89c840.c:160

References DBGP, GRCMBOX_BASE, tp, u32, val, and writel.

Referenced by tg3_get_invariants().

◆ tg3_write_indirect_mbox()

void tg3_write_indirect_mbox ( struct tg3 * tp,
u32 off,
u32 val )

Definition at line 71 of file tg3_hw.c.

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}
#define MAILBOX_INTERRUPT_0
Definition tg3.h:431
#define TG3PCI_RCV_RET_RING_CON_IDX
Definition tg3.h:413
#define GRC_LCLCTRL_CLEARINT
Definition tg3.h:1839
#define TG3_RX_STD_PROD_IDX_REG
Definition tg3.h:445
#define MAILBOX_RCVRET_CON_IDX_0
Definition tg3.h:451
#define TG3PCI_MISC_LOCAL_CTRL
Definition tg3.h:410
#define TG3_64BIT_REG_LOW
Definition tg3.h:160
#define TG3PCI_STD_RING_PROD_IDX
Definition tg3.h:412

References DBGP, GRC_LCLCTRL_CLEARINT, MAILBOX_INTERRUPT_0, MAILBOX_RCVRET_CON_IDX_0, pci_write_config_dword(), TG3_64BIT_REG_LOW, TG3_RX_STD_PROD_IDX_REG, TG3PCI_MISC_LOCAL_CTRL, TG3PCI_RCV_RET_RING_CON_IDX, TG3PCI_REG_BASE_ADDR, TG3PCI_REG_DATA, TG3PCI_STD_RING_PROD_IDX, tp, u32, and val.

Referenced by tg3_get_invariants().

◆ tg3_read_indirect_mbox()

u32 tg3_read_indirect_mbox ( struct tg3 * tp,
u32 off )

Definition at line 98 of file tg3_hw.c.

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}

References DBGP, pci_read_config_dword(), pci_write_config_dword(), TG3PCI_REG_BASE_ADDR, TG3PCI_REG_DATA, tp, u32, and val.

Referenced by tg3_get_invariants().

◆ _tw32_flush()

void _tw32_flush ( struct tg3 * tp,
u32 off,
u32 val,
u32 usec_wait )

Definition at line 114 of file tg3_hw.c.

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}
#define tr32(reg)
Definition tg3.h:3339
#define tw32(reg, val)
Definition tg3.h:3329
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
Definition timer.c:61

References DBGP, tp, tr32, tw32, u32, udelay(), and val.

◆ tg3_set_power_state_0()

void tg3_set_power_state_0 ( struct tg3 * tp)

Definition at line 130 of file tg3_hw.c.

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}
unsigned short uint16_t
Definition stdint.h:11
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_word(struct pci_device *pci, unsigned int where, uint16_t value)
Write 16-bit word to PCI configuration space.
#define PCI_PM_CTRL_STATE_MASK
Current power state.
Definition pci.h:107
#define PCI_PM_CTRL
Power management control and status.
Definition pci.h:106
#define PCI_PM_CTRL_PME_STATUS
PME pin status.
Definition pci.h:109
#define tw32_wait_f(reg, val, us)
Definition tg3.h:3334
#define GRC_LOCAL_CTRL
Definition tg3.h:1837
#define TG3PCI_MISC_HOST_CTRL
Definition tg3.h:244

References DBGP, GRC_LOCAL_CTRL, PCI_PM_CTRL, PCI_PM_CTRL_PME_STATUS, PCI_PM_CTRL_STATE_MASK, pci_read_config_word(), pci_write_config_dword(), pci_write_config_word(), TG3PCI_MISC_HOST_CTRL, tp, and tw32_wait_f.

Referenced by tg3_get_invariants(), and tg3_open().

◆ tg3_read_mem()

void tg3_read_mem ( struct tg3 * tp,
u32 off,
u32 * val )

Definition at line 153 of file tg3_hw.c.

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}
#define ASIC_REV_5906
Definition tg3.h:310
#define GET_ASIC_REV(CHIP_REV_ID)
Definition tg3.h:298
#define TG3PCI_MEM_WIN_BASE_ADDR
Definition tg3.h:407
#define NIC_SRAM_STATS_BLK
Definition tg3.h:2200
#define NIC_SRAM_TX_BUFFER_DESC
Definition tg3.h:2288
#define TG3PCI_MEM_WIN_DATA
Definition tg3.h:409

References ASIC_REV_5906, DBGP, GET_ASIC_REV, NIC_SRAM_STATS_BLK, NIC_SRAM_TX_BUFFER_DESC, pci_read_config_dword(), pci_write_config_dword(), TG3PCI_MEM_WIN_BASE_ADDR, TG3PCI_MEM_WIN_DATA, tp, u32, and val.

Referenced by tg3_get_device_address(), tg3_get_eeprom_hw_cfg(), tg3_poll_fw(), and tg3_test_dma().

◆ tg3_get_eeprom_hw_cfg()

void tg3_get_eeprom_hw_cfg ( struct tg3 * tp)
static

Definition at line 171 of file tg3_hw.c.

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}
#define NIC_SRAM_DATA_CFG_2_APD_EN
Definition tg3.h:2268
#define TG3_PHYFLG_MII_SERDES
Definition tg3.h:3238
#define NIC_SRAM_DATA_PHY_ID1_MASK
Definition tg3.h:2231
#define LED_CTRL_MODE_SHASTA_MAC
Definition tg3.h:568
#define TG3_PHYFLG_PHY_SERDES
Definition tg3.h:3237
#define ASIC_REV_5701
Definition tg3.h:300
#define NIC_SRAM_DATA_CFG_4
Definition tg3.h:2278
#define NIC_SRAM_DATA_CFG_3
Definition tg3.h:2275
#define LED_CTRL_MODE_COMBO
Definition tg3.h:570
#define PCI_VENDOR_ID_DELL
Definition tg3.h:142
#define NIC_SRAM_DATA_CFG_PHY_TYPE_MASK
Definition tg3.h:2215
#define tg3_flag(tp, flag)
Definition tg3.h:3365
#define NIC_SRAM_DATA_CFG
Definition tg3.h:2210
#define TG3_PHYFLG_SERDES_PREEMPHASIS
Definition tg3.h:3251
#define LED_CTRL_MODE_PHY_2
Definition tg3.h:567
#define NIC_SRAM_DATA_CFG_EEPROM_WP
Definition tg3.h:2221
#define LED_CTRL_MODE_PHY_1
Definition tg3.h:566
#define NIC_SRAM_DATA_CFG_LED_MODE_PHY_1
Definition tg3.h:2213
#define ASIC_REV_5785
Definition tg3.h:314
#define SHASTA_EXT_LED_SHARED
Definition tg3.h:2271
#define NIC_SRAM_DATA_VER_SHIFT
Definition tg3.h:2228
#define NIC_SRAM_DATA_CFG_LED_MODE_MAC
Definition tg3.h:2212
#define NIC_SRAM_DATA_CFG_APE_ENABLE
Definition tg3.h:2225
#define ASIC_REV_5703
Definition tg3.h:301
#define NIC_SRAM_RGMII_INBAND_DISABLE
Definition tg3.h:2280
#define NIC_SRAM_DATA_CFG_LED_MODE_MASK
Definition tg3.h:2211
#define NIC_SRAM_DATA_PHY_ID
Definition tg3.h:2230
#define NIC_SRAM_RGMII_EXT_IBND_TX_EN
Definition tg3.h:2282
#define LED_CTRL_MODE_SHARED
Definition tg3.h:569
#define CHIPREV_5784_AX
Definition tg3.h:331
#define TG3_PHYFLG_ENABLE_APD
Definition tg3.h:3243
#define tg3_flag_set(tp, flag)
Definition tg3.h:3367
#define TG3_PHY_ID_INVALID
Definition tg3.h:3209
#define tg3_flag_clear(tp, flag)
Definition tg3.h:3369
#define SHASTA_EXT_LED_COMBO
Definition tg3.h:2273
#define CHIPREV_ID_5750_A0
Definition tg3.h:283
#define NIC_SRAM_DATA_CFG_LED_MODE_PHY_2
Definition tg3.h:2214
#define TG3_PHYFLG_CAPACITIVE_COUPLING
Definition tg3.h:3244
#define NIC_SRAM_RGMII_EXT_IBND_RX_EN
Definition tg3.h:2281
#define CHIPREV_ID_5750_A1
Definition tg3.h:284
#define MEMARB_MODE
Definition tg3.h:1410
#define ASIC_REV_5784
Definition tg3.h:312
#define ASIC_REV_5700
Definition tg3.h:299
#define NIC_SRAM_DATA_SIG
Definition tg3.h:2207
#define SHASTA_EXT_LED_MODE_MASK
Definition tg3.h:2269
#define NIC_SRAM_DATA_CFG_2
Definition tg3.h:2266
#define SHASTA_EXT_LED_MAC
Definition tg3.h:2272
#define NIC_SRAM_DATA_CFG_ASF_ENABLE
Definition tg3.h:2220
#define NIC_SRAM_DATA_PHY_ID2_MASK
Definition tg3.h:2232
#define MEMARB_MODE_ENABLE
Definition tg3.h:1412
#define NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER
Definition tg3.h:2218
#define NIC_SRAM_DATA_SIG_MAGIC
Definition tg3.h:2208
#define GET_CHIP_REV(CHIP_REV_ID)
Definition tg3.h:321
#define NIC_SRAM_DATA_VER
Definition tg3.h:2227
#define LED_CTRL_MODE_MAC
Definition tg3.h:565
#define PCI_VENDOR_ID_ARIMA
Definition tg3_hw.c:169
void tg3_read_mem(struct tg3 *tp, u32 off, u32 *val)
Definition tg3_hw.c:153
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
Definition timer.c:79
#define u16
Definition vga.h:20

References ASIC_REV_5700, ASIC_REV_5701, ASIC_REV_5703, ASIC_REV_5784, ASIC_REV_5785, CHIPREV_5784_AX, CHIPREV_ID_5750_A0, CHIPREV_ID_5750_A1, DBGP, GET_ASIC_REV, GET_CHIP_REV, LED_CTRL_MODE_COMBO, LED_CTRL_MODE_MAC, LED_CTRL_MODE_PHY_1, LED_CTRL_MODE_PHY_2, LED_CTRL_MODE_SHARED, LED_CTRL_MODE_SHASTA_MAC, mdelay(), MEMARB_MODE, MEMARB_MODE_ENABLE, NIC_SRAM_DATA_CFG, NIC_SRAM_DATA_CFG_2, NIC_SRAM_DATA_CFG_2_APD_EN, NIC_SRAM_DATA_CFG_3, NIC_SRAM_DATA_CFG_4, NIC_SRAM_DATA_CFG_APE_ENABLE, NIC_SRAM_DATA_CFG_ASF_ENABLE, NIC_SRAM_DATA_CFG_EEPROM_WP, NIC_SRAM_DATA_CFG_LED_MODE_MAC, NIC_SRAM_DATA_CFG_LED_MODE_MASK, NIC_SRAM_DATA_CFG_LED_MODE_PHY_1, NIC_SRAM_DATA_CFG_LED_MODE_PHY_2, NIC_SRAM_DATA_CFG_PHY_TYPE_FIBER, NIC_SRAM_DATA_CFG_PHY_TYPE_MASK, NIC_SRAM_DATA_PHY_ID, NIC_SRAM_DATA_PHY_ID1_MASK, NIC_SRAM_DATA_PHY_ID2_MASK, NIC_SRAM_DATA_SIG, NIC_SRAM_DATA_SIG_MAGIC, NIC_SRAM_DATA_VER, NIC_SRAM_DATA_VER_SHIFT, NIC_SRAM_RGMII_EXT_IBND_RX_EN, NIC_SRAM_RGMII_EXT_IBND_TX_EN, NIC_SRAM_RGMII_INBAND_DISABLE, PCI_PM_CTRL, PCI_PM_CTRL_STATE_MASK, pci_read_config_word(), PCI_VENDOR_ID_ARIMA, PCI_VENDOR_ID_DELL, pci_write_config_dword(), pci_write_config_word(), SHASTA_EXT_LED_COMBO, SHASTA_EXT_LED_MAC, SHASTA_EXT_LED_MODE_MASK, SHASTA_EXT_LED_SHARED, tg3_flag, tg3_flag_clear, tg3_flag_set, TG3_PHY_ID_INVALID, TG3_PHYFLG_CAPACITIVE_COUPLING, TG3_PHYFLG_ENABLE_APD, TG3_PHYFLG_MII_SERDES, TG3_PHYFLG_PHY_SERDES, TG3_PHYFLG_SERDES_PREEMPHASIS, tg3_read_mem(), TG3PCI_MISC_HOST_CTRL, tp, tr32, tw32, u16, u32, and val.

Referenced by tg3_get_invariants().

◆ tg3_switch_clocks()

void tg3_switch_clocks ( struct tg3 * tp)
static

Definition at line 360 of file tg3_hw.c.

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}
#define CLOCK_CTRL_FORCE_CLKRUN
Definition tg3.h:403
#define CLOCK_CTRL_625_CORE
Definition tg3.h:402
#define TG3PCI_CLOCK_CTRL
Definition tg3.h:395
#define CLOCK_CTRL_CLKRUN_OENABLE
Definition tg3.h:404
#define CLOCK_CTRL_ALTCLK
Definition tg3.h:399
#define CLOCK_CTRL_44MHZ_CORE
Definition tg3.h:401

References CLOCK_CTRL_44MHZ_CORE, CLOCK_CTRL_625_CORE, CLOCK_CTRL_ALTCLK, CLOCK_CTRL_CLKRUN_OENABLE, CLOCK_CTRL_FORCE_CLKRUN, DBGP, tg3_flag, TG3PCI_CLOCK_CTRL, tp, tr32, tw32_wait_f, and u32.

Referenced by tg3_get_invariants(), tg3_init_hw(), and tg3_test_dma().

◆ tg3_get_invariants()

int tg3_get_invariants ( struct tg3 * tp)

tg3_nvram_init(tp);

Definition at line 394 of file tg3_hw.c.

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}
#define PCI_CAP_ID_PCIX
Definition bnx2.h:35
#define DBGC(...)
Definition compiler.h:505
#define EIO
Input/output error.
Definition errno.h:434
int pci_write_config_byte(struct pci_device *pci, unsigned int where, uint8_t value)
Write byte 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.
#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_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
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
#define GRC_MISC_CFG
Definition tg3.h:1819
#define PCISTATE_BUS_32BIT
Definition tg3.h:387
#define GRC_MISC_CFG_BOARD_ID_5788M
Definition tg3.h:1833
#define GRC_LCLCTRL_GPIO_OUTPUT1
Definition tg3.h:1855
#define CHIPREV_ID_5705_A0
Definition tg3.h:279
#define ASIC_REV_57765
Definition tg3.h:317
#define TG3PCI_DEVICE_TIGON3_57795
Definition tg3.h:206
#define GRC_LCLCTRL_GPIO_OE0
Definition tg3.h:1851
#define TG3PCI_DEVICE_TIGON3_5720
Definition tg3.h:208
#define TG3PCI_PCISTATE
Definition tg3.h:382
#define ASIC_REV_5705
Definition tg3.h:303
#define CHIPREV_ID_5719_A0
Definition tg3.h:296
#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 GRC_MODE_HOST_STACKUP
Definition tg3.h:1798
#define HOSTCC_MODE_CLRTICK_RXBD
Definition tg3.h:1307
#define TG3PCI_DEVICE_TIGON3_57790
Definition tg3.h:193
#define ASIC_REV_5720
Definition tg3.h:320
#define GRC_LCLCTRL_GPIO_OUTPUT0
Definition tg3.h:1854
#define PCI_DEVICE_ID_TIGON3_5787F
Definition tg3.h:114
#define CHIPREV_ID_5701_B5
Definition tg3.h:270
#define TG3_PHYFLG_ADJUST_TRIM
Definition tg3.h:3247
#define GRC_LCLCTRL_AUTO_SEEPROM
Definition tg3.h:1868
#define GET_CHIP_REV_ID(MISC_HOST_CTRL)
Definition tg3.h:257
#define GRC_MISC_CFG_BOARD_ID_5788
Definition tg3.h:1832
#define ASIC_REV_5755
Definition tg3.h:308
#define TG3PCI_DEVICE_TIGON3_5719
Definition tg3.h:207
#define GRC_MODE_WORD_SWAP_B2HRX_DATA
Definition tg3.h:1789
#define ASIC_REV_57780
Definition tg3.h:315
#define TG3_PHYFLG_ADC_BUG
Definition tg3.h:3248
void tg3_write_indirect_mbox(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:71
void tg3_write_indirect_reg32(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:42
#define GRC_MISC_CFG_BOARD_ID_MASK
Definition tg3.h:1823
#define TG3PCI_DEVICE_TIGON3_5761S
Definition tg3.h:189
#define TG3PCI_DEVICE_TIGON3_5718
Definition tg3.h:198
#define TG3PCI_DEVICE_TIGON3_57781
Definition tg3.h:199
#define TG3_PHYFLG_NO_ETH_WIRE_SPEED
Definition tg3.h:3245
#define TG3PCI_DEVICE_TIGON3_57785
Definition tg3.h:200
#define TG3_OTP_DEFAULT
Definition tg3.h:2138
u32 tg3_read_indirect_mbox(struct tg3 *tp, u32 off)
Definition tg3_hw.c:98
#define GRC_MODE
Definition tg3.h:1782
#define PCISTATE_BUS_SPEED_HIGH
Definition tg3.h:386
#define ASIC_REV_5717
Definition tg3.h:316
#define TG3PCI_PRODID_ASICREV
Definition tg3.h:418
#define ASIC_REV_5750
Definition tg3.h:304
#define MAC_MI_MODE_500KHZ_CONST
Definition tg3.h:622
#define ASIC_REV_5761
Definition tg3.h:313
#define GRC_MODE_BYTE_SWAP_B2HRX_DATA
Definition tg3.h:1788
#define CHIPREV_ID_57780_A1
Definition tg3.h:293
#define ASIC_REV_5719
Definition tg3.h:319
#define TG3_PHYFLG_ANY_SERDES
Definition tg3.h:3239
#define MISC_HOST_CTRL_CHIPREV_SHIFT
Definition tg3.h:256
#define GRC_LCLCTRL_GPIO_UART_SEL
Definition tg3.h:1842
#define CHIPREV_ID_5752_A0
Definition tg3.h:288
#define CHIPREV_5703_AX
Definition tg3.h:326
#define PCI_DEVICE_ID_TIGON3_5705F
Definition tg3.h:103
#define HOSTCC_MODE_ATTN
Definition tg3.h:1302
#define ASIC_REV_57766
Definition tg3.h:318
#define TG3PCI_DEVICE_TIGON3_57761
Definition tg3.h:201
#define PCI_DEVICE_ID_TIGON3_5901
Definition tg3.h:136
#define PCI_DEVICE_ID_TIGON3_5756
Definition tg3.h:106
#define CHIPREV_ID_5752_A0_HW
Definition tg3.h:287
#define TG3_PHYFLG_BER_BUG
Definition tg3.h:3250
#define TG3PCI_GEN2_PRODID_ASICREV
Definition tg3.h:422
#define CHIPREV_5700_AX
Definition tg3.h:322
#define CHIPREV_ID_5720_A0
Definition tg3.h:297
#define GRC_LCLCTRL_GPIO_OE3
Definition tg3.h:1846
#define PCI_EXP_LNKCTL
Definition tg3.h:17
#define TG3_PHYFLG_IS_FET
Definition tg3.h:3241
#define CHIPREV_5704_AX
Definition tg3.h:327
#define MISC_HOST_CTRL_CHIPREV
Definition tg3.h:255
#define ASIC_REV_5752
Definition tg3.h:305
#define TG3_PHYFLG_USE_MI_INTERRUPT
Definition tg3.h:3236
#define PCI_VENDOR_ID_BROADCOM
Definition tg3.h:73
#define MISC_HOST_CTRL_TAGGED_STATUS
Definition tg3.h:254
#define TG3PCI_GEN15_PRODID_ASICREV
Definition tg3.h:423
#define CHIPREV_ID_5701_B2
Definition tg3.h:269
#define PCISTATE_RETRY_SAME_DMA
Definition tg3.h:391
#define PCI_DEVICE_ID_TIGON3_5753F
Definition tg3.h:135
#define HOSTCC_MODE_32BYTE
Definition tg3.h:1306
#define PCISTATE_CONV_PCI_MODE
Definition tg3.h:385
#define TG3PCI_DEVICE_TIGON3_57762
Definition tg3.h:202
#define GRC_MODE_IRQ_ON_FLOW_ATTN
Definition tg3.h:1810
#define PCI_DEVICE_ID_TIGON3_5751F
Definition tg3.h:113
#define MAC_MODE_APE_RX_EN
Definition tg3.h:528
void tg3_mdio_init(struct tg3 *tp)
Definition tg3_phy.c:14
#define CHIPREV_ID_5717_A0
Definition tg3.h:294
#define TG3PCI_DEVICE_TIGON3_57791
Definition tg3.h:205
#define NIC_SRAM_WIN_BASE
Definition tg3.h:2194
#define PCI_DEVICE_ID_TIGON3_5901_2
Definition tg3.h:137
#define CHIPREV_ID_5705_A1
Definition tg3.h:280
#define GRC_LCLCTRL_GPIO_OE1
Definition tg3.h:1852
#define PCI_EXP_LNKCTL_CLKREQ_EN
Definition tg3.h:18
#define MAC_MODE_APE_TX_EN
Definition tg3.h:529
#define TG3PCI_DEVICE_TIGON3_57766
Definition tg3.h:204
int tg3_phy_probe(struct tg3 *tp)
Definition tg3_phy.c:896
#define CHIPREV_ID_5704_A0
Definition tg3.h:275
#define MAC_MI_MODE_BASE
Definition tg3.h:623
#define GRC_LCLCTRL_INT_ON_ATTN
Definition tg3.h:1841
#define PCI_DEVICE_ID_TIGON3_5761
Definition tg3.h:116
#define GRC_MODE_B2HRX_ENABLE
Definition tg3.h:1797
#define TG3_PHYFLG_10_100_ONLY
Definition tg3.h:3242
#define ASIC_REV_5787
Definition tg3.h:309
#define ASIC_REV_USE_PROD_ID_REG
Definition tg3.h:311
#define TG3PCI_DEVICE_TIGON3_57765
Definition tg3.h:203
#define TG3_PHYFLG_JITTER_BUG
Definition tg3.h:3246
#define PCI_DEVICE_ID_TIGON3_5722
Definition tg3.h:93
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 CHIPREV_5700_BX
Definition tg3.h:323
#define TG3PCI_DEVICE_TIGON3_5717
Definition tg3.h:197
#define CHIPREV_ID_57780_A0
Definition tg3.h:292
#define CHIPREV_ID_5701_B0
Definition tg3.h:268
#define HOSTCC_MODE_CLRTICK_TXBD
Definition tg3.h:1308
void tg3_set_power_state_0(struct tg3 *tp)
Definition tg3_hw.c:130
static void tg3_get_eeprom_hw_cfg(struct tg3 *tp)
Definition tg3_hw.c:171
static void tg3_switch_clocks(struct tg3 *tp)
Definition tg3_hw.c:360
#define TG3_DEF_MAC_MODE
Definition tg3_hw.c:40
static void tg3_write32_mbox_5906(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:65
static u32 tg3_read32_mbox_5906(struct tg3 *tp, u32 off)
Definition tg3_hw.c:59

References ASIC_REV_5700, ASIC_REV_5703, ASIC_REV_5705, ASIC_REV_5717, ASIC_REV_5719, ASIC_REV_5720, ASIC_REV_5750, ASIC_REV_5752, ASIC_REV_5755, ASIC_REV_5761, ASIC_REV_57765, ASIC_REV_57766, ASIC_REV_57780, ASIC_REV_5784, ASIC_REV_5785, ASIC_REV_5787, ASIC_REV_5906, ASIC_REV_USE_PROD_ID_REG, CHIPREV_5700_AX, CHIPREV_5700_BX, CHIPREV_5703_AX, CHIPREV_5704_AX, CHIPREV_5784_AX, CHIPREV_ID_5701_A0, CHIPREV_ID_5701_B0, CHIPREV_ID_5701_B2, CHIPREV_ID_5701_B5, CHIPREV_ID_5704_A0, CHIPREV_ID_5705_A0, CHIPREV_ID_5705_A1, CHIPREV_ID_5717_A0, CHIPREV_ID_5719_A0, CHIPREV_ID_5720_A0, CHIPREV_ID_5752_A0, CHIPREV_ID_5752_A0_HW, CHIPREV_ID_57780_A0, CHIPREV_ID_57780_A1, DBGC, DBGP, EIO, GET_ASIC_REV, GET_CHIP_REV, GET_CHIP_REV_ID, GRC_LCLCTRL_AUTO_SEEPROM, GRC_LCLCTRL_GPIO_OE0, GRC_LCLCTRL_GPIO_OE1, GRC_LCLCTRL_GPIO_OE3, GRC_LCLCTRL_GPIO_OUTPUT0, GRC_LCLCTRL_GPIO_OUTPUT1, GRC_LCLCTRL_GPIO_UART_SEL, GRC_LCLCTRL_INT_ON_ATTN, GRC_MISC_CFG, GRC_MISC_CFG_BOARD_ID_5788, GRC_MISC_CFG_BOARD_ID_5788M, GRC_MISC_CFG_BOARD_ID_MASK, GRC_MODE, GRC_MODE_B2HRX_ENABLE, GRC_MODE_BYTE_SWAP_B2HRX_DATA, GRC_MODE_HOST_STACKUP, GRC_MODE_HTX2B_ENABLE, GRC_MODE_IRQ_ON_FLOW_ATTN, GRC_MODE_WORD_SWAP_B2HRX_DATA, HOSTCC_MODE_32BYTE, HOSTCC_MODE_ATTN, HOSTCC_MODE_CLRTICK_RXBD, HOSTCC_MODE_CLRTICK_TXBD, MAC_MI_MODE_500KHZ_CONST, MAC_MI_MODE_BASE, MAC_MODE_APE_RX_EN, MAC_MODE_APE_TX_EN, MISC_HOST_CTRL_CHIPREV, MISC_HOST_CTRL_CHIPREV_SHIFT, MISC_HOST_CTRL_TAGGED_STATUS, NIC_SRAM_STATS_BLK, NIC_SRAM_WIN_BASE, PCI_CACHE_LINE_SIZE, PCI_CAP_ID_EXP, PCI_CAP_ID_PCIX, PCI_COMMAND, PCI_COMMAND_INVALIDATE, PCI_COMMAND_PARITY, PCI_COMMAND_SERR, PCI_DEVICE_ID_TIGON3_5705F, PCI_DEVICE_ID_TIGON3_5722, PCI_DEVICE_ID_TIGON3_5751F, PCI_DEVICE_ID_TIGON3_5753F, PCI_DEVICE_ID_TIGON3_5755M, PCI_DEVICE_ID_TIGON3_5756, PCI_DEVICE_ID_TIGON3_5761, PCI_DEVICE_ID_TIGON3_5787F, PCI_DEVICE_ID_TIGON3_5901, PCI_DEVICE_ID_TIGON3_5901_2, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_CLKREQ_EN, pci_find_capability(), PCI_LATENCY_TIMER, PCI_PM_CTRL, PCI_PM_CTRL_PME_ENABLE, PCI_PM_CTRL_STATE_MASK, pci_read_config_byte(), pci_read_config_dword(), pci_read_config_word(), PCI_VENDOR_ID_BROADCOM, pci_write_config_byte(), pci_write_config_dword(), pci_write_config_word(), PCISTATE_BUS_32BIT, PCISTATE_BUS_SPEED_HIGH, PCISTATE_CONV_PCI_MODE, PCISTATE_RETRY_SAME_DMA, readl, strerror(), TG3_DEF_MAC_MODE, tg3_flag, tg3_flag_clear, tg3_flag_set, tg3_get_eeprom_hw_cfg(), tg3_mdio_init(), TG3_OTP_DEFAULT, tg3_phy_probe(), TG3_PHYFLG_10_100_ONLY, TG3_PHYFLG_5704_A0_BUG, TG3_PHYFLG_ADC_BUG, TG3_PHYFLG_ADJUST_TRIM, TG3_PHYFLG_ANY_SERDES, TG3_PHYFLG_BER_BUG, TG3_PHYFLG_IS_FET, TG3_PHYFLG_JITTER_BUG, TG3_PHYFLG_NO_ETH_WIRE_SPEED, TG3_PHYFLG_PHY_SERDES, TG3_PHYFLG_USE_MI_INTERRUPT, tg3_read32_mbox_5906(), tg3_read_indirect_mbox(), tg3_read_otp_phycfg(), tg3_set_power_state_0(), tg3_switch_clocks(), tg3_write32_mbox_5906(), tg3_write_indirect_mbox(), tg3_write_indirect_reg32(), TG3PCI_DEVICE_TIGON3_5717, TG3PCI_DEVICE_TIGON3_5718, TG3PCI_DEVICE_TIGON3_5719, TG3PCI_DEVICE_TIGON3_5720, TG3PCI_DEVICE_TIGON3_5761S, TG3PCI_DEVICE_TIGON3_57761, TG3PCI_DEVICE_TIGON3_57762, TG3PCI_DEVICE_TIGON3_57765, TG3PCI_DEVICE_TIGON3_57766, TG3PCI_DEVICE_TIGON3_57781, TG3PCI_DEVICE_TIGON3_57785, TG3PCI_DEVICE_TIGON3_57790, TG3PCI_DEVICE_TIGON3_57791, TG3PCI_DEVICE_TIGON3_57795, TG3PCI_GEN15_PRODID_ASICREV, TG3PCI_GEN2_PRODID_ASICREV, TG3PCI_MEM_WIN_BASE_ADDR, TG3PCI_MISC_HOST_CTRL, TG3PCI_PCISTATE, TG3PCI_PRODID_ASICREV, tp, tr32, tw32, u16, u32, udelay(), val, and writel.

Referenced by tg3_init_one().

◆ tg3_init_bufmgr_config()

void tg3_init_bufmgr_config ( struct tg3 * tp)

Definition at line 850 of file tg3_hw.c.

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}
#define DEFAULT_DMA_LOW_WATER
Definition tg3.h:1460
#define DEFAULT_MB_RDMA_LOW_WATER_5705
Definition tg3.h:1433
#define DEFAULT_MB_HIGH_WATER_JUMBO_57765
Definition tg3.h:1451
#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO
Definition tg3.h:1434
#define DEFAULT_DMA_HIGH_WATER
Definition tg3.h:1462
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_57765
Definition tg3.h:1443
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780
Definition tg3.h:1442
#define DEFAULT_MB_HIGH_WATER_JUMBO
Definition tg3.h:1449
#define DEFAULT_MB_MACRX_LOW_WATER
Definition tg3.h:1437
#define DEFAULT_MB_MACRX_LOW_WATER_JUMBO
Definition tg3.h:1441
#define DEFAULT_MB_HIGH_WATER_5906
Definition tg3.h:1447
#define DEFAULT_MB_MACRX_LOW_WATER_5705
Definition tg3.h:1438
#define DEFAULT_MB_HIGH_WATER
Definition tg3.h:1445
#define DEFAULT_MB_HIGH_WATER_57765
Definition tg3.h:1448
#define DEFAULT_MB_MACRX_LOW_WATER_57765
Definition tg3.h:1440
#define DEFAULT_MB_HIGH_WATER_5705
Definition tg3.h:1446
#define DEFAULT_MB_MACRX_LOW_WATER_5906
Definition tg3.h:1439
#define DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780
Definition tg3.h:1435
#define DEFAULT_MB_HIGH_WATER_JUMBO_5780
Definition tg3.h:1450
#define DEFAULT_MB_RDMA_LOW_WATER
Definition tg3.h:1432

References ASIC_REV_5906, DBGP, DEFAULT_DMA_HIGH_WATER, DEFAULT_DMA_LOW_WATER, DEFAULT_MB_HIGH_WATER, DEFAULT_MB_HIGH_WATER_5705, DEFAULT_MB_HIGH_WATER_57765, DEFAULT_MB_HIGH_WATER_5906, DEFAULT_MB_HIGH_WATER_JUMBO, DEFAULT_MB_HIGH_WATER_JUMBO_57765, DEFAULT_MB_HIGH_WATER_JUMBO_5780, DEFAULT_MB_MACRX_LOW_WATER, DEFAULT_MB_MACRX_LOW_WATER_5705, DEFAULT_MB_MACRX_LOW_WATER_57765, DEFAULT_MB_MACRX_LOW_WATER_5906, DEFAULT_MB_MACRX_LOW_WATER_JUMBO, DEFAULT_MB_MACRX_LOW_WATER_JUMBO_57765, DEFAULT_MB_MACRX_LOW_WATER_JUMBO_5780, DEFAULT_MB_RDMA_LOW_WATER, DEFAULT_MB_RDMA_LOW_WATER_5705, DEFAULT_MB_RDMA_LOW_WATER_JUMBO, DEFAULT_MB_RDMA_LOW_WATER_JUMBO_5780, GET_ASIC_REV, tg3_flag, and tp.

Referenced by tg3_init_one().

◆ tg3_wait_for_event_ack()

void tg3_wait_for_event_ack ( struct tg3 * tp)

Definition at line 909 of file tg3_hw.c.

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}
#define GRC_RX_CPU_EVENT
Definition tg3.h:1870
#define GRC_RX_CPU_DRIVER_EVENT
Definition tg3.h:1871
#define TG3_FW_EVENT_TIMEOUT_USEC
Definition tg3_hw.c:907

References DBGP, GRC_RX_CPU_DRIVER_EVENT, GRC_RX_CPU_EVENT, TG3_FW_EVENT_TIMEOUT_USEC, tp, tr32, and udelay().

Referenced by tg3_stop_fw(), and tg3_ump_link_report().

◆ tg3_write_mem()

void tg3_write_mem ( struct tg3 * tp,
u32 off,
u32 val )

◆ tg3_stop_fw()

void tg3_stop_fw ( struct tg3 * tp)
static

Definition at line 936 of file tg3_hw.c.

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}
#define NIC_SRAM_FW_CMD_MBOX
Definition tg3.h:2234
static void tg3_generate_fw_event(struct tg3 *tp)
Definition tg3.h:3403
#define FWCMD_NICDRV_PAUSE_FW
Definition tg3.h:2236
void tg3_wait_for_event_ack(struct tg3 *tp)
Definition tg3_hw.c:909
void tg3_write_mem(struct tg3 *tp, u32 off, u32 val)
Definition tg3_hw.c:922

References DBGP, FWCMD_NICDRV_PAUSE_FW, NIC_SRAM_FW_CMD_MBOX, tg3_flag, tg3_generate_fw_event(), tg3_wait_for_event_ack(), tg3_write_mem(), and tp.

Referenced by tg3_chip_reset(), tg3_halt(), and tg3_reset_hw().

◆ tg3_write_sig_pre_reset()

void tg3_write_sig_pre_reset ( struct tg3 * tp)
static

Definition at line 952 of file tg3_hw.c.

953{ DBGP("%s\n", __func__);
954
957}
#define NIC_SRAM_FIRMWARE_MBOX
Definition tg3.h:2203
#define NIC_SRAM_FIRMWARE_MBOX_MAGIC1
Definition tg3.h:2204

References DBGP, NIC_SRAM_FIRMWARE_MBOX, NIC_SRAM_FIRMWARE_MBOX_MAGIC1, tg3_write_mem(), and tp.

Referenced by tg3_halt(), and tg3_reset_hw().

◆ tg3_disable_ints()

void tg3_disable_ints ( struct tg3 * tp)

Definition at line 959 of file tg3_hw.c.

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}
#define MISC_HOST_CTRL_MASK_PCI_INT
Definition tg3.h:246
#define tw32_mailbox_f(reg, val)
Definition tg3.h:3332

References DBGP, MISC_HOST_CTRL_MASK_PCI_INT, TG3PCI_MISC_HOST_CTRL, tp, tw32, and tw32_mailbox_f.

Referenced by tg3_abort_hw(), and tg3_irq().

◆ tg3_enable_ints()

void tg3_enable_ints ( struct tg3 * tp)

Definition at line 968 of file tg3_hw.c.

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}
#define HOSTCC_MODE
Definition tg3.h:1299
#define SD_STATUS_UPDATED
Definition tg3.h:2672
#define HOSTCC_MODE_ENABLE
Definition tg3.h:1301
#define GRC_LCLCTRL_SETINT
Definition tg3.h:1840

References DBGP, GRC_LCLCTRL_SETINT, GRC_LOCAL_CTRL, HOSTCC_MODE, HOSTCC_MODE_ENABLE, MISC_HOST_CTRL_MASK_PCI_INT, SD_STATUS_UPDATED, tg3_flag, TG3PCI_MISC_HOST_CTRL, tp, tw32, and tw32_mailbox_f.

Referenced by tg3_irq().

◆ tg3_stop_block()

int tg3_stop_block ( struct tg3 * tp,
unsigned long ofs,
u32 enable_bit )
static

Definition at line 989 of file tg3_hw.c.

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}
#define ENODEV
No such device.
Definition errno.h:510
#define RCVLSC_MODE
Definition tg3.h:1210
#define MBFREE_MODE
Definition tg3.h:1292
#define tw32_f(reg, val)
Definition tg3.h:3333
#define BUFMGR_MODE
Definition tg3.h:1419
#define DMAC_MODE
Definition tg3.h:1776
#define MAX_WAIT_CNT
Definition tg3_hw.c:986

References BUFMGR_MODE, DBGC, DBGP, DMAC_MODE, ENODEV, MAX_WAIT_CNT, MBFREE_MODE, MEMARB_MODE, RCVLSC_MODE, tg3_flag, tp, tr32, tw32_f, u32, udelay(), and val.

Referenced by tg3_abort_hw().

◆ tg3_abort_hw()

int tg3_abort_hw ( struct tg3 * tp)
static

Definition at line 1033 of file tg3_hw.c.

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}
void * memset(void *dest, int character, size_t len) __nonnull
#define RDMAC_MODE_ENABLE
Definition tg3.h:1475
#define RX_MODE_ENABLE
Definition tg3.h:653
#define RDMAC_MODE
Definition tg3.h:1473
#define SNDDATAI_MODE
Definition tg3.h:980
#define RCVDBDI_MODE
Definition tg3.h:1132
#define RCVBDI_MODE_ENABLE
Definition tg3.h:1181
#define MAC_MODE
Definition tg3.h:501
#define SNDDATAC_MODE
Definition tg3.h:1023
#define TG3_HW_STATUS_SIZE
Definition tg3.h:2669
#define RCVDCC_MODE_ENABLE
Definition tg3.h:1174
#define DMAC_MODE_ENABLE
Definition tg3.h:1778
#define RCVLPC_MODE
Definition tg3.h:1090
#define SNDDATAC_MODE_ENABLE
Definition tg3.h:1025
#define FTQ_RESET
Definition tg3.h:1692
#define SNDDATAI_MODE_ENABLE
Definition tg3.h:982
#define BUFMGR_MODE_ENABLE
Definition tg3.h:1421
#define MBFREE_MODE_ENABLE
Definition tg3.h:1294
#define MAC_RX_MODE
Definition tg3.h:651
#define TX_MODE_ENABLE
Definition tg3.h:628
#define SNDBDC_MODE
Definition tg3.h:1083
#define RCVDBDI_MODE_ENABLE
Definition tg3.h:1134
#define RCVBDI_MODE
Definition tg3.h:1179
#define SNDBDS_MODE_ENABLE
Definition tg3.h:1032
#define RCVLSC_MODE_ENABLE
Definition tg3.h:1212
#define WDMAC_MODE_ENABLE
Definition tg3.h:1524
#define MAC_TX_MODE
Definition tg3.h:626
#define RCVLPC_MODE_ENABLE
Definition tg3.h:1092
#define MAC_MODE_TDE_ENABLE
Definition tg3.h:524
#define SNDBDI_MODE_ENABLE
Definition tg3.h:1059
#define RCVCC_MODE
Definition tg3.h:1198
#define RCVDCC_MODE
Definition tg3.h:1172
#define RCVCC_MODE_ENABLE
Definition tg3.h:1200
#define SNDBDI_MODE
Definition tg3.h:1057
#define SNDBDC_MODE_ENABLE
Definition tg3.h:1085
#define WDMAC_MODE
Definition tg3.h:1522
#define SNDBDS_MODE
Definition tg3.h:1030
static int tg3_stop_block(struct tg3 *tp, unsigned long ofs, u32 enable_bit)
Definition tg3_hw.c:989
void tg3_disable_ints(struct tg3 *tp)
Definition tg3_hw.c:959

References BUFMGR_MODE, BUFMGR_MODE_ENABLE, DBGC, DBGP, DMAC_MODE, DMAC_MODE_ENABLE, ENODEV, FTQ_RESET, HOSTCC_MODE, HOSTCC_MODE_ENABLE, MAC_MODE, MAC_MODE_TDE_ENABLE, MAC_RX_MODE, MAC_TX_MODE, MAX_WAIT_CNT, MBFREE_MODE, MBFREE_MODE_ENABLE, MEMARB_MODE, MEMARB_MODE_ENABLE, memset(), RCVBDI_MODE, RCVBDI_MODE_ENABLE, RCVCC_MODE, RCVCC_MODE_ENABLE, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE, RCVDCC_MODE, RCVDCC_MODE_ENABLE, RCVLPC_MODE, RCVLPC_MODE_ENABLE, RCVLSC_MODE, RCVLSC_MODE_ENABLE, RDMAC_MODE, RDMAC_MODE_ENABLE, RX_MODE_ENABLE, SNDBDC_MODE, SNDBDC_MODE_ENABLE, SNDBDI_MODE, SNDBDI_MODE_ENABLE, SNDBDS_MODE, SNDBDS_MODE_ENABLE, SNDDATAC_MODE, SNDDATAC_MODE_ENABLE, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, tg3_disable_ints(), TG3_HW_STATUS_SIZE, tg3_stop_block(), tp, tr32, tw32, tw32_f, TX_MODE_ENABLE, udelay(), WDMAC_MODE, and WDMAC_MODE_ENABLE.

Referenced by tg3_halt(), and tg3_reset_hw().

◆ __tg3_set_mac_addr()

void __tg3_set_mac_addr ( struct tg3 * tp,
int skip_mac_1 )

Definition at line 1094 of file tg3_hw.c.

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}
#define TX_BACKOFF_SEED_MASK
Definition tg3.h:590
#define MAC_ADDR_0_HIGH
Definition tg3.h:575
#define MAC_ADDR_0_LOW
Definition tg3.h:576
#define MAC_EXTADDR_0_LOW
Definition tg3.h:720
#define ASIC_REV_5704
Definition tg3.h:302
#define MAC_TX_BACKOFF_SEED
Definition tg3.h:589
#define MAC_EXTADDR_0_HIGH
Definition tg3.h:719

References ASIC_REV_5703, ASIC_REV_5704, DBGP, GET_ASIC_REV, MAC_ADDR_0_HIGH, MAC_ADDR_0_LOW, MAC_EXTADDR_0_HIGH, MAC_EXTADDR_0_LOW, MAC_TX_BACKOFF_SEED, tp, tw32, TX_BACKOFF_SEED_MASK, and u32.

Referenced by tg3_halt(), tg3_open(), and tg3_reset_hw().

◆ tg3_save_pci_state()

void tg3_save_pci_state ( struct tg3 * tp)
static

Definition at line 1132 of file tg3_hw.c.

1133{ DBGP("%s\n", __func__);
1134
1135 pci_read_config_word(tp->pdev, PCI_COMMAND, &tp->pci_cmd);
1136}

References DBGP, PCI_COMMAND, pci_read_config_word(), and tp.

Referenced by tg3_chip_reset().

◆ tg3_restore_pci_state()

void tg3_restore_pci_state ( struct tg3 * tp)
static

Definition at line 1139 of file tg3_hw.c.

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}
#define PCI_X_CMD
Definition bnx2.h:36
#define PCI_X_CMD_ERO
Definition bnx2.h:37
#define PCISTATE_ROM_RETRY_ENABLE
Definition tg3.h:389
#define PCISTATE_ROM_ENABLE
Definition tg3.h:388

References ASIC_REV_5785, CHIPREV_ID_5704_A0, DBGP, GET_ASIC_REV, PCI_CACHE_LINE_SIZE, PCI_COMMAND, PCI_LATENCY_TIMER, pci_read_config_word(), pci_write_config_byte(), pci_write_config_dword(), pci_write_config_word(), PCI_X_CMD, PCI_X_CMD_ERO, PCISTATE_RETRY_SAME_DMA, PCISTATE_ROM_ENABLE, PCISTATE_ROM_RETRY_ENABLE, tg3_flag, TG3PCI_MISC_HOST_CTRL, TG3PCI_PCISTATE, tp, u16, u32, and val.

Referenced by tg3_chip_reset().

◆ tg3_poll_fw()

int tg3_poll_fw ( struct tg3 * tp)
static

Definition at line 1178 of file tg3_hw.c.

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}
#define CHIPREV_ID_57765_A0
Definition tg3.h:295
#define VCPU_STATUS_INIT_DONE
Definition tg3.h:1611
#define VCPU_STATUS
Definition tg3.h:1610

References ASIC_REV_5906, CHIPREV_ID_57765_A0, DBGC, DBGP, ENODEV, GET_ASIC_REV, mdelay(), NIC_SRAM_FIRMWARE_MBOX, NIC_SRAM_FIRMWARE_MBOX_MAGIC1, tg3_flag, tg3_flag_set, tg3_read_mem(), tp, tr32, u32, udelay(), val, VCPU_STATUS, and VCPU_STATUS_INIT_DONE.

Referenced by tg3_chip_reset().

◆ tg3_nvram_lock()

int tg3_nvram_lock ( struct tg3 * tp)
static

Definition at line 1223 of file tg3_hw.c.

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}
#define NVRAM_SWARB
Definition tg3.h:2039
#define SWARB_REQ_SET1
Definition tg3.h:2041
#define SWARB_REQ_CLR1
Definition tg3.h:2045
#define SWARB_GNT1
Definition tg3.h:2049

References DBGP, ENODEV, NVRAM_SWARB, SWARB_GNT1, SWARB_REQ_CLR1, SWARB_REQ_SET1, tg3_flag, tp, tr32, tw32, and udelay().

Referenced by tg3_chip_reset(), tg3_get_device_address(), and tg3_nvram_read().

◆ tg3_nvram_unlock()

void tg3_nvram_unlock ( struct tg3 * tp)
static

Definition at line 1246 of file tg3_hw.c.

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}

References DBGP, NVRAM_SWARB, SWARB_REQ_CLR1, tg3_flag, tp, and tw32_f.

Referenced by tg3_get_device_address(), and tg3_nvram_read().

◆ tg3_chip_reset()

int tg3_chip_reset ( struct tg3 * tp)
static

Definition at line 1257 of file tg3_hw.c.

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}
void mb(void)
Memory barrier.
#define PCI_EXP_DEVCTL
PCI Express.
Definition pci.h:112
#define TG3_PCIE_LNKCTL_L1_PLL_PD_EN
Definition tg3.h:2094
#define TG3_CPMU_D0_CLCK_POLICY
Definition tg3.h:1237
#define TG3_CPMU_CLCK_ORIDE_EN
Definition tg3.h:1248
#define PCI_EXP_DEVSTA_NFED
Definition tg3.h:67
#define GRC_MISC_CFG_CORECLK_RESET
Definition tg3.h:1820
#define PCI_EXP_DEVCTL_NOSNOOP_EN
Definition tg3.h:63
#define TG3_PCIE_LNKCTL_L1_PLL_PD_DIS
Definition tg3.h:2095
#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN
Definition tg3.h:1246
#define MAC_MODE_PORT_MODE_TBI
Definition tg3.h:505
#define TG3_PCIE_PHY_TSTCTL_PSCRAM
Definition tg3.h:2100
#define PCI_EXP_DEVSTA_FED
Definition tg3.h:68
#define PCI_EXP_DEVSTA
Definition tg3.h:65
#define TG3_PCIE_PHY_TSTCTL
Definition tg3.h:2098
#define TG3_PCIE_LNKCTL
Definition tg3.h:2093
#define VCPU_STATUS_DRV_RESET
Definition tg3.h:1612
#define PCI_EXP_DEVSTA_URD
Definition tg3.h:69
#define NIC_SRAM_DATA_CFG_MINI_PCI
Definition tg3.h:2222
#define PCI_EXP_DEVCTL_RELAX_EN
Definition tg3.h:62
#define CHIPREV_ID_5750_A3
Definition tg3.h:285
#define GRC_FASTBOOT_PC
Definition tg3.h:1901
#define GRC_VCPU_EXT_CTRL_HALT_CPU
Definition tg3.h:1899
#define GRC_VCPU_EXT_CTRL
Definition tg3.h:1898
#define GRC_MISC_CFG_KEEP_GPHY_POWER
Definition tg3.h:1836
#define CPMU_CLCK_ORIDE_MAC_CLCK_ORIDE_EN
Definition tg3.h:1249
#define PCI_EXP_DEVSTA_CED
Definition tg3.h:66
#define MAC_MODE_PORT_MODE_GMII
Definition tg3.h:506
#define TG3_CPMU_CLCK_ORIDE
Definition tg3.h:1245
#define TG3_PCIE_PHY_TSTCTL_PCIE10
Definition tg3.h:2099
#define PCI_EXP_DEVCTL_PAYLOAD
Definition tg3.h:64
static int tg3_nvram_lock(struct tg3 *tp)
Definition tg3_hw.c:1223
static void tg3_save_pci_state(struct tg3 *tp)
Definition tg3_hw.c:1132
static int tg3_poll_fw(struct tg3 *tp)
Definition tg3_hw.c:1178
static void tg3_restore_pci_state(struct tg3 *tp)
Definition tg3_hw.c:1139
static void tg3_stop_fw(struct tg3 *tp)
Definition tg3_hw.c:936

References ASIC_REV_5705, ASIC_REV_5720, ASIC_REV_5752, ASIC_REV_57780, ASIC_REV_5785, ASIC_REV_5906, CHIPREV_ID_5705_A0, CHIPREV_ID_5750_A0, CHIPREV_ID_5750_A3, CLOCK_CTRL_CLKRUN_OENABLE, CLOCK_CTRL_FORCE_CLKRUN, CPMU_CLCK_ORIDE_MAC_CLCK_ORIDE_EN, CPMU_CLCK_ORIDE_MAC_ORIDE_EN, DBGP, GET_ASIC_REV, GRC_FASTBOOT_PC, GRC_MISC_CFG, GRC_MISC_CFG_CORECLK_RESET, GRC_MISC_CFG_KEEP_GPHY_POWER, GRC_MODE, GRC_VCPU_EXT_CTRL, GRC_VCPU_EXT_CTRL_HALT_CPU, MAC_MODE, MAC_MODE_PORT_MODE_GMII, MAC_MODE_PORT_MODE_TBI, mb(), MEMARB_MODE, MEMARB_MODE_ENABLE, NIC_SRAM_DATA_CFG_MINI_PCI, PCI_COMMAND, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_NOSNOOP_EN, PCI_EXP_DEVCTL_PAYLOAD, PCI_EXP_DEVCTL_RELAX_EN, PCI_EXP_DEVSTA, PCI_EXP_DEVSTA_CED, PCI_EXP_DEVSTA_FED, PCI_EXP_DEVSTA_NFED, PCI_EXP_DEVSTA_URD, pci_read_config_dword(), pci_read_config_word(), pci_write_config_dword(), pci_write_config_word(), TG3_CPMU_CLCK_ORIDE, TG3_CPMU_CLCK_ORIDE_EN, TG3_CPMU_D0_CLCK_POLICY, tg3_flag, tg3_flag_clear, tg3_flag_set, tg3_nvram_lock(), TG3_PCIE_LNKCTL, TG3_PCIE_LNKCTL_L1_PLL_PD_DIS, TG3_PCIE_LNKCTL_L1_PLL_PD_EN, TG3_PCIE_PHY_TSTCTL, TG3_PCIE_PHY_TSTCTL_PCIE10, TG3_PCIE_PHY_TSTCTL_PSCRAM, TG3_PHYFLG_MII_SERDES, TG3_PHYFLG_PHY_SERDES, tg3_poll_fw(), tg3_restore_pci_state(), tg3_save_pci_state(), tg3_stop_fw(), TG3PCI_CLOCK_CTRL, tp, tr32, tw32, tw32_f, u16, u32, udelay(), val, VCPU_STATUS, and VCPU_STATUS_DRV_RESET.

Referenced by tg3_halt(), and tg3_reset_hw().

◆ tg3_halt()

int tg3_halt ( struct tg3 * tp)

Definition at line 1481 of file tg3_hw.c.

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}
static int tg3_chip_reset(struct tg3 *tp)
Definition tg3_hw.c:1257
static int tg3_abort_hw(struct tg3 *tp)
Definition tg3_hw.c:1033
static void tg3_write_sig_pre_reset(struct tg3 *tp)
Definition tg3_hw.c:952
void __tg3_set_mac_addr(struct tg3 *tp, int skip_mac_1)
Definition tg3_hw.c:1094

References __tg3_set_mac_addr(), DBGP, tg3_abort_hw(), tg3_chip_reset(), tg3_stop_fw(), tg3_write_sig_pre_reset(), and tp.

Referenced by tg3_close(), and tg3_init_one().

◆ tg3_nvram_read_using_eeprom()

int tg3_nvram_read_using_eeprom ( struct tg3 * tp,
u32 offset,
u32 * val )
static

Definition at line 1501 of file tg3_hw.c.

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}
uint16_t offset
Offset to command line.
Definition bzimage.h:3
#define EINVAL
Invalid argument.
Definition errno.h:429
#define EBUSY
Device or resource busy.
Definition errno.h:339
#define bswap_32(value)
Definition byteswap.h:71
unsigned long tmp
Definition linux_pci.h:65
#define GRC_EEPROM_DATA
Definition tg3.h:1893
#define EEPROM_ADDR_DEVID_MASK
Definition tg3.h:1885
#define EEPROM_ADDR_ADDR_SHIFT
Definition tg3.h:1890
#define GRC_EEPROM_ADDR
Definition tg3.h:1880
#define EEPROM_ADDR_START
Definition tg3.h:1887
#define EEPROM_ADDR_ADDR_MASK
Definition tg3.h:1889
#define EEPROM_ADDR_READ
Definition tg3.h:1882
#define EEPROM_ADDR_DEVID_SHIFT
Definition tg3.h:1886
#define EEPROM_ADDR_COMPLETE
Definition tg3.h:1883

References bswap_32, DBGP, EBUSY, EEPROM_ADDR_ADDR_MASK, EEPROM_ADDR_ADDR_SHIFT, EEPROM_ADDR_COMPLETE, EEPROM_ADDR_DEVID_MASK, EEPROM_ADDR_DEVID_SHIFT, EEPROM_ADDR_READ, EEPROM_ADDR_START, EINVAL, GRC_EEPROM_ADDR, GRC_EEPROM_DATA, mdelay(), offset, tmp, tp, tr32, tw32, u32, and val.

Referenced by tg3_nvram_read().

◆ tg3_nvram_phys_addr()

u32 tg3_nvram_phys_addr ( struct tg3 * tp,
u32 addr )
static

Definition at line 1542 of file tg3_hw.c.

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}
uint32_t addr
Buffer address.
Definition dwmac.h:9
#define ATMEL_AT45DB0X1B_PAGE_POS
Definition tg3.h:3294
#define JEDEC_ATMEL
Definition tg3.h:3280

References addr, ATMEL_AT45DB0X1B_PAGE_POS, DBGP, JEDEC_ATMEL, tg3_flag, tp, and u32.

Referenced by tg3_nvram_read().

◆ tg3_enable_nvram_access()

void tg3_enable_nvram_access ( struct tg3 * tp)
static

Definition at line 1558 of file tg3_hw.c.

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}
#define NVRAM_ACCESS
Definition tg3.h:2056
#define ACCESS_ENABLE
Definition tg3.h:2057

References ACCESS_ENABLE, DBGP, NVRAM_ACCESS, tg3_flag, tp, tr32, tw32, and u32.

Referenced by tg3_nvram_read().

◆ tg3_disable_nvram_access()

void tg3_disable_nvram_access ( struct tg3 * tp)
static

Definition at line 1568 of file tg3_hw.c.

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}

References ACCESS_ENABLE, DBGP, NVRAM_ACCESS, tg3_flag, tp, tr32, tw32, and u32.

Referenced by tg3_nvram_read().

◆ tg3_nvram_exec_cmd()

int tg3_nvram_exec_cmd ( struct tg3 * tp,
u32 nvram_cmd )
static

Definition at line 1580 of file tg3_hw.c.

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}
#define NVRAM_CMD
Definition tg3.h:1906
#define NVRAM_CMD_DONE
Definition tg3.h:1908
#define NVRAM_CMD_TIMEOUT
Definition tg3_hw.c:1578

References DBGP, EBUSY, NVRAM_CMD, NVRAM_CMD_DONE, NVRAM_CMD_TIMEOUT, tp, tr32, tw32, u32, and udelay().

Referenced by tg3_nvram_read().

◆ tg3_nvram_read()

int tg3_nvram_read ( struct tg3 * tp,
u32 offset,
u32 * val )
static

Definition at line 1606 of file tg3_hw.c.

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}
#define NVRAM_ADDR_MSK
Definition tg3.h:1920
#define NVRAM_CMD_RD
Definition tg3.h:1911
#define NVRAM_ADDR
Definition tg3.h:1919
#define NVRAM_CMD_GO
Definition tg3.h:1909
#define NVRAM_CMD_LAST
Definition tg3.h:1914
#define NVRAM_CMD_FIRST
Definition tg3.h:1913
#define NVRAM_RDDATA
Definition tg3.h:1921
static int tg3_nvram_read_using_eeprom(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1501
static void tg3_disable_nvram_access(struct tg3 *tp)
Definition tg3_hw.c:1568
static void tg3_enable_nvram_access(struct tg3 *tp)
Definition tg3_hw.c:1558
static u32 tg3_nvram_phys_addr(struct tg3 *tp, u32 addr)
Definition tg3_hw.c:1542
static int tg3_nvram_exec_cmd(struct tg3 *tp, u32 nvram_cmd)
Definition tg3_hw.c:1580
static void tg3_nvram_unlock(struct tg3 *tp)
Definition tg3_hw.c:1246

References DBGP, EINVAL, NVRAM_ADDR, NVRAM_ADDR_MSK, NVRAM_CMD_DONE, NVRAM_CMD_FIRST, NVRAM_CMD_GO, NVRAM_CMD_LAST, NVRAM_CMD_RD, NVRAM_RDDATA, offset, tg3_disable_nvram_access(), tg3_enable_nvram_access(), tg3_flag, tg3_nvram_exec_cmd(), tg3_nvram_lock(), tg3_nvram_phys_addr(), tg3_nvram_read_using_eeprom(), tg3_nvram_unlock(), tp, tr32, tw32, u32, and val.

Referenced by tg3_nvram_read_be32().

◆ tg3_nvram_read_be32()

int tg3_nvram_read_be32 ( struct tg3 * tp,
u32 offset,
u32 * val )
static

Definition at line 1640 of file tg3_hw.c.

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}
#define cpu_to_be32(value)
Definition byteswap.h:111
static int tg3_nvram_read(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1606

References cpu_to_be32, DBGP, offset, tg3_nvram_read(), tp, u32, and val.

Referenced by tg3_get_device_address().

◆ tg3_get_device_address()

int tg3_get_device_address ( struct tg3 * tp)

Definition at line 1650 of file tg3_hw.c.

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}
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
Definition ethernet.h:78
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define PCI_FUNC(busdevfn)
Definition pci.h:286
A network device.
Definition netdevice.h:353
struct device * dev
Underlying hardware device.
Definition netdevice.h:365
#define NVRAM_CMD_RESET
Definition tg3.h:1907
#define NIC_SRAM_MAC_ADDR_HIGH_MBOX
Definition tg3.h:2257
#define NIC_SRAM_MAC_ADDR_LOW_MBOX
Definition tg3.h:2258
#define DUAL_MAC_CTRL_ID
Definition tg3.h:417
#define TG3PCI_DUAL_MAC_CTRL
Definition tg3.h:415
static int tg3_nvram_read_be32(struct tg3 *tp, u32 offset, u32 *val)
Definition tg3_hw.c:1640

References ASIC_REV_5704, ASIC_REV_5906, DBGP, net_device::dev, DUAL_MAC_CTRL_ID, EINVAL, GET_ASIC_REV, is_valid_ether_addr(), MAC_ADDR_0_HIGH, MAC_ADDR_0_LOW, memcpy(), NIC_SRAM_MAC_ADDR_HIGH_MBOX, NIC_SRAM_MAC_ADDR_LOW_MBOX, NVRAM_CMD, NVRAM_CMD_RESET, PCI_FUNC, tg3_flag, tg3_nvram_lock(), tg3_nvram_read_be32(), tg3_nvram_unlock(), tg3_read_mem(), TG3PCI_DUAL_MAC_CTRL, tp, tr32, tw32_f, and u32.

Referenced by tg3_init_one().

◆ __tg3_set_rx_mode()

void __tg3_set_rx_mode ( struct net_device * dev)
static

Definition at line 1718 of file tg3_hw.c.

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}
void * priv
Driver private data.
Definition netdevice.h:432
Definition tg3.h:3047
u32 rx_mode
Definition tg3.h:3158
struct net_device * dev
Definition tg3.h:3091
#define RX_MODE_PROMISC
Definition tg3.h:660
#define MAC_HASH_REG_2
Definition tg3.h:676
#define MAC_HASH_REG_0
Definition tg3.h:674
#define MAC_HASH_REG_3
Definition tg3.h:677
#define RX_MODE_KEEP_VLAN_TAG
Definition tg3.h:662
#define MAC_HASH_REG_1
Definition tg3.h:675

References DBGP, tg3::dev, MAC_HASH_REG_0, MAC_HASH_REG_1, MAC_HASH_REG_2, MAC_HASH_REG_3, MAC_RX_MODE, net_device::priv, tg3::rx_mode, RX_MODE_KEEP_VLAN_TAG, RX_MODE_PROMISC, tp, tw32, tw32_f, u32, and udelay().

Referenced by tg3_reset_hw().

◆ __tg3_set_coalesce()

void __tg3_set_coalesce ( struct tg3 * tp)
static

Definition at line 1742 of file tg3_hw.c.

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}
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
Definition netdevice.h:640
#define HOSTCC_STAT_COAL_TICKS
Definition tg3.h:1350
#define HOSTCC_RXCOAL_TICK_INT
Definition tg3.h:1336
#define LOW_TXCOL_TICKS
Definition tg3.h:1321
#define HOSTCC_TXMAX_FRAMES
Definition tg3.h:1331
#define HOSTCC_RXMAX_FRAMES
Definition tg3.h:1326
#define LOW_RXMAX_FRAMES
Definition tg3.h:1327
#define HOSTCC_TXCOL_TICKS
Definition tg3.h:1320
#define HOSTCC_RXCOAL_MAXF_INT
Definition tg3.h:1344
#define DEFAULT_STAT_COAL_TICKS
Definition tg3.h:1351
#define DEFAULT_RXCOAL_TICK_INT
Definition tg3.h:1337
#define HOSTCC_RXCOL_TICKS
Definition tg3.h:1314
#define DEFAULT_TXCOAL_TICK_INT
Definition tg3.h:1341
#define HOSTCC_TXCOAL_MAXF_INT
Definition tg3.h:1347
#define HOSTCC_TXCOAL_TICK_INT
Definition tg3.h:1340

References DBGP, DEFAULT_RXCOAL_TICK_INT, DEFAULT_STAT_COAL_TICKS, DEFAULT_TXCOAL_TICK_INT, HOSTCC_RXCOAL_MAXF_INT, HOSTCC_RXCOAL_TICK_INT, HOSTCC_RXCOL_TICKS, HOSTCC_RXMAX_FRAMES, HOSTCC_STAT_COAL_TICKS, HOSTCC_TXCOAL_MAXF_INT, HOSTCC_TXCOAL_TICK_INT, HOSTCC_TXCOL_TICKS, HOSTCC_TXMAX_FRAMES, LOW_RXMAX_FRAMES, LOW_TXCOL_TICKS, netdev_link_ok(), tg3_flag, tp, tw32, u32, and val.

Referenced by tg3_reset_hw().

◆ tg3_set_bdinfo()

void tg3_set_bdinfo ( struct tg3 * tp,
u32 bdinfo_addr,
dma_addr_t mapping,
u32 maxlen_flags,
u32 nic_addr )
static

Definition at line 1767 of file tg3_hw.c.

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}
uint64_t u64
Definition stdint.h:26
#define TG3_BDINFO_HOST_ADDR
Definition tg3.h:163
#define TG3_BDINFO_NIC_ADDR
Definition tg3.h:169
#define TG3_64BIT_REG_HIGH
Definition tg3.h:159
#define TG3_BDINFO_MAXLEN_FLAGS
Definition tg3.h:164

References DBGP, dma_addr_t, TG3_64BIT_REG_HIGH, TG3_64BIT_REG_LOW, TG3_BDINFO_HOST_ADDR, TG3_BDINFO_MAXLEN_FLAGS, TG3_BDINFO_NIC_ADDR, tg3_flag, tg3_write_mem(), tp, and u32.

Referenced by tg3_rings_reset().

◆ tg3_rings_reset()

void tg3_rings_reset ( struct tg3 * tp)
static

Definition at line 1788 of file tg3_hw.c.

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}
uint16_t limit
Limit.
Definition librm.h:1
Definition golan.c:120
#define BDINFO_FLAGS_DISABLED
Definition tg3.h:166
#define tw32_tx_mbox(reg, val)
Definition tg3.h:3336
#define NIC_SRAM_SEND_RCB
Definition tg3.h:2198
#define NIC_SRAM_RCV_RET_RCB
Definition tg3.h:2199
#define MAILBOX_SNDNIC_PROD_IDX_0
Definition tg3.h:483
#define TG3_RX_RET_MAX_SIZE_5705
Definition tg3.h:178
#define tw32_rx_mbox(reg, val)
Definition tg3.h:3337
#define HOSTCC_STATUS_BLK_HOST_ADDR
Definition tg3.h:1356
#define tw32_mailbox(reg, val)
define tw32_mailbox(reg, val) tg3_write_indirect_mbox(((val) & 0xffffffff), tp->regs + (reg))
Definition tg3.h:3331
#define TG3_BDINFO_SIZE
Definition tg3.h:170
#define TG3_TX_RING_SIZE
Definition tg3.h:3310
#define BDINFO_FLAGS_MAXLEN_SHIFT
Definition tg3.h:168
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

References ASIC_REV_5755, ASIC_REV_57765, BDINFO_FLAGS_DISABLED, BDINFO_FLAGS_MAXLEN_SHIFT, DBGP, GET_ASIC_REV, HOSTCC_STATUS_BLK_HOST_ADDR, limit, MAILBOX_SNDNIC_PROD_IDX_0, memset(), NIC_SRAM_RCV_RET_RCB, NIC_SRAM_SEND_RCB, NIC_SRAM_TX_BUFFER_DESC, TG3_64BIT_REG_HIGH, TG3_64BIT_REG_LOW, TG3_BDINFO_MAXLEN_FLAGS, TG3_BDINFO_SIZE, tg3_flag, TG3_HW_STATUS_SIZE, TG3_RX_RET_MAX_SIZE_5705, tg3_set_bdinfo(), TG3_TX_RING_SIZE, tg3_write_mem(), tp, tw32, tw32_mailbox, tw32_mailbox_f, tw32_rx_mbox, tw32_tx_mbox, and u32.

Referenced by tg3_reset_hw().

◆ tg3_setup_rxbd_thresholds()

void tg3_setup_rxbd_thresholds ( struct tg3 * tp)
static

Definition at line 1870 of file tg3_hw.c.

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}
#define TG3_DEF_RX_RING_PENDING
Definition tg3.h:2949
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5906
Definition tg3.h:2299
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5755
Definition tg3.h:2298
#define TG3_SRAM_RX_STD_BDCACHE_SIZE_5700
Definition tg3.h:2297
#define STD_REPLENISH_LWM
Definition tg3.h:1193
#define RCVBDI_STD_THRESH
Definition tg3.h:1189

References ASIC_REV_5750, ASIC_REV_5752, ASIC_REV_5755, ASIC_REV_5787, DBGP, GET_ASIC_REV, RCVBDI_STD_THRESH, STD_REPLENISH_LWM, TG3_DEF_RX_RING_PENDING, tg3_flag, TG3_SRAM_RX_STD_BDCACHE_SIZE_5700, TG3_SRAM_RX_STD_BDCACHE_SIZE_5755, TG3_SRAM_RX_STD_BDCACHE_SIZE_5906, tp, tw32, u32, and val.

Referenced by tg3_reset_hw().

◆ tg3_reset_hw()

int tg3_reset_hw ( struct tg3 * tp,
int reset_phy )
static

Definition at line 1897 of file tg3_hw.c.

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}
dma_addr_t rx_std_mapping
Definition tg3.h:2957
int tg3_init_rings(struct tg3 *tp)
Definition tg3.c:204
#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 TX_LENGTHS_CNT_DWN_VAL_MSK
Definition tg3.h:650
#define RCVLPC_STATSENAB_LNGBRST_RFIX
Definition tg3.h:1114
#define BUFMGR_MB_MACRX_LOW_WATER
Definition tg3.h:1436
#define SERDES_RX_SIG_DETECT
Definition tg3.h:862
#define RX_STD_MAX_SIZE
Definition tg3.h:172
#define TG3_PCIE_DL_LO_FTSMAX_MSK
Definition tg3.h:2111
#define GRC_MODE_HOST_SENDBDS
Definition tg3.h:1799
#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
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 SNDDATAI_SCTRL_ENABLE
Definition tg3.h:987
#define GRC_LCLCTRL_USE_EXT_SIG_DETECT
Definition tg3.h:1844
#define NIC_SRAM_MBUF_POOL_SIZE96
Definition tg3.h:2292
#define GRC_MODE_IRQ_ON_MAC_ATTN
Definition tg3.h:1808
#define CHIPREV_ID_5703_A1
Definition tg3.h:272
#define PCI_X_CMD_READ_2K
Definition tg3.h:21
#define GRC_MODE_PCIE_PORT_MASK
Definition tg3.h:1815
#define SNDBDS_MODE_ATTN_ENABLE
Definition tg3.h:1033
#define GRC_MODE_PCIE_DL_SEL
Definition tg3.h:1812
#define MII_TG3_TEST1
Definition tg3.h:2414
#define RCVBDI_MODE_RCB_ATTN_ENAB
Definition tg3.h:1182
#define WDMAC_MODE_BURST_ALL_DATA
Definition tg3.h:1535
#define CPMU_LSPD_10MB_MACCLK_6_25
Definition tg3.h:1226
#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 TG3_PCIE_EIDLE_DELAY_13_CLKS
Definition tg3.h:2104
#define NIC_SRAM_RX_BUFFER_DESC
Definition tg3.h:2289
#define WDMAC_MODE_FIFOURUN_ENAB
Definition tg3.h:1530
#define GRC_MODE_NO_RX_PHDR_CSUM
Definition tg3.h:1805
#define RX_MODE_RESET
Definition tg3.h:652
#define SNDDATAC_MODE_CDELAY
Definition tg3.h:1026
#define TX_LENGTHS_SLOT_TIME_SHIFT
Definition tg3.h:644
#define TG3_RDMA_RSRVCTRL_REG
Definition tg3.h:1506
#define MAC_RCV_RULE_0
Definition tg3.h:678
#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 TG3_RDMA_RSRVCTRL_FIFO_LWM_1_5K
Definition tg3.h:1508
#define RDMAC_MODE_FIFOOREAD_ENAB
Definition tg3.h:1482
#define CHIPREV_5704_BX
Definition tg3.h:328
#define TX_MODE_CNT_DN_MODE
Definition tg3.h:634
#define TX_MODE_MBUF_LOCKUP_FIX
Definition tg3.h:632
#define TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K
Definition tg3.h:1518
#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 RDMAC_MODE_LNGREAD_ENAB
Definition tg3.h:1483
#define TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX
Definition tg3.h:1507
#define DMA_RWCTRL_CRDRDR_RDMA_MRRS_MSK
Definition tg3.h:343
#define GRC_LCLCTRL_GPIO_OE2
Definition tg3.h:1853
#define TG3_PHYFLG_PARALLEL_DETECT
Definition tg3.h:3252
#define WDMAC_MODE_MSTABORT_ENAB
Definition tg3.h:1526
#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 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 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_LCLCTRL_USE_SIG_DETECT
Definition tg3.h:1843
#define TG3_RDMA_RSRVCTRL_TXMRGN_MASK
Definition tg3.h:1513
#define PCIE_PWR_MGMT_EXT_ASPM_TMR_EN
Definition tg3.h:2090
#define RDMAC_MODE_FIFO_LONG_BURST
Definition tg3.h:1490
#define SNDDATAI_STATSENAB
Definition tg3.h:992
#define RCVDBDI_MODE_LRG_RING_SZ
Definition tg3.h:1138
#define TG3_CPMU_LSPD_10MB_CLK
Definition tg3.h:1224
#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 TG3_RX_JMB_PROD_IDX_REG
Definition tg3.h:448
#define MAC_RCV_VALUE_12
Definition tg3.h:703
#define MAC_RCV_RULE_14
Definition tg3.h:706
#define TG3_RDMA_RSRVCTRL_TXMRGN_320B
Definition tg3.h:1512
#define WDMAC_MODE_ADDROFLOW_ENAB
Definition tg3.h:1528
#define WDMAC_MODE_STATUS_TAG_FIX
Definition tg3.h:1534
#define MAC_RCV_RULE_8
Definition tg3.h:694
#define RDMAC_MODE_FIFOOFLOW_ENAB
Definition tg3.h:1480
#define BUFMGR_MB_HIGH_WATER
Definition tg3.h:1444
#define TG3_PCIE_PL_LO_PHYCTL5
Definition tg3.h:2115
#define SNDDATAI_SCTRL_FASTUPD
Definition tg3.h:988
#define SNDDATAI_STATSCTRL
Definition tg3.h:986
#define RCVCC_MODE_ATTN_ENABLE
Definition tg3.h:1201
#define TG3_PCIE_PL_LO_PHYCTL1
Definition tg3.h:2113
#define TX_MODE_JMB_FRM_LEN
Definition tg3.h:633
#define WDMAC_MODE_LNGREAD_ENAB
Definition tg3.h:1532
#define SNDBDC_MODE_ATTN_ENABLE
Definition tg3.h:1086
#define NIC_SRAM_STATUS_BLK
Definition tg3.h:2201
#define MAC_RCV_RULE_10
Definition tg3.h:698
#define MAC_RCV_RULE_1
Definition tg3.h:680
#define CHIPREV_57765_AX
Definition tg3.h:333
#define GRC_MODE_NO_TX_PHDR_CSUM
Definition tg3.h:1801
#define MAC_RCV_VALUE_6
Definition tg3.h:691
#define MAC_RCV_VALUE_7
Definition tg3.h:693
#define BUFMGR_DMA_HIGH_WATER
Definition tg3.h:1461
#define SNDBDI_MODE_MULTI_TXQ_EN
Definition tg3.h:1061
#define RDMAC_MODE_MULT_DMA_RD_DIS
Definition tg3.h:1491
#define RCVDBDI_MINI_BD
Definition tg3.h:1147
#define TG3_CORR_ERR_STAT_CLEAR
Definition tg3.h:427
#define MAC_RCV_RULE_4
Definition tg3.h:686
#define WDMAC_MODE_PARITYERR_ENAB
Definition tg3.h:1527
#define BUFMGR_MODE_MBLOW_ATTN_ENAB
Definition tg3.h:1424
#define MAC_RCV_RULE_11
Definition tg3.h:700
#define MAC_RCV_VALUE_9
Definition tg3.h:697
#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 NIC_SRAM_DMA_DESC_POOL_BASE
Definition tg3.h:2286
#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 RDMAC_MODE_MSTABORT_ENAB
Definition tg3.h:1477
#define NIC_SRAM_DMA_DESC_POOL_SIZE
Definition tg3.h:2287
#define TG3_RX_STD_MAX_SIZE_5700
Definition tg3.h:173
#define TG3_PCIE_TLDLPL_PORT
Definition tg3.h:2109
#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 MAC_LOW_WMARK_MAX_RX_FRAME
Definition tg3.h:713
#define MAC_LED_CTRL
Definition tg3.h:553
#define PCIE_PWR_MGMT_L1_THRESH_4MS
Definition tg3.h:2089
#define BUFMGR_DMA_DESC_POOL_ADDR
Definition tg3.h:1457
#define WDMAC_MODE_FIFOOFLOW_ENAB
Definition tg3.h:1529
#define RCVDBDI_MODE_INV_RING_SZ
Definition tg3.h:1137
#define GRC_MODE_4X_NIC_SEND_RINGS
Definition tg3.h:1811
#define ISO_PKT_TX
Definition tg3.h:994
#define BUFMGR_MODE_ATTN_ENABLE
Definition tg3.h:1422
#define MII_TG3_TEST1_CRC_EN
Definition tg3.h:2416
int tg3_setup_phy(struct tg3 *tp, int force_reset)
Definition tg3_phy.c:2521
#define PCIE_PWR_MGMT_THRESH
Definition tg3.h:2087
#define MAC_RCV_VALUE_11
Definition tg3.h:701
#define RDMAC_MODE_MBUF_RBD_CRPT_ENAB
Definition tg3.h:1487
#define MAC_RCV_VALUE_10
Definition tg3.h:699
#define TG3_RDMA_RSRVCTRL_FIFO_HWM_1_5K
Definition tg3.h:1510
#define RCVLPC_CONFIG
Definition tg3.h:1107
#define RCV_RULE_CFG_DEFAULT_CLASS
Definition tg3.h:712
#define RCVLPC_STATSENAB_DACK_FIX
Definition tg3.h:1113
#define MAC_RCV_VALUE_15
Definition tg3.h:709
#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 CPMU_LSPD_10MB_MACCLK_MASK
Definition tg3.h:1225
#define TG3PCI_MSI_DATA
Definition tg3.h:242
#define GRC_MODE_PCIE_PL_SEL
Definition tg3.h:1804
#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 MAC_RCV_VALUE_14
Definition tg3.h:707
#define MAC_RCV_VALUE_4
Definition tg3.h:687
#define TG3_PCIE_PL_LO_PHYCTL5_DIS_L2CLKREQ
Definition tg3.h:2116
#define MAC_RCV_VALUE_5
Definition tg3.h:689
#define MAC_MODE_RDE_ENABLE
Definition tg3.h:525
#define MAC_RCV_RULE_9
Definition tg3.h:696
#define MAC_MI_STAT
Definition tg3.h:615
#define TG3_PCIE_EIDLE_DELAY
Definition tg3.h:2102
#define MAC_RCV_VALUE_13
Definition tg3.h:705
#define RCV_RULE_DISABLE_MASK
Definition tg3.h:710
#define PCI_X_CMD_MAX_SPLIT
Definition tg3.h:24
#define RDMAC_MODE_MBUF_SBD_CRPT_ENAB
Definition tg3.h:1488
#define MAC_MODE_LINK_POLARITY
Definition tg3.h:513
#define RDMAC_MODE_ADDROFLOW_ENAB
Definition tg3.h:1479
#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 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 GRC_LCLCTRL_GPIO_OUTPUT2
Definition tg3.h:1856
#define ASIC_REV_5714
Definition tg3.h:307
#define RDMAC_MODE_PARITYERR_ENAB
Definition tg3.h:1478
#define MAC_RCV_RULE_15
Definition tg3.h:708
#define TG3_CORR_ERR_STAT
Definition tg3.h:426
#define MAC_RCV_VALUE_0
Definition tg3.h:679
#define MAC_RCV_VALUE_1
Definition tg3.h:681
#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 BUFMGR_MB_POOL_SIZE
Definition tg3.h:1430
#define MAC_RCV_RULE_7
Definition tg3.h:692
#define RDMAC_MODE_TGTABORT_ENAB
Definition tg3.h:1476
#define MAC_RCV_VALUE_8
Definition tg3.h:695
#define TG3_MAX_MTU
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
static void tg3_setup_rxbd_thresholds(struct tg3 *tp)
Definition tg3_hw.c:1870

References __tg3_set_coalesce(), __tg3_set_mac_addr(), __tg3_set_rx_mode(), ASIC_REV_5700, ASIC_REV_5703, ASIC_REV_5704, ASIC_REV_5705, ASIC_REV_5714, ASIC_REV_5717, ASIC_REV_5719, ASIC_REV_5720, ASIC_REV_5752, ASIC_REV_5755, ASIC_REV_5761, ASIC_REV_57765, ASIC_REV_57780, ASIC_REV_5784, ASIC_REV_5785, ASIC_REV_5906, BDINFO_FLAGS_DISABLED, BDINFO_FLAGS_MAXLEN_SHIFT, BUFMGR_DMA_DESC_POOL_ADDR, BUFMGR_DMA_DESC_POOL_SIZE, BUFMGR_DMA_HIGH_WATER, BUFMGR_DMA_LOW_WATER, BUFMGR_MB_HIGH_WATER, BUFMGR_MB_MACRX_LOW_WATER, BUFMGR_MB_POOL_ADDR, BUFMGR_MB_POOL_SIZE, BUFMGR_MB_RDMA_LOW_WATER, BUFMGR_MODE, BUFMGR_MODE_ATTN_ENABLE, BUFMGR_MODE_ENABLE, BUFMGR_MODE_MBLOW_ATTN_ENAB, BUFMGR_MODE_NO_TX_UNDERRUN, CHIPREV_5704_BX, CHIPREV_57765_AX, CHIPREV_ID_5701_A0, CHIPREV_ID_5703_A1, CHIPREV_ID_5704_A0, CHIPREV_ID_5705_A0, CHIPREV_ID_5719_A0, CHIPREV_ID_5720_A0, CHIPREV_ID_57765_A0, CHIPREV_ID_5906_A1, CLOCK_CTRL_DELAY_PCI_GRANT, CPMU_LSPD_10MB_MACCLK_6_25, CPMU_LSPD_10MB_MACCLK_MASK, DBGC, DBGP, DMA_RWCTRL_CRDRDR_RDMA_MRRS_MSK, DMA_RWCTRL_DIS_CACHE_ALIGNMENT, DMA_RWCTRL_TAGGED_STAT_WA, DMAC_MODE, DMAC_MODE_ENABLE, ENODEV, GET_ASIC_REV, GET_CHIP_REV, GRC_LCLCTRL_GPIO_OE0, GRC_LCLCTRL_GPIO_OE1, GRC_LCLCTRL_GPIO_OE2, GRC_LCLCTRL_GPIO_OE3, GRC_LCLCTRL_GPIO_OUTPUT0, GRC_LCLCTRL_GPIO_OUTPUT1, GRC_LCLCTRL_GPIO_OUTPUT2, GRC_LCLCTRL_GPIO_OUTPUT3, GRC_LCLCTRL_GPIO_UART_SEL, GRC_LCLCTRL_USE_EXT_SIG_DETECT, GRC_LCLCTRL_USE_SIG_DETECT, GRC_LOCAL_CTRL, GRC_MISC_CFG, GRC_MISC_CFG_PRESCALAR_SHIFT, GRC_MODE, GRC_MODE_4X_NIC_SEND_RINGS, GRC_MODE_HOST_SENDBDS, GRC_MODE_HOST_STACKUP, GRC_MODE_IRQ_ON_MAC_ATTN, GRC_MODE_NO_RX_PHDR_CSUM, GRC_MODE_NO_TX_PHDR_CSUM, GRC_MODE_PCIE_DL_SEL, GRC_MODE_PCIE_PL_SEL, GRC_MODE_PCIE_PORT_MASK, HOSTCC_MODE, HOSTCC_MODE_ENABLE, HOSTCC_STATUS_BLK_NIC_ADDR, ISO_PKT_TX, limit, MAC_LED_CTRL, MAC_LOW_WMARK_MAX_RX_FRAME, MAC_MI_STAT, MAC_MI_STAT_LNKSTAT_ATTN_ENAB, MAC_MODE, MAC_MODE_APE_RX_EN, MAC_MODE_APE_TX_EN, MAC_MODE_FHDE_ENABLE, MAC_MODE_LINK_POLARITY, MAC_MODE_RDE_ENABLE, MAC_MODE_RXSTAT_CLEAR, MAC_MODE_RXSTAT_ENABLE, MAC_MODE_TDE_ENABLE, MAC_MODE_TXSTAT_CLEAR, MAC_MODE_TXSTAT_ENABLE, MAC_RCV_RULE_0, MAC_RCV_RULE_1, MAC_RCV_RULE_10, MAC_RCV_RULE_11, MAC_RCV_RULE_12, MAC_RCV_RULE_13, MAC_RCV_RULE_14, MAC_RCV_RULE_15, MAC_RCV_RULE_4, MAC_RCV_RULE_5, MAC_RCV_RULE_6, MAC_RCV_RULE_7, MAC_RCV_RULE_8, MAC_RCV_RULE_9, MAC_RCV_RULE_CFG, MAC_RCV_VALUE_0, MAC_RCV_VALUE_1, MAC_RCV_VALUE_10, MAC_RCV_VALUE_11, MAC_RCV_VALUE_12, MAC_RCV_VALUE_13, MAC_RCV_VALUE_14, MAC_RCV_VALUE_15, MAC_RCV_VALUE_4, MAC_RCV_VALUE_5, MAC_RCV_VALUE_6, MAC_RCV_VALUE_7, MAC_RCV_VALUE_8, MAC_RCV_VALUE_9, MAC_RX_MODE, MAC_RX_MTU_SIZE, MAC_SERDES_CFG, MAC_TX_LENGTHS, MAC_TX_MODE, MBFREE_MODE, MBFREE_MODE_ENABLE, MII_TG3_RXR_COUNTERS, MII_TG3_TEST1, MII_TG3_TEST1_CRC_EN, NIC_SRAM_DMA_DESC_POOL_BASE, NIC_SRAM_DMA_DESC_POOL_SIZE, NIC_SRAM_MBUF_POOL_BASE, NIC_SRAM_MBUF_POOL_SIZE64, NIC_SRAM_MBUF_POOL_SIZE96, NIC_SRAM_RX_BUFFER_DESC, NIC_SRAM_STATS_BLK, NIC_SRAM_STATUS_BLK, pci_read_config_word(), pci_write_config_word(), PCI_X_CMD, PCI_X_CMD_MAX_READ, PCI_X_CMD_MAX_SPLIT, PCI_X_CMD_READ_2K, PCIE_PWR_MGMT_EXT_ASPM_TMR_EN, PCIE_PWR_MGMT_L1_THRESH_4MS, PCIE_PWR_MGMT_L1_THRESH_MSK, PCIE_PWR_MGMT_THRESH, PCISTATE_BUS_SPEED_HIGH, PCISTATE_RETRY_SAME_DMA, RCV_RULE_CFG_DEFAULT_CLASS, RCV_RULE_DISABLE_MASK, RCVBDI_MODE, RCVBDI_MODE_ENABLE, RCVBDI_MODE_RCB_ATTN_ENAB, RCVCC_MODE, RCVCC_MODE_ATTN_ENABLE, RCVCC_MODE_ENABLE, RCVDBDI_MINI_BD, RCVDBDI_MODE, RCVDBDI_MODE_ENABLE, RCVDBDI_MODE_INV_RING_SZ, RCVDBDI_MODE_LRG_RING_SZ, RCVDBDI_STD_BD, RCVDCC_MODE, RCVDCC_MODE_ATTN_ENABLE, RCVDCC_MODE_ENABLE, RCVLPC_CONFIG, RCVLPC_MODE, RCVLPC_MODE_ENABLE, RCVLPC_STATS_ENABLE, RCVLPC_STATSCTRL, RCVLPC_STATSCTRL_ENABLE, RCVLPC_STATSENAB_DACK_FIX, RCVLPC_STATSENAB_LNGBRST_RFIX, RCVLSC_MODE, RCVLSC_MODE_ATTN_ENABLE, RCVLSC_MODE_ENABLE, RDMAC_MODE, RDMAC_MODE_ADDROFLOW_ENAB, RDMAC_MODE_BD_SBD_CRPT_ENAB, RDMAC_MODE_ENABLE, RDMAC_MODE_FIFO_LONG_BURST, RDMAC_MODE_FIFO_SIZE_128, RDMAC_MODE_FIFOOFLOW_ENAB, RDMAC_MODE_FIFOOREAD_ENAB, RDMAC_MODE_FIFOURUN_ENAB, RDMAC_MODE_H2BNC_VLAN_DET, RDMAC_MODE_LNGREAD_ENAB, RDMAC_MODE_MBUF_RBD_CRPT_ENAB, RDMAC_MODE_MBUF_SBD_CRPT_ENAB, RDMAC_MODE_MSTABORT_ENAB, RDMAC_MODE_MULT_DMA_RD_DIS, RDMAC_MODE_PARITYERR_ENAB, RDMAC_MODE_TGTABORT_ENAB, RX_MODE_ENABLE, RX_MODE_RESET, tg3_rx_prodring_set::rx_std_mapping, RX_STD_MAX_SIZE, tg3_rx_prodring_set::rx_std_prod_idx, SERDES_RX_CTRL, SERDES_RX_SIG_DETECT, SNDBDC_MODE, SNDBDC_MODE_ATTN_ENABLE, SNDBDC_MODE_ENABLE, SNDBDI_MODE, SNDBDI_MODE_ATTN_ENABLE, SNDBDI_MODE_ENABLE, SNDBDI_MODE_MULTI_TXQ_EN, SNDBDS_MODE, SNDBDS_MODE_ATTN_ENABLE, SNDBDS_MODE_ENABLE, SNDDATAC_MODE, SNDDATAC_MODE_CDELAY, SNDDATAC_MODE_ENABLE, SNDDATAI_MODE, SNDDATAI_MODE_ENABLE, SNDDATAI_SCTRL_ENABLE, SNDDATAI_SCTRL_FASTUPD, SNDDATAI_STATSCTRL, SNDDATAI_STATSENAB, TG3_64BIT_REG_HIGH, TG3_64BIT_REG_LOW, tg3_abort_hw(), TG3_BDINFO_HOST_ADDR, TG3_BDINFO_MAXLEN_FLAGS, TG3_BDINFO_NIC_ADDR, tg3_chip_reset(), TG3_CORR_ERR_STAT, TG3_CORR_ERR_STAT_CLEAR, TG3_CPMU_LSPD_10MB_CLK, tg3_flag, tg3_flag_set, TG3_HW_STATUS_SIZE, tg3_init_rings(), TG3_LSO_RD_DMA_CRPTEN_CTRL, TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K, TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K, TG3_MAX_MTU, TG3_PCIE_DL_LO_FTSMAX, TG3_PCIE_DL_LO_FTSMAX_MSK, TG3_PCIE_DL_LO_FTSMAX_VAL, TG3_PCIE_EIDLE_DELAY, TG3_PCIE_EIDLE_DELAY_13_CLKS, TG3_PCIE_EIDLE_DELAY_MASK, TG3_PCIE_LNKCTL, TG3_PCIE_LNKCTL_L1_PLL_PD_DIS, TG3_PCIE_LNKCTL_L1_PLL_PD_EN, TG3_PCIE_PL_LO_PHYCTL1, TG3_PCIE_PL_LO_PHYCTL1_L1PLLPD_EN, TG3_PCIE_PL_LO_PHYCTL5, TG3_PCIE_PL_LO_PHYCTL5_DIS_L2CLKREQ, TG3_PCIE_TLDLPL_PORT, tg3_phy_reset(), TG3_PHYFLG_IS_FET, TG3_PHYFLG_MII_SERDES, TG3_PHYFLG_PARALLEL_DETECT, TG3_PHYFLG_PHY_SERDES, TG3_PHYFLG_SERDES_PREEMPHASIS, TG3_RDMA_RSRVCTRL_FIFO_HWM_1_5K, TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK, TG3_RDMA_RSRVCTRL_FIFO_LWM_1_5K, TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK, TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX, TG3_RDMA_RSRVCTRL_REG, TG3_RDMA_RSRVCTRL_TXMRGN_320B, TG3_RDMA_RSRVCTRL_TXMRGN_MASK, tg3_readphy(), tg3_rings_reset(), TG3_RX_JMB_PROD_IDX_REG, TG3_RX_STD_MAX_SIZE_5700, TG3_RX_STD_PROD_IDX_REG, tg3_setup_phy(), tg3_setup_rxbd_thresholds(), tg3_stop_fw(), tg3_write_mem(), tg3_write_sig_pre_reset(), tg3_writephy(), TG3PCI_CLOCK_CTRL, TG3PCI_DMA_RW_CTRL, TG3PCI_MSI_DATA, TG3PCI_PCISTATE, tmp, tp, tr32, tw32, tw32_f, tw32_rx_mbox, TX_LENGTHS_CNT_DWN_VAL_MSK, TX_LENGTHS_IPG_CRS_SHIFT, TX_LENGTHS_IPG_SHIFT, TX_LENGTHS_JMB_FRM_LEN_MSK, TX_LENGTHS_SLOT_TIME_SHIFT, TX_MODE_CNT_DN_MODE, TX_MODE_ENABLE, TX_MODE_JMB_FRM_LEN, TX_MODE_MBUF_LOCKUP_FIX, u16, u32, udelay(), val, WDMAC_MODE, WDMAC_MODE_ADDROFLOW_ENAB, WDMAC_MODE_BURST_ALL_DATA, WDMAC_MODE_ENABLE, WDMAC_MODE_FIFOOFLOW_ENAB, WDMAC_MODE_FIFOOREAD_ENAB, WDMAC_MODE_FIFOURUN_ENAB, WDMAC_MODE_LNGREAD_ENAB, WDMAC_MODE_MSTABORT_ENAB, WDMAC_MODE_PARITYERR_ENAB, WDMAC_MODE_STATUS_TAG_FIX, and WDMAC_MODE_TGTABORT_ENAB.

Referenced by tg3_init_hw().

◆ tg3_init_hw()

int tg3_init_hw ( struct tg3 * tp,
int reset_phy )

Definition at line 2573 of file tg3_hw.c.

2574{ DBGP("%s\n", __func__);
2575
2577
2579
2580 return tg3_reset_hw(tp, reset_phy);
2581}
static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
Definition tg3_hw.c:1897

References DBGP, tg3_reset_hw(), tg3_switch_clocks(), TG3PCI_MEM_WIN_BASE_ADDR, tp, and tw32.

Referenced by tg3_open().

◆ tg3_set_txd()

void tg3_set_txd ( struct tg3 * tp,
int entry,
dma_addr_t mapping,
int len,
u32 flags )

Definition at line 2583 of file tg3_hw.c.

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}
#define txd
Definition davicom.c:144
ring len
Length.
Definition dwmac.h:226
uint8_t flags
Flags.
Definition ena.h:7
#define TXD_LEN_SHIFT
Definition tg3.h:2571

References DBGP, dma_addr_t, flags, len, tp, txd, TXD_LEN_SHIFT, and u32.

Referenced by tg3_transmit().

◆ tg3_do_test_dma()

int tg3_do_test_dma ( struct tg3 * tp,
u32 __unused * buf,
dma_addr_t buf_dma,
int size,
int to_device )

Definition at line 2595 of file tg3_hw.c.

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}
uint16_t size
Buffer size.
Definition dwmac.h:3
#define RDMAC_STATUS
Definition tg3.h:1495
#define FTQ_DMA_HIGH_READ_FIFO_ENQDEQ
Definition tg3.h:1700
#define WDMAC_STATUS
Definition tg3.h:1536
#define FTQ_RCVBD_COMP_FIFO_ENQDEQ
Definition tg3.h:1744
#define FTQ_RCVDATA_COMP_FIFO_ENQDEQ
Definition tg3.h:1756
#define FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ
Definition tg3.h:1720

References __unused, tg3_internal_buffer_desc::addr_hi, tg3_internal_buffer_desc::addr_lo, BUFMGR_MODE, tg3_internal_buffer_desc::cqid_sqid, DBGP, dma_addr_t, ENODEV, tg3_internal_buffer_desc::flags, FTQ_DMA_HIGH_READ_FIFO_ENQDEQ, FTQ_DMA_HIGH_WRITE_FIFO_ENQDEQ, FTQ_RCVBD_COMP_FIFO_ENQDEQ, FTQ_RCVDATA_COMP_FIFO_ENQDEQ, FTQ_RESET, tg3_internal_buffer_desc::len, tg3_internal_buffer_desc::nic_mbuf, NIC_SRAM_DMA_DESC_POOL_BASE, pci_write_config_dword(), RDMAC_MODE, RDMAC_MODE_ENABLE, RDMAC_STATUS, size, TG3PCI_MEM_WIN_BASE_ADDR, TG3PCI_MEM_WIN_DATA, tp, tr32, tw32, tw32_f, u32, udelay(), val, WDMAC_MODE, WDMAC_MODE_ENABLE, and WDMAC_STATUS.

Referenced by tg3_test_dma().