[U-Boot] [PATCH 1/9] MIPS: Add arch-wide arch_cpu_init
Paul Burton
paul.burton at imgtec.com
Wed Sep 7 19:48:33 CEST 2016
Add an implementation of arch_cpu_init that covers all MIPS boards, in
preparation for performing various pieces of initialisation there in
later patches.
In order to allow the ath79 code to continue performing initialisation
at this point in the boot, it's converted to use a new mach_cpu_init
function which is called from arch_cpu_init.
Signed-off-by: Paul Burton <paul.burton at imgtec.com>
---
arch/mips/Kconfig | 4 ++++
arch/mips/cpu/cpu.c | 6 ++++++
arch/mips/include/asm/u-boot-mips.h | 12 ++++++++++++
arch/mips/mach-ath79/cpu.c | 3 +--
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 21066f0..34eb404 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -67,6 +67,7 @@ config ARCH_ATH79
bool "Support QCA/Atheros ath79"
select OF_CONTROL
select DM
+ select MACH_CPU_INIT
config MACH_PIC32
bool "Support Microchip PIC32"
@@ -303,6 +304,9 @@ config MIPS_L1_CACHE_SHIFT
config DYNAMIC_IO_PORT_BASE
bool
+config MACH_CPU_INIT
+ bool
+
endif
endmenu
diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index 391feb3..5ee80dd 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -35,3 +35,9 @@ void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
write_c0_index(index);
tlb_write_indexed();
}
+
+int arch_cpu_init(void)
+{
+ mach_cpu_init();
+ return 0;
+}
diff --git a/arch/mips/include/asm/u-boot-mips.h b/arch/mips/include/asm/u-boot-mips.h
index 1f527bb..0eaf32b 100644
--- a/arch/mips/include/asm/u-boot-mips.h
+++ b/arch/mips/include/asm/u-boot-mips.h
@@ -5,4 +5,16 @@
#ifndef _U_BOOT_MIPS_H_
#define _U_BOOT_MIPS_H_
+/**
+ * mach_cpu_init() - Perform SoC/machine-specific CPU initialisation
+ *
+ * This is called from arch_cpu_init() to allow for SoC/machine-level code to
+ * perform any CPU initialisation it may require.
+ */
+#ifdef CONFIG_MACH_CPU_INIT
+void mach_cpu_init(void);
+#else
+static inline void mach_cpu_init(void) {}
+#endif
+
#endif /* _U_BOOT_MIPS_H_ */
diff --git a/arch/mips/mach-ath79/cpu.c b/arch/mips/mach-ath79/cpu.c
index 5756a06..a556b73 100644
--- a/arch/mips/mach-ath79/cpu.c
+++ b/arch/mips/mach-ath79/cpu.c
@@ -46,7 +46,7 @@ static const struct ath79_soc_desc desc[] = {
{ATH79_SOC_QCA9561, "9561", REV_ID_MAJOR_QCA9561, 0},
};
-int arch_cpu_init(void)
+void mach_cpu_init(void)
{
void __iomem *base;
enum ath79_soc_type soc = ATH79_SOC_UNKNOWN;
@@ -98,7 +98,6 @@ int arch_cpu_init(void)
gd->arch.soc = soc;
gd->arch.rev = rev;
gd->arch.ver = ver;
- return 0;
}
int print_cpuinfo(void)
--
2.9.3
More information about the U-Boot
mailing list