nandbcb: fix the issue cannot support gf_14 NAND boot
[oweals/u-boot.git] / arch / arm / mach-imx / sip.c
index 813c2ae5e11cf3415241e63c98b8bfaa1124647f..fca520c671ba581964e011da057b8a0711427a6d 100644 (file)
@@ -7,7 +7,8 @@
 #include <asm/arch/sys_proto.h>
 
 unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
-                          unsigned long reg1, unsigned long reg2)
+                          unsigned long reg1, unsigned long reg2,
+                          unsigned long reg3)
 {
        struct pt_regs regs;
 
@@ -15,8 +16,31 @@ unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
        regs.regs[1] = reg0;
        regs.regs[2] = reg1;
        regs.regs[3] = reg2;
+       regs.regs[4] = reg3;
 
        smc_call(&regs);
 
        return regs.regs[0];
 }
+
+/*
+ * Do an SMC call to return 2 registers by having reg1 passed in by reference
+ */
+unsigned long call_imx_sip_ret2(unsigned long id, unsigned long reg0,
+                               unsigned long *reg1, unsigned long reg2,
+                               unsigned long reg3)
+{
+       struct pt_regs regs;
+
+       regs.regs[0] = id;
+       regs.regs[1] = reg0;
+       regs.regs[2] = *reg1;
+       regs.regs[3] = reg2;
+       regs.regs[4] = reg3;
+
+       smc_call(&regs);
+
+       *reg1 = regs.regs[1];
+
+       return regs.regs[0];
+}