Linux 3.11-rc3
[cris-mirror.git] / arch / arm / mach-exynos / firmware.c
blob932129ef26c66054a2bdeecaef9c0af1a9bba788
1 /*
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.
9 */
11 #include <linux/kernel.h>
12 #include <linux/io.h>
13 #include <linux/init.h>
14 #include <linux/of.h>
15 #include <linux/of_address.h>
17 #include <asm/firmware.h>
19 #include <mach/map.h>
21 #include "smc.h"
23 static int exynos_do_idle(void)
25 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
26 return 0;
29 static int exynos_cpu_boot(int cpu)
31 exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
32 return 0;
35 static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
37 void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c + 4*cpu;
39 __raw_writel(boot_addr, boot_reg);
40 return 0;
43 static const struct firmware_ops exynos_firmware_ops = {
44 .do_idle = exynos_do_idle,
45 .set_cpu_boot_addr = exynos_set_cpu_boot_addr,
46 .cpu_boot = exynos_cpu_boot,
49 void __init exynos_firmware_init(void)
51 struct device_node *nd;
52 const __be32 *addr;
54 nd = of_find_compatible_node(NULL, NULL,
55 "samsung,secure-firmware");
56 if (!nd)
57 return;
59 addr = of_get_address(nd, 0, NULL, NULL);
60 if (!addr) {
61 pr_err("%s: No address specified.\n", __func__);
62 return;
65 pr_info("Running under secure firmware.\n");
67 register_firmware_ops(&exynos_firmware_ops);