public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] arm: mvebu: Move Armada XP/38x Kconfig to mach specific Kconfig file
@ 2015-08-25 12:24 Stefan Roese
  2015-08-25 12:24 ` [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot Stefan Roese
  2015-08-25 12:24 ` [U-Boot] [PATCH 3/3] arm: mvebu: Only set CONFIG_SKIP_LOWLEVEL_INIT for SPL Stefan Roese
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Roese @ 2015-08-25 12:24 UTC (permalink / raw)
  To: u-boot

Introduce a mach-mvebu/Kconfig for all Armada based SoC's.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 arch/arm/Kconfig                    | 16 ++++------------
 arch/arm/mach-mvebu/Kconfig         | 21 +++++++++++++++++++++
 board/Marvell/db-88f6820-gp/Kconfig |  3 ---
 board/Marvell/db-mv784mp-gp/Kconfig |  3 ---
 board/maxbcm/Kconfig                |  3 ---
 configs/db-88f6820-gp_defconfig     |  3 ++-
 configs/db-mv784mp-gp_defconfig     |  1 +
 configs/maxbcm_defconfig            |  1 +
 8 files changed, 29 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/Kconfig

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a99ae28..92e5512 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -103,18 +103,8 @@ config KIRKWOOD
 	bool "Marvell Kirkwood"
 	select CPU_ARM926EJS
 
-config TARGET_DB_88F6820_GP
-	bool "Support DB-88F6820-GP"
-	select CPU_V7
-	select SUPPORT_SPL
-
-config TARGET_DB_MV784MP_GP
-	bool "Support db-mv784mp-gp"
-	select CPU_V7
-	select SUPPORT_SPL
-
-config TARGET_MAXBCM
-	bool "Support maxbcm"
+config ARCH_MVEBU
+	bool "Marvell MVEBU family (Armada XP/38x)"
 	select CPU_V7
 	select SUPPORT_SPL
 
@@ -845,6 +835,8 @@ source "arch/arm/mach-keystone/Kconfig"
 
 source "arch/arm/mach-kirkwood/Kconfig"
 
+source "arch/arm/mach-mvebu/Kconfig"
+
 source "arch/arm/cpu/armv7/mx6/Kconfig"
 
 source "arch/arm/cpu/armv7/mx5/Kconfig"
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
new file mode 100644
index 0000000..1aa9640
--- /dev/null
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -0,0 +1,21 @@
+if ARCH_MVEBU
+
+choice
+	prompt "Marvell MVEBU (Armada XP/38x) board select"
+	optional
+
+config TARGET_DB_88F6820_GP
+	bool "Support DB-88F6820-GP"
+
+config TARGET_DB_MV784MP_GP
+	bool "Support db-mv784mp-gp"
+
+config TARGET_MAXBCM
+	bool "Support maxbcm"
+
+endchoice
+
+config SYS_SOC
+	default "mvebu"
+
+endif
diff --git a/board/Marvell/db-88f6820-gp/Kconfig b/board/Marvell/db-88f6820-gp/Kconfig
index b2e9115..f12b968 100644
--- a/board/Marvell/db-88f6820-gp/Kconfig
+++ b/board/Marvell/db-88f6820-gp/Kconfig
@@ -6,9 +6,6 @@ config SYS_BOARD
 config SYS_VENDOR
 	default "Marvell"
 
-config SYS_SOC
-	default "mvebu"
-
 config SYS_CONFIG_NAME
 	default "db-88f6820-gp"
 
diff --git a/board/Marvell/db-mv784mp-gp/Kconfig b/board/Marvell/db-mv784mp-gp/Kconfig
index d0b426e..428a5e1 100644
--- a/board/Marvell/db-mv784mp-gp/Kconfig
+++ b/board/Marvell/db-mv784mp-gp/Kconfig
@@ -6,9 +6,6 @@ config SYS_BOARD
 config SYS_VENDOR
 	default "Marvell"
 
-config SYS_SOC
-	default "mvebu"
-
 config SYS_CONFIG_NAME
 	default "db-mv784mp-gp"
 
diff --git a/board/maxbcm/Kconfig b/board/maxbcm/Kconfig
index e86aa16..2edccfe 100644
--- a/board/maxbcm/Kconfig
+++ b/board/maxbcm/Kconfig
@@ -3,9 +3,6 @@ if TARGET_MAXBCM
 config SYS_BOARD
 	default "maxbcm"
 
-config SYS_SOC
-	default "mvebu"
-
 config SYS_CONFIG_NAME
 	default "maxbcm"
 
diff --git a/configs/db-88f6820-gp_defconfig b/configs/db-88f6820-gp_defconfig
index 0ff6706..24647ce 100644
--- a/configs/db-88f6820-gp_defconfig
+++ b/configs/db-88f6820-gp_defconfig
@@ -1,6 +1,7 @@
-CONFIG_SPL=y
 CONFIG_ARM=y
+CONFIG_ARCH_MVEBU=y
 CONFIG_TARGET_DB_88F6820_GP=y
+CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_SETEXPR is not set
diff --git a/configs/db-mv784mp-gp_defconfig b/configs/db-mv784mp-gp_defconfig
index d11377f..4a828a0 100644
--- a/configs/db-mv784mp-gp_defconfig
+++ b/configs/db-mv784mp-gp_defconfig
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_ARCH_MVEBU=y
 CONFIG_TARGET_DB_MV784MP_GP=y
 CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
diff --git a/configs/maxbcm_defconfig b/configs/maxbcm_defconfig
index b0b0d6c..5957997 100644
--- a/configs/maxbcm_defconfig
+++ b/configs/maxbcm_defconfig
@@ -1,4 +1,5 @@
 CONFIG_ARM=y
+CONFIG_ARCH_MVEBU=y
 CONFIG_TARGET_MAXBCM=y
 CONFIG_SPL=y
 # CONFIG_CMD_IMLS is not set
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot
  2015-08-25 12:24 [U-Boot] [PATCH 1/3] arm: mvebu: Move Armada XP/38x Kconfig to mach specific Kconfig file Stefan Roese
@ 2015-08-25 12:24 ` Stefan Roese
  2015-08-25 22:30   ` Kevin Smith
  2015-08-25 12:24 ` [U-Boot] [PATCH 3/3] arm: mvebu: Only set CONFIG_SKIP_LOWLEVEL_INIT for SPL Stefan Roese
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2015-08-25 12:24 UTC (permalink / raw)
  To: u-boot

This patch enables the use of the kwboot tool, to boot mainline U-Boot
on the Marvell Armada XP/38x SoC's. This is done by returning to the
SoC's BootROM after SPL has initialized the SDRAM. We need to make sure
to not reconfigure the internal register space and MBARs. Otherwise
the BootROM will not be able to continue after SPL jumps back to it.

To use this feature, please don't forget to change the BOOT_FROM line
in your board specfic kwbimage.cfg file this way:

    BOOT_FROM uart

Tested on these Marvell eval boards:
DB-MV784MP-GP - Armada XP
DB-88F6820-GP - Armada 38x

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Dirk Eibach <eibach@gdsys.de>
Cc: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Luka Perkov <luka.perkov@sartura.hr>
---
 Makefile                               | 12 +++++++++++-
 arch/arm/mach-mvebu/Kconfig            | 10 ++++++++++
 arch/arm/mach-mvebu/include/mach/cpu.h |  2 ++
 arch/arm/mach-mvebu/include/mach/soc.h |  2 +-
 arch/arm/mach-mvebu/lowlevel_spl.S     | 16 ++++++++++++++++
 arch/arm/mach-mvebu/spl.c              | 25 +++++++++++++++++++++++++
 6 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 9919314..9d1905f 100644
--- a/Makefile
+++ b/Makefile
@@ -901,7 +901,7 @@ MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
 
 MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
-	-T kwbimage -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE)
+	-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
 
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 		-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
@@ -909,8 +909,18 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
 	$(call if_changed,mkimage)
 
+# If the kwboot xmodem protocol is used, to boot U-Boot on the MVEBU
+# SoC's, the SPL U-Boot returns to the BootROM after it completes
+# the SDRAM setup. The BootROM expects no U-Boot header in the main
+# U-Boot image. So we need to combine SPL and u-boot.bin instead of
+# u-boot.img in this case.
+ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT
+u-boot-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+else
 u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE
 	$(call if_changed,mkimage)
+endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
 
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 1aa9640..79ff0e8 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -18,4 +18,14 @@ endchoice
 config SYS_SOC
 	default "mvebu"
 
+config MVEBU_BOOTROM_UARTBOOT
+	bool "Use kwboot to boot via BootROM xmodem protocol"
+	help
+	  This option provides support for booting via the Marvell
+	  xmodem protocol, used by the kwboot tool.
+
+	  Please don't forget to configure the boot device in
+	  the board specific kwbimage.cfg file this way:
+	      BOOT_FROM uart
+
 endif
diff --git a/arch/arm/mach-mvebu/include/mach/cpu.h b/arch/arm/mach-mvebu/include/mach/cpu.h
index 6fa4173..5e8bf0c 100644
--- a/arch/arm/mach-mvebu/include/mach/cpu.h
+++ b/arch/arm/mach-mvebu/include/mach/cpu.h
@@ -119,6 +119,8 @@ int mvebu_mbus_probe(struct mbus_win windows[], int count);
 int mvebu_soc_family(void);
 u32 mvebu_get_nand_clock(void);
 
+void return_to_bootrom(void);
+
 int mv_sdh_init(unsigned long regbase, u32 max_clk, u32 min_clk, u32 quirks);
 
 /*
diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h
index a8a6b27..64e5443 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -33,7 +33,7 @@
 /* SOC specific definations */
 #define INTREG_BASE		0xd0000000
 #define INTREG_BASE_ADDR_REG	(INTREG_BASE + 0x20080)
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_MVEBU_DDR_A38X)
+#if defined(CONFIG_SPL_BUILD)
 /*
  * On A38x switching the regs base address without running from
  * SDRAM doesn't seem to work. So let the SPL still use the
diff --git a/arch/arm/mach-mvebu/lowlevel_spl.S b/arch/arm/mach-mvebu/lowlevel_spl.S
index 69da7fe..c8cc8b2 100644
--- a/arch/arm/mach-mvebu/lowlevel_spl.S
+++ b/arch/arm/mach-mvebu/lowlevel_spl.S
@@ -5,10 +5,26 @@
 #include <config.h>
 #include <linux/linkage.h>
 
+#ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT
 ENTRY(save_boot_params)
+	stmfd	sp!, {r0 - r12, lr}	/* @ save registers on stack */
+	ldr	r12, =CONFIG_SPL_BOOTROM_SAVE
+	str	sp, [r12]
 	b	save_boot_params_ret
 ENDPROC(save_boot_params)
 
+ENTRY(return_to_bootrom)
+	ldr	r12, =CONFIG_SPL_BOOTROM_SAVE
+	ldr	sp, [r12]
+	mov	r0, #0x0		/* @ return value: 0x0 NO_ERR */
+	ldmfd	sp!, {r0 - r12, pc}	/* @ restore regs and return */
+ENDPROC(return_to_bootrom)
+#else
+ENTRY(save_boot_params)
+ 	b	save_boot_params_ret
+ENDPROC(save_boot_params)
+#endif
+
 /*
  * cache_inv - invalidate Cache line
  * r0 - dest
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index af61ded..26ff1a2 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -34,8 +34,18 @@ void board_init_f(ulong dummy)
 	/* Set global data pointer */
 	gd = &gdata;
 
+#ifndef CONFIG_MVEBU_BOOTROM_UARTBOOT
+	/*
+	 * Only call arch_cpu_init() when not returning to the
+	 * Marvell BootROM, which is done when booting via
+	 * the xmodem protocol (kwboot tool). Otherwise the
+	 * internal register will get remapped and the BootROM
+	 * can't continue to run correctly.
+	 */
+
 	/* Linux expects the internal registers to be at 0xf1000000 */
 	arch_cpu_init();
+#endif
 
 	/*
 	 * Pin muxing needs to be done before UART output, since
@@ -54,5 +64,20 @@ void board_init_f(ulong dummy)
 	/* Setup DDR */
 	ddr3_init();
 
+#ifdef CONFIG_MVEBU_BOOTROM_UARTBOOT
+	/*
+	 * Return to the BootROM to continue the Marvell xmodem
+	 * UART boot protocol. As initiated by the kwboot tool.
+	 *
+	 * This can only be done by the BootROM and not by the
+	 * U-Boot SPL infrastructure, since the beginning of the
+	 * image is already read and interpreted by the BootROM.
+	 * SPL has no chance to receive this information. So we
+	 * need to return to the BootROM to enable this xmodem
+	 * UART download.
+	 */
+	return_to_bootrom();
+#endif
+
 	board_init_r(NULL, 0);
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 3/3] arm: mvebu: Only set CONFIG_SKIP_LOWLEVEL_INIT for SPL
  2015-08-25 12:24 [U-Boot] [PATCH 1/3] arm: mvebu: Move Armada XP/38x Kconfig to mach specific Kconfig file Stefan Roese
  2015-08-25 12:24 ` [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot Stefan Roese
@ 2015-08-25 12:24 ` Stefan Roese
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2015-08-25 12:24 UTC (permalink / raw)
  To: u-boot

When running on the AXP I sometimes noticed a strange behavior. As some
characters are not echoed on the U-Boot prompt. Not disabling the
lowlevel_init code, especially calling cpu_init_cp15() in the main
U-Boot seems to solve this issue.

Signed-off-by: Stefan Roese <sr@denx.de>
---
 arch/arm/mach-mvebu/cpu.c       | 31 +++++++++++++++++++------------
 include/configs/db-88f6820-gp.h |  2 ++
 include/configs/db-mv784mp-gp.h |  2 ++
 include/configs/maxbcm.h        |  2 ++
 4 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index efd4d04..895ad92 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -27,6 +27,14 @@ static struct mbus_win windows[] = {
 	  CPU_TARGET_DEVICEBUS_BOOTROM_SPI, CPU_ATTR_BOOTROM },
 };
 
+void lowlevel_init(void)
+{
+	/*
+	 * Dummy implementation, we only need LOWLEVEL_INIT
+	 * on Armada to configure CP15 in start.S / cpu_init_cp15()
+	 */
+}
+
 void reset_cpu(unsigned long ignored)
 {
 	struct mvebu_system_registers *reg =
@@ -214,7 +222,10 @@ static void setup_usb_phys(void)
 
 int arch_cpu_init(void)
 {
-#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_ARMADA_38X)
+#if !defined(CONFIG_SPL_BUILD)
+	struct pl310_regs *const pl310 =
+		(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
+
 	/*
 	 * Only with disabled MMU its possible to switch the base
 	 * register address on Armada 38x. Without this the SDRAM
@@ -234,18 +245,14 @@ int arch_cpu_init(void)
 	 * configured the internal register base to the value used
 	 * in the macros / defines in the U-Boot header (soc.h).
 	 */
-	if (mvebu_soc_family() == MVEBU_SOC_A38X) {
-		struct pl310_regs *const pl310 =
-			(struct pl310_regs *)CONFIG_SYS_PL310_BASE;
 
-		/*
-		 * To fully release / unlock this area from cache, we need
-		 * to flush all caches and disable the L2 cache.
-		 */
-		icache_disable();
-		dcache_disable();
-		clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
-	}
+	/*
+	 * To fully release / unlock this area from cache, we need
+	 * to flush all caches and disable the L2 cache.
+	 */
+	icache_disable();
+	dcache_disable();
+	clrbits_le32(&pl310->pl310_ctrl, L2X0_CTRL_EN);
 #endif
 
 	/*
diff --git a/include/configs/db-88f6820-gp.h b/include/configs/db-88f6820-gp.h
index 1dd4182..15f7bdf 100644
--- a/include/configs/db-88f6820-gp.h
+++ b/include/configs/db-88f6820-gp.h
@@ -16,7 +16,9 @@
 
 #define CONFIG_SYS_L2_PL310
 
+#ifdef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
+#endif
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
diff --git a/include/configs/db-mv784mp-gp.h b/include/configs/db-mv784mp-gp.h
index eec2ba9..f075a2d 100644
--- a/include/configs/db-mv784mp-gp.h
+++ b/include/configs/db-mv784mp-gp.h
@@ -13,7 +13,9 @@
 #define CONFIG_ARMADA_XP		/* SOC Family Name */
 #define CONFIG_DB_784MP_GP		/* Board target name for DDR training */
 
+#ifdef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
+#endif
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
diff --git a/include/configs/maxbcm.h b/include/configs/maxbcm.h
index 3530a26..3bed9c7 100644
--- a/include/configs/maxbcm.h
+++ b/include/configs/maxbcm.h
@@ -11,7 +11,9 @@
  * High Level Configuration Options (easy to change)
  */
 #define CONFIG_ARMADA_XP		/* SOC Family Name */
+#ifdef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board lowlevel_init */
+#endif
 #define CONFIG_SYS_GENERIC_BOARD
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot
  2015-08-25 12:24 ` [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot Stefan Roese
@ 2015-08-25 22:30   ` Kevin Smith
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Smith @ 2015-08-25 22:30 UTC (permalink / raw)
  To: u-boot

On 08/25/2015 07:24 AM, Stefan Roese wrote:
> This patch enables the use of the kwboot tool, to boot mainline U-Boot
> on the Marvell Armada XP/38x SoC's. This is done by returning to the
> SoC's BootROM after SPL has initialized the SDRAM. We need to make sure
> to not reconfigure the internal register space and MBARs. Otherwise
> the BootROM will not be able to continue after SPL jumps back to it.
>
> To use this feature, please don't forget to change the BOOT_FROM line
> in your board specfic kwbimage.cfg file this way:
>
>      BOOT_FROM uart
>
> Tested on these Marvell eval boards:
> DB-MV784MP-GP - Armada XP
> DB-88F6820-GP - Armada 38x
>
> Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Kevin Smith <kevin.smith@elecsyscorp.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-25 22:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-25 12:24 [U-Boot] [PATCH 1/3] arm: mvebu: Move Armada XP/38x Kconfig to mach specific Kconfig file Stefan Roese
2015-08-25 12:24 ` [U-Boot] [PATCH 2/3] arm: mvebu: Add option to use UART xmodem protocol via kwboot Stefan Roese
2015-08-25 22:30   ` Kevin Smith
2015-08-25 12:24 ` [U-Boot] [PATCH 3/3] arm: mvebu: Only set CONFIG_SKIP_LOWLEVEL_INIT for SPL Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox