diff options
author | dhananjay@netxen.com <dhananjay@netxen.com> | 2007-07-19 05:11:09 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-24 16:28:39 -0400 |
commit | ceded32f097ba753fb4d339ad5c74f265ea8a03d (patch) | |
tree | 64fd4a130d32c4fa39cd82c465645ab04b5d6cc4 | |
parent | 890de95e8fe617a978e0fcad3c5dd2be99db4532 (diff) |
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: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: Milan Bag <mbag@netxen.com>
Signed-off-by: Wen Xiong <wenxiong@us.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 3 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 48 |
2 files changed, 25 insertions, 26 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 325269d8ae38..d4c92cc879d4 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1179,8 +1179,7 @@ dma_watchdog_shutdown_poll_result(struct netxen_adapter *adapter) | |||
1179 | NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) | 1179 | NETXEN_CAM_RAM(NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL), &ctrl, 4)) |
1180 | printk(KERN_ERR "failed to read dma watchdog status\n"); | 1180 | printk(KERN_ERR "failed to read dma watchdog status\n"); |
1181 | 1181 | ||
1182 | return ((netxen_get_dma_watchdog_enabled(ctrl) == 0) && | 1182 | return (netxen_get_dma_watchdog_enabled(ctrl) == 0); |
1183 | (netxen_get_dma_watchdog_disabled(ctrl) == 0)); | ||
1184 | } | 1183 | } |
1185 | 1184 | ||
1186 | static inline int | 1185 | static inline int |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index b703ccfe040b..19e2fa940ac0 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -46,7 +46,7 @@ MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | |||
46 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
48 | 48 | ||
49 | char netxen_nic_driver_name[] = "netxen-nic"; | 49 | char netxen_nic_driver_name[] = "netxen_nic"; |
50 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " | 50 | static char netxen_nic_driver_string[] = "NetXen Network Driver version " |
51 | NETXEN_NIC_LINUX_VERSIONID; | 51 | NETXEN_NIC_LINUX_VERSIONID; |
52 | 52 | ||
@@ -640,6 +640,10 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
640 | NETXEN_CRB_NORMALIZE(adapter, | 640 | NETXEN_CRB_NORMALIZE(adapter, |
641 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); | 641 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE)); |
642 | /* Handshake with the card before we register the devices. */ | 642 | /* Handshake with the card before we register the devices. */ |
643 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | ||
644 | netxen_pinit_from_rom(adapter, 0); | ||
645 | msleep(1); | ||
646 | netxen_load_firmware(adapter); | ||
643 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 647 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
644 | } | 648 | } |
645 | 649 | ||
@@ -782,19 +786,18 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
782 | 786 | ||
783 | if (adapter->portnum == 0) { | 787 | if (adapter->portnum == 0) { |
784 | if (init_firmware_done) { | 788 | if (init_firmware_done) { |
785 | dma_watchdog_shutdown_request(adapter); | ||
786 | msleep(100); | ||
787 | i = 100; | 789 | i = 100; |
788 | while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { | 790 | do { |
789 | printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); | 791 | if (dma_watchdog_shutdown_request(adapter) == 1) |
792 | break; | ||
790 | msleep(100); | 793 | msleep(100); |
791 | i--; | 794 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
792 | } | 795 | break; |
796 | } while (--i); | ||
793 | 797 | ||
794 | if (i == 0) { | 798 | if (i == 0) |
795 | printk(KERN_ERR "dma_watchdog_shutdown_request failed\n"); | 799 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
796 | return; | 800 | netdev->name); |
797 | } | ||
798 | 801 | ||
799 | /* clear the register for future unloads/loads */ | 802 | /* clear the register for future unloads/loads */ |
800 | writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); | 803 | 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 | 806 | ||
804 | /* leave the hw in the same state as reboot */ | 807 | /* leave the hw in the same state as reboot */ |
805 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); | 808 | writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)); |
806 | if (netxen_pinit_from_rom(adapter, 0)) | 809 | netxen_pinit_from_rom(adapter, 0); |
807 | return; | ||
808 | msleep(1); | 810 | msleep(1); |
809 | if (netxen_load_firmware(adapter)) | 811 | netxen_load_firmware(adapter); |
810 | return; | ||
811 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 812 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
812 | } | 813 | } |
813 | 814 | ||
@@ -816,22 +817,21 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
816 | printk(KERN_INFO "State: 0x%0x\n", | 817 | printk(KERN_INFO "State: 0x%0x\n", |
817 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); | 818 | readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); |
818 | 819 | ||
819 | dma_watchdog_shutdown_request(adapter); | ||
820 | msleep(100); | ||
821 | i = 100; | 820 | i = 100; |
822 | while ((dma_watchdog_shutdown_poll_result(adapter) != 1) && i) { | 821 | do { |
823 | printk(KERN_INFO "dma_watchdog_shutdown_poll still in progress\n"); | 822 | if (dma_watchdog_shutdown_request(adapter) == 1) |
823 | break; | ||
824 | msleep(100); | 824 | msleep(100); |
825 | i--; | 825 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
826 | } | 826 | break; |
827 | } while (--i); | ||
827 | 828 | ||
828 | if (i) { | 829 | if (i) { |
829 | netxen_free_adapter_offload(adapter); | 830 | netxen_free_adapter_offload(adapter); |
830 | } else { | 831 | } else { |
831 | printk(KERN_ERR "failed to dma shutdown\n"); | 832 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
832 | return; | 833 | netdev->name); |
833 | } | 834 | } |
834 | |||
835 | } | 835 | } |
836 | 836 | ||
837 | iounmap(adapter->ahw.db_base); | 837 | iounmap(adapter->ahw.db_base); |