diff options
author | Hariprasad Shenai <hariprasad@chelsio.com> | 2014-10-14 16:24:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-14 16:55:06 -0400 |
commit | 22c0b963d7400971f4c5a1a67b083e3742996640 (patch) | |
tree | fe295e10c677b0a2d51afd4ceaef3c042fae45ab /drivers/net | |
parent | 6e36145d4ec754f4a8ce9d6912ca4d82ffb6ae3f (diff) |
cxgb4: Fix FW flash logic using ethtool
Use t4_fw_upgrade instead of t4_load_fw to write firmware into FLASH, since
t4_load_fw doesn't co-ordinate with the firmware and the adapter can get hosed
enough to require a power cycle of the system.
Based on original work by Casey Leedom <leedom@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 14 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 6 |
3 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 410ed5805a9a..3c481b260745 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -986,6 +986,8 @@ static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, | |||
986 | int t4_seeprom_wp(struct adapter *adapter, bool enable); | 986 | int t4_seeprom_wp(struct adapter *adapter, bool enable); |
987 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p); | 987 | int get_vpd_params(struct adapter *adapter, struct vpd_params *p); |
988 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); | 988 | int t4_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size); |
989 | int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, | ||
990 | const u8 *fw_data, unsigned int size, int force); | ||
989 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); | 991 | unsigned int t4_flash_cfg_addr(struct adapter *adapter); |
990 | int t4_get_fw_version(struct adapter *adapter, u32 *vers); | 992 | int t4_get_fw_version(struct adapter *adapter, u32 *vers); |
991 | int t4_get_tp_version(struct adapter *adapter, u32 *vers); | 993 | int t4_get_tp_version(struct adapter *adapter, u32 *vers); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 5b38e955af6e..fed8f26ee67b 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -2929,16 +2929,26 @@ static int set_flash(struct net_device *netdev, struct ethtool_flash *ef) | |||
2929 | int ret; | 2929 | int ret; |
2930 | const struct firmware *fw; | 2930 | const struct firmware *fw; |
2931 | struct adapter *adap = netdev2adap(netdev); | 2931 | struct adapter *adap = netdev2adap(netdev); |
2932 | unsigned int mbox = FW_PCIE_FW_MASTER_MASK + 1; | ||
2932 | 2933 | ||
2933 | ef->data[sizeof(ef->data) - 1] = '\0'; | 2934 | ef->data[sizeof(ef->data) - 1] = '\0'; |
2934 | ret = request_firmware(&fw, ef->data, adap->pdev_dev); | 2935 | ret = request_firmware(&fw, ef->data, adap->pdev_dev); |
2935 | if (ret < 0) | 2936 | if (ret < 0) |
2936 | return ret; | 2937 | return ret; |
2937 | 2938 | ||
2938 | ret = t4_load_fw(adap, fw->data, fw->size); | 2939 | /* If the adapter has been fully initialized then we'll go ahead and |
2940 | * try to get the firmware's cooperation in upgrading to the new | ||
2941 | * firmware image otherwise we'll try to do the entire job from the | ||
2942 | * host ... and we always "force" the operation in this path. | ||
2943 | */ | ||
2944 | if (adap->flags & FULL_INIT_DONE) | ||
2945 | mbox = adap->mbox; | ||
2946 | |||
2947 | ret = t4_fw_upgrade(adap, mbox, fw->data, fw->size, 1); | ||
2939 | release_firmware(fw); | 2948 | release_firmware(fw); |
2940 | if (!ret) | 2949 | if (!ret) |
2941 | dev_info(adap->pdev_dev, "loaded firmware %s\n", ef->data); | 2950 | dev_info(adap->pdev_dev, "loaded firmware %s," |
2951 | " reload cxgb4 driver\n", ef->data); | ||
2942 | return ret; | 2952 | return ret; |
2943 | } | 2953 | } |
2944 | 2954 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 1fff1495fe31..a9d9d74e4f09 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include "t4_regs.h" | 37 | #include "t4_regs.h" |
38 | #include "t4fw_api.h" | 38 | #include "t4fw_api.h" |
39 | 39 | ||
40 | static int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, | ||
41 | const u8 *fw_data, unsigned int size, int force); | ||
42 | /** | 40 | /** |
43 | * t4_wait_op_done_val - wait until an operation is completed | 41 | * t4_wait_op_done_val - wait until an operation is completed |
44 | * @adapter: the adapter performing the operation | 42 | * @adapter: the adapter performing the operation |
@@ -3076,8 +3074,8 @@ static int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) | |||
3076 | * positive errno indicates that the adapter is ~probably~ intact, a | 3074 | * positive errno indicates that the adapter is ~probably~ intact, a |
3077 | * negative errno indicates that things are looking bad ... | 3075 | * negative errno indicates that things are looking bad ... |
3078 | */ | 3076 | */ |
3079 | static int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, | 3077 | int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, |
3080 | const u8 *fw_data, unsigned int size, int force) | 3078 | const u8 *fw_data, unsigned int size, int force) |
3081 | { | 3079 | { |
3082 | const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; | 3080 | const struct fw_hdr *fw_hdr = (const struct fw_hdr *)fw_data; |
3083 | int reset, ret; | 3081 | int reset, ret; |