summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-08-26 09:04:45 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-08-27 21:37:03 +0200
commit83b0a5ae055bc084938dac96b3ea1c796d99d86c (patch)
treeba69e2015cbfeb1626f7ea3f6bf850556541095a /arch/arm/mach-omap
parent167e93947e9b755b54900ae9870dbcc089f8d6c9 (diff)
downloadbarebox-83b0a5ae055bc084938dac96b3ea1c796d99d86c.tar.gz
barebox-83b0a5ae055bc084938dac96b3ea1c796d99d86c.tar.xz
restart: replace reset_cpu with registered restart handlers
This replaces the reset_cpu() function which every SoC or board must provide with registered handlers. This makes it possible to have multiple reset functions for boards which have multiple ways to reset the machine. Also boards which have no way at all to reset the machine no longer have to provide a dummy reset_cpu() function. The problem this solves is that some machines have external PMICs or similar to reset the system which have to be preferred over the internal SoC reset, because the PMIC can reset not only the SoC but also the external devices. To pick the right way to reset a machine each handler has a priority. The default priority is 100 and all currently existing restart handlers are registered with this priority. of_get_restart_priority() allows to retrieve the priority from the device tree which makes it possible for boards to give certain restart handlers a higher priority in order to use this one instead of the default one. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap')
-rw-r--r--arch/arm/mach-omap/am33xx_generic.c7
-rw-r--r--arch/arm/mach-omap/include/mach/am33xx-generic.h2
-rw-r--r--arch/arm/mach-omap/include/mach/omap3-generic.h2
-rw-r--r--arch/arm/mach-omap/include/mach/omap4-generic.h2
-rw-r--r--arch/arm/mach-omap/omap3_generic.c8
-rw-r--r--arch/arm/mach-omap/omap4_generic.c7
-rw-r--r--arch/arm/mach-omap/omap_generic.c11
7 files changed, 15 insertions, 24 deletions
diff --git a/arch/arm/mach-omap/am33xx_generic.c b/arch/arm/mach-omap/am33xx_generic.c
index 7ce32f01e1..ae0ee585a8 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -19,6 +19,7 @@
#include <init.h>
#include <io.h>
#include <net.h>
+#include <restart.h>
#include <asm/barebox-arm.h>
#include <mach/am33xx-silicon.h>
#include <mach/am33xx-clock.h>
@@ -28,11 +29,11 @@
#include <mach/gpmc.h>
#include <reset_source.h>
-void __noreturn am33xx_reset_cpu(unsigned long addr)
+static void __noreturn am33xx_restart_soc(struct restart_handler *rst)
{
writel(AM33XX_PRM_RSTCTRL_RESET, AM33XX_PRM_RSTCTRL);
- while (1);
+ hang();
}
/**
@@ -243,6 +244,8 @@ int am33xx_init(void)
{
omap_gpmc_base = (void *)AM33XX_GPMC_BASE;
+ restart_handler_register_fn(am33xx_restart_soc);
+
am33xx_enable_per_clocks();
if (IS_ENABLED(CONFIG_RESET_SOURCE))
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index 03418b053b..7e64e74d5c 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -28,8 +28,6 @@ u32 am33xx_running_in_flash(void);
u32 am33xx_running_in_sram(void);
u32 am33xx_running_in_sdram(void);
-void __noreturn am33xx_reset_cpu(unsigned long addr);
-
void am33xx_enable_per_clocks(void);
int am33xx_init(void);
int am33xx_devices_init(void);
diff --git a/arch/arm/mach-omap/include/mach/omap3-generic.h b/arch/arm/mach-omap/include/mach/omap3-generic.h
index ab53b98971..177862e4b1 100644
--- a/arch/arm/mach-omap/include/mach/omap3-generic.h
+++ b/arch/arm/mach-omap/include/mach/omap3-generic.h
@@ -24,8 +24,6 @@ u32 omap3_running_in_flash(void);
u32 omap3_running_in_sram(void);
u32 omap3_running_in_sdram(void);
-void __noreturn omap3_reset_cpu(unsigned long addr);
-
int omap3_init(void);
int omap3_devices_init(void);
diff --git a/arch/arm/mach-omap/include/mach/omap4-generic.h b/arch/arm/mach-omap/include/mach/omap4-generic.h
index e246e360e5..7ec41d880b 100644
--- a/arch/arm/mach-omap/include/mach/omap4-generic.h
+++ b/arch/arm/mach-omap/include/mach/omap4-generic.h
@@ -18,8 +18,6 @@ static inline void omap4_save_bootinfo(uint32_t *info)
memcpy((void *)OMAP44XX_SRAM_SCRATCH_SPACE, info, 3 * sizeof(uint32_t));
}
-void __noreturn omap4_reset_cpu(unsigned long addr);
-
int omap4_init(void);
int omap4_devices_init(void);
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 0f2e9ce6b7..5c29feaeb4 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -31,6 +31,7 @@
#include <bootsource.h>
#include <init.h>
#include <io.h>
+#include <restart.h>
#include <mach/omap3-silicon.h>
#include <mach/gpmc.h>
#include <mach/generic.h>
@@ -52,13 +53,12 @@
*
* @return void
*/
-void __noreturn omap3_reset_cpu(unsigned long addr)
+static void __noreturn omap3_restart_soc(struct restart_handler *rst)
{
writel(OMAP3_PRM_RSTCTRL_RESET, OMAP3_PRM_REG(RSTCTRL));
- while (1);
+ hang();
}
-EXPORT_SYMBOL(reset_cpu);
/**
* @brief Low level CPU type
@@ -490,6 +490,8 @@ int omap3_init(void)
{
omap_gpmc_base = (void *)OMAP3_GPMC_BASE;
+ restart_handler_register_fn(omap3_restart_soc);
+
return omap3_bootsource();
}
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 0b683da181..a3f370df8f 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -1,6 +1,7 @@
#include <common.h>
#include <bootsource.h>
#include <init.h>
+#include <restart.h>
#include <io.h>
#include <mach/omap4-clock.h>
#include <mach/omap4-silicon.h>
@@ -34,11 +35,11 @@
#define EMIF_L3_CONFIG_VAL_SYS_10_LL_0 0x0A0000FF
#define EMIF_L3_CONFIG_VAL_SYS_10_MPU_3_LL_0 0x0A300000
-void __noreturn omap4_reset_cpu(unsigned long addr)
+static void __noreturn omap4_restart_soc(struct restart_handler *rst)
{
writel(OMAP44XX_PRM_RSTCTRL_RESET, OMAP44XX_PRM_RSTCTRL);
- while (1);
+ hang();
}
void omap4_set_warmboot_order(u32 *device_list)
@@ -533,6 +534,8 @@ int omap4_init(void)
{
omap_gpmc_base = (void *)OMAP44XX_GPMC_BASE;
+ restart_handler_register_fn(omap4_restart_soc);
+
return omap4_bootsource();
}
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 334cf8db56..165487c645 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -150,17 +150,6 @@ static int omap_env_init(void)
late_initcall(omap_env_init);
#endif
-void __noreturn reset_cpu(unsigned long addr)
-{
- if (cpu_is_omap3())
- omap3_reset_cpu(addr);
- if (cpu_is_omap4())
- omap4_reset_cpu(addr);
- if (cpu_is_am33xx())
- am33xx_reset_cpu(addr);
- while (1);
-}
-
static int omap_soc_from_dt(void)
{
if (of_machine_is_compatible("ti,am33xx"))