summaryrefslogtreecommitdiff
path: root/drivers/net/wwan/iosm/iosm_ipc_flash.c
diff options
context:
space:
mode:
authorM Chetan Kumar <m.chetan.kumar@linux.intel.com>2021-09-21 19:47:36 +0300
committerDavid S. Miller <davem@davemloft.net>2021-09-22 16:23:33 +0300
commit8bea96efa7c0c57dc0c9ec4518ed61e3d5e9261c (patch)
tree8c8c530a903dea5bc10e3d930785b1461da66307 /drivers/net/wwan/iosm/iosm_ipc_flash.c
parenta5df6333f1a08380c3b94a02105482263711ed3a (diff)
downloadlinux-8bea96efa7c0c57dc0c9ec4518ed61e3d5e9261c.tar.xz
net: wwan: iosm: fw flashing and cd improvements
1> Function comments moved to .c file. 2> Use literals in return to improve readability. 3> Do error handling check instead of success check. 4> Redundant ret assignment removed. Signed-off-by: M Chetan Kumar <m.chetan.kumar@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wwan/iosm/iosm_ipc_flash.c')
-rw-r--r--drivers/net/wwan/iosm/iosm_ipc_flash.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/drivers/net/wwan/iosm/iosm_ipc_flash.c b/drivers/net/wwan/iosm/iosm_ipc_flash.c
index 3d2f1ec6da00..ebceedf7c9f5 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_flash.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_flash.c
@@ -40,7 +40,6 @@ static int ipc_flash_proc_check_ebl_rsp(void *hdr_rsp, void *payload_rsp)
{
struct iosm_ebl_error *err_info = payload_rsp;
u16 *rsp_code = hdr_rsp;
- int res = 0;
u32 i;
if (*rsp_code == IOSM_EBL_RSP_BUFF) {
@@ -51,10 +50,10 @@ static int ipc_flash_proc_check_ebl_rsp(void *hdr_rsp, void *payload_rsp)
err_info->error[i].error_code);
}
}
- res = -EINVAL;
+ return -EINVAL;
}
- return res;
+ return 0;
}
/* Send data to the modem */
@@ -90,7 +89,12 @@ ipc_free_payload:
return ret;
}
-/* Allocate flash channel and read LER data from modem */
+/**
+ * ipc_flash_link_establish - Flash link establishment
+ * @ipc_imem: Pointer to struct iosm_imem
+ *
+ * Returns: 0 on success and failure value on error
+ */
int ipc_flash_link_establish(struct iosm_imem *ipc_imem)
{
u8 ler_data[IOSM_LER_RSP_SIZE];
@@ -109,6 +113,7 @@ int ipc_flash_link_establish(struct iosm_imem *ipc_imem)
if (bytes_read != IOSM_LER_RSP_SIZE)
goto devlink_read_fail;
+
return 0;
devlink_read_fail:
@@ -179,12 +184,16 @@ ipc_flash_send_rcv:
return ret;
}
-/* Set the capabilities for the EBL */
+/**
+ * ipc_flash_boot_set_capabilities - Set modem boot capabilities in flash
+ * @ipc_devlink: Pointer to devlink structure
+ * @mdm_rsp: Pointer to modem response buffer
+ *
+ * Returns: 0 on success and failure value on error
+ */
int ipc_flash_boot_set_capabilities(struct iosm_devlink *ipc_devlink,
u8 *mdm_rsp)
{
- int ret;
-
ipc_devlink->ebl_ctx.ebl_sw_info_version =
ipc_devlink->ebl_ctx.m_ebl_resp[EBL_RSP_SW_INFO_VER];
ipc_devlink->ebl_ctx.m_ebl_resp[EBL_SKIP_ERASE] = IOSM_CAP_NOT_ENHANCED;
@@ -205,10 +214,9 @@ int ipc_flash_boot_set_capabilities(struct iosm_devlink *ipc_devlink,
/* Write back the EBL capability to modem
* Request Set Protcnf command
*/
- ret = ipc_flash_send_receive(ipc_devlink, FLASH_SET_PROT_CONF,
+ return ipc_flash_send_receive(ipc_devlink, FLASH_SET_PROT_CONF,
ipc_devlink->ebl_ctx.m_ebl_resp,
IOSM_EBL_RSP_SIZE, mdm_rsp);
- return ret;
}
/* Read the SWID type and SWID value from the EBL */
@@ -380,7 +388,14 @@ dl_region_fail:
return ret;
}
-/* Flash the individual fls files */
+/**
+ * ipc_flash_send_fls - Inject Modem subsystem fls file to device
+ * @ipc_devlink: Pointer to devlink structure
+ * @fw: FW image
+ * @mdm_rsp: Pointer to modem response buffer
+ *
+ * Returns: 0 on success and failure value on error
+ */
int ipc_flash_send_fls(struct iosm_devlink *ipc_devlink,
const struct firmware *fw, u8 *mdm_rsp)
{
@@ -420,7 +435,13 @@ ipc_flash_err:
return ret;
}
-/* Inject RPSI */
+/**
+ * ipc_flash_boot_psi - Inject PSI image
+ * @ipc_devlink: Pointer to devlink structure
+ * @fw: FW image
+ *
+ * Returns: 0 on success and failure value on error
+ */
int ipc_flash_boot_psi(struct iosm_devlink *ipc_devlink,
const struct firmware *fw)
{
@@ -470,7 +491,13 @@ ipc_flash_psi_free:
return ret;
}
-/* Inject EBL */
+/**
+ * ipc_flash_boot_ebl - Inject EBL image
+ * @ipc_devlink: Pointer to devlink structure
+ * @fw: FW image
+ *
+ * Returns: 0 on success and failure value on error
+ */
int ipc_flash_boot_ebl(struct iosm_devlink *ipc_devlink,
const struct firmware *fw)
{