mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2026-01-27 12:35:36 +01:00
LF-14885: drivers: firmware: imx: se: add ele-get-fw-version
Adds a new API ELE_GET_FW_VERSION, to fetch the FW version and other misc. details. Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com> Acked-by: Jason Liu <jason.hui.liu@nxp.com>
This commit is contained in:
parent
934c85903f
commit
8406270373
|
|
@ -819,3 +819,58 @@ int ele_v2x_fw_authenticate(struct se_if_priv *priv, phys_addr_t addr)
|
|||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ele_get_fw_version(struct se_if_priv *priv, u32 *fw_ver_word,
|
||||
u32 *commit_sha1)
|
||||
{
|
||||
struct se_api_msg *tx_msg __free(kfree) = NULL;
|
||||
struct se_api_msg *rx_msg __free(kfree) = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (!priv) {
|
||||
ret = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
tx_msg = kzalloc(ELE_GET_FW_VERSION_REQ_SZ, GFP_KERNEL);
|
||||
if (!tx_msg) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rx_msg = kzalloc(ELE_GET_FW_VERSION_RSP_SZ, GFP_KERNEL);
|
||||
if (!rx_msg) {
|
||||
ret = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ret = se_fill_cmd_msg_hdr(priv,
|
||||
(struct se_msg_hdr *)&tx_msg->header,
|
||||
ELE_GET_FW_VERSION_REQ,
|
||||
ELE_GET_FW_VERSION_REQ_SZ,
|
||||
true);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
ret = ele_msg_send_rcv(priv->priv_dev_ctx,
|
||||
tx_msg,
|
||||
ELE_GET_FW_VERSION_REQ_SZ,
|
||||
rx_msg,
|
||||
ELE_GET_FW_VERSION_RSP_SZ);
|
||||
if (ret < 0)
|
||||
goto exit;
|
||||
|
||||
ret = se_val_rsp_hdr_n_status(priv,
|
||||
rx_msg,
|
||||
ELE_GET_FW_VERSION_REQ,
|
||||
ELE_GET_FW_VERSION_RSP_SZ,
|
||||
true);
|
||||
if (ret)
|
||||
goto exit;
|
||||
|
||||
*fw_ver_word = rx_msg->data[1];
|
||||
*commit_sha1 = rx_msg->data[2];
|
||||
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ struct ele_dev_info {
|
|||
#define ELE_IMEM_EXPORT 0x1
|
||||
#define ELE_IMEM_IMPORT 0x2
|
||||
|
||||
#define ELE_FW_GET_FWAUTH_REQ 0x02
|
||||
#define ELE_FW_AUTH_REQ_SZ 0x10
|
||||
#define ELE_FW_AUTH_RSP_MSG_SZ 0x08
|
||||
|
||||
#define ELE_FW_AUTH_REQ 0x02
|
||||
#define ELE_FW_AUTH_REQ_SZ 0x10
|
||||
#define ELE_FW_AUTH_RSP_MSG_SZ 0x08
|
||||
|
|
@ -116,6 +120,10 @@ struct ele_dev_info {
|
|||
#define ELE_V2X_FW_AUTH_REQ_SZ 0x10
|
||||
#define ELE_V2X_FW_AUTH_RSP_MSG_SZ 0x08
|
||||
|
||||
#define ELE_GET_FW_VERSION_REQ 0x9d
|
||||
#define ELE_GET_FW_VERSION_REQ_SZ 0x04
|
||||
#define ELE_GET_FW_VERSION_RSP_SZ 0x10
|
||||
|
||||
int ele_get_info(struct se_if_priv *priv, struct ele_dev_info *s_info);
|
||||
int ele_fetch_soc_info(struct se_if_priv *priv, void *data);
|
||||
int ele_ping(struct se_if_priv *priv);
|
||||
|
|
@ -132,5 +140,6 @@ int read_common_fuse(struct se_if_priv *priv,
|
|||
u16 fuse_id, u32 *value);
|
||||
int ele_get_v2x_fw_state(struct se_if_priv *priv, uint32_t *state);
|
||||
int ele_v2x_fw_authenticate(struct se_if_priv *priv, phys_addr_t addr);
|
||||
|
||||
int ele_get_fw_version(struct se_if_priv *priv, u32 *fw_ver_word,
|
||||
u32 *commit_sha1);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ struct se_var_info {
|
|||
u8 board_type;
|
||||
u16 soc_id;
|
||||
u16 soc_rev;
|
||||
u32 fw_vers_word;
|
||||
u32 commit_sha1;
|
||||
struct se_fw_load_info load_fw;
|
||||
};
|
||||
|
||||
|
|
@ -541,6 +543,20 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static bool runtime_fw_status(struct se_if_priv *priv)
|
||||
{
|
||||
/*
|
||||
* Initializing to false as not sure if
|
||||
* the run-time FW status can be fetched for the SoC.
|
||||
*/
|
||||
bool fw_prsnt_n_running = false;
|
||||
|
||||
if (get_se_soc_id(priv) == SOC_ID_OF_IMX95)
|
||||
fw_prsnt_n_running =
|
||||
(var_se_info.fw_vers_word & 0x1000000) ? true : false;
|
||||
|
||||
return fw_prsnt_n_running;
|
||||
}
|
||||
/*
|
||||
* get_se_soc_id() - to fetch the soc_id of the platform
|
||||
*
|
||||
|
|
@ -619,6 +635,11 @@ static int se_soc_info(struct se_if_priv *priv)
|
|||
if (var_se_info.soc_rev)
|
||||
return err;
|
||||
|
||||
err = ele_get_fw_version(priv, &var_se_info.fw_vers_word,
|
||||
&var_se_info.commit_sha1);
|
||||
if (err)
|
||||
dev_err(priv->dev, "Failed to fetch FW version");
|
||||
|
||||
if (info_list->se_fetch_soc_info) {
|
||||
err = info_list->se_fetch_soc_info(priv, &data);
|
||||
if (err < 0) {
|
||||
|
|
@ -752,6 +773,11 @@ static int se_load_firmware(struct se_if_priv *priv)
|
|||
|
||||
} while (se_img_file_to_load);
|
||||
|
||||
ret = ele_get_fw_version(priv, &var_se_info.fw_vers_word,
|
||||
&var_se_info.commit_sha1);
|
||||
if (ret)
|
||||
dev_err(priv->dev, "Failed to fetch FW version");
|
||||
|
||||
if (!ret)
|
||||
load_fw->is_fw_loaded = true;
|
||||
|
||||
|
|
@ -2024,7 +2050,7 @@ static int se_if_probe(struct platform_device *pdev)
|
|||
info_list->se_fw_img_nm.seco_fw_nm_in_rfs) {
|
||||
load_fw = get_load_fw_instance(priv);
|
||||
load_fw->se_fw_img_nm = &info_list->se_fw_img_nm;
|
||||
load_fw->is_fw_loaded = false;
|
||||
load_fw->is_fw_loaded = runtime_fw_status(priv);
|
||||
|
||||
if (info_list->se_fw_img_nm.prim_fw_nm_in_rfs) {
|
||||
/* allocate buffer where SE store encrypted IMEM */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user