drivers: tee: i2c trampoline driver
Subsystems (2)
PATCH v2 1/1 drivers: tee: i2c trampoline driver
This commit gives the secure world access to the I2C bus so it can communicate with I2C slaves (tipically those would be secure elements like the NXP SE050).
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>
--- drivers/tee/optee/Makefile | 1 + drivers/tee/optee/i2c.c | 88 ++++++++++++++++++++++++ drivers/tee/optee/optee_msg.h | 21 ++++++ drivers/tee/optee/optee_msg_supplicant.h | 5 ++ drivers/tee/optee/optee_private.h | 12 ++++ drivers/tee/optee/supplicant.c | 3 + 6 files changed, 130 insertions(+) create mode 100644 drivers/tee/optee/i2c.c
drivers/tee/optee/Makefile +1 -0
@@ -2,4 +2,5 @@ obj-y += core.o obj-y += supplicant.o +obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o
drivers/tee/optee/i2c.c new file +88 -0
88 lines not on this page · raw message
drivers/tee/optee/optee_msg.h +21 -0
@@ -422,4 +422,25 @@ struct optee_msg_arg {*/ #define OPTEE_MSG_RPC_CMD_SHM_FREE 7 +/* +* Access a device on an i2c bus +* +* [in] param[0].u.value.a mode: RD(0), WR(1) +* [in] param[0].u.value.b i2c adapter +* [in] param[0].u.value.c i2c chip +* +* [in] param[1].u.value.a i2c control flags +* +* [in/out] memref[2] buffer to exchange the transfer data +* with the secure world +* +* [out] param[3].u.value.a bytes transferred by the driver +*/ +#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21 +/* I2C master transfer modes */ +#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0 +#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1 +/* I2C master control flags */ +#define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT BIT(0) +#endif /* _OPTEE_MSG_H */
drivers/tee/optee/optee_msg_supplicant.h +5 -0
@@ -147,6 +147,11 @@#define OPTEE_MSG_RPC_CMD_SHM_ALLOC 6#define OPTEE_MSG_RPC_CMD_SHM_FREE 7 +/* +* I2C bus access +*/ +#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21 +/* * Was OPTEE_MSG_RPC_CMD_SQL_FS, which isn't supported any longer */
drivers/tee/optee/optee_private.h +12 -0
@@ -60,6 +60,18 @@ static inline void optee_suppl_rpmb_release(struct udevice *dev) }#endif +#ifdef CONFIG_DM_I2C +void optee_suppl_cmd_i2c_transfer (struct udevice *dev, +struct optee_msg_arg *arg); +#else +static void optee_suppl_cmd_i2c_transfer (struct udevice *dev, +struct optee_msg_arg *arg) +{ +debug ("OPTEE_MSG_RPC_CMD_I2C_TRANSFER not implemented\n" ); + arg->ret =TEE_ERROR_NOT_IMPLEMENTED ; +} +#endif +void *optee_alloc_and_init_page_list (void *buf,ulong len,u64 *phys_buf_ptr);#endif /* __OPTEE_PRIVATE_H */
drivers/tee/optee/supplicant.c +3 -0
@@ -89,6 +89,9 @@ void optee_suppl_cmd(struct udevice *dev, struct tee_shm *shm_arg,case OPTEE_MSG_RPC_CMD_RPMB :optee_suppl_cmd_rpmb (dev, arg);break ; +case OPTEE_MSG_RPC_CMD_I2C_TRANSFER : +optee_suppl_cmd_i2c_transfer (dev, arg); +break ;default : arg->ret =TEE_ERROR_NOT_IMPLEMENTED ; }
Signature · 1 line
2.17.1
PATCH v2 1/1 drivers: tee: i2c trampoline driver
hI Jorge,
Quoted 6 lines · Jorge Ramirez-Ortiz
This commit gives the secure world access to the I2C bus so it can communicate with I2C slaves (tipically those would be secure elements like the NXP SE050).
Signed-off-by Jorge Ramirez-Ortiz <[email protected]>
Quoted 9 lines
--- drivers/tee/optee/Makefile | 1 + drivers/tee/optee/i2c.c | 88 ++++++++++++++++++++++++ drivers/tee/optee/optee_msg.h | 21 ++++++ drivers/tee/optee/optee_msg_supplicant.h | 5 ++ drivers/tee/optee/optee_private.h | 12 ++++ drivers/tee/optee/supplicant.c | 3 + 6 files changed, 130 insertions(+) create mode 100644 drivers/tee/optee/i2c.c
I think you missed the change log.
Also please see my comment in the original patch about a test for optee.
Regards,
Simo
n