netxen: fix firmware init handshake

Make sure all functions run firmware init handshake.

If PCI function 0 fails to initialize firmware, mark the
state failed so that other functions on the same board
bail out quickly instead of waiting 30s for firmware
handshake.

Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dhananjay Phadke 2009-06-22 20:26:21 +00:00 committed by David S. Miller
parent 01542cd1bb
commit 96f2ebd2e1
2 changed files with 23 additions and 19 deletions

View File

@ -944,28 +944,31 @@ int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val)
u32 val = 0; u32 val = 0;
int retries = 60; int retries = 60;
if (!pegtune_val) { if (pegtune_val)
do { return 0;
val = NXRD32(adapter, CRB_CMDPEG_STATE);
if (val == PHAN_INITIALIZE_COMPLETE || do {
val == PHAN_INITIALIZE_ACK) val = NXRD32(adapter, CRB_CMDPEG_STATE);
return 0;
msleep(500); switch (val) {
case PHAN_INITIALIZE_COMPLETE:
} while (--retries); case PHAN_INITIALIZE_ACK:
return 0;
if (!retries) { case PHAN_INITIALIZE_FAILED:
pegtune_val = NXRD32(adapter, goto out_err;
NETXEN_ROMUSB_GLB_PEGTUNE_DONE); default:
printk(KERN_WARNING "netxen_phantom_init: init failed, " break;
"pegtune_val=%x\n", pegtune_val);
return -1;
} }
}
return 0; msleep(500);
} while (--retries);
NXWR32(adapter, CRB_CMDPEG_STATE, PHAN_INITIALIZE_FAILED);
out_err:
dev_warn(&adapter->pdev->dev, "firmware init failed\n");
return -EIO;
} }
static int static int

View File

@ -705,7 +705,7 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw)
first_driver = (adapter->ahw.pci_func == 0); first_driver = (adapter->ahw.pci_func == 0);
if (!first_driver) if (!first_driver)
return 0; goto wait_init;
first_boot = NXRD32(adapter, NETXEN_CAM_RAM(0x1fc)); first_boot = NXRD32(adapter, NETXEN_CAM_RAM(0x1fc));
@ -752,6 +752,7 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw)
| (_NETXEN_NIC_LINUX_SUBVERSION); | (_NETXEN_NIC_LINUX_SUBVERSION);
NXWR32(adapter, CRB_DRIVER_VERSION, val); NXWR32(adapter, CRB_DRIVER_VERSION, val);
wait_init:
/* Handshake with the card before we register the devices. */ /* Handshake with the card before we register the devices. */
err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
if (err) { if (err) {