ARM: EXYNOS: Add Exynos3250 SoC ID
[deliverable/linux.git] / arch / arm / mach-exynos / firmware.c
CommitLineData
bca28f8f
TF
1/*
2 * Copyright (C) 2012 Samsung Electronics.
3 * Kyungmin Park <kyungmin.park@samsung.com>
4 * Tomasz Figa <t.figa@samsung.com>
5 *
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 */
10
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>
16
17#include <asm/firmware.h>
18
19#include <mach/map.h>
20
4b245edc 21#include "common.h"
bca28f8f
TF
22#include "smc.h"
23
24static int exynos_do_idle(void)
25{
26 exynos_smc(SMC_CMD_SLEEP, 0, 0, 0);
27 return 0;
28}
29
30static int exynos_cpu_boot(int cpu)
31{
989ff3fd
KP
32 /*
33 * The second parameter of SMC_CMD_CPU1BOOT command means CPU id.
34 * But, Exynos4212 has only one secondary CPU so second parameter
35 * isn't used for informing secure firmware about CPU id.
36 */
37 if (soc_is_exynos4212())
38 cpu = 0;
39
bca28f8f
TF
40 exynos_smc(SMC_CMD_CPU1BOOT, cpu, 0, 0);
41 return 0;
42}
43
44static int exynos_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
45{
989ff3fd
KP
46 void __iomem *boot_reg = S5P_VA_SYSRAM_NS + 0x1c;
47
48 if (!soc_is_exynos4212())
49 boot_reg += 4*cpu;
bca28f8f
TF
50
51 __raw_writel(boot_addr, boot_reg);
52 return 0;
53}
54
55static const struct firmware_ops exynos_firmware_ops = {
56 .do_idle = exynos_do_idle,
57 .set_cpu_boot_addr = exynos_set_cpu_boot_addr,
58 .cpu_boot = exynos_cpu_boot,
59};
60
61void __init exynos_firmware_init(void)
62{
4ee1cc79
TF
63 struct device_node *nd;
64 const __be32 *addr;
bca28f8f 65
4ee1cc79
TF
66 nd = of_find_compatible_node(NULL, NULL,
67 "samsung,secure-firmware");
68 if (!nd)
69 return;
bca28f8f 70
4ee1cc79
TF
71 addr = of_get_address(nd, 0, NULL, NULL);
72 if (!addr) {
73 pr_err("%s: No address specified.\n", __func__);
74 return;
bca28f8f
TF
75 }
76
77 pr_info("Running under secure firmware.\n");
78
79 register_firmware_ops(&exynos_firmware_ops);
80}
This page took 0.101581 seconds and 5 git commands to generate.