summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-06-13 16:11:14 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit2f4483be3043433c5ebe7b7a8dd7888112e2f61a (patch)
treefebbf3b02337863c13c57632e82af8c880a1d84a /drivers/soc
parent0a60c3644a43daad4a5d004984bdca42a25469ab (diff)
MLK-18592-1 soc: imx: use vendor hvc to communiate with SCU
Let Dom0 use hvc to trap to xen to communicate with SCU. xen could reuse the MU used by Dom0 before. By reusing the MU in Dom0, xen has power to control resources owned by DomU. Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/imx/sc/main/ipc.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/soc/imx/sc/main/ipc.c b/drivers/soc/imx/sc/main/ipc.c
index 924f7a6c0d25..cfe70eca0a50 100644
--- a/drivers/soc/imx/sc/main/ipc.c
+++ b/drivers/soc/imx/sc/main/ipc.c
@@ -6,6 +6,7 @@
*/
/* Includes */
+#include <linux/arm-smccc.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/of.h>
@@ -18,6 +19,7 @@
#include <linux/mx8_mu.h>
#include <linux/syscore_ops.h>
+#include <soc/imx/fsl_hvc.h>
#include <soc/imx8/sc/svc/irq/api.h>
#include <soc/imx8/sc/ipc.h>
#include <soc/imx8/sc/sci.h>
@@ -54,6 +56,8 @@ EXPORT_SYMBOL(sc_pm_set_clock_rate);
/*--------------------------------------------------------------------------*/
void sc_call_rpc(sc_ipc_t handle, sc_rpc_msg_t *msg, bool no_resp)
{
+ struct arm_smccc_res res;
+
if (in_interrupt()) {
pr_warn("Cannot make SC IPC calls from an interrupt context\n");
dump_stack();
@@ -61,9 +65,16 @@ void sc_call_rpc(sc_ipc_t handle, sc_rpc_msg_t *msg, bool no_resp)
}
mutex_lock(&scu_mu_mutex);
- sc_ipc_write(handle, msg);
- if (!no_resp)
- sc_ipc_read(handle, msg);
+ if (xen_initial_domain()) {
+ arm_smccc_hvc(FSL_HVC_SC, (uint64_t)msg, no_resp, 0, 0, 0, 0,
+ 0, &res);
+ if (res.a0)
+ printk("Error FSL_HVC_SC %ld\n", res.a0);
+ } else {
+ sc_ipc_write(handle, msg);
+ if (!no_resp)
+ sc_ipc_read(handle, msg);
+ }
mutex_unlock(&scu_mu_mutex);
}