aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/benet/be_cmds.c
diff options
context:
space:
mode:
authorAjit Khaparde <ajitk@serverengines.com>2009-09-03 23:12:16 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-07 04:56:38 -0400
commit84517482e19bc775de7b3b4e998dee2f506bc34e (patch)
treeae3491a5cf8891feef8c2896ef50758d763646f2 /drivers/net/benet/be_cmds.c
parent384824281caa9ac4b76664033416f1eac4a652fe (diff)
be2net: Changes to support flashing of the be2 network adapter
Changes to support flashing of the be2 network adapter using the request_firmware() & ethtool infrastructure. The trigger to flash the device will come from ethtool utility. The driver will invoke request_firmware() to start the flash process. The file containing the flash image is expected to be available in /lib/firmware/ Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r--drivers/net/benet/be_cmds.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 2547ee296a7d..1db092498309 100644
--- a/drivers/net/benet/be_cmds.c
+++ b/drivers/net/benet/be_cmds.c
@@ -155,7 +155,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db)
155 if (ready) 155 if (ready)
156 break; 156 break;
157 157
158 if (cnt > 200000) { 158 if (cnt > 4000000) {
159 dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); 159 dev_err(&adapter->pdev->dev, "mbox poll timed out\n");
160 return -1; 160 return -1;
161 } 161 }
@@ -1040,3 +1040,31 @@ int be_cmd_reset_function(struct be_adapter *adapter)
1040 spin_unlock(&adapter->mbox_lock); 1040 spin_unlock(&adapter->mbox_lock);
1041 return status; 1041 return status;
1042} 1042}
1043
1044int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
1045 u32 flash_type, u32 flash_opcode, u32 buf_size)
1046{
1047 struct be_mcc_wrb *wrb = wrb_from_mbox(&adapter->mbox_mem);
1048 struct be_cmd_write_flashrom *req = cmd->va;
1049 struct be_sge *sge = nonembedded_sgl(wrb);
1050 int status;
1051
1052 spin_lock(&adapter->mbox_lock);
1053 memset(wrb, 0, sizeof(*wrb));
1054 be_wrb_hdr_prepare(wrb, cmd->size, false, 1);
1055
1056 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
1057 OPCODE_COMMON_WRITE_FLASHROM, cmd->size);
1058 sge->pa_hi = cpu_to_le32(upper_32_bits(cmd->dma));
1059 sge->pa_lo = cpu_to_le32(cmd->dma & 0xFFFFFFFF);
1060 sge->len = cpu_to_le32(cmd->size);
1061
1062 req->params.op_type = cpu_to_le32(flash_type);
1063 req->params.op_code = cpu_to_le32(flash_opcode);
1064 req->params.data_buf_size = cpu_to_le32(buf_size);
1065
1066 status = be_mbox_notify(adapter);
1067
1068 spin_unlock(&adapter->mbox_lock);
1069 return status;
1070}