aboutsummaryrefslogtreecommitdiff
path: root/arch/arc/kernel/setup.c
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-18 15:12:26 +0530
committerVineet Gupta <vgupta@synopsys.com>2013-02-15 23:16:13 +0530
commit03a6d28cdddfbd11b338c23e7fe51d0816b9bdef (patch)
tree740383bea378fd680c35ff9b8c074ac36e2781ee /arch/arc/kernel/setup.c
parent93ad700de2abc111c50bb961c150a9968d5b3982 (diff)
ARC: [Review] Multi-platform image #2: Board callback Infrastructure
The orig platform code orgnaization was singleton design pattern - only one platform (and board thereof) would build at a time. Thus any platform/board specific code (e.g. irq init, early init ...) expected by ARC common code was exported as well defined set of APIs, with only ONE instance building ever. Now with multiple-platform build requirement, that design of code no longer holds - multiple board specific calls need to build at the same time - so ARC common code can't use the API approach, it needs a callback based design where each board registers it's specific set of functions, and at runtime, depending on board detection, the callbacks are used from the registry. This commit adds all the infrastructure, where board specific callbacks are specified as a "maThine description". All the hooks are placed in right spots, no board callbacks registered yet (with MACHINE_STARt/END constructs) so the hooks will not run. Next commit will actually convert the platform to this infrastructure. Signed-off-by: Vineet Gupta <vgupta@synopsys.com> Cc: Arnd Bergmann <arnd@arndb.de> Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arc/kernel/setup.c')
-rw-r--r--arch/arc/kernel/setup.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 6cc361c6751..20273b89e54 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -25,12 +25,14 @@
#include <asm/prom.h>
#include <asm/unwind.h>
#include <asm/clk.h>
+#include <asm/mach_desc.h>
#define FIX_PTR(x) __asm__ __volatile__(";" : "+r"(x))
int running_on_hw = 1; /* vs. on ISS */
char __initdata command_line[COMMAND_LINE_SIZE];
+struct machine_desc *machine_desc __initdata;
struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
@@ -323,8 +325,6 @@ void __init __attribute__((weak)) arc_platform_early_init(void)
void __init setup_arch(char **cmdline_p)
{
- int rc;
-
#ifdef CONFIG_CMDLINE_UBOOT
/* Make sure that a whitespace is inserted before */
strlcat(command_line, " ", sizeof(command_line));
@@ -339,13 +339,17 @@ void __init setup_arch(char **cmdline_p)
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line;
- rc = setup_machine_fdt(__dtb_start);
+ machine_desc = setup_machine_fdt(__dtb_start);
+ if (!machine_desc)
+ panic("Embedded DT invalid\n");
/* To force early parsing of things like mem=xxx */
parse_early_param();
/* Platform/board specific: e.g. early console registration */
arc_platform_early_init();
+ if (machine_desc->init_early)
+ machine_desc->init_early();
setup_processor();
@@ -372,6 +376,24 @@ void __init setup_arch(char **cmdline_p)
arc_unwind_setup();
}
+static int __init customize_machine(void)
+{
+ /* Add platform devices */
+ if (machine_desc->init_machine)
+ machine_desc->init_machine();
+
+ return 0;
+}
+arch_initcall(customize_machine);
+
+static int __init init_late_machine(void)
+{
+ if (machine_desc->init_late)
+ machine_desc->init_late();
+
+ return 0;
+}
+late_initcall(init_late_machine);
/*
* Get CPU information for use by the procfs.
*/