diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2008-06-16 01:59:46 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-06-17 23:07:01 -0400 |
commit | 439b454edf551f5a6eb49de6b868015724d275ab (patch) | |
tree | 4c3b9f9c3a9ef85a36ae77636040f19033287af0 /drivers/net/netxen/netxen_nic_main.c | |
parent | dcd56fdbaeae1008044687b973c4a3e852e8a726 (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/netxen_nic_main.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 65 |
1 files changed, 10 insertions, 55 deletions
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); |