aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2008-06-16 01:59:46 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-06-17 23:07:01 -0400
commit439b454edf551f5a6eb49de6b868015724d275ab (patch)
tree4c3b9f9c3a9ef85a36ae77636040f19033287af0 /drivers/net/netxen
parentdcd56fdbaeae1008044687b973c4a3e852e8a726 (diff)
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: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic_init.c24
-rw-r--r--drivers/net/netxen/netxen_nic_main.c65
2 files changed, 30 insertions, 59 deletions
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index f6aeccfa2831..70d1b22ced22 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -840,10 +840,10 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose)
840 netxen_nic_pci_change_crbwindow(adapter, 1); 840 netxen_nic_pci_change_crbwindow(adapter, 1);
841 } 841 }
842 if (init_delay == 1) { 842 if (init_delay == 1) {
843 msleep(2000); 843 msleep(1000);
844 init_delay = 0; 844 init_delay = 0;
845 } 845 }
846 msleep(20); 846 msleep(1);
847 } 847 }
848 kfree(buf); 848 kfree(buf);
849 849
@@ -918,12 +918,28 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter)
918 918
919void netxen_free_adapter_offload(struct netxen_adapter *adapter) 919void netxen_free_adapter_offload(struct netxen_adapter *adapter)
920{ 920{
921 int i;
922
921 if (adapter->dummy_dma.addr) { 923 if (adapter->dummy_dma.addr) {
922 pci_free_consistent(adapter->ahw.pdev, 924 i = 100;
925 do {
926 if (dma_watchdog_shutdown_request(adapter) == 1)
927 break;
928 msleep(50);
929 if (dma_watchdog_shutdown_poll_result(adapter) == 1)
930 break;
931 } while (--i);
932
933 if (i) {
934 pci_free_consistent(adapter->ahw.pdev,
923 NETXEN_HOST_DUMMY_DMA_SIZE, 935 NETXEN_HOST_DUMMY_DMA_SIZE,
924 adapter->dummy_dma.addr, 936 adapter->dummy_dma.addr,
925 adapter->dummy_dma.phys_addr); 937 adapter->dummy_dma.phys_addr);
926 adapter->dummy_dma.addr = NULL; 938 adapter->dummy_dma.addr = NULL;
939 } else {
940 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
941 adapter->netdev->name);
942 }
927 } 943 }
928} 944}
929 945
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 755f4abe2f55..6797ed069f1f 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -543,14 +543,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
543 break; 543 break;
544 } 544 }
545 545
546#ifdef CONFIG_IA64
547 if(adapter->portnum == 0) {
548 netxen_pinit_from_rom(adapter, 0);
549 udelay(500);
550 netxen_load_firmware(adapter);
551 }
552#endif
553
554 init_timer(&adapter->watchdog_timer); 546 init_timer(&adapter->watchdog_timer);
555 adapter->ahw.xg_linkup = 0; 547 adapter->ahw.xg_linkup = 0;
556 adapter->watchdog_timer.function = &netxen_watchdog; 548 adapter->watchdog_timer.function = &netxen_watchdog;
@@ -622,11 +614,18 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
622 err = -ENODEV; 614 err = -ENODEV;
623 goto err_out_free_dev; 615 goto err_out_free_dev;
624 } 616 }
617 } else {
618 writel(0, NETXEN_CRB_NORMALIZE(adapter,
619 CRB_CMDPEG_STATE));
620 netxen_pinit_from_rom(adapter, 0);
621 msleep(1);
622 netxen_load_firmware(adapter);
623 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
625 } 624 }
626 625
627 /* clear the register for future unloads/loads */ 626 /* clear the register for future unloads/loads */
628 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc))); 627 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
629 printk(KERN_DEBUG "State: 0x%0x\n", 628 dev_info(&pdev->dev, "cmdpeg state: 0x%0x\n",
630 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE))); 629 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
631 630
632 /* 631 /*
@@ -757,52 +756,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
757 756
758 vfree(adapter->cmd_buf_arr); 757 vfree(adapter->cmd_buf_arr);
759 758
760 if (adapter->portnum == 0) { 759 if (adapter->portnum == 0)
761 if (init_firmware_done) { 760 netxen_free_adapter_offload(adapter);
762 i = 100;
763 do {
764 if (dma_watchdog_shutdown_request(adapter) == 1)
765 break;
766 msleep(100);
767 if (dma_watchdog_shutdown_poll_result(adapter) == 1)
768 break;
769 } while (--i);
770
771 if (i == 0)
772 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
773 netdev->name);
774
775 /* clear the register for future unloads/loads */
776 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
777 /* leave the hw in the same state as reboot */
778 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
779 netxen_pinit_from_rom(adapter, 0);
780 msleep(1);
781 netxen_load_firmware(adapter);
782 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
783 }
784
785 /* clear the register for future unloads/loads */
786 writel(0, NETXEN_CRB_NORMALIZE(adapter, NETXEN_CAM_RAM(0x1fc)));
787 printk(KERN_DEBUG "State: 0x%0x\n",
788 readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE)));
789
790 i = 100;
791 do {
792 if (dma_watchdog_shutdown_request(adapter) == 1)
793 break;
794 msleep(100);
795 if (dma_watchdog_shutdown_poll_result(adapter) == 1)
796 break;
797 } while (--i);
798
799 if (i) {
800 netxen_free_adapter_offload(adapter);
801 } else {
802 printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n",
803 netdev->name);
804 }
805 }
806 761
807 if (adapter->irq) 762 if (adapter->irq)
808 free_irq(adapter->irq, adapter); 763 free_irq(adapter->irq, adapter);