[U-Boot] [PATCH v1 08/21] sparc: Initial ground work for generic board initialization
Francois Retief
fgretief at spaceteq.co.za
Mon Nov 23 16:38:49 CET 2015
Initial ground work in preperation for generic board initialization
code for the SPARC architecture.
Signed-off-by: Francois Retief <fgretief at spaceteq.co.za>
---
arch/Kconfig | 1 +
arch/sparc/cpu/leon2/cpu.c | 4 ++--
arch/sparc/cpu/leon2/cpu_init.c | 21 +++++++++++----------
arch/sparc/cpu/leon3/cpu.c | 4 ++--
arch/sparc/cpu/leon3/cpu_init.c | 17 +++++++++--------
arch/sparc/include/asm/config.h | 4 +++-
arch/sparc/include/asm/u-boot.h | 7 +++++++
arch/sparc/lib/Makefile | 8 ++++++--
common/board_r.c | 3 ++-
9 files changed, 43 insertions(+), 26 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 25dcf4a..6489cc9 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -97,6 +97,7 @@ config SH
config SPARC
bool "SPARC architecture"
+ select HAVE_GENERIC_BOARD
select CREATE_ARCH_SYMLINK
config X86
diff --git a/arch/sparc/cpu/leon2/cpu.c b/arch/sparc/cpu/leon2/cpu.c
index 380c397..22e63e3 100644
--- a/arch/sparc/cpu/leon2/cpu.c
+++ b/arch/sparc/cpu/leon2/cpu.c
@@ -1,7 +1,7 @@
/* CPU specific code for the LEON2 CPU
*
- * (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com
+ * (C) Copyright 2007, 2015
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
diff --git a/arch/sparc/cpu/leon2/cpu_init.c b/arch/sparc/cpu/leon2/cpu_init.c
index 695ee02..581f057 100644
--- a/arch/sparc/cpu/leon2/cpu_init.c
+++ b/arch/sparc/cpu/leon2/cpu_init.c
@@ -1,8 +1,8 @@
/* Initializes CPU and basic hardware such as memory
* controllers, IRQ controller and system timer 0.
*
- * (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com
+ * (C) Copyright 2007, 2015
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -18,14 +18,6 @@
DECLARE_GLOBAL_DATA_PTR;
-/* reset CPU (jump to 0, without reset) */
-void start(void);
-
-struct {
- gd_t gd_area;
- bd_t bd;
-} global_data;
-
/*
* Breath some life into the CPU...
*
@@ -69,6 +61,15 @@ void cpu_init_f2(void)
}
+int arch_cpu_init(void)
+{
+ gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+ gd->bus_clk = CONFIG_SYS_CLK_FREQ;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
+
/*
* initialize higher level parts of CPU like time base and timers
*/
diff --git a/arch/sparc/cpu/leon3/cpu.c b/arch/sparc/cpu/leon3/cpu.c
index 8ab3150..d57bf2f 100644
--- a/arch/sparc/cpu/leon3/cpu.c
+++ b/arch/sparc/cpu/leon3/cpu.c
@@ -1,7 +1,7 @@
/* CPU specific code for the LEON3 CPU
*
- * (C) Copyright 2007
- * Daniel Hellstrom, Gaisler Research, daniel at gaisler.com
+ * (C) Copyright 2007, 2015
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com
*
* SPDX-License-Identifier: GPL-2.0+
*/
diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c
index b140da3..a0526cd 100644
--- a/arch/sparc/cpu/leon3/cpu_init.c
+++ b/arch/sparc/cpu/leon3/cpu_init.c
@@ -27,19 +27,11 @@
DECLARE_GLOBAL_DATA_PTR;
-/* reset CPU (jump to 0, without reset) */
-void start(void);
-
ambapp_dev_irqmp *irqmp = NULL;
ambapp_dev_gptimer *gptimer = NULL;
unsigned int gptimer_irq = 0;
int leon3_snooping_avail = 0;
-struct {
- gd_t gd_area;
- bd_t bd;
-} global_data;
-
/*
* Breath some life into the CPU...
*
@@ -71,6 +63,15 @@ void cpu_init_f2(void)
ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
}
+int arch_cpu_init(void)
+{
+ gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+ gd->bus_clk = CONFIG_SYS_CLK_FREQ;
+ gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+ return 0;
+}
+
/*
* initialize higher level parts of CPU like time base and timers
*/
diff --git a/arch/sparc/include/asm/config.h b/arch/sparc/include/asm/config.h
index fd0b551..c884b25 100644
--- a/arch/sparc/include/asm/config.h
+++ b/arch/sparc/include/asm/config.h
@@ -1,5 +1,6 @@
/*
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2015,
+ * Daniel Hellstrom, Cobham Gaisler, daniel at gaisler.com.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -7,6 +8,7 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
#define CONFIG_NEEDS_MANUAL_RELOC
#define CONFIG_LMB
diff --git a/arch/sparc/include/asm/u-boot.h b/arch/sparc/include/asm/u-boot.h
index 5f12e58..4c4b5f2 100644
--- a/arch/sparc/include/asm/u-boot.h
+++ b/arch/sparc/include/asm/u-boot.h
@@ -17,6 +17,11 @@
#ifndef __U_BOOT_H__
#define __U_BOOT_H__
+#ifdef CONFIG_SYS_GENERIC_BOARD
+/* Use the generic board which requires a unified bd_info */
+#include <asm-generic/u-boot.h>
+#else
+
/*
* Currently, this Board information is not passed to
* Linux kernel from U-Boot, but may be passed to other
@@ -44,6 +49,8 @@ typedef struct bd_info {
#endif /* __ASSEMBLY__ */
+#endif /* !CONFIG_SYS_GENERIC_BOARD */
+
/* For image.h:image_check_target_arch() */
#define IH_ARCH_DEFAULT IH_ARCH_SPARC
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
index e69b9ba..6bddd4c 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -1,9 +1,13 @@
#
-# (C) Copyright 2000-2006
+# (C) Copyright 2000-2015
# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
#
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y = board.o cache.o interrupts.o time.o
+obj-y = cache.o interrupts.o time.o
obj-$(CONFIG_CMD_BOOTM) += bootm.o
+
+ifndef CONFIG_SYS_GENERIC_BOARD
+obj-y += board.o
+endif
diff --git a/common/board_r.c b/common/board_r.c
index f7118e8..a5690ad 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -805,7 +805,8 @@ init_fnc_t init_sequence_r[] = {
initr_flash,
#endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86)
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_X86) || \
+ defined(CONFIG_SPARC)
/* initialize higher level parts of CPU like time base and timers */
cpu_init_r,
#endif
--
2.4.3
More information about the U-Boot
mailing list