[PATCH 3/6] ARM: introduce SoC description

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Nov 28 13:06:44 EST 2013


This will allow to do have runtime SoC init level based on the current machine
running.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 arch/arm/cpu/machine.c           |  6 ++++++
 arch/arm/include/asm/mach/arch.h | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/cpu/machine.c b/arch/arm/cpu/machine.c
index ad0d8cb..55266f5 100644
--- a/arch/arm/cpu/machine.c
+++ b/arch/arm/cpu/machine.c
@@ -107,6 +107,12 @@ static void arm_mach_only_one_machine(void)
 			if (__ret)					\
 				break;					\
 		}							\
+									\
+		if (!machine_desc->soc_desc)				\
+			break;						\
+									\
+		if (machine_desc->soc_desc->level##_init)		\
+			__ret = machine_desc->soc_desc->level##_init();	\
 	} while(0);							\
 	__ret;								\
 })
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 91f1d2e..71dbb83 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -14,12 +14,29 @@
 #ifndef __ASM_MACH_ARCH_H__
 #define __ASM_MACH_ARCH_H__
 
+struct soc_desc {
+	const char		*name;		/* architecture name	*/
+
+	int			(*pure_init)(void);
+	int			(*core_init)(void);
+	int			(*postcore_init)(void);
+	int			(*console_init)(void);
+	int			(*postconsole_init)(void);
+	int			(*mem_init)(void);
+	int			(*postmmu_init)(void);
+	int			(*coredevice_init)(void);
+	int			(*device_init)(void);
+	int			(*late_init)(void);
+};
+
 struct machine_desc {
 	unsigned int		nr;		/* architecture number	*/
 	const char		*name;		/* architecture name	*/
 	const char *const	*dt_compat;	/* array of device tree
 						 * 'compatible' strings	*/
 
+	struct soc_desc		*soc_desc;
+
 	int			(*pure_init)(void);
 	int			(*core_init)(void);
 	int			(*postcore_init)(void);
-- 
1.8.4.3




More information about the barebox mailing list