Skip to contentSkip to conversation

sunxi: Restore lowlevel_init usage

PATCH New Hans de Goede 2 participants 2 messages Jan 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: Restore lowlevel_init usage

2 recent sunxi changes have removed the usage of lowlevel_init by moving some code around and then setting CONFIG_SKIP_LOWLEVEL_INIT.
This is problematic for 2 reasons:

1) It does not just stop s_init from being called, it also stops cpu_init_cp15 from getting called, which is undesirable.

2) We want u-boot.bin to be usable standalone, without SPL, some people e.g. use an upstream u-boot.bin together with Allwinner's boot0 loader. So u-boot.bin must (re)initialize the gpios, timer, etc.

This commit restores the lowlevel_init / s_init usage, while keeping the changes to no longer use the global-data (gd) struct in the SPL.

---
 arch/arm/cpu/armv7/sunxi/board.c | 42 ++++++++++++++++++++--------------------
 include/configs/sunxi-common.h   |  1 -
 2 files changed, 21 insertions(+), 22 deletions(-)
arch/arm/cpu/armv7/sunxi/board.c +21 -21
index f4a580a..6e28bcd 100644
@@ -27,26 +27,6 @@
 
 #include <linux/compiler.h>
 
-#ifdef CONFIG_SPL_BUILD
-/* Pointer to the global data structure for SPL */
-DECLARE_GLOBAL_DATA_PTR;
-
-/* The sunxi internal brom will try to loader external bootloader
- * from mmc0, nand flash, mmc2.
- * Unfortunately we can't check how SPL was loaded so assume
- * it's always the first SD/MMC controller
- */
-u32 spl_boot_device(void)
-{
-	return BOOT_DEVICE_MMC1;
-}
-
-/* No confirmation data available in SPL yet. Hardcode bootmode */
-u32 spl_boot_mode(void)
-{
-	return MMCSD_MODE_RAW;
-}
-
 static int gpio_init(void)
 {
 #if CONFIG_CONS_INDEX == 1 && defined(CONFIG_UART0_PORT_F)
@@ -85,7 +65,7 @@ static int gpio_init(void)
 	return 0;
 }
 
-void board_init_f(ulong dummy)
+void s_init(void)
 {
 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I
 	/* Magic (undocmented) value taken from boot0, without this DRAM
@@ -105,7 +85,27 @@ void board_init_f(ulong dummy)
 	timer_init();
 	gpio_init();
 	i2c_init_board();
+}
 
+#ifdef CONFIG_SPL_BUILD
+/* The sunxi internal brom will try to loader external bootloader
+ * from mmc0, nand flash, mmc2.
+ * Unfortunately we can't check how SPL was loaded so assume
+ * it's always the first SD/MMC controller
+ */
+u32 spl_boot_device(void)
+{
+	return BOOT_DEVICE_MMC1;
+}
+
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(void)
+{
+	return MMCSD_MODE_RAW;
+}
+
+void board_init_f(ulong dummy)
+{
 	preloader_console_init();
 
 #ifdef CONFIG_SPL_I2C_SUPPORT
include/configs/sunxi-common.h +0 -1
index 2bad807..59a298d 100644
@@ -168,7 +168,6 @@
 #define CONFIG_SYS_PBSIZE	1024	/* Print Buffer Size */
 #define CONFIG_SYS_MAXARGS	16	/* max number of command args */
 #define CONFIG_SYS_GENERIC_BOARD
-#define CONFIG_SKIP_LOWLEVEL_INIT
 
 /* Boot Argument Buffer Size */
 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 sunxi: Restore lowlevel_init usage

Quoted 7 lines · Hans de Goede

2 recent sunxi changes have removed the usage of lowlevel_init by moving some code around and then setting CONFIG_SKIP_LOWLEVEL_INIT.
This is problematic for 2 reasons:

1) It does not just stop s_init from being called, it also stops cpu_init_cp15 from getting called, which is undesirable.

Quoted 8 lines

2) We want u-boot.bin to be usable standalone, without SPL, some people e.g. use an upstream u-boot.bin together with Allwinner's boot0 loader. So u-boot.bin must (re)initialize the gpios, timer, etc.

This commit restores the lowlevel_init / s_init usage, while keeping the changes to no longer use the global-data (gd) struct in the SPL.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150121/5e56e013/attachment.pgp>