aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2014-10-27 11:39:26 -0400
committerTony Lindgren <tony@atomide.com>2014-10-27 11:39:26 -0400
commit61c8621e2bd14faad9b89ab2284955b28000bcd5 (patch)
treeb7b24d5490f68336f06dcee1dbc50d2fc2254a55 /arch/arm/mach-omap2
parent4984eeaf71f033d1ca6b644e4fcdef4b3e6a97b4 (diff)
ARM: OMAP2+: PRM: provide generic API for system reset
This patch combines the various prm_warm_reset calls under a common API prm_reset_system, and adds the SoC specific implementation under prm_ll_data. Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Paul Walmsley <paul@pwsan.com> Tested-by: Nishanth Menon <nm@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/am33xx-restart.c5
-rw-r--r--arch/arm/mach-omap2/omap2-restart.c5
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c7
-rw-r--r--arch/arm/mach-omap2/omap4-restart.c6
-rw-r--r--arch/arm/mach-omap2/prm.h2
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c3
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h1
-rw-r--r--arch/arm/mach-omap2/prm33xx.c3
-rw-r--r--arch/arm/mach-omap2/prm33xx.h1
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c3
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c1
-rw-r--r--arch/arm/mach-omap2/prm_common.c19
13 files changed, 36 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/am33xx-restart.c b/arch/arm/mach-omap2/am33xx-restart.c
index 728638913cd1..5bace6a45ffb 100644
--- a/arch/arm/mach-omap2/am33xx-restart.c
+++ b/arch/arm/mach-omap2/am33xx-restart.c
@@ -9,8 +9,7 @@
9#include <linux/reboot.h> 9#include <linux/reboot.h>
10 10
11#include "common.h" 11#include "common.h"
12#include "prm-regbits-33xx.h" 12#include "prm.h"
13#include "prm33xx.h"
14 13
15/** 14/**
16 * am3xx_restart - trigger a software restart of the SoC 15 * am3xx_restart - trigger a software restart of the SoC
@@ -24,5 +23,5 @@ void am33xx_restart(enum reboot_mode mode, const char *cmd)
24{ 23{
25 /* TODO: Handle mode and cmd if necessary */ 24 /* TODO: Handle mode and cmd if necessary */
26 25
27 am33xx_prm_global_warm_sw_reset(); 26 omap_prm_reset_system();
28} 27}
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
index 68423e26399d..d937b2e4040b 100644
--- a/arch/arm/mach-omap2/omap2-restart.c
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -15,7 +15,7 @@
15 15
16#include "soc.h" 16#include "soc.h"
17#include "common.h" 17#include "common.h"
18#include "prm2xxx.h" 18#include "prm.h"
19 19
20/* 20/*
21 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set 21 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
@@ -40,8 +40,7 @@ void omap2xxx_restart(enum reboot_mode mode, const char *cmd)
40 40
41 /* XXX Should save the cmd argument for use after the reboot */ 41 /* XXX Should save the cmd argument for use after the reboot */
42 42
43 omap2xxx_prm_dpll_reset(); /* never returns */ 43 omap_prm_reset_system();
44 while (1);
45} 44}
46 45
47/** 46/**
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
index 5de2a0c2979d..103a49f68bcb 100644
--- a/arch/arm/mach-omap2/omap3-restart.c
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -14,10 +14,8 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/reboot.h> 15#include <linux/reboot.h>
16 16
17#include "iomap.h"
18#include "common.h"
19#include "control.h" 17#include "control.h"
20#include "prm3xxx.h" 18#include "prm.h"
21 19
22/* Global address base setup code */ 20/* Global address base setup code */
23 21
@@ -32,6 +30,5 @@
32void omap3xxx_restart(enum reboot_mode mode, const char *cmd) 30void omap3xxx_restart(enum reboot_mode mode, const char *cmd)
33{ 31{
34 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); 32 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
35 omap3xxx_prm_dpll3_reset(); /* never returns */ 33 omap_prm_reset_system();
36 while (1);
37} 34}
diff --git a/arch/arm/mach-omap2/omap4-restart.c b/arch/arm/mach-omap2/omap4-restart.c
index 41dfd7da8170..a99e7f7fb5be 100644
--- a/arch/arm/mach-omap2/omap4-restart.c
+++ b/arch/arm/mach-omap2/omap4-restart.c
@@ -9,7 +9,7 @@
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/reboot.h> 11#include <linux/reboot.h>
12#include "prminst44xx.h" 12#include "prm.h"
13 13
14/** 14/**
15 * omap44xx_restart - trigger a software restart of the SoC 15 * omap44xx_restart - trigger a software restart of the SoC
@@ -22,7 +22,5 @@
22void omap44xx_restart(enum reboot_mode mode, const char *cmd) 22void omap44xx_restart(enum reboot_mode mode, const char *cmd)
23{ 23{
24 /* XXX Should save 'cmd' into scratchpad for use after reboot */ 24 /* XXX Should save 'cmd' into scratchpad for use after reboot */
25 omap4_prminst_global_warm_sw_reset(); /* never returns */ 25 omap_prm_reset_system();
26 while (1)
27 ;
28} 26}
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index dd802eec0dec..77752e49d8d4 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -144,6 +144,7 @@ struct prm_ll_data {
144 u16 offset, u16 st_offset); 144 u16 offset, u16 st_offset);
145 int (*is_hardreset_asserted)(u8 shift, u8 part, s16 prm_mod, 145 int (*is_hardreset_asserted)(u8 shift, u8 part, s16 prm_mod,
146 u16 offset); 146 u16 offset);
147 void (*reset_system)(void);
147}; 148};
148 149
149extern int prm_register(struct prm_ll_data *pld); 150extern int prm_register(struct prm_ll_data *pld);
@@ -156,6 +157,7 @@ int omap_prm_is_hardreset_asserted(u8 shift, u8 part, s16 prm_mod, u16 offset);
156extern u32 prm_read_reset_sources(void); 157extern u32 prm_read_reset_sources(void);
157extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx); 158extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
158extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx); 159extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
160void omap_prm_reset_system(void);
159 161
160void omap_prm_reconfigure_io_chain(void); 162void omap_prm_reconfigure_io_chain(void);
161 163
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index 54ae55520da6..af0f15278fc2 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -106,7 +106,7 @@ static int omap2xxx_pwrst_to_common_pwrst(u8 omap2xxx_pwrst)
106 * Set the DPLL reset bit, which should reboot the SoC. This is the 106 * Set the DPLL reset bit, which should reboot the SoC. This is the
107 * recommended way to restart the SoC. No return value. 107 * recommended way to restart the SoC. No return value.
108 */ 108 */
109void omap2xxx_prm_dpll_reset(void) 109static void omap2xxx_prm_dpll_reset(void)
110{ 110{
111 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD, 111 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
112 OMAP2_RM_RSTCTRL); 112 OMAP2_RM_RSTCTRL);
@@ -215,6 +215,7 @@ static struct prm_ll_data omap2xxx_prm_ll_data = {
215 .assert_hardreset = &omap2_prm_assert_hardreset, 215 .assert_hardreset = &omap2_prm_assert_hardreset,
216 .deassert_hardreset = &omap2_prm_deassert_hardreset, 216 .deassert_hardreset = &omap2_prm_deassert_hardreset,
217 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted, 217 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
218 .reset_system = &omap2xxx_prm_dpll_reset,
218}; 219};
219 220
220int __init omap2xxx_prm_init(void) 221int __init omap2xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index d73414139292..1d51643062f7 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -124,7 +124,6 @@
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm); 124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm); 125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126 126
127extern void omap2xxx_prm_dpll_reset(void);
128void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask); 127void omap2xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 wkst_mask);
129 128
130extern int __init omap2xxx_prm_init(void); 129extern int __init omap2xxx_prm_init(void);
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 4a843f7cac02..02f628601b09 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -341,7 +341,7 @@ static int am33xx_check_vcvp(void)
341 * 341 *
342 * Immediately reboots the device through warm reset. 342 * Immediately reboots the device through warm reset.
343 */ 343 */
344void am33xx_prm_global_warm_sw_reset(void) 344static void am33xx_prm_global_warm_sw_reset(void)
345{ 345{
346 am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK, 346 am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK,
347 AM33XX_RST_GLOBAL_WARM_SW_MASK, 347 AM33XX_RST_GLOBAL_WARM_SW_MASK,
@@ -375,6 +375,7 @@ static struct prm_ll_data am33xx_prm_ll_data = {
375 .assert_hardreset = am33xx_prm_assert_hardreset, 375 .assert_hardreset = am33xx_prm_assert_hardreset,
376 .deassert_hardreset = am33xx_prm_deassert_hardreset, 376 .deassert_hardreset = am33xx_prm_deassert_hardreset,
377 .is_hardreset_asserted = am33xx_prm_is_hardreset_asserted, 377 .is_hardreset_asserted = am33xx_prm_is_hardreset_asserted,
378 .reset_system = am33xx_prm_global_warm_sw_reset,
378}; 379};
379 380
380int __init am33xx_prm_init(void) 381int __init am33xx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm33xx.h b/arch/arm/mach-omap2/prm33xx.h
index 937d56e70b3e..98ac41f271da 100644
--- a/arch/arm/mach-omap2/prm33xx.h
+++ b/arch/arm/mach-omap2/prm33xx.h
@@ -118,7 +118,6 @@
118#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004) 118#define AM33XX_PM_CEFUSE_PWRSTST AM33XX_PRM_REGADDR(AM33XX_PRM_CEFUSE_MOD, 0x0004)
119 119
120#ifndef __ASSEMBLER__ 120#ifndef __ASSEMBLER__
121extern void am33xx_prm_global_warm_sw_reset(void);
122int am33xx_prm_init(void); 121int am33xx_prm_init(void);
123 122
124#endif /* ASSEMBLER */ 123#endif /* ASSEMBLER */
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 9da15e9db6d2..c5e00c6714b1 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -136,7 +136,7 @@ u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
136 * recommended way to restart the SoC, considering Errata i520. No 136 * recommended way to restart the SoC, considering Errata i520. No
137 * return value. 137 * return value.
138 */ 138 */
139void omap3xxx_prm_dpll3_reset(void) 139static void omap3xxx_prm_dpll3_reset(void)
140{ 140{
141 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD, 141 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
142 OMAP2_RM_RSTCTRL); 142 OMAP2_RM_RSTCTRL);
@@ -663,6 +663,7 @@ static struct prm_ll_data omap3xxx_prm_ll_data = {
663 .assert_hardreset = &omap2_prm_assert_hardreset, 663 .assert_hardreset = &omap2_prm_assert_hardreset,
664 .deassert_hardreset = &omap2_prm_deassert_hardreset, 664 .deassert_hardreset = &omap2_prm_deassert_hardreset,
665 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted, 665 .is_hardreset_asserted = &omap2_prm_is_hardreset_asserted,
666 .reset_system = &omap3xxx_prm_dpll3_reset,
666}; 667};
667 668
668int __init omap3xxx_prm_init(void) 669int __init omap3xxx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index 321568bc0847..cfde3f4a03cc 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -144,8 +144,6 @@ extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset); 144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146 146
147extern void omap3xxx_prm_dpll3_reset(void);
148
149extern int __init omap3xxx_prm_init(void); 147extern int __init omap3xxx_prm_init(void);
150extern u32 omap3xxx_prm_get_reset_sources(void); 148extern u32 omap3xxx_prm_get_reset_sources(void);
151int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits); 149int omap3xxx_prm_clear_mod_irqs(s16 module, u8 regs, u32 ignore_bits);
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index e7ac7e209edc..cc170fb81ff7 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -697,6 +697,7 @@ static struct prm_ll_data omap44xx_prm_ll_data = {
697 .assert_hardreset = omap4_prminst_assert_hardreset, 697 .assert_hardreset = omap4_prminst_assert_hardreset,
698 .deassert_hardreset = omap4_prminst_deassert_hardreset, 698 .deassert_hardreset = omap4_prminst_deassert_hardreset,
699 .is_hardreset_asserted = omap4_prminst_is_hardreset_asserted, 699 .is_hardreset_asserted = omap4_prminst_is_hardreset_asserted,
700 .reset_system = omap4_prminst_global_warm_sw_reset,
700}; 701};
701 702
702int __init omap44xx_prm_init(void) 703int __init omap44xx_prm_init(void)
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index be40824acf5f..779940cb6e56 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -503,6 +503,25 @@ void omap_prm_reconfigure_io_chain(void)
503} 503}
504 504
505/** 505/**
506 * omap_prm_reset_system - trigger global SW reset
507 *
508 * Triggers SoC specific global warm reset to reboot the device.
509 */
510void omap_prm_reset_system(void)
511{
512 if (!prm_ll_data->reset_system) {
513 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
514 __func__);
515 return;
516 }
517
518 prm_ll_data->reset_system();
519
520 while (1)
521 cpu_relax();
522}
523
524/**
506 * prm_register - register per-SoC low-level data with the PRM 525 * prm_register - register per-SoC low-level data with the PRM
507 * @pld: low-level per-SoC OMAP PRM data & function pointers to register 526 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
508 * 527 *