Skip to contentSkip to conversation

drivers: optee: allow op-tee to access devices on the i2c bus

PATCH Superseded Jorge Ramirez-Ortiz 1 participant 1 message Jul 22, 2020

Subsystems (2)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 drivers: optee: allow op-tee to access devices on the i2c bus

Some secure elements like NXP's SE050 sit on I2C buses. For OP-TEE to control this type of cryptographic devices it needs coordinated access to the bus, so collisions and RUNTIME_PM dont get in the way.

This trampoline driver allow OP-TEE to access them.

---
v5: arrange includes alphabetically
v4: removed unecessary extra line in optee_msg.h
v3: use from/to msg param to support all types of memory
modify OPTEE_MSG_RPC_CMD_I2C_TRANSFER id

 drivers/tee/optee/optee_msg.h | 16 +++++++
 drivers/tee/optee/rpc.c       | 80 +++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+)
drivers/tee/optee/optee_msg.h +16 -0
index 795bc19ae17a..14b580f55356 100644
@@ -419,4 +419,20 @@ 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/out] memref[1]			buffer to exchange the transfer data
+ *					with the secure world
+ *
+ * [out]  param[0].u.value.a		bytes transferred by the driver
+ */
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1
+
 #endif /* _OPTEE_MSG_H */
drivers/tee/optee/rpc.c +80 -0

98 lines not on this page · raw message

Signature · 1 line
2.17.1