diff options
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 6 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 35 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 47 |
3 files changed, 51 insertions, 37 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 4276f7f82238..511db2ac57c9 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -939,7 +939,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
939 | { | 939 | { |
940 | int i; | 940 | int i; |
941 | u32 data, size = 0; | 941 | u32 data, size = 0; |
942 | u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; | 942 | u32 flashaddr = NETXEN_BOOTLD_START; |
943 | 943 | ||
944 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; | 944 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; |
945 | 945 | ||
@@ -951,10 +951,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
951 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) | 951 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) |
952 | return -EIO; | 952 | return -EIO; |
953 | 953 | ||
954 | adapter->pci_mem_write(adapter, memaddr, &data, 4); | 954 | adapter->pci_mem_write(adapter, flashaddr, &data, 4); |
955 | flashaddr += 4; | 955 | flashaddr += 4; |
956 | memaddr += 4; | ||
957 | cond_resched(); | ||
958 | } | 956 | } |
959 | msleep(1); | 957 | msleep(1); |
960 | 958 | ||
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index c0e06a653170..a3203644b482 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -439,6 +439,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter) | |||
439 | long timeout = 0; | 439 | long timeout = 0; |
440 | long done = 0; | 440 | long done = 0; |
441 | 441 | ||
442 | cond_resched(); | ||
443 | |||
442 | while (done == 0) { | 444 | while (done == 0) { |
443 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); | 445 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); |
444 | done &= 2; | 446 | done &= 2; |
@@ -533,12 +535,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | |||
533 | static int do_rom_fast_read(struct netxen_adapter *adapter, | 535 | static int do_rom_fast_read(struct netxen_adapter *adapter, |
534 | int addr, int *valp) | 536 | int addr, int *valp) |
535 | { | 537 | { |
536 | cond_resched(); | ||
537 | |||
538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | 538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); |
539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
540 | udelay(100); /* prevent bursting on CRB */ | ||
541 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
540 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
542 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 541 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
543 | if (netxen_wait_rom_done(adapter)) { | 542 | if (netxen_wait_rom_done(adapter)) { |
544 | printk("Error waiting for rom done\n"); | 543 | printk("Error waiting for rom done\n"); |
@@ -546,7 +545,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter, | |||
546 | } | 545 | } |
547 | /* reset abyte_cnt and dummy_byte_cnt */ | 546 | /* reset abyte_cnt and dummy_byte_cnt */ |
548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | 547 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); |
549 | udelay(100); /* prevent bursting on CRB */ | 548 | udelay(10); |
550 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 549 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
551 | 550 | ||
552 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); | 551 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); |
@@ -884,14 +883,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter) | |||
884 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | 883 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) |
885 | { | 884 | { |
886 | int addr, val; | 885 | int addr, val; |
887 | int i, init_delay = 0; | 886 | int i, n, init_delay = 0; |
888 | struct crb_addr_pair *buf; | 887 | struct crb_addr_pair *buf; |
889 | unsigned offset, n; | 888 | unsigned offset; |
890 | u32 off; | 889 | u32 off; |
891 | 890 | ||
892 | /* resetall */ | 891 | /* resetall */ |
892 | rom_lock(adapter); | ||
893 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, | 893 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, |
894 | 0xffffffff); | 894 | 0xffffffff); |
895 | netxen_rom_unlock(adapter); | ||
895 | 896 | ||
896 | if (verbose) { | 897 | if (verbose) { |
897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) | 898 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) |
@@ -910,7 +911,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
910 | 911 | ||
911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 912 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || | 913 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || |
913 | (n != 0xcafecafeUL) || | 914 | (n != 0xcafecafe) || |
914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { | 915 | netxen_rom_fast_read(adapter, 4, &n) != 0) { |
915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " | 916 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " |
916 | "n: %08x\n", netxen_nic_driver_name, n); | 917 | "n: %08x\n", netxen_nic_driver_name, n); |
@@ -975,6 +976,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
975 | /* do not reset PCI */ | 976 | /* do not reset PCI */ |
976 | if (off == (ROMUSB_GLB + 0xbc)) | 977 | if (off == (ROMUSB_GLB + 0xbc)) |
977 | continue; | 978 | continue; |
979 | if (off == (ROMUSB_GLB + 0xa8)) | ||
980 | continue; | ||
981 | if (off == (ROMUSB_GLB + 0xc8)) /* core clock */ | ||
982 | continue; | ||
983 | if (off == (ROMUSB_GLB + 0x24)) /* MN clock */ | ||
984 | continue; | ||
985 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | ||
986 | continue; | ||
978 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 987 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
979 | buf[i].data = 0x1020; | 988 | buf[i].data = 0x1020; |
980 | /* skip the function enable register */ | 989 | /* skip the function enable register */ |
@@ -992,23 +1001,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
992 | continue; | 1001 | continue; |
993 | } | 1002 | } |
994 | 1003 | ||
1004 | init_delay = 1; | ||
995 | /* After writing this register, HW needs time for CRB */ | 1005 | /* After writing this register, HW needs time for CRB */ |
996 | /* to quiet down (else crb_window returns 0xffffffff) */ | 1006 | /* to quiet down (else crb_window returns 0xffffffff) */ |
997 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { | 1007 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { |
998 | init_delay = 1; | 1008 | init_delay = 1000; |
999 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1009 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
1000 | /* hold xdma in reset also */ | 1010 | /* hold xdma in reset also */ |
1001 | buf[i].data = NETXEN_NIC_XDMA_RESET; | 1011 | buf[i].data = NETXEN_NIC_XDMA_RESET; |
1012 | buf[i].data = 0x8000ff; | ||
1002 | } | 1013 | } |
1003 | } | 1014 | } |
1004 | 1015 | ||
1005 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); | 1016 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); |
1006 | 1017 | ||
1007 | if (init_delay == 1) { | 1018 | msleep(init_delay); |
1008 | msleep(1000); | ||
1009 | init_delay = 0; | ||
1010 | } | ||
1011 | msleep(1); | ||
1012 | } | 1019 | } |
1013 | kfree(buf); | 1020 | kfree(buf); |
1014 | 1021 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2c6ce6ffde09..cbe2b3e814dd 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -280,10 +280,15 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
280 | static int | 280 | static int |
281 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | 281 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) |
282 | { | 282 | { |
283 | int ret = 0; | 283 | u32 val, timeout; |
284 | 284 | ||
285 | if (first_boot == 0x55555555) { | 285 | if (first_boot == 0x55555555) { |
286 | /* This is the first boot after power up */ | 286 | /* This is the first boot after power up */ |
287 | adapter->pci_write_normalize(adapter, | ||
288 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | ||
289 | |||
290 | if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
291 | return 0; | ||
287 | 292 | ||
288 | /* PCI bus master workaround */ | 293 | /* PCI bus master workaround */ |
289 | adapter->hw_read_wx(adapter, | 294 | adapter->hw_read_wx(adapter, |
@@ -303,18 +308,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
303 | /* clear the register for future unloads/loads */ | 308 | /* clear the register for future unloads/loads */ |
304 | adapter->pci_write_normalize(adapter, | 309 | adapter->pci_write_normalize(adapter, |
305 | NETXEN_CAM_RAM(0x1fc), 0); | 310 | NETXEN_CAM_RAM(0x1fc), 0); |
306 | ret = -1; | 311 | return -EIO; |
307 | } | 312 | } |
308 | 313 | ||
309 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 314 | /* Start P2 boot loader */ |
310 | /* Start P2 boot loader */ | 315 | val = adapter->pci_read_normalize(adapter, |
311 | adapter->pci_write_normalize(adapter, | 316 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE); |
312 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 317 | adapter->pci_write_normalize(adapter, |
313 | adapter->pci_write_normalize(adapter, | 318 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1); |
314 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | 319 | timeout = 0; |
315 | } | 320 | do { |
321 | msleep(1); | ||
322 | val = adapter->pci_read_normalize(adapter, | ||
323 | NETXEN_CAM_RAM(0x1fc)); | ||
324 | |||
325 | if (++timeout > 5000) | ||
326 | return -EIO; | ||
327 | |||
328 | } while (val == NETXEN_BDINFO_MAGIC); | ||
316 | } | 329 | } |
317 | return ret; | 330 | return 0; |
318 | } | 331 | } |
319 | 332 | ||
320 | static void netxen_set_port_mode(struct netxen_adapter *adapter) | 333 | static void netxen_set_port_mode(struct netxen_adapter *adapter) |
@@ -793,8 +806,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
793 | CRB_CMDPEG_STATE, 0); | 806 | CRB_CMDPEG_STATE, 0); |
794 | netxen_pinit_from_rom(adapter, 0); | 807 | netxen_pinit_from_rom(adapter, 0); |
795 | msleep(1); | 808 | msleep(1); |
796 | netxen_load_firmware(adapter); | ||
797 | } | 809 | } |
810 | netxen_load_firmware(adapter); | ||
798 | 811 | ||
799 | if (NX_IS_REVISION_P3(revision_id)) | 812 | if (NX_IS_REVISION_P3(revision_id)) |
800 | netxen_pcie_strap_init(adapter); | 813 | netxen_pcie_strap_init(adapter); |
@@ -810,13 +823,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
810 | 823 | ||
811 | } | 824 | } |
812 | 825 | ||
813 | if ((first_boot == 0x55555555) && | ||
814 | (NX_IS_REVISION_P2(revision_id))) { | ||
815 | /* Unlock the HW, prompting the boot sequence */ | ||
816 | adapter->pci_write_normalize(adapter, | ||
817 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | ||
818 | } | ||
819 | |||
820 | err = netxen_initialize_adapter_offload(adapter); | 826 | err = netxen_initialize_adapter_offload(adapter); |
821 | if (err) | 827 | if (err) |
822 | goto err_out_iounmap; | 828 | goto err_out_iounmap; |
@@ -830,7 +836,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
830 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); | 836 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); |
831 | 837 | ||
832 | /* Handshake with the card before we register the devices. */ | 838 | /* Handshake with the card before we register the devices. */ |
833 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 839 | err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
840 | if (err) | ||
841 | goto err_out_free_offload; | ||
834 | 842 | ||
835 | } /* first_driver */ | 843 | } /* first_driver */ |
836 | 844 | ||
@@ -934,6 +942,7 @@ err_out_disable_msi: | |||
934 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 942 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
935 | pci_disable_msi(pdev); | 943 | pci_disable_msi(pdev); |
936 | 944 | ||
945 | err_out_free_offload: | ||
937 | if (first_driver) | 946 | if (first_driver) |
938 | netxen_free_adapter_offload(adapter); | 947 | netxen_free_adapter_offload(adapter); |
939 | 948 | ||