1
0
Fork 0

LF-824: fw: imx: scu: Add SECO API

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Franck LENORMAND 2020-02-21 10:42:38 +01:00
parent 10237c7bcb
commit 9edf1255f8
5 changed files with 115 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_IMX_DSP) += imx-dsp.o
obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.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

View File

@ -0,0 +1,62 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2020 NXP
*
* File containing client-side RPC functions for the SECO service. These
* function are ported to clients that communicate to the SC.
*/
#include <linux/firmware/imx/sci.h>
struct imx_sc_msg_seco_get_build_id {
struct imx_sc_rpc_msg hdr;
u32 version;
u32 commit;
};
int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version,
uint32_t *commit)
{
struct imx_sc_msg_seco_get_build_id msg = {0};
struct imx_sc_rpc_msg *hdr = &msg.hdr;
hdr->ver = IMX_SC_RPC_VERSION;
hdr->svc = IMX_SC_RPC_SVC_SECO;
hdr->func = IMX_SC_SECO_FUNC_BUILD_INFO;
hdr->size = 1;
imx_scu_call_rpc(ipc, &msg, true);
if (version)
*version = msg.version;
if (commit)
*commit = msg.commit;
return 0;
}
EXPORT_SYMBOL(imx_sc_seco_build_info);
struct imx_sc_msg_seco_sab_msg {
struct imx_sc_rpc_msg hdr;
u32 smsg_addr_hi;
u32 smsg_addr_lo;
};
int imx_sc_seco_sab_msg(struct imx_sc_ipc *ipc, u64 smsg_addr)
{
struct imx_sc_msg_seco_sab_msg msg;
struct imx_sc_rpc_msg *hdr = &msg.hdr;
int ret;
hdr->ver = IMX_SC_RPC_VERSION;
hdr->svc = IMX_SC_RPC_SVC_SECO;
hdr->func = IMX_SC_SECO_FUNC_SAB_MSG;
hdr->size = 3;
msg.smsg_addr_hi = smsg_addr >> 32;
msg.smsg_addr_lo = smsg_addr;
ret = imx_scu_call_rpc(ipc, &msg, true);
return ret;
}
EXPORT_SYMBOL(imx_sc_seco_sab_msg);

View File

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2018 NXP
* Copyright 2018,2020 NXP
*
* Header file for the IPC implementation.
*/
@ -24,7 +24,8 @@ enum imx_sc_rpc_svc {
IMX_SC_RPC_SVC_PAD = 6,
IMX_SC_RPC_SVC_MISC = 7,
IMX_SC_RPC_SVC_IRQ = 8,
IMX_SC_RPC_SVC_ABORT = 9
IMX_SC_RPC_SVC_SECO = 9,
IMX_SC_RPC_SVC_ABORT = 10,
};
struct imx_sc_rpc_msg {

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2016 Freescale Semiconductor, Inc.
* Copyright 2017~2018 NXP
* Copyright 2017~2018,2020 NXP
*
* Header file containing the public System Controller Interface (SCI)
* definitions.
@ -15,6 +15,7 @@
#include <linux/firmware/imx/svc/misc.h>
#include <linux/firmware/imx/svc/pm.h>
#include <linux/firmware/imx/svc/rm.h>
#include <linux/firmware/imx/svc/seco.h>
int imx_scu_enable_general_irq_channel(struct device *dev);
int imx_scu_irq_register_notifier(struct notifier_block *nb);

View File

@ -0,0 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright 2020 NXP
*
* Header file containing the public API for the System Controller (SC)
* Security Controller (SECO) function.
*
* SECO_SVC (SVC) Security Controller Service
*
* Module for the Security Controller (SECO) service.
*/
#ifndef _SC_SECO_API_H
#define _SC_SECO_API_H
#include <linux/errno.h>
#include <linux/firmware/imx/sci.h>
/*
* This type is used to indicate RPC RM function calls.
*/
enum imx_sc_seco_func {
IMX_SC_SECO_FUNC_UNKNOWN = 0,
IMX_SC_SECO_FUNC_BUILD_INFO = 16,
IMX_SC_SECO_FUNC_SAB_MSG = 23,
};
#if IS_ENABLED(CONFIG_IMX_SCU)
int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version,
uint32_t *commit);
int imx_sc_seco_sab_msg(struct imx_sc_ipc *ipc, u64 smsg_addr);
#else /* IS_ENABLED(CONFIG_IMX_SCU) */
static inline
int imx_sc_seco_build_info(struct imx_sc_ipc *ipc, uint32_t *version,
uint32_t *commit)
{
return -ENOTSUP;
}
static inline
int imx_sc_seco_sab_msg(struct imx_sc_ipc *ipc, u64 smsg_addr)
{
return -ENOTSUP;
}
#endif /* IS_ENABLED(CONFIG_IMX_SCU) */
#endif /* _SC_SECO_API_H */