diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-03-02 11:02:17 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-03 03:05:27 -0500 |
commit | 567c6c4e2b92f4b8632b043f9395b216b7e7c3ce (patch) | |
tree | 20eda4904012401002d42e27abf555564adf12b8 | |
parent | 1f434f638457712732238329dfdf089eab25e5b3 (diff) |
netxen: firmware download improvements
o set port mode after resetting device.
o prefer cut-through firmware (doesn't require on-card memory).
o load flashed firmware if newer.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 27 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 7 |
2 files changed, 24 insertions, 10 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index b15246c19da7..b564d69cfa45 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -1069,6 +1069,16 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname, | |||
1069 | return -EINVAL; | 1069 | return -EINVAL; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | /* check if flashed firmware is newer */ | ||
1073 | if (netxen_rom_fast_read(adapter, | ||
1074 | NX_FW_VERSION_OFFSET, (int *)&val)) | ||
1075 | return -EIO; | ||
1076 | major = (__force u32)val & 0xff; | ||
1077 | minor = ((__force u32)val >> 8) & 0xff; | ||
1078 | build = (__force u32)val >> 16; | ||
1079 | if (NETXEN_VERSION_CODE(major, minor, build) > ver) | ||
1080 | return -EINVAL; | ||
1081 | |||
1072 | netxen_nic_reg_write(adapter, NETXEN_CAM_RAM(0x1fc), | 1082 | netxen_nic_reg_write(adapter, NETXEN_CAM_RAM(0x1fc), |
1073 | NETXEN_BDINFO_MAGIC); | 1083 | NETXEN_BDINFO_MAGIC); |
1074 | return 0; | 1084 | return 0; |
@@ -1087,6 +1097,12 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
1087 | goto request_fw; | 1097 | goto request_fw; |
1088 | } | 1098 | } |
1089 | 1099 | ||
1100 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
1101 | fw_name = NX_P3_CT_ROMIMAGE; | ||
1102 | goto request_fw; | ||
1103 | } | ||
1104 | |||
1105 | request_mn: | ||
1090 | capability = 0; | 1106 | capability = 0; |
1091 | 1107 | ||
1092 | netxen_rom_fast_read(adapter, | 1108 | netxen_rom_fast_read(adapter, |
@@ -1100,15 +1116,12 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
1100 | } | 1116 | } |
1101 | } | 1117 | } |
1102 | 1118 | ||
1103 | request_ct: | ||
1104 | fw_name = NX_P3_CT_ROMIMAGE; | ||
1105 | |||
1106 | request_fw: | 1119 | request_fw: |
1107 | rc = request_firmware(&fw, fw_name, &pdev->dev); | 1120 | rc = request_firmware(&fw, fw_name, &pdev->dev); |
1108 | if (rc != 0) { | 1121 | if (rc != 0) { |
1109 | if (fw_name == NX_P3_MN_ROMIMAGE) { | 1122 | if (fw_name == NX_P3_CT_ROMIMAGE) { |
1110 | msleep(1); | 1123 | msleep(1); |
1111 | goto request_ct; | 1124 | goto request_mn; |
1112 | } | 1125 | } |
1113 | 1126 | ||
1114 | fw = NULL; | 1127 | fw = NULL; |
@@ -1119,9 +1132,9 @@ request_fw: | |||
1119 | if (rc != 0) { | 1132 | if (rc != 0) { |
1120 | release_firmware(fw); | 1133 | release_firmware(fw); |
1121 | 1134 | ||
1122 | if (fw_name == NX_P3_MN_ROMIMAGE) { | 1135 | if (fw_name == NX_P3_CT_ROMIMAGE) { |
1123 | msleep(1); | 1136 | msleep(1); |
1124 | goto request_ct; | 1137 | goto request_mn; |
1125 | } | 1138 | } |
1126 | 1139 | ||
1127 | fw = NULL; | 1140 | fw = NULL; |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 0ce7cf0dc99c..dfd66eaed1aa 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -676,16 +676,17 @@ netxen_start_firmware(struct netxen_adapter *adapter) | |||
676 | return err; | 676 | return err; |
677 | } | 677 | } |
678 | 678 | ||
679 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
680 | netxen_set_port_mode(adapter); | ||
681 | |||
682 | if (first_boot != 0x55555555) { | 679 | if (first_boot != 0x55555555) { |
683 | adapter->pci_write_normalize(adapter, | 680 | adapter->pci_write_normalize(adapter, |
684 | CRB_CMDPEG_STATE, 0); | 681 | CRB_CMDPEG_STATE, 0); |
685 | netxen_pinit_from_rom(adapter, 0); | 682 | netxen_pinit_from_rom(adapter, 0); |
686 | msleep(1); | 683 | msleep(1); |
687 | } | 684 | } |
685 | |||
688 | netxen_nic_reg_write(adapter, CRB_DMA_SHIFT, 0x55555555); | 686 | netxen_nic_reg_write(adapter, CRB_DMA_SHIFT, 0x55555555); |
687 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
688 | netxen_set_port_mode(adapter); | ||
689 | |||
689 | netxen_load_firmware(adapter); | 690 | netxen_load_firmware(adapter); |
690 | 691 | ||
691 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 692 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |