2 * Copyright (C) 2012 Samsung Electronics.
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Tomasz Figa <t.figa@samsung.com>
6 * This program is free software,you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
13 #include <linux/init.h>
15 #include <linux/of_address.h>
17 #include <asm/firmware.h>
24 static int exynos_do_idle(void)
26 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
30 static int exynos_cpu_boot(int cpu)
33 * Exynos3250 doesn't need to send smc command for secondary CPU boot
34 * because Exynos3250 removes WFE in secure mode.
36 if (soc_is_exynos3250())
40 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
41 * But, Exynos4212 has only one secondary CPU so second parameter
42 * isn't used for informing secure firmware about CPU id.
44 if (soc_is_exynos4212())
47 exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
51 static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
53 void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
55 if (!soc_is_exynos4212() && !soc_is_exynos3250())
58 __raw_writel(boot_addr, boot_reg);
62 static const struct firmware_ops exynos_firmware_ops = {
63 .do_idle = exynos_do_idle,
64 .set_cpu_boot_addr = exynos_set_cpu_boot_addr,
65 .cpu_boot = exynos_cpu_boot,
68 void __init exynos_firmware_init(void)
70 struct device_node *nd;
73 nd = of_find_compatible_node(NULL, NULL,
74 "samsung,secure-firmware");
78 addr = of_get_address(nd, 0, NULL, NULL);
80 pr_err("%s: No address specified.\n", __func__);
84 pr_info("Running under secure firmware.\n");
86 register_firmware_ops(&exynos_firmware_ops);