aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2007-01-30 22:43:45 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-05 16:58:49 -0500
commit4aac38990843b4f165ccf467b772e18827bff84c (patch)
tree0143837e7200c6e8243fb2da7adaeebd448aafc3 /drivers/net
parentb9662d0e9ca3092e1473f27628fd60fa33b1a97a (diff)
cxgb3 - FW versioning
Clean up FW version checking. The supported FW version is now 3.1. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c15
-rw-r--r--drivers/net/cxgb3/firmware_exports.h27
-rw-r--r--drivers/net/cxgb3/t3_hw.c17
3 files changed, 47 insertions, 12 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 54c49acd86b4..804414637ec7 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -665,11 +665,8 @@ static int cxgb_up(struct adapter *adap)
665 665
666 if (!(adap->flags & FULL_INIT_DONE)) { 666 if (!(adap->flags & FULL_INIT_DONE)) {
667 err = t3_check_fw_version(adap); 667 err = t3_check_fw_version(adap);
668 if (err) { 668 if (err)
669 dev_err(&adap->pdev->dev,
670 "adapter FW is not compatible with driver\n");
671 goto out; 669 goto out;
672 }
673 670
674 err = init_dummy_netdevs(adap); 671 err = init_dummy_netdevs(adap);
675 if (err) 672 if (err)
@@ -1002,10 +999,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1002 strcpy(info->bus_info, pci_name(adapter->pdev)); 999 strcpy(info->bus_info, pci_name(adapter->pdev));
1003 if (!fw_vers) 1000 if (!fw_vers)
1004 strcpy(info->fw_version, "N/A"); 1001 strcpy(info->fw_version, "N/A");
1005 else 1002 else {
1006 snprintf(info->fw_version, sizeof(info->fw_version), 1003 snprintf(info->fw_version, sizeof(info->fw_version),
1007 "%s %u.%u", (fw_vers >> 24) ? "T" : "N", 1004 "%s %u.%u.%u",
1008 (fw_vers >> 12) & 0xfff, fw_vers & 0xfff); 1005 G_FW_VERSION_TYPE(fw_vers) ? "T" : "N",
1006 G_FW_VERSION_MAJOR(fw_vers),
1007 G_FW_VERSION_MINOR(fw_vers),
1008 G_FW_VERSION_MICRO(fw_vers));
1009 }
1009} 1010}
1010 1011
1011static void get_strings(struct net_device *dev, u32 stringset, u8 * data) 1012static void get_strings(struct net_device *dev, u32 stringset, u8 * data)
diff --git a/drivers/net/cxgb3/firmware_exports.h b/drivers/net/cxgb3/firmware_exports.h
index 3565f481801b..eea7d8940dc7 100644
--- a/drivers/net/cxgb3/firmware_exports.h
+++ b/drivers/net/cxgb3/firmware_exports.h
@@ -141,4 +141,31 @@
141#define FW_WRC_NUM \ 141#define FW_WRC_NUM \
142 (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM) 142 (65536 + FW_TUNNEL_NUM + FW_CTRL_NUM + FW_RI_NUM + FW_RX_PKT_NUM)
143 143
144/*
145 * FW type and version.
146 */
147#define S_FW_VERSION_TYPE 28
148#define M_FW_VERSION_TYPE 0xF
149#define V_FW_VERSION_TYPE(x) ((x) << S_FW_VERSION_TYPE)
150#define G_FW_VERSION_TYPE(x) \
151 (((x) >> S_FW_VERSION_TYPE) & M_FW_VERSION_TYPE)
152
153#define S_FW_VERSION_MAJOR 16
154#define M_FW_VERSION_MAJOR 0xFFF
155#define V_FW_VERSION_MAJOR(x) ((x) << S_FW_VERSION_MAJOR)
156#define G_FW_VERSION_MAJOR(x) \
157 (((x) >> S_FW_VERSION_MAJOR) & M_FW_VERSION_MAJOR)
158
159#define S_FW_VERSION_MINOR 8
160#define M_FW_VERSION_MINOR 0xFF
161#define V_FW_VERSION_MINOR(x) ((x) << S_FW_VERSION_MINOR)
162#define G_FW_VERSION_MINOR(x) \
163 (((x) >> S_FW_VERSION_MINOR) & M_FW_VERSION_MINOR)
164
165#define S_FW_VERSION_MICRO 0
166#define M_FW_VERSION_MICRO 0xFF
167#define V_FW_VERSION_MICRO(x) ((x) << S_FW_VERSION_MICRO)
168#define G_FW_VERSION_MICRO(x) \
169 (((x) >> S_FW_VERSION_MICRO) & M_FW_VERSION_MICRO)
170
144#endif /* _FIRMWARE_EXPORTS_H_ */ 171#endif /* _FIRMWARE_EXPORTS_H_ */
diff --git a/drivers/net/cxgb3/t3_hw.c b/drivers/net/cxgb3/t3_hw.c
index a4e2e57e1465..4545acb3a2d5 100644
--- a/drivers/net/cxgb3/t3_hw.c
+++ b/drivers/net/cxgb3/t3_hw.c
@@ -826,6 +826,11 @@ static int t3_write_flash(struct adapter *adapter, unsigned int addr,
826 return 0; 826 return 0;
827} 827}
828 828
829enum fw_version_type {
830 FW_VERSION_N3,
831 FW_VERSION_T3
832};
833
829/** 834/**
830 * t3_get_fw_version - read the firmware version 835 * t3_get_fw_version - read the firmware version
831 * @adapter: the adapter 836 * @adapter: the adapter
@@ -849,19 +854,21 @@ int t3_check_fw_version(struct adapter *adapter)
849{ 854{
850 int ret; 855 int ret;
851 u32 vers; 856 u32 vers;
857 unsigned int type, major, minor;
852 858
853 ret = t3_get_fw_version(adapter, &vers); 859 ret = t3_get_fw_version(adapter, &vers);
854 if (ret) 860 if (ret)
855 return ret; 861 return ret;
856 862
857 /* Minor 0xfff means the FW is an internal development-only version. */ 863 type = G_FW_VERSION_TYPE(vers);
858 if ((vers & 0xfff) == 0xfff) 864 major = G_FW_VERSION_MAJOR(vers);
859 return 0; 865 minor = G_FW_VERSION_MINOR(vers);
860 866
861 if (vers == 0x1002009) 867 if (type == FW_VERSION_T3 && major == 3 && minor == 1)
862 return 0; 868 return 0;
863 869
864 CH_ERR(adapter, "found wrong FW version, driver needs version 2.9\n"); 870 CH_ERR(adapter, "found wrong FW version(%u.%u), "
871 "driver needs version 3.1\n", major, minor);
865 return -EINVAL; 872 return -EINVAL;
866} 873}
867 874