diff options
author | Inaky Perez-Gonzalez <inaky@linux.intel.com> | 2009-02-28 18:42:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-02 06:10:24 -0500 |
commit | 6a0f7ab8305cb60a43a6c4a548f57adab784e6cd (patch) | |
tree | 549aaceafa4e95e35050a6e98e8953afbbc1b1c8 | |
parent | efa05d0f0a723642fd0d88bb97b0f31800a3f716 (diff) |
wimax/i2400m: firmware_check() encodes the firmware version in i2400m->fw_version
Upcoming modifications will need to test for the running firmware
version before activating a feature or not. This is helpful to
implement backward compatibility with older firmware versions.
Modify i2400m_firmware_check() to encode in i2400m->fw_version the
major and minor version numbers of the firmware interface.
As well, move the call to be done as the very first operation once we
have communication with the device during probe() [in
__i2400m_dev_start()]. This is needed so any operation that is
executed afterwards can determine which fw version it is talking to.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wimax/i2400m/control.c | 12 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/driver.c | 5 | ||||
-rw-r--r-- | drivers/net/wimax/i2400m/i2400m.h | 4 |
3 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/wimax/i2400m/control.c b/drivers/net/wimax/i2400m/control.c index ac8fb6d07e61..c8b3a68b72b8 100644 --- a/drivers/net/wimax/i2400m/control.c +++ b/drivers/net/wimax/i2400m/control.c | |||
@@ -52,7 +52,6 @@ | |||
52 | * | 52 | * |
53 | * i2400m_dev_initalize() Called by i2400m_dev_start() | 53 | * i2400m_dev_initalize() Called by i2400m_dev_start() |
54 | * i2400m_set_init_config() | 54 | * i2400m_set_init_config() |
55 | * i2400m_firmware_check() | ||
56 | * i2400m_cmd_get_state() | 55 | * i2400m_cmd_get_state() |
57 | * i2400m_dev_shutdown() Called by i2400m_dev_stop() | 56 | * i2400m_dev_shutdown() Called by i2400m_dev_stop() |
58 | * i2400m->bus_reset() | 57 | * i2400m->bus_reset() |
@@ -959,6 +958,10 @@ enum { | |||
959 | * Long function, but quite simple; first chunk launches the command | 958 | * Long function, but quite simple; first chunk launches the command |
960 | * and double checks the reply for the right TLV. Then we process the | 959 | * and double checks the reply for the right TLV. Then we process the |
961 | * TLV (where the meat is). | 960 | * TLV (where the meat is). |
961 | * | ||
962 | * Once we process the TLV that gives us the firmware's interface | ||
963 | * version, we encode it and save it in i2400m->fw_version for future | ||
964 | * reference. | ||
962 | */ | 965 | */ |
963 | int i2400m_firmware_check(struct i2400m *i2400m) | 966 | int i2400m_firmware_check(struct i2400m *i2400m) |
964 | { | 967 | { |
@@ -1018,9 +1021,11 @@ int i2400m_firmware_check(struct i2400m *i2400m) | |||
1018 | if (minor < I2400M_HDIv_MINOR_2 && minor > I2400M_HDIv_MINOR) | 1021 | if (minor < I2400M_HDIv_MINOR_2 && minor > I2400M_HDIv_MINOR) |
1019 | dev_warn(dev, "untested minor fw version %u.%u.%u\n", | 1022 | dev_warn(dev, "untested minor fw version %u.%u.%u\n", |
1020 | major, minor, branch); | 1023 | major, minor, branch); |
1021 | error_bad_major: | 1024 | /* Yes, we ignore the branch -- we don't have to track it */ |
1025 | i2400m->fw_version = major << 16 | minor; | ||
1022 | dev_info(dev, "firmware interface version %u.%u.%u\n", | 1026 | dev_info(dev, "firmware interface version %u.%u.%u\n", |
1023 | major, minor, branch); | 1027 | major, minor, branch); |
1028 | error_bad_major: | ||
1024 | error_no_tlv: | 1029 | error_no_tlv: |
1025 | error_cmd_failed: | 1030 | error_cmd_failed: |
1026 | kfree_skb(ack_skb); | 1031 | kfree_skb(ack_skb); |
@@ -1251,9 +1256,6 @@ int i2400m_dev_initialize(struct i2400m *i2400m) | |||
1251 | result = i2400m_set_init_config(i2400m, args, argc); | 1256 | result = i2400m_set_init_config(i2400m, args, argc); |
1252 | if (result < 0) | 1257 | if (result < 0) |
1253 | goto error; | 1258 | goto error; |
1254 | result = i2400m_firmware_check(i2400m); /* fw versions ok? */ | ||
1255 | if (result < 0) | ||
1256 | goto error; | ||
1257 | /* | 1259 | /* |
1258 | * Update state: Here it just calls a get state; parsing the | 1260 | * Update state: Here it just calls a get state; parsing the |
1259 | * result (System State TLV and RF Status TLV [done in the rx | 1261 | * result (System State TLV and RF Status TLV [done in the rx |
diff --git a/drivers/net/wimax/i2400m/driver.c b/drivers/net/wimax/i2400m/driver.c index e80a0b65a754..69a816e7c5db 100644 --- a/drivers/net/wimax/i2400m/driver.c +++ b/drivers/net/wimax/i2400m/driver.c | |||
@@ -48,6 +48,7 @@ | |||
48 | * i2400m_dev_bootstrap() | 48 | * i2400m_dev_bootstrap() |
49 | * i2400m_tx_setup() | 49 | * i2400m_tx_setup() |
50 | * i2400m->bus_dev_start() | 50 | * i2400m->bus_dev_start() |
51 | * i2400m_firmware_check() | ||
51 | * i2400m_check_mac_addr() | 52 | * i2400m_check_mac_addr() |
52 | * wimax_dev_add() | 53 | * wimax_dev_add() |
53 | * | 54 | * |
@@ -404,6 +405,9 @@ retry: | |||
404 | dev_err(dev, "cannot create workqueue\n"); | 405 | dev_err(dev, "cannot create workqueue\n"); |
405 | goto error_create_workqueue; | 406 | goto error_create_workqueue; |
406 | } | 407 | } |
408 | result = i2400m_firmware_check(i2400m); /* fw versions ok? */ | ||
409 | if (result < 0) | ||
410 | goto error_fw_check; | ||
407 | /* At this point is ok to send commands to the device */ | 411 | /* At this point is ok to send commands to the device */ |
408 | result = i2400m_check_mac_addr(i2400m); | 412 | result = i2400m_check_mac_addr(i2400m); |
409 | if (result < 0) | 413 | if (result < 0) |
@@ -421,6 +425,7 @@ retry: | |||
421 | 425 | ||
422 | error_dev_initialize: | 426 | error_dev_initialize: |
423 | error_check_mac_addr: | 427 | error_check_mac_addr: |
428 | error_fw_check: | ||
424 | destroy_workqueue(i2400m->work_queue); | 429 | destroy_workqueue(i2400m->work_queue); |
425 | error_create_workqueue: | 430 | error_create_workqueue: |
426 | i2400m->bus_dev_stop(i2400m); | 431 | i2400m->bus_dev_stop(i2400m); |
diff --git a/drivers/net/wimax/i2400m/i2400m.h b/drivers/net/wimax/i2400m/i2400m.h index ad71ad1086ea..5008cdb12b42 100644 --- a/drivers/net/wimax/i2400m/i2400m.h +++ b/drivers/net/wimax/i2400m/i2400m.h | |||
@@ -366,6 +366,9 @@ struct i2400m_reset_ctx; | |||
366 | * module unloads, as we don't keep each dentry. | 366 | * module unloads, as we don't keep each dentry. |
367 | * | 367 | * |
368 | * @fw_name: name of the firmware image that is currently being used. | 368 | * @fw_name: name of the firmware image that is currently being used. |
369 | * | ||
370 | * @fw_version: version of the firmware interface, Major.minor, | ||
371 | * encoded in the high word and low word (major << 16 | minor). | ||
369 | */ | 372 | */ |
370 | struct i2400m { | 373 | struct i2400m { |
371 | struct wimax_dev wimax_dev; /* FIRST! See doc */ | 374 | struct wimax_dev wimax_dev; /* FIRST! See doc */ |
@@ -424,6 +427,7 @@ struct i2400m { | |||
424 | 427 | ||
425 | struct dentry *debugfs_dentry; | 428 | struct dentry *debugfs_dentry; |
426 | const char *fw_name; /* name of the current firmware image */ | 429 | const char *fw_name; /* name of the current firmware image */ |
430 | unsigned long fw_version; /* version of the firmware interface */ | ||
427 | }; | 431 | }; |
428 | 432 | ||
429 | 433 | ||