diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-01-14 23:49:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-14 23:49:00 -0500 |
commit | 27c915a4d843b90eb4065298969578d15e5e6ab0 (patch) | |
tree | df1e34fb723aedfd851c24946437951528548938 /drivers/net/netxen/netxen_nic_init.c | |
parent | c7860a2aec571ea95d3ad19b8d9775b27828baac (diff) |
netxen: firmware init fix
o Fix order or rom register writes.
o Reduce udelays when writing rom registers.
This cuts the firmware init time by 40%.
o Do not reset core/memory clocks when reinitializing driver.
Firmware willl handle this when initialized.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_init.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 35 |
1 files changed, 21 insertions, 14 deletions
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 | ||