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 May 31, 2020

Subsystems (2)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 drivers/tee/optee/optee_msg.h | 18 +++++++++++
 drivers/tee/optee/rpc.c       | 56 +++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)
drivers/tee/optee/optee_msg.h +18 -0
index 795bc19ae17a..b6cc964fdeea 100644
@@ -419,4 +419,22 @@ 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
+ *
+ * [io]  param[1].u.tmem.buf_ptr	physical address
+ * [io]  param[1].u.tmem.size		transfer size in bytes
+ * [io]  param[1].u.tmem.shm_ref	shared memory reference
+ *
+ * [out]  param[0].u.value.a		bytes transferred
+ *
+ */
+#define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 8
+#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 +56 -0

74 lines not on this page · raw message

Signature · 1 line
2.17.1