summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorFranck LENORMAND <franck.lenormand@nxp.com>2019-10-09 10:27:43 +0200
committerYe Li <ye.li@nxp.com>2020-04-26 23:36:34 -0700
commit8f2a1e1901091c958baa15c1629742940991b035 (patch)
tree9dda6d0ad53f40492611a7546e081317d934d96d /drivers/misc
parent4e6ffa43820fab8a626b5b16cc700f9b945bcf43 (diff)
SSI-87: imx8: Configure SNVS
Add a module to configure the tamper and secure violation of the SNVS using the SCU API. The module also adds some commands: - snvs_cfg: Configure the SNVS HP and LP registers - snvs_dgo_cfg: Configure the SNVS DGO bloc if present (8QXP) - tamper_pin_cfg: Change the configuration of the tamper pins - snvs_clear_status: Allow to write to LPSR and LPTDSR to clear status bits Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com> (cherry picked from commit 75aa7f2254f0883aa14568ac32702b1ca15367e4) Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit 2f3804bdfe29a3c134a1753d6fa92881ea3e2b30)
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/imx8/scu_api.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index 972b132652d..577799b0a41 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -222,6 +222,36 @@ int sc_pad_set(sc_ipc_t ipc, sc_pad_t pad, u32 val)
return ret;
}
+int sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val)
+{
+ struct udevice *dev = gd->arch.scu_dev;
+ int size = sizeof(struct sc_rpc_msg_s);
+ struct sc_rpc_msg_s msg;
+ int ret;
+
+ if (!dev)
+ hang();
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 2U;
+ RPC_SVC(&msg) = (u8)(SC_RPC_SVC_PAD);
+ RPC_FUNC(&msg) = (u8)(PAD_FUNC_GET);
+
+ RPC_U16(&msg, 0U) = (u16)(pad);
+
+ ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+ if (ret)
+ printf("%s: pad:%d: res:%d\n",
+ __func__, pad, RPC_R8(&msg));
+
+ if (val != NULL)
+ {
+ *val = (uint32_t) RPC_U32(&msg, 0U);
+ }
+
+ return ret;
+}
+
/* MISC */
int sc_misc_set_control(sc_ipc_t ipc, sc_rsrc_t resource,
sc_ctrl_t ctrl, u32 val)
@@ -1103,3 +1133,40 @@ int sc_seco_get_mp_sign(sc_ipc_t ipc, sc_faddr_t msg_addr,
return ret;
}
+
+int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access,
+ u32 *data0, u32 *data1, u32 *data2, u32 *data3,
+ u32 *data4, u8 size)
+{
+ struct udevice *dev = gd->arch.scu_dev;
+ struct sc_rpc_msg_s msg;
+ int msg_size = sizeof(struct sc_rpc_msg_s);
+ int ret;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SIZE(&msg) = 7U;
+ RPC_SVC(&msg) = (u8)(SC_RPC_SVC_SECO);
+ RPC_FUNC(&msg) = (u8)(SECO_FUNC_SECVIO_CONFIG);
+
+ RPC_U32(&msg, 0U) = (u32)(*data0);
+ RPC_U32(&msg, 4U) = (u32)(*data1);
+ RPC_U32(&msg, 8U) = (u32)(*data2);
+ RPC_U32(&msg, 12U) = (u32)(*data3);
+ RPC_U32(&msg, 16U) = (u32)(*data4);
+ RPC_U8(&msg, 20U) = (u8)(id);
+ RPC_U8(&msg, 21U) = (u8)(access);
+ RPC_U8(&msg, 22U) = (u8)(size);
+
+ ret = misc_call(dev, SC_FALSE, &msg, msg_size, &msg, msg_size);
+ if (ret)
+ printf("%s, id:0x%x, access:%x, res:%d\n",
+ __func__, id, access, RPC_R8(&msg));
+
+ *data0 = (u32) RPC_U32(&msg, 0U);
+ *data1 = (u32) RPC_U32(&msg, 4U);
+ *data2 = (u32) RPC_U32(&msg, 8U);
+ *data3 = (u32) RPC_U32(&msg, 12U);
+ *data4 = (u32) RPC_U32(&msg, 16U);
+
+ return ret;
+}