aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2008-12-16 04:51:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-16 04:51:47 -0500
commit8207befa199c9ade670d1cf9a5bcdc76310751bd (patch)
tree4ba183ae8406744f5c37f9e1fd740948a0ba678a /drivers/net/cxgb3
parent5ad258c0a85a7cc03c46874e8a26c7e9b4dfb90d (diff)
cxgb3: untie strict FW matching
The NIC driver can work with mutliple versions of the FW. Let the driver load when the embedded FW does not match, and the FW update mechanism failed. The iWARP module will make its own loading decision. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3')
-rw-r--r--drivers/net/cxgb3/common.h4
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c15
-rw-r--r--drivers/net/cxgb3/t3_hw.c26
3 files changed, 15 insertions, 30 deletions
diff --git a/drivers/net/cxgb3/common.h b/drivers/net/cxgb3/common.h
index e312d315a42d..db4f4f575b6a 100644
--- a/drivers/net/cxgb3/common.h
+++ b/drivers/net/cxgb3/common.h
@@ -714,7 +714,7 @@ int t3_seeprom_read(struct adapter *adapter, u32 addr, __le32 *data);
714int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data); 714int t3_seeprom_write(struct adapter *adapter, u32 addr, __le32 data);
715int t3_seeprom_wp(struct adapter *adapter, int enable); 715int t3_seeprom_wp(struct adapter *adapter, int enable);
716int t3_get_tp_version(struct adapter *adapter, u32 *vers); 716int t3_get_tp_version(struct adapter *adapter, u32 *vers);
717int t3_check_tpsram_version(struct adapter *adapter, int *must_load); 717int t3_check_tpsram_version(struct adapter *adapter);
718int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram, 718int t3_check_tpsram(struct adapter *adapter, const u8 *tp_ram,
719 unsigned int size); 719 unsigned int size);
720int t3_set_proto_sram(struct adapter *adap, const u8 *data); 720int t3_set_proto_sram(struct adapter *adap, const u8 *data);
@@ -722,7 +722,7 @@ int t3_read_flash(struct adapter *adapter, unsigned int addr,
722 unsigned int nwords, u32 *data, int byte_oriented); 722 unsigned int nwords, u32 *data, int byte_oriented);
723int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size); 723int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size);
724int t3_get_fw_version(struct adapter *adapter, u32 *vers); 724int t3_get_fw_version(struct adapter *adapter, u32 *vers);
725int t3_check_fw_version(struct adapter *adapter, int *must_load); 725int t3_check_fw_version(struct adapter *adapter);
726int t3_init_hw(struct adapter *adapter, u32 fw_params); 726int t3_init_hw(struct adapter *adapter, u32 fw_params);
727void mac_prep(struct cmac *mac, struct adapter *adapter, int index); 727void mac_prep(struct cmac *mac, struct adapter *adapter, int index);
728void early_hw_init(struct adapter *adapter, const struct adapter_info *ai); 728void early_hw_init(struct adapter *adapter, const struct adapter_info *ai);
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 9e8727c5eced..2847f947499d 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -958,21 +958,22 @@ release_tpsram:
958static int cxgb_up(struct adapter *adap) 958static int cxgb_up(struct adapter *adap)
959{ 959{
960 int err; 960 int err;
961 int must_load;
962 961
963 if (!(adap->flags & FULL_INIT_DONE)) { 962 if (!(adap->flags & FULL_INIT_DONE)) {
964 err = t3_check_fw_version(adap, &must_load); 963 err = t3_check_fw_version(adap);
965 if (err == -EINVAL) { 964 if (err == -EINVAL) {
966 err = upgrade_fw(adap); 965 err = upgrade_fw(adap);
967 if (err && must_load) 966 CH_WARN(adap, "FW upgrade to %d.%d.%d %s\n",
968 goto out; 967 FW_VERSION_MAJOR, FW_VERSION_MINOR,
968 FW_VERSION_MICRO, err ? "failed" : "succeeded");
969 } 969 }
970 970
971 err = t3_check_tpsram_version(adap, &must_load); 971 err = t3_check_tpsram_version(adap);
972 if (err == -EINVAL) { 972 if (err == -EINVAL) {
973 err = update_tpsram(adap); 973 err = update_tpsram(adap);
974 if (err && must_load) 974 CH_WARN(adap, "TP upgrade to %d.%d.%d %s\n",
975 goto out; 975 TP_VERSION_MAJOR, TP_VERSION_MINOR,
976 TP_VERSION_MICRO, err ? "failed" : "succeeded");
976 } 977 }
977 978
978 /* 979 /*
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index 9a0898b0dbce..2d1433077a8e 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -925,11 +925,10 @@ int t3_get_tp_version(struct adapter *adapter, u32 *vers)
925/** 925/**
926 * t3_check_tpsram_version - read the tp sram version 926 * t3_check_tpsram_version - read the tp sram version
927 * @adapter: the adapter 927 * @adapter: the adapter
928 * @must_load: set to 1 if loading a new microcode image is required
929 * 928 *
930 * Reads the protocol sram version from flash. 929 * Reads the protocol sram version from flash.
931 */ 930 */
932int t3_check_tpsram_version(struct adapter *adapter, int *must_load) 931int t3_check_tpsram_version(struct adapter *adapter)
933{ 932{
934 int ret; 933 int ret;
935 u32 vers; 934 u32 vers;
@@ -938,7 +937,6 @@ int t3_check_tpsram_version(struct adapter *adapter, int *must_load)
938 if (adapter->params.rev == T3_REV_A) 937 if (adapter->params.rev == T3_REV_A)
939 return 0; 938 return 0;
940 939
941 *must_load = 1;
942 940
943 ret = t3_get_tp_version(adapter, &vers); 941 ret = t3_get_tp_version(adapter, &vers);
944 if (ret) 942 if (ret)
@@ -949,13 +947,7 @@ int t3_check_tpsram_version(struct adapter *adapter, int *must_load)
949 947
950 if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR) 948 if (major == TP_VERSION_MAJOR && minor == TP_VERSION_MINOR)
951 return 0; 949 return 0;
952
953 if (major != TP_VERSION_MAJOR)
954 CH_ERR(adapter, "found wrong TP version (%u.%u), "
955 "driver needs version %d.%d\n", major, minor,
956 TP_VERSION_MAJOR, TP_VERSION_MINOR);
957 else { 950 else {
958 *must_load = 0;
959 CH_ERR(adapter, "found wrong TP version (%u.%u), " 951 CH_ERR(adapter, "found wrong TP version (%u.%u), "
960 "driver compiled for version %d.%d\n", major, minor, 952 "driver compiled for version %d.%d\n", major, minor,
961 TP_VERSION_MAJOR, TP_VERSION_MINOR); 953 TP_VERSION_MAJOR, TP_VERSION_MINOR);
@@ -1012,18 +1004,16 @@ int t3_get_fw_version(struct adapter *adapter, u32 *vers)
1012/** 1004/**
1013 * t3_check_fw_version - check if the FW is compatible with this driver 1005 * t3_check_fw_version - check if the FW is compatible with this driver
1014 * @adapter: the adapter 1006 * @adapter: the adapter
1015 * @must_load: set to 1 if loading a new FW image is required 1007 *
1016
1017 * Checks if an adapter's FW is compatible with the driver. Returns 0 1008 * Checks if an adapter's FW is compatible with the driver. Returns 0
1018 * if the versions are compatible, a negative error otherwise. 1009 * if the versions are compatible, a negative error otherwise.
1019 */ 1010 */
1020int t3_check_fw_version(struct adapter *adapter, int *must_load) 1011int t3_check_fw_version(struct adapter *adapter)
1021{ 1012{
1022 int ret; 1013 int ret;
1023 u32 vers; 1014 u32 vers;
1024 unsigned int type, major, minor; 1015 unsigned int type, major, minor;
1025 1016
1026 *must_load = 1;
1027 ret = t3_get_fw_version(adapter, &vers); 1017 ret = t3_get_fw_version(adapter, &vers);
1028 if (ret) 1018 if (ret)
1029 return ret; 1019 return ret;
@@ -1035,17 +1025,11 @@ int t3_check_fw_version(struct adapter *adapter, int *must_load)
1035 if (type == FW_VERSION_T3 && major == FW_VERSION_MAJOR && 1025 if (type == FW_VERSION_T3 && major == FW_VERSION_MAJOR &&
1036 minor == FW_VERSION_MINOR) 1026 minor == FW_VERSION_MINOR)
1037 return 0; 1027 return 0;
1038 1028 else if (major != FW_VERSION_MAJOR || minor < FW_VERSION_MINOR)
1039 if (major != FW_VERSION_MAJOR)
1040 CH_ERR(adapter, "found wrong FW version(%u.%u), "
1041 "driver needs version %u.%u\n", major, minor,
1042 FW_VERSION_MAJOR, FW_VERSION_MINOR);
1043 else if (minor < FW_VERSION_MINOR) {
1044 *must_load = 0;
1045 CH_WARN(adapter, "found old FW minor version(%u.%u), " 1029 CH_WARN(adapter, "found old FW minor version(%u.%u), "
1046 "driver compiled for version %u.%u\n", major, minor, 1030 "driver compiled for version %u.%u\n", major, minor,
1047 FW_VERSION_MAJOR, FW_VERSION_MINOR); 1031 FW_VERSION_MAJOR, FW_VERSION_MINOR);
1048 } else { 1032 else {
1049 CH_WARN(adapter, "found newer FW version(%u.%u), " 1033 CH_WARN(adapter, "found newer FW version(%u.%u), "
1050 "driver compiled for version %u.%u\n", major, minor, 1034 "driver compiled for version %u.%u\n", major, minor,
1051 FW_VERSION_MAJOR, FW_VERSION_MINOR); 1035 FW_VERSION_MAJOR, FW_VERSION_MINOR);