1
0
Fork 0

LF-824: fw: imx: seco_mu: Add driver for SECO

This patch adds the driver to interact with the different
APIs exposed by the SECO using a shared Messaging Unit.

The driver exposes some char devices in user space allowing
a user to send message to the SECO and read its response.

The driver uses the mailbox framework instead of directly
configuring the MU.

Signed-off-by: Stephane Dion <stephane.dion_1@nxp.com>
Signed-off-by: Silvano di Ninno <silvano.dininno@nxp.com>
Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>

(cherry picked from commit 4985109d60164c842ee5d189621455db349b5212)
(cherry picked from commit eb721810fdc309b6a32a7a64c7686eaa6052cdc7)
(cherry picked from commit 4956bbf43349ab40a6a60765752a904d11bfcd18)
5.4-rM2-2.2.x-imx-squashed
Silvano di Ninno 2019-12-02 19:21:01 +01:00 committed by Franck LENORMAND
parent 73c8bbb404
commit c334337d16
4 changed files with 1298 additions and 0 deletions

View File

@ -27,3 +27,13 @@ config IMX_SCU_PD
depends on IMX_SCU
help
The System Controller Firmware (SCFW) based power domain driver.
config IMX_SECO_MU
tristate "i.MX Security Controller (SECO) support"
depends on IMX_SCU && IMX_MBOX && MAILBOX
help
It is possible to use APIs exposed by the SECO like HSM and SHE using the
SAB protocol via the shared Messaging Unit. This driver exposes these
interfaces via a set of file descriptors allowing to configure shared
memory, send and receive messages.

View File

@ -2,3 +2,4 @@
obj-$(CONFIG_IMX_DSP) += imx-dsp.o
obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o seco.o
obj-$(CONFIG_IMX_SCU_PD) += scu-pd.o
obj-${CONFIG_IMX_SECO_MU} += seco_mu.o

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,50 @@
/* SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause*/
/*
* Copyright 2019-2020 NXP
*/
#ifndef SECO_MU_IOCTL_H
#define SECO_MU_IOCTL_H
/* IOCTL definitions. */
struct seco_mu_ioctl_setup_iobuf {
u8 *user_buf;
u32 length;
u32 flags;
u64 seco_addr;
};
struct seco_mu_ioctl_shared_mem_cfg {
u32 base_offset;
u32 size;
};
struct seco_mu_ioctl_get_mu_info {
u8 seco_mu_idx;
u8 interrupt_idx;
u8 tz;
u8 did;
};
struct seco_mu_ioctl_signed_message {
u8 *message;
u32 msg_size;
u32 error_code;
};
#define SECO_MU_IO_FLAGS_IS_INPUT (0x01u)
#define SECO_MU_IO_FLAGS_USE_SEC_MEM (0x02u)
#define SECO_MU_IO_FLAGS_USE_SHORT_ADDR (0x04u)
#define SECO_MU_IOCTL 0x0A /* like MISC_MAJOR. */
#define SECO_MU_IOCTL_ENABLE_CMD_RCV _IO(SECO_MU_IOCTL, 0x01)
#define SECO_MU_IOCTL_SHARED_BUF_CFG _IOW(SECO_MU_IOCTL, 0x02, \
struct seco_mu_ioctl_shared_mem_cfg)
#define SECO_MU_IOCTL_SETUP_IOBUF _IOWR(SECO_MU_IOCTL, 0x03, \
struct seco_mu_ioctl_setup_iobuf)
#define SECO_MU_IOCTL_GET_MU_INFO _IOR(SECO_MU_IOCTL, 0x04, \
struct seco_mu_ioctl_get_mu_info)
#define SECO_MU_IOCTL_SIGNED_MESSAGE _IOWR(SECO_MU_IOCTL, 0x05, \
struct seco_mu_ioctl_signed_message)
#endif