diff options
author | Paul Walmsley <paul@pwsan.com> | 2012-10-29 22:56:07 -0400 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2012-11-08 14:33:08 -0500 |
commit | 2f334a3896714b47e24cc4cd08eed11d1a7f0d8e (patch) | |
tree | b9698fae56bb2f5bdcadd35667ef59669d76cf7d | |
parent | baa689b8b2e9a6ae1eb7aa49246276d838345a39 (diff) |
ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific
variants. These functions need to be able to save the reboot reason
into the scratchpad RAM. This implies a dependency on both the PRM
and SCM IP blocks, so they've been moved into their own file. This
will eventually call functions in the PRM and SCM drivers, once those
are created.
Vaibhav Hiremath <hvaibhav@ti.com> identified an unused prototype in
the first version of this patch - now removed. Tony Lindgren
<tony@atomide.com> noted a compile problem with some RMK Kconfigs;
resolved in this patch.
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Vaibhav Hiremath <hvaibhav@ti.com>
Tested-by: Vaibhav Hiremath <hvaibhav@ti.com>
Cc: Tony Lindgren <tony@atomide.com>
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/common.h | 24 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap2-restart.c | 65 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap3-restart.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap4-common.c | 17 |
5 files changed, 147 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ae87a3ea53ae..1988810c9de7 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -50,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6 | |||
50 | AFLAGS_sram243x.o :=-Wa,-march=armv6 | 50 | AFLAGS_sram243x.o :=-Wa,-march=armv6 |
51 | AFLAGS_sram34xx.o :=-Wa,-march=armv7-a | 51 | AFLAGS_sram34xx.o :=-Wa,-march=armv7-a |
52 | 52 | ||
53 | # Restart code (OMAP4/5 currently in omap4-common.c) | ||
54 | obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o | ||
55 | obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o | ||
56 | obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o | ||
57 | |||
53 | # Pin multiplexing | 58 | # Pin multiplexing |
54 | obj-$(CONFIG_SOC_OMAP2420) += mux2420.o | 59 | obj-$(CONFIG_SOC_OMAP2420) += mux2420.o |
55 | obj-$(CONFIG_SOC_OMAP2430) += mux2430.o | 60 | obj-$(CONFIG_SOC_OMAP2430) += mux2430.o |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index ed21815edd4b..349d0153791b 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -113,6 +113,30 @@ void omap4430_init_late(void); | |||
113 | int omap2_common_pm_late_init(void); | 113 | int omap2_common_pm_late_init(void); |
114 | void omap_prcm_restart(char, const char *); | 114 | void omap_prcm_restart(char, const char *); |
115 | 115 | ||
116 | #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) | ||
117 | void omap2xxx_restart(char mode, const char *cmd); | ||
118 | #else | ||
119 | static inline void omap2xxx_restart(char mode, const char *cmd) | ||
120 | { | ||
121 | } | ||
122 | #endif | ||
123 | |||
124 | #ifdef CONFIG_ARCH_OMAP3 | ||
125 | void omap3xxx_restart(char mode, const char *cmd); | ||
126 | #else | ||
127 | static inline void omap3xxx_restart(char mode, const char *cmd) | ||
128 | { | ||
129 | } | ||
130 | #endif | ||
131 | |||
132 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | ||
133 | void omap44xx_restart(char mode, const char *cmd); | ||
134 | #else | ||
135 | static inline void omap44xx_restart(char mode, const char *cmd) | ||
136 | { | ||
137 | } | ||
138 | #endif | ||
139 | |||
116 | /* This gets called from mach-omap2/io.c, do not call this */ | 140 | /* This gets called from mach-omap2/io.c, do not call this */ |
117 | void __init omap2_set_globals_tap(u32 class, void __iomem *tap); | 141 | void __init omap2_set_globals_tap(u32 class, void __iomem *tap); |
118 | 142 | ||
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c new file mode 100644 index 000000000000..be6bc89ab1e8 --- /dev/null +++ b/arch/arm/mach-omap2/omap2-restart.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * omap2-restart.c - code common to all OMAP2xxx machines. | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments | ||
5 | * Paul Walmsley | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/io.h> | ||
15 | |||
16 | #include "common.h" | ||
17 | #include "prm2xxx.h" | ||
18 | |||
19 | /* | ||
20 | * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set | ||
21 | * clock and the sys_ck. Used during the reset process | ||
22 | */ | ||
23 | static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; | ||
24 | |||
25 | /* Reboot handling */ | ||
26 | |||
27 | /** | ||
28 | * omap2xxx_restart - Set DPLL to bypass mode for reboot to work | ||
29 | * | ||
30 | * Set the DPLL to bypass so that reboot completes successfully. No | ||
31 | * return value. | ||
32 | */ | ||
33 | void omap2xxx_restart(char mode, const char *cmd) | ||
34 | { | ||
35 | u32 rate; | ||
36 | |||
37 | rate = clk_get_rate(reset_sys_ck); | ||
38 | clk_set_rate(reset_virt_prcm_set_ck, rate); | ||
39 | |||
40 | /* XXX Should save the cmd argument for use after the reboot */ | ||
41 | |||
42 | omap2xxx_prm_dpll_reset(); /* never returns */ | ||
43 | while (1); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart | ||
48 | * | ||
49 | * Some clocks need to be looked up in advance for the SoC restart | ||
50 | * operation to work - see omap2xxx_restart(). Returns -EINVAL upon | ||
51 | * error or 0 upon success. | ||
52 | */ | ||
53 | static int __init omap2xxx_common_look_up_clks_for_reset(void) | ||
54 | { | ||
55 | reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); | ||
56 | if (IS_ERR(reset_virt_prcm_set_ck)) | ||
57 | return -EINVAL; | ||
58 | |||
59 | reset_sys_ck = clk_get(NULL, "sys_ck"); | ||
60 | if (IS_ERR(reset_sys_ck)) | ||
61 | return -EINVAL; | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | core_initcall(omap2xxx_common_look_up_clks_for_reset); | ||
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c new file mode 100644 index 000000000000..923c582189e5 --- /dev/null +++ b/arch/arm/mach-omap2/omap3-restart.c | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * omap3-restart.c - Code common to all OMAP3xxx machines. | ||
3 | * | ||
4 | * Copyright (C) 2009, 2012 Texas Instruments | ||
5 | * Copyright (C) 2010 Nokia Corporation | ||
6 | * Tony Lindgren <tony@atomide.com> | ||
7 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include "iomap.h" | ||
17 | #include "common.h" | ||
18 | #include "control.h" | ||
19 | #include "prm3xxx.h" | ||
20 | |||
21 | /* Global address base setup code */ | ||
22 | |||
23 | /** | ||
24 | * omap3xxx_restart - trigger a software restart of the SoC | ||
25 | * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c | ||
26 | * @cmd: passed from the userspace program rebooting the system (if provided) | ||
27 | * | ||
28 | * Resets the SoC. For @cmd, see the 'reboot' syscall in | ||
29 | * kernel/sys.c. No return value. | ||
30 | */ | ||
31 | void omap3xxx_restart(char mode, const char *cmd) | ||
32 | { | ||
33 | omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); | ||
34 | omap3xxx_prm_dpll3_reset(); /* never returns */ | ||
35 | while (1); | ||
36 | } | ||
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 6cd7e877c8e5..3b1398798b61 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "common.h" | 33 | #include "common.h" |
34 | #include "mmc.h" | 34 | #include "mmc.h" |
35 | #include "hsmmc.h" | 35 | #include "hsmmc.h" |
36 | #include "prminst44xx.h" | ||
36 | #include "omap4-sar-layout.h" | 37 | #include "omap4-sar-layout.h" |
37 | #include "omap-secure.h" | 38 | #include "omap-secure.h" |
38 | 39 | ||
@@ -281,3 +282,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
281 | return 0; | 282 | return 0; |
282 | } | 283 | } |
283 | #endif | 284 | #endif |
285 | |||
286 | /** | ||
287 | * omap44xx_restart - trigger a software restart of the SoC | ||
288 | * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c | ||
289 | * @cmd: passed from the userspace program rebooting the system (if provided) | ||
290 | * | ||
291 | * Resets the SoC. For @cmd, see the 'reboot' syscall in | ||
292 | * kernel/sys.c. No return value. | ||
293 | */ | ||
294 | void omap44xx_restart(char mode, const char *cmd) | ||
295 | { | ||
296 | /* XXX Should save 'cmd' into scratchpad for use after reboot */ | ||
297 | omap4_prminst_global_warm_sw_reset(); /* never returns */ | ||
298 | while (1); | ||
299 | } | ||
300 | |||