Commit ceded32f authored by dhananjay@netxen.com's avatar dhananjay@netxen.com Committed by Jeff Garzik

netxen: Load firmware during probe, dma watchdog fix.

The firmware should be loaded after resetting hardware during PCI probe,
besides module unload. This fixes issue with 2nd port of multiport adapter
on powerpc blades. This patch also fixes a bug that PCI resources are not
freed if dma watchdog shutdown failed. The dma watchdog poll messages
during module unload are also suppressed.
Signed-off-by: default avatarDhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: default avatarMilan Bag <mbag@netxen.com>
Signed-off-by: default avatarWen Xiong <wenxiong@us.ibm.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 890de95e
...@@ -1179,8 +1179,7 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter) ...@@ -1179,8 +1179,7 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter)
NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4))
printk(KERN_ERR "failed to read dma watchdog status\n"); printk(KERN_ERR "failed to read dma watchdog status\n");
return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) && return (netxen_get_dma_watchdog_enabled(ctrl) == 0);
(netxen_get_dma_watchdog_disabled(ctrl) == 0));
} }
static inline int static inline int
......
...@@ -46,7 +46,7 @@ MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); ...@@ -46,7 +46,7 @@ MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID);
char netxen_nic_driver_name[] = "netxen-nic"; char netxen_nic_driver_name[] = "netxen_nic";
static char netxen_nic_driver_string[] = "NetXen Network Driver version " static char netxen_nic_driver_string[] = "NetXen Network Driver version "
NETXEN_NIC_LINUX_VERSIONID; NETXEN_NIC_LINUX_VERSIONID;
...@@ -640,6 +640,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -640,6 +640,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
NETXEN_CRB_NORMALIZE(adapter, NETXEN_CRB_NORMALIZE(adapter,
NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); NETXEN_ROMUSB_GLB_PEGTUNE_DONE));
/* Handshake with the card before we register the devices. */ /* Handshake with the card before we register the devices. */
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); netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
} }
...@@ -782,19 +786,18 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) ...@@ -782,19 +786,18 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
if (adapter->portnum == 0) { if (adapter->portnum == 0) {
if (init_firmware_done) { if (init_firmware_done) {
dma_watchdog_shutdown_request(adapter);
msleep(100);
i = 100; i = 100;
while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { do {
printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); if (dma_watchdog_shutdown_request(adapter) == 1)
break;
msleep(100); msleep(100);
i--; if (dma_watchdog_shutdown_poll_result(adapter) == 1)
} break;
} while (--i);
if (i == 0) { if (i == 0)
printk(KERN_ERR "dma_watchdog_shutdown_request failed\n"); printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
return; netdev->name);
}
/* 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)));
...@@ -803,11 +806,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) ...@@ -803,11 +806,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
/* leave the hw in the same state as reboot */ /* leave the hw in the same state as reboot */
writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
if (netxen_pinit_from_rom(adapter, 0)) netxen_pinit_from_rom(adapter, 0);
return;
msleep(1); msleep(1);
if (netxen_load_firmware(adapter)) netxen_load_firmware(adapter);
return;
netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
} }
...@@ -816,22 +817,21 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) ...@@ -816,22 +817,21 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
printk(KERN_INFO "State: 0x%0x\n", printk(KERN_INFO "State: 0x%0x\n",
readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
dma_watchdog_shutdown_request(adapter);
msleep(100);
i = 100; i = 100;
while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { do {
printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); if (dma_watchdog_shutdown_request(adapter) == 1)
break;
msleep(100); msleep(100);
i--; if (dma_watchdog_shutdown_poll_result(adapter) == 1)
} break;
} while (--i);
if (i) { if (i) {
netxen_free_adapter_offload(adapter); netxen_free_adapter_offload(adapter);
} else { } else {
printk(KERN_ERR "failed to dma shutdown\n"); printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
return; netdev->name);
} }
} }
iounmap(adapter->ahw.db_base); iounmap(adapter->ahw.db_base);
......
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