blob: 968e7cf3097356849f4c85d50845efed02366043 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Peng Fanaa3b9072018-01-10 13:20:23 +08002/*
3 * Copyright 2017 NXP
Peng Fanaa3b9072018-01-10 13:20:23 +08004 */
5
6#include <common.h>
7#include <asm/arch/sys_proto.h>
8
9unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
10 unsigned long reg1, unsigned long reg2)
11{
12 struct pt_regs regs;
13
14 regs.regs[0] = id;
15 regs.regs[1] = reg0;
16 regs.regs[2] = reg1;
17 regs.regs[3] = reg2;
18
19 smc_call(&regs);
20
21 return regs.regs[0];
22}
Peng Fana5060092019-04-12 07:54:50 +000023
24/*
25 * Do an SMC call to return 2 registers by having reg1 passed in by reference
26 */
27unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
28 unsigned long *reg1, unsigned long reg2,
29 unsigned long reg3)
30{
31 struct pt_regs regs;
32
33 regs.regs[0] = id;
34 regs.regs[1] = reg0;
35 regs.regs[2] = *reg1;
36 regs.regs[3] = reg2;
37 regs.regs[4] = reg3;
38
39 smc_call(&regs);
40
41 *reg1 = regs.regs[1];
42
43 return regs.regs[0];
44}