Commit 439b454e authored by Dhananjay Phadke's avatar Dhananjay Phadke Committed by Jeff Garzik

netxen: download firmware in pci probe

Downloading firmware in pci probe allows recovery in case of
firmware failure by reloading the driver.

Also reduced delays in firmware load.
Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent dcd56fdb
...@@ -840,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) ...@@ -840,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
netxen_nic_pci_change_crbwindow(adapter, 1); netxen_nic_pci_change_crbwindow(adapter, 1);
} }
if (init_delay == 1) { if (init_delay == 1) {
msleep(2000); msleep(1000);
init_delay = 0; init_delay = 0;
} }
msleep(20); msleep(1);
} }
kfree(buf); kfree(buf);
...@@ -918,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) ...@@ -918,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
void netxen_free_adapter_offload(struct netxen_adapter *adapter) void netxen_free_adapter_offload(struct netxen_adapter *adapter)
{ {
int i;
if (adapter->dummy_dma.addr) { if (adapter->dummy_dma.addr) {
pci_free_consistent(adapter->ahw.pdev, i = 100;
do {
if (dma_watchdog_shutdown_request(adapter) == 1)
break;
msleep(50);
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
break;
} while (--i);
if (i) {
pci_free_consistent(adapter->ahw.pdev,
NETXEN_HOST_DUMMY_DMA_SIZE, NETXEN_HOST_DUMMY_DMA_SIZE,
adapter->dummy_dma.addr, adapter->dummy_dma.addr,
adapter->dummy_dma.phys_addr); adapter->dummy_dma.phys_addr);
adapter->dummy_dma.addr = NULL; adapter->dummy_dma.addr = NULL;
} else {
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
adapter->netdev->name);
}
} }
} }
......
...@@ -543,14 +543,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -543,14 +543,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
break; break;
} }
#ifdef CONFIG_IA64
if(adapter->portnum == 0) {
netxen_pinit_from_rom(adapter, 0);
udelay(500);
netxen_load_firmware(adapter);
}
#endif
init_timer(&adapter->watchdog_timer); init_timer(&adapter->watchdog_timer);
adapter->ahw.xg_linkup = 0; adapter->ahw.xg_linkup = 0;
adapter->watchdog_timer.function = &netxen_watchdog; adapter->watchdog_timer.function = &netxen_watchdog;
...@@ -622,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -622,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
err = -ENODEV; err = -ENODEV;
goto err_out_free_dev; goto err_out_free_dev;
} }
} else {
writel(0, NETXEN_CRB_NORMALIZE(adapter,
CRB_CMDPEG_STATE));
netxen_pinit_from_rom(adapter, 0);
msleep(1);
netxen_load_firmware(adapter);
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
} }
/* clear the register for future unloads/loads */ /* clear the register for future unloads/loads */
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
printk(KERN_DEBUG "State: 0x%0x\n", dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n",
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
/* /*
...@@ -757,52 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) ...@@ -757,52 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
vfree(adapter->cmd_buf_arr); vfree(adapter->cmd_buf_arr);
if (adapter->portnum == 0) { if (adapter->portnum == 0)
if (init_firmware_done) { netxen_free_adapter_offload(adapter);
i = 100;
do {
if (dma_watchdog_shutdown_request(adapter) == 1)
break;
msleep(100);
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
break;
} while (--i);
if (i == 0)
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
netdev->name);
/* clear the register for future unloads/loads */
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
/* leave the hw in the same state as reboot */
writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
netxen_pinit_from_rom(adapter, 0);
msleep(1);
netxen_load_firmware(adapter);
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
}
/* clear the register for future unloads/loads */
writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
printk(KERN_DEBUG "State: 0x%0x\n",
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
i = 100;
do {
if (dma_watchdog_shutdown_request(adapter) == 1)
break;
msleep(100);
if (dma_watchdog_shutdown_poll_result(adapter) == 1)
break;
} while (--i);
if (i) {
netxen_free_adapter_offload(adapter);
} else {
printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
netdev->name);
}
}
if (adapter->irq) if (adapter->irq)
free_irq(adapter->irq, adapter); free_irq(adapter->irq, adapter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment