aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/include
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2013-01-18 04:42:26 -0500
committerVineet Gupta <vgupta@synopsys.com>2013-02-15 12:46:13 -0500
commit03a6d28cdddfbd11b338c23e7fe51d0816b9bdef (patch)
tree740383bea378fd680c35ff9b8c074ac36e2781ee /arch/arc/include
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/include')
-rw-r--r--arch/arc/include/asm/mach_desc.h85
-rw-r--r--arch/arc/include/asm/prom.h1
2 files changed, 85 insertions, 1 deletions
diff --git a/arch/arc/include/asm/mach_desc.h b/arch/arc/include/asm/mach_desc.h
new file mode 100644
index 000000000000..eaebaf835f85
--- /dev/null
+++ b/arch/arc/include/asm/mach_desc.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * based on METAG mach/arch.h (which in turn was based on ARM)
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef _ASM_ARC_MACH_DESC_H_
12#define _ASM_ARC_MACH_DESC_H_
13
14/**
15 * struct machine_desc - Board specific callbacks, called from ARC common code
16 * Provided by each ARC board using MACHINE_START()/MACHINE_END(), so
17 * a multi-platform kernel builds with array of such descriptors.
18 * We extend the early DT scan to also match the DT's "compatible" string
19 * against the @dt_compat of all such descriptors, and one with highest
20 * "DT score" is selected as global @machine_desc.
21 *
22 * @name: Board/SoC name
23 * @dt_compat: Array of device tree 'compatible' strings
24 * (XXX: although only 1st entry is looked at)
25 * @init_early: Very early callback [called from setup_arch()]
26 * @init_irq: setup external IRQ controllers [called from init_IRQ()]
27 * @init_smp: for each CPU (e.g. setup IPI)
28 * [(M):init_IRQ(), (o):start_kernel_secondary()]
29 * @init_time: platform specific clocksource/clockevent registration
30 * [called from time_init()]
31 * @init_machine: arch initcall level callback (e.g. populate static
32 * platform devices or parse Devicetree)
33 * @init_late: Late initcall level callback
34 *
35 */
36struct machine_desc {
37 const char *name;
38 const char **dt_compat;
39
40 void (*init_early)(void);
41 void (*init_irq)(void);
42#ifdef CONFIG_SMP
43 void (*init_smp)(unsigned int);
44#endif
45 void (*init_time)(void);
46 void (*init_machine)(void);
47 void (*init_late)(void);
48
49};
50
51/*
52 * Current machine - only accessible during boot.
53 */
54extern struct machine_desc *machine_desc;
55
56/*
57 * Machine type table - also only accessible during boot
58 */
59extern struct machine_desc __arch_info_begin[], __arch_info_end[];
60#define for_each_machine_desc(p) \
61 for (p = __arch_info_begin; p < __arch_info_end; p++)
62
63static inline struct machine_desc *default_machine_desc(void)
64{
65 /* the default machine is the last one linked in */
66 if (__arch_info_end - 1 < __arch_info_begin)
67 return NULL;
68 return __arch_info_end - 1;
69}
70
71/*
72 * Set of macros to define architecture features.
73 * This is built into a table by the linker.
74 */
75#define MACHINE_START(_type, _name) \
76static const struct machine_desc __mach_desc_##_type \
77__used \
78__attribute__((__section__(".arch.info.init"))) = { \
79 .name = _name,
80
81#define MACHINE_END \
82};
83
84extern struct machine_desc *setup_machine_fdt(void *dt);
85#endif
diff --git a/arch/arc/include/asm/prom.h b/arch/arc/include/asm/prom.h
index f54489bc4eca..692d0d0789a7 100644
--- a/arch/arc/include/asm/prom.h
+++ b/arch/arc/include/asm/prom.h
@@ -10,6 +10,5 @@
10#define _ASM_ARC_PROM_H_ 10#define _ASM_ARC_PROM_H_
11 11
12#define HAVE_ARCH_DEVTREE_FIXUPS 12#define HAVE_ARCH_DEVTREE_FIXUPS
13extern int __init setup_machine_fdt(void *dt);
14 13
15#endif 14#endif