diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-22 14:27:43 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-11-22 21:34:06 +0100 |
commit | e0fbce20e6e09a55ae860af5a25859bd3461d9b4 (patch) | |
tree | 315aca2c71e6e9130d4ae221407a0e1a3fcbf242 /arch/arm/mach-omap/omap_generic.c | |
parent | dd04578bb23db1bf31ee40c002cc53ca58b1a372 (diff) | |
download | barebox-e0fbce20e6e09a55ae860af5a25859bd3461d9b4.tar.gz barebox-e0fbce20e6e09a55ae860af5a25859bd3461d9b4.tar.xz |
ARM: OMAP: centralize omap startup
This introduces a single omap_init function which detects the
SoC and does all further SoC initialization. This is done to get
rid of initcalls without proper SoC protection. The same has been
done for i.MX already.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-omap/omap_generic.c')
-rw-r--r-- | arch/arm/mach-omap/omap_generic.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c index b999ea4391..47fa9ba958 100644 --- a/arch/arm/mach-omap/omap_generic.c +++ b/arch/arm/mach-omap/omap_generic.c @@ -21,6 +21,7 @@ #include <fs.h> #include <malloc.h> #include <linux/stat.h> +#include <mach/gpmc.h> #include <mach/generic.h> #include <mach/am33xx-silicon.h> #include <mach/omap3-silicon.h> @@ -29,6 +30,8 @@ #include <mach/omap3-generic.h> #include <mach/omap4-generic.h> +void __iomem *omap_gpmc_base; + unsigned int __omap_cpu_type; static void *omap_sram_start(void) @@ -147,3 +150,52 @@ void __noreturn reset_cpu(unsigned long addr) am33xx_reset_cpu(addr); while (1); } + +static int omap_soc_from_dt(void) +{ + if (of_machine_is_compatible("ti,am33xx")) + return OMAP_CPU_AM33XX; + if (of_machine_is_compatible("ti,omap4")) + return OMAP_CPU_OMAP4; + if (of_machine_is_compatible("ti,omap3")) + return OMAP_CPU_OMAP3; + + return 0; +} + +static int omap_init(void) +{ + int ret; + struct device_node *root; + + root = of_get_root_node(); + if (root) { + __omap_cpu_type = omap_soc_from_dt(); + if (!__omap_cpu_type) + hang(); + } + + if (cpu_is_omap3()) + ret = omap3_init(); + else if (cpu_is_omap4()) + ret = omap4_init(); + else if (cpu_is_am33xx()) + ret = am33xx_init(); + else + return -EINVAL; + + if (root) + return ret; + + if (cpu_is_omap3()) + ret = omap3_devices_init(); + else if (cpu_is_omap4()) + ret = omap4_devices_init(); + else if (cpu_is_am33xx()) + ret = am33xx_devices_init(); + else + return -EINVAL; + + return ret; +} +postcore_initcall(omap_init); |