]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: tegra: set CPU reset handler using firmware
authorAlexandre Courbot <acourbot@nvidia.com>
Sun, 24 Nov 2013 06:30:51 +0000 (15:30 +0900)
committerStephen Warren <swarren@nvidia.com>
Fri, 13 Dec 2013 19:50:31 +0000 (12:50 -0700)
Use a firmware operation to set the CPU reset handler and only resort to
doing it ourselves if there is none defined.

This supports the booting of secondary CPUs on devices using a TrustZone
secure monitor.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
arch/arm/mach-tegra/reset.c

index 17c4b6d6b498a5c1b6aba2ccbe1765d43277e97d..146fe8e0ae7ce52eea0e960c3c508ebb0a35f3b6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <asm/cacheflush.h>
 #include <asm/hardware/cache-l2x0.h>
+#include <asm/firmware.h>
 
 #include "iomap.h"
 #include "irammap.h"
@@ -65,6 +66,7 @@ static void __init tegra_cpu_reset_handler_enable(void)
        void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
        const u32 reset_address = TEGRA_IRAM_RESET_BASE +
                                                tegra_cpu_reset_handler_offset;
+       int err;
 
        BUG_ON(is_enabled);
        BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
@@ -72,9 +74,18 @@ static void __init tegra_cpu_reset_handler_enable(void)
        memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
                        tegra_cpu_reset_handler_size);
 
-       tegra_cpu_reset_handler_set(reset_address);
-
-       is_enabled = true;
+       err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
+       switch (err) {
+       case -ENOSYS:
+               tegra_cpu_reset_handler_set(reset_address);
+               /* pass-through */
+       case 0:
+               is_enabled = true;
+               break;
+       default:
+               pr_crit("Cannot set CPU reset handler: %d\n", err);
+               BUG();
+       }
 }
 
 void __init tegra_cpu_reset_handler_init(void)