aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/brocade
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2012-02-01 10:02:41 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-01 23:11:59 -0500
commit57b9bef0d6990d088a5e840c88ae137d8e76202c (patch)
tree8a1a1acacfaa672ce7f7c14b40b7bd68114b5db1 /drivers/net/ethernet/brocade
parent7161c76f0def54f5dc7fd9a5534bb3e3e2b2aa60 (diff)
bna: Implement ethtool flash_device entry point.
Incorporated review comments from Ben Hutchings. Change details: - Implement ethtool flash_device() entry point to write the firmware image to the flash firmware partition. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Reviewed-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/brocade')
-rw-r--r--drivers/net/ethernet/brocade/bna/bfa_defs.h1
-rw-r--r--drivers/net/ethernet/brocade/bna/bnad_ethtool.c42
2 files changed, 43 insertions, 0 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bfa_defs.h b/drivers/net/ethernet/brocade/bna/bfa_defs.h
index 871c6309334c..48f877337390 100644
--- a/drivers/net/ethernet/brocade/bna/bfa_defs.h
+++ b/drivers/net/ethernet/brocade/bna/bfa_defs.h
@@ -297,6 +297,7 @@ enum bfa_mode {
297#define BFA_FLASH_PART_ENTRY_SIZE 32 /* partition entry size */ 297#define BFA_FLASH_PART_ENTRY_SIZE 32 /* partition entry size */
298#define BFA_FLASH_PART_MAX 32 /* maximal # of partitions */ 298#define BFA_FLASH_PART_MAX 32 /* maximal # of partitions */
299#define BFA_TOTAL_FLASH_SIZE 0x400000 299#define BFA_TOTAL_FLASH_SIZE 0x400000
300#define BFA_FLASH_PART_FWIMG 2
300#define BFA_FLASH_PART_MFG 7 301#define BFA_FLASH_PART_MFG 7
301 302
302/* 303/*
diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
index 9b44ec8096ba..a27c601af3d1 100644
--- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
+++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
@@ -1072,6 +1072,47 @@ done:
1072 return ret; 1072 return ret;
1073} 1073}
1074 1074
1075static int
1076bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
1077{
1078 struct bnad *bnad = netdev_priv(netdev);
1079 struct bnad_iocmd_comp fcomp;
1080 const struct firmware *fw;
1081 int ret = 0;
1082
1083 ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev);
1084 if (ret) {
1085 pr_err("BNA: Can't locate firmware %s\n", eflash->data);
1086 goto out;
1087 }
1088
1089 fcomp.bnad = bnad;
1090 fcomp.comp_status = 0;
1091
1092 init_completion(&fcomp.comp);
1093 spin_lock_irq(&bnad->bna_lock);
1094 ret = bfa_nw_flash_update_part(&bnad->bna.flash, BFA_FLASH_PART_FWIMG,
1095 bnad->id, (u8 *)fw->data, fw->size, 0,
1096 bnad_cb_completion, &fcomp);
1097 if (ret != BFA_STATUS_OK) {
1098 pr_warn("BNA: Flash update failed with err: %d\n", ret);
1099 ret = -EIO;
1100 spin_unlock_irq(&bnad->bna_lock);
1101 goto out;
1102 }
1103
1104 spin_unlock_irq(&bnad->bna_lock);
1105 wait_for_completion(&fcomp.comp);
1106 if (fcomp.comp_status != BFA_STATUS_OK) {
1107 ret = -EIO;
1108 pr_warn("BNA: Firmware image update to flash failed with: %d\n",
1109 fcomp.comp_status);
1110 }
1111out:
1112 release_firmware(fw);
1113 return ret;
1114}
1115
1075static const struct ethtool_ops bnad_ethtool_ops = { 1116static const struct ethtool_ops bnad_ethtool_ops = {
1076 .get_settings = bnad_get_settings, 1117 .get_settings = bnad_get_settings,
1077 .set_settings = bnad_set_settings, 1118 .set_settings = bnad_set_settings,
@@ -1090,6 +1131,7 @@ static const struct ethtool_ops bnad_ethtool_ops = {
1090 .get_eeprom_len = bnad_get_eeprom_len, 1131 .get_eeprom_len = bnad_get_eeprom_len,
1091 .get_eeprom = bnad_get_eeprom, 1132 .get_eeprom = bnad_get_eeprom,
1092 .set_eeprom = bnad_set_eeprom, 1133 .set_eeprom = bnad_set_eeprom,
1134 .flash_device = bnad_flash_device,
1093}; 1135};
1094 1136
1095void 1137void