Skip to contentSkip to conversation

Basic support for Armada 370/XP SOCs

PATCH Superseded Thomas Petazzoni 2 participants 12 messages May 8, 2013

Subsystems (6)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Basic support for Armada 370/XP SOCs

Hello,

Here is a patch set that adds basic support for the Marvell Armada 370 and Armada XP SOCs. For now, the support is quite minimal, since only the serial port is supported. However, a significant part of the work has been the development of the tools that allow to extract/create bootable images and to push a bootable image through the UART to the hardware platform.

I expect to work on adding support for more devices (such as the network interface) and possibly to add support for the older, but popular, Marvell Kirkwood SoC family. Contributions are of course welcome.

Changes since v1:

- Drop the patch fixing scripts/checkpatch.pl since it has been merged upstream.

- Improve kwbimage to add options that allow to override the payload filename, the boot media, the destination address and execution address from the command line. Suggested by Sascha Hauer.

- Add an integration of kwbimage to the Barebox build process. Now, when an ARCH_MVEBU platform is selected, a barebox.kwb file is automatically generated using the board kwbimage.cfg, and a barebox.kwbuart is generated using the board kwbimage.cfg + an override of the boot media to be UART.

- Simplify the kwbimage.cfg to no longer contain the payload filename (it is passed by Barebox using kwbimage -p option), the destination and execution addresses (those are passed by Barebox using kwbimage -d and -e options, which allows to ensure they match CONFIG_TEXT_BASE).

- Change the default boot media of the kwbimage.cfg to be the real boot media used on the platform, typically SPI or NAND. Since an image for UART is always automatically generated by overriding the boot media, it makes sense to have the real boot media in kwbimage.cfg.

- Remove incorrect whitespace change in scripts/Makefile. Noticed by Sascha Hauer.

In detail, the patch set contains:

* A kwbimage tool. This tool allows to extract existing bootloader images, and create new bootloader images. It is more or less similar in purpose to the kwbimage tool from U-Boot, but is capable of handling 'version 1' images used by Armada 370/XP, and not only allows to create images, but also extract images.

A typical usage is to first extract an existing bootloader image:

./scripts/kwbimage -x -i <existing-image> -o <some-directory>

As an output, you typically get 3 files: kwbimage.cfg (a text file that describes the configuration of the image in a format ressembling the one used by U-Boot), binary.0 (the binary blob that does the DDR3 training) and payload (the bootloader itself).

Being able to extract an image is needed in order to get the DDR3 training code, and re-use it with Barebox.

An image is then later created with:

./scripts/kwbimage -c -i <path/to/kwbimage.cfg> -o <image>

For each board, the kwbimage.cfg file is typically located in arch/arm/boards/<board-name>/. The DDR3 training code must however be extracted from an existing bootloader image of your board, usually the one provided by the board manufacturer.

* A kwboot tool to push a bootloader through UART. It is directly taken from U-Boot source code, to which I've added some fixes:

- Extend the timeouts, to actually make it work on Armada 370/XP. This has originally been found by Willy Tarreau.

- Ignore non-Xmodem characters, so that the original DDR3 training code can be used without modifications (Willy had to change it to make it output its messages on a different serial port, otherwise it was confusing the Xmodem implementation)

- Output to stdout all the non-Xmodem characters so that if something goes wrong during the transfer, we have some informations. It also shows the messages output by the DDR3 training code.

- Remove the 'patch' feature that patches an image to have the UART type. This requires a knowledge of the header format, which is different between version 0 (kirkwood) and version 1 (armada 370/xp). It is not really needed anyway since kwbimage can extract and create images.

* The SoC-level code, which for now only consists in a minimal clocksource driver, a function to register an UART, a fixed-rate clock, and a function that determines the amount of RAM by looking at the SDRAM windows registers.

* An integration of kwbimage generation. When an ARCH_MVEBU platform is selected, both barebox.kwb and barebox.kwbuart images are generated automatically.

* The board-level code for the Armada 370 Mirabox from Globalscale, the Armada XP OpenBlocks AX3 from Plathome and the Armada XP GP from Marvell.

Best regards,

Thomas

Thomas Petazzoni (7):
scripts: new kwbimage manipulation tool for Marvell SoC boot images
scripts: add kwboot tool
arm: initial support for Marvell Armada 370/XP SoCs
arm: integrate kwbimage in the image generation
arm: add basic support for Armada XP OpenBlocks AX3 platform
arm: add basic support for the Armada 370 Mirabox platform
arm: add basic support for the Armada XP GP platform

 Makefile                                           |    2 +-
 arch/arm/Kconfig                                   |    8 +
 arch/arm/Makefile                                  |   24 +
 arch/arm/boards/globalscale-mirabox/Makefile       |    2 +
 arch/arm/boards/globalscale-mirabox/config.h       |    4 +
 .../globalscale-mirabox/globalscale-mirabox.c      |   26 +
 arch/arm/boards/globalscale-mirabox/kwbimage.cfg   |    5 +
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |   26 +
 arch/arm/boards/marvell-armada-xp-gp/Makefile      |    2 +
 arch/arm/boards/marvell-armada-xp-gp/config.h      |    4 +
 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg  |    3 +
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |   25 +
 .../marvell-armada-xp-gp/marvell-armada-xp-gp.c    |   25 +
 arch/arm/boards/plathome-openblocks-ax3/Makefile   |    2 +
 arch/arm/boards/plathome-openblocks-ax3/config.h   |    4 +
 .../boards/plathome-openblocks-ax3/kwbimage.cfg    |    3 +
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |   25 +
 .../plathome-openblocks-ax3.c                      |   25 +
 arch/arm/configs/globalscale_mirabox_defconfig     |    8 +
 arch/arm/configs/marvell_armada_xp_gp_defconfig    |   10 +
 arch/arm/configs/plathome_openblocks_ax3_defconfig |    9 +
 arch/arm/mach-mvebu/Kconfig                        |   54 +
 arch/arm/mach-mvebu/Makefile                       |    1 +
 arch/arm/mach-mvebu/core.c                         |  142 ++
 arch/arm/mach-mvebu/include/mach/clkdev.h          |    7 +
 arch/arm/mach-mvebu/include/mach/debug_ll.h        |   40 +
 arch/arm/mach-mvebu/include/mach/mvebu.h           |   22 +
 drivers/clocksource/Kconfig                        |    4 +
 drivers/clocksource/Makefile                       |    1 +
 drivers/clocksource/mvebu.c                        |   90 ++
 scripts/.gitignore                                 |    2 +
 scripts/Makefile                                   |    1 +
 scripts/kwbimage.c                                 | 1443 ++++++++++++++++++++
 scripts/kwboot.c                                   |  717 ++++++++++
 34 files changed, 2765 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/globalscale-mirabox/Makefile
 create mode 100644 arch/arm/boards/globalscale-mirabox/config.h
 create mode 100644 arch/arm/boards/globalscale-mirabox/globalscale-mirabox.c
 create mode 100644 arch/arm/boards/globalscale-mirabox/kwbimage.cfg
 create mode 100644 arch/arm/boards/globalscale-mirabox/lowlevel.c
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/Makefile
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/config.h
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/marvell-armada-xp-gp.c
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/Makefile
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/config.h
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/plathome-openblocks-ax3.c
 create mode 100644 arch/arm/configs/globalscale_mirabox_defconfig
 create mode 100644 arch/arm/configs/marvell_armada_xp_gp_defconfig
 create mode 100644 arch/arm/configs/plathome_openblocks_ax3_defconfig
 create mode 100644 arch/arm/mach-mvebu/Kconfig
 create mode 100644 arch/arm/mach-mvebu/Makefile
 create mode 100644 arch/arm/mach-mvebu/core.c
 create mode 100644 arch/arm/mach-mvebu/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/mvebu.h
 create mode 100644 drivers/clocksource/mvebu.c
 create mode 100644 scripts/kwbimage.c
 create mode 100644 scripts/kwboot.c
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/7 scripts: new kwbimage manipulation tool for Marvell SoC boot images

The Marvell EBU SoCs (Kirkwood, Armada 370, Armada XP) have a BootROM that understand a specific image format, composed of a main header, several extension headers and a paylod. This image can be booted from NAND, SPI, SATA, UART, NOR, etc.

This patch adds a tool that allows to extract the components and configuration of existing images, and to create new images.

---
 scripts/.gitignore |    1 +
 scripts/Makefile   |    1 +
 scripts/kwbimage.c | 1443 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1445 insertions(+)
 create mode 100644 scripts/kwbimage.c
scripts/.gitignore +1 -0
index bff805d..a28ea52 100644
@@ -2,6 +2,7 @@ bareboxenv
 bin2c
 gen_netx_image
 kallsyms
+kwbimage
 mk-am35xx-spi-image
 mkimage
 mkublheader
scripts/Makefile +1 -0
index f062fc0..e0b9868 100644
@@ -8,6 +8,7 @@ hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-y                      += bin2c
 hostprogs-y                      += mkimage
 hostprogs-y                      += bareboxenv
+hostprogs-$(CONFIG_ARCH_MVEBU)   += kwbimage
 hostprogs-$(CONFIG_ARCH_NETX)    += gen_netx_image
 hostprogs-$(CONFIG_ARCH_OMAP)    += omap_signGP mk-am35xx-spi-image
 hostprogs-$(CONFIG_ARCH_S5PCxx)  += s5p_cksum
scripts/kwbimage.c new file +1443 -0

1,443 lines not on this page · raw message

Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v2 2/7 scripts: add kwboot tool

In reply to Thomas Petazzoni

This tool is used with Marvell EBU SoC to trigger the UART boot mode provided by the SoC BootROM, and push the bootloader image to the target using the Xmodem protocol.

It has been taken from the U-Boot source code, with minor modifications to make it work with Armada 370/XP platforms.

---
 scripts/.gitignore |    1 +
 scripts/Makefile   |    2 +-
 scripts/kwboot.c   |  717 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 719 insertions(+), 1 deletion(-)
 create mode 100644 scripts/kwboot.c
scripts/.gitignore +1 -0
index a28ea52..6518c0f 100644
@@ -3,6 +3,7 @@ bin2c
 gen_netx_image
 kallsyms
 kwbimage
+kwboot
 mk-am35xx-spi-image
 mkimage
 mkublheader
scripts/Makefile +1 -1
index e0b9868..cd0b976 100644
@@ -8,7 +8,7 @@ hostprogs-$(CONFIG_KALLSYMS)     += kallsyms
 hostprogs-y                      += bin2c
 hostprogs-y                      += mkimage
 hostprogs-y                      += bareboxenv
-hostprogs-$(CONFIG_ARCH_MVEBU)   += kwbimage
+hostprogs-$(CONFIG_ARCH_MVEBU)   += kwbimage kwboot
 hostprogs-$(CONFIG_ARCH_NETX)    += gen_netx_image
 hostprogs-$(CONFIG_ARCH_OMAP)    += omap_signGP mk-am35xx-spi-image
 hostprogs-$(CONFIG_ARCH_S5PCxx)  += s5p_cksum
scripts/kwboot.c new file +717 -0

717 lines not on this page · raw message

Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v2 3/7 arm: initial support for Marvell Armada 370/XP SoCs

In reply to Thomas Petazzoni

This commit adds minimal support for the Armada 370 and Armada XP SoCs from Marvell.

---
 arch/arm/Kconfig                            |    8 ++
 arch/arm/Makefile                           |    1 +
 arch/arm/mach-mvebu/Kconfig                 |   40 ++++++++
 arch/arm/mach-mvebu/Makefile                |    1 +
 arch/arm/mach-mvebu/core.c                  |  142 +++++++++++++++++++++++++++
 arch/arm/mach-mvebu/include/mach/clkdev.h   |    7 ++
 arch/arm/mach-mvebu/include/mach/debug_ll.h |   40 ++++++++
 arch/arm/mach-mvebu/include/mach/mvebu.h    |   22 +++++
 drivers/clocksource/Kconfig                 |    4 +
 drivers/clocksource/Makefile                |    1 +
 drivers/clocksource/mvebu.c                 |   90 +++++++++++++++++
 11 files changed, 356 insertions(+)
 create mode 100644 arch/arm/mach-mvebu/Kconfig
 create mode 100644 arch/arm/mach-mvebu/Makefile
 create mode 100644 arch/arm/mach-mvebu/core.c
 create mode 100644 arch/arm/mach-mvebu/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/mvebu.h
 create mode 100644 drivers/clocksource/mvebu.c
arch/arm/Kconfig +8 -0
index 0a4f821..a044ab3 100644
@@ -79,6 +79,13 @@ config ARCH_IMX
 	select WATCHDOG_IMX_RESET_SOURCE
 	select HAS_DEBUG_LL
 
+config ARCH_MVEBU
+	bool "Marvell EBU platforms"
+	select COMMON_CLK
+	select CLOCKSOURCE_MVEBU
+	select CLKDEV_LOOKUP
+	select HAS_DEBUG_LL
+
 config ARCH_MXS
 	bool "Freescale i.MX23/28 (mxs) based"
 	select GENERIC_GPIO
@@ -161,6 +168,7 @@ source arch/arm/mach-ep93xx/Kconfig
 source arch/arm/mach-highbank/Kconfig
 source arch/arm/mach-imx/Kconfig
 source arch/arm/mach-mxs/Kconfig
+source arch/arm/mach-mvebu/Kconfig
 source arch/arm/mach-netx/Kconfig
 source arch/arm/mach-nomadik/Kconfig
 source arch/arm/mach-omap/Kconfig
arch/arm/Makefile +1 -0
index d506b12..bb47506 100644
@@ -58,6 +58,7 @@ machine-$(CONFIG_ARCH_EP93XX)		:= ep93xx
 machine-$(CONFIG_ARCH_HIGHBANK)		:= highbank
 machine-$(CONFIG_ARCH_IMX)		:= imx
 machine-$(CONFIG_ARCH_MXS)		:= mxs
+machine-$(CONFIG_ARCH_MVEBU)		:= mvebu
 machine-$(CONFIG_ARCH_NOMADIK)		:= nomadik
 machine-$(CONFIG_ARCH_NETX)		:= netx
 machine-$(CONFIG_ARCH_OMAP)		:= omap
arch/arm/mach-mvebu/Kconfig new file +40 -0
new file mode 100644
index 0000000..4cbe546
@@ -0,0 +1,40 @@
+if ARCH_MVEBU
+
+config ARCH_TEXT_BASE
+	hex
+
+config BOARDINFO
+	default
+
+choice
+	prompt "Marvell EBU Processor"
+
+config ARCH_ARMADA_370
+	bool "Armada 370"
+	select CPU_V7
+
+config ARCH_ARMADA_XP
+	bool "Armada XP"
+	select CPU_V7
+
+endchoice
+
+if ARCH_ARMADA_370
+
+choice
+	prompt "Armada 370 Board Type"
+
+endchoice
+
+endif # ARCH_ARMADA_370
+
+if ARCH_ARMADA_XP
+
+choice
+	prompt "Armada XP Board Type"
+
+endchoice
+
+endif # ARCH_ARMADA_XP
+
+endif # ARCH_MVEBU
arch/arm/mach-mvebu/Makefile new file +1 -0
new file mode 100644
index 0000000..820eb10
@@ -0,0 +1 @@
+obj-y += core.o
arch/arm/mach-mvebu/core.c new file +142 -0

142 lines not on this page · raw message

arch/arm/mach-mvebu/include/mach/clkdev.h new file +7 -0
new file mode 100644
index 0000000..04b37a8
@@ -0,0 +1,7 @@
+#ifndef __ASM_MACH_CLKDEV_H
+#define __ASM_MACH_CLKDEV_H
+
+#define __clk_get(clk) ({ 1; })
+#define __clk_put(clk) do { } while (0)
+
+#endif
arch/arm/mach-mvebu/include/mach/debug_ll.h new file +40 -0
new file mode 100644
index 0000000..2653573
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+
+#define UART_BASE 0xd0012000
+#define UART_THR  0x0
+#define UART_LSR  0x14
+#define   UART_LSR_THRE   (1 << 5)
+
+static inline void PUTC_LL(char c)
+{
+	/* Wait until there is space in the FIFO */
+	while (!(readl(UART_BASE + UART_LSR) & UART_LSR_THRE))
+		;
+
+	/* Send the character */
+	writel(c, UART_BASE + UART_THR)
+		;
+
+	/* Wait to make sure it hits the line, in case we die too soon. */
+	while (!(readl(UART_BASE + UART_LSR) & UART_LSR_THRE))
+		;
+}
+#endif
arch/arm/mach-mvebu/include/mach/mvebu.h new file +22 -0
new file mode 100644
index 0000000..e13a446
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_MVEBU_H
+#define __MACH_MVEBU_H
+
+int mvebu_add_uart0(void);
+void __naked __noreturn mvebu_barebox_entry(void);
+
+#endif /* __MACH_MVEBU_H */
drivers/clocksource/Kconfig +4 -0
index 9f3558b..dfc89dd 100644
@@ -14,6 +14,10 @@ config CLOCKSOURCE_CLPS711X
 	bool
 	depends on ARCH_CLPS711X
 
+config CLOCKSOURCE_MVEBU
+	bool
+	depends on ARCH_MVEBU
+
 config CLOCKSOURCE_NOMADIK
 	bool
 	depends on ARM
drivers/clocksource/Makefile +1 -0
index d919881..0b42ce4 100644
@@ -2,4 +2,5 @@ obj-$(CONFIG_AMBA_SP804) += amba-sp804.o
 obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o
 obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o
 obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
+obj-$(CONFIG_CLOCKSOURCE_MVEBU)   += mvebu.o
 obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
drivers/clocksource/mvebu.c new file +90 -0

90 lines not on this page · raw message

Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v2 4/7 arm: integrate kwbimage in the image generation

In reply to Thomas Petazzoni

When a ARCH_MVEBU platform is selected, generate barebox.kwb and barebox.kwbuart images from barebox.bin, using kwbimage.

barebox.kwb is generated by executing kwbimage on the board kwbimage.cfg file, and is therefore designed to be booted from the default boot media of the board, as defined by kwbimage.cfg (typically a NAND flash or SPI flash).

barebox.kwbuart is generated by executing kwbimage on the board kwbimage.cfg file, but by overriding the boot media to be UART. This image is suitable for usage with the kwbtool and is generally useful for recovery purposes.

---
 Makefile          |    2 +-
 arch/arm/Makefile |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
Makefile +1 -1
index f919993..9fcdd78 100644
@@ -970,7 +970,7 @@ CLEAN_FILES +=	barebox System.map include/generated/barebox_default_env.h \
 		.tmp_kallsyms* common/barebox_default_env* barebox.ldr \
 		scripts/bareboxenv-target barebox-flash-image \
 		Doxyfile.version barebox.srec barebox.s5p barebox.ubl \
-		barebox.uimage barebox.spi
+		barebox.uimage barebox.spi barebox.kwb barebox.kwbuart
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2 usr/include
arch/arm/Makefile +20 -0
index bb47506..3103db4 100644
@@ -263,6 +263,26 @@ KBUILD_TARGET := barebox.zynq
 KBUILD_IMAGE := barebox.zynq
 endif
 
+KWBIMAGE_OPTS = \
+	-c -i $(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)
+
+quiet_cmd_kwbimage = KWB     $@
+      cmd_kwbimage = scripts/kwbimage -p $< $(KWBIMAGE_OPTS) -o $@
+
+quiet_cmd_kwbimage_uart = KWBUART $@
+      cmd_kwbimage_uart = scripts/kwbimage -m uart -p $< $(KWBIMAGE_OPTS) -o $@
+
+barebox.kwb: $(KBUILD_BINARY) FORCE
+	$(call if_changed,kwbimage)
+
+barebox.kwbuart: $(KBUILD_BINARY) FORCE
+	$(call if_changed,kwbimage_uart)
+
+ifeq ($(CONFIG_ARCH_MVEBU),y)
+KBUILD_TARGET := barebox.kwb barebox.kwbuart
+KBUILD_IMAGE  := barebox.kwb barebox.kwbuart
+endif
+
 pbl := arch/arm/pbl
 zbarebox.S zbarebox.bin zbarebox: barebox.bin
 	$(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

Re: [PATCH v2 4/7] arm: integrate kwbimage in the image generation

Hi Thomas,

Quoted 37 lines · Thomas Petazzoni

When a ARCH_MVEBU platform is selected, generate barebox.kwb and barebox.kwbuart images from barebox.bin, using kwbimage.

barebox.kwb is generated by executing kwbimage on the board kwbimage.cfg file, and is therefore designed to be booted from the default boot media of the board, as defined by kwbimage.cfg (typically a NAND flash or SPI flash).

barebox.kwbuart is generated by executing kwbimage on the board kwbimage.cfg file, but by overriding the boot media to be UART. This image is suitable for usage with the kwbtool and is generally useful for recovery purposes.

---
 Makefile          |    2 +-
 arch/arm/Makefile |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
Makefile +1 -1
index f919993..9fcdd78 100644
@@ -970,7 +970,7 @@ CLEAN_FILES +=	barebox System.map include/generated/barebox_default_env.h \
 		.tmp_kallsyms* common/barebox_default_env* barebox.ldr \
 		scripts/bareboxenv-target barebox-flash-image \
 		Doxyfile.version barebox.srec barebox.s5p barebox.ubl \
-		barebox.uimage barebox.spi
+		barebox.uimage barebox.spi barebox.kwb barebox.kwbuart
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include2 usr/include
arch/arm/Makefile +0 -0
index bb47506..3103db4 100644

arch/arm/Makefile KBUILD_TARGET := barebox.zynq · line 268

Quoted 6 lines
arch/arm/Makefile +2 -0
@@ -263,6 +263,26 @@ KBUILD_TARGET := barebox.zynq
 KBUILD_IMAGE := barebox.zynq
 endif
 
+KWBIMAGE_OPTS = \
 
+	-c -i $(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)

if you replace this line by
-c -i $(srctree)/$(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)

it works when barebox is built out of tree

Quoted 22 lines
arch/arm/Makefile +18 -0
+
+quiet_cmd_kwbimage = KWB     $@
+      cmd_kwbimage = scripts/kwbimage -p $< $(KWBIMAGE_OPTS) -o $@
+
+quiet_cmd_kwbimage_uart = KWBUART $@
+      cmd_kwbimage_uart = scripts/kwbimage -m uart -p $< $(KWBIMAGE_OPTS) -o $@
+
+barebox.kwb: $(KBUILD_BINARY) FORCE
+	$(call if_changed,kwbimage)
+
+barebox.kwbuart: $(KBUILD_BINARY) FORCE
+	$(call if_changed,kwbimage_uart)
+
+ifeq ($(CONFIG_ARCH_MVEBU),y)
+KBUILD_TARGET := barebox.kwb barebox.kwbuart
+KBUILD_IMAGE  := barebox.kwb barebox.kwbuart
+endif
+
 pbl := arch/arm/pbl
 zbarebox.S zbarebox.bin zbarebox: barebox.bin

$(Q)$(MAKE) $(build)=$(pbl) $(pbl)/$@

Signature · 9 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v2 5/7 arm: add basic support for Armada XP OpenBlocks AX3 platform

In reply to Thomas Petazzoni

The OpenBlocks AX3 platform is manufactured by PlatHome and uses the MV78260 dual-core SoC from the Armada XP family.

---
 arch/arm/Makefile                                  |    1 +
 arch/arm/boards/plathome-openblocks-ax3/Makefile   |    2 ++
 arch/arm/boards/plathome-openblocks-ax3/config.h   |    4 ++++
 .../boards/plathome-openblocks-ax3/kwbimage.cfg    |    3 +++
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |   25 ++++++++++++++++++++
 .../plathome-openblocks-ax3.c                      |   25 ++++++++++++++++++++
 arch/arm/configs/plathome_openblocks_ax3_defconfig |    9 +++++++
 arch/arm/mach-mvebu/Kconfig                        |    6 ++++-
 8 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/Makefile
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/config.h
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/plathome-openblocks-ax3.c
 create mode 100644 arch/arm/configs/plathome_openblocks_ax3_defconfig
arch/arm/Makefile +1 -0
index 3103db4..13799fd 100644
@@ -143,6 +143,7 @@ board-$(CONFIG_MACH_GUF_CUPID)			:= guf-cupid
 board-$(CONFIG_MACH_MINI2440)			:= friendlyarm-mini2440
 board-$(CONFIG_MACH_MINI6410)			:= friendlyarm-mini6410
 board-$(CONFIG_MACH_TINY6410)			:= friendlyarm-tiny6410
+board-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3)	:= plathome-openblocks-ax3
 board-$(CONFIG_MACH_QIL_A9260)			:= qil-a9260
 board-$(CONFIG_MACH_TNY_A9260)			:= tny-a926x
 board-$(CONFIG_MACH_TNY_A9263)			:= tny-a926x
arch/arm/boards/plathome-openblocks-ax3/Makefile new file +2 -0
new file mode 100644
index 0000000..91dc764
@@ -0,0 +1,2 @@
+obj-y = plathome-openblocks-ax3.o
+lwl-y += lowlevel.o
arch/arm/boards/plathome-openblocks-ax3/config.h new file +4 -0
new file mode 100644
index 0000000..ca15136
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg new file +3 -0
new file mode 100644
index 0000000..05d398c
@@ -0,0 +1,3 @@
+VERSION 1
+BOOT_FROM spi
+BINARY binary.0 0000005b 00000068
arch/arm/boards/plathome-openblocks-ax3/lowlevel.c new file +25 -0
new file mode 100644
index 0000000..e9b2e30
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <mach/mvebu.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+	arm_cpu_lowlevel_init();
+	mvebu_barebox_entry();
+}
arch/arm/boards/plathome-openblocks-ax3/plathome-openblocks-ax3.c new file +25 -0
new file mode 100644
index 0000000..9daf020
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/mvebu.h>
+
+static int plathome_openblocks_ax3_console_init(void)
+{
+	return mvebu_add_uart0();
+}
+
+console_initcall(plathome_openblocks_ax3_console_init);
arch/arm/configs/plathome_openblocks_ax3_defconfig new file +9 -0
new file mode 100644
index 0000000..95449c9
@@ -0,0 +1,9 @@
+CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_ARMADA_XP=y
+CONFIG_AEABI=y
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_LOADS=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_CLK=y
+CONFIG_DRIVER_SERIAL_NS16550=y
arch/arm/mach-mvebu/Kconfig +5 -1
index 4cbe546..9196251 100644
@@ -2,9 +2,10 @@ if ARCH_MVEBU
 
 config ARCH_TEXT_BASE
 	hex
+	default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3
 
 config BOARDINFO
-	default
+	default "PlatHome OpenBlocks AX3" if MACH_PLATHOME_OPENBLOCKS_AX3
 
 choice
 	prompt "Marvell EBU Processor"
@@ -33,6 +34,9 @@ if ARCH_ARMADA_XP
 choice
 	prompt "Armada XP Board Type"
 
+config MACH_PLATHOME_OPENBLOCKS_AX3
+	bool "PlatHome OpenBlocks AX3"
+
 endchoice
 
 endif # ARCH_ARMADA_XP
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v2 6/7 arm: add basic support for the Armada 370 Mirabox platform

In reply to Thomas Petazzoni

The Mirabox is a platform manufactured by Globalscale, and based on the Marvell Armada 370 SoC.

---
 arch/arm/Makefile                                  |    1 +
 arch/arm/boards/globalscale-mirabox/Makefile       |    2 ++
 arch/arm/boards/globalscale-mirabox/config.h       |    4 +++
 .../globalscale-mirabox/globalscale-mirabox.c      |   26 ++++++++++++++++++++
 arch/arm/boards/globalscale-mirabox/kwbimage.cfg   |    5 ++++
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |   26 ++++++++++++++++++++
 arch/arm/configs/globalscale_mirabox_defconfig     |    8 ++++++
 arch/arm/mach-mvebu/Kconfig                        |    5 ++++
 8 files changed, 77 insertions(+)
 create mode 100644 arch/arm/boards/globalscale-mirabox/Makefile
 create mode 100644 arch/arm/boards/globalscale-mirabox/config.h
 create mode 100644 arch/arm/boards/globalscale-mirabox/globalscale-mirabox.c
 create mode 100644 arch/arm/boards/globalscale-mirabox/kwbimage.cfg
 create mode 100644 arch/arm/boards/globalscale-mirabox/lowlevel.c
 create mode 100644 arch/arm/configs/globalscale_mirabox_defconfig
arch/arm/Makefile +1 -0
index 13799fd..c8bdba7 100644
@@ -102,6 +102,7 @@ board-$(CONFIG_MACH_EUKREA_CPUIMX51SD)		:= eukrea_cpuimx51
 board-$(CONFIG_MACH_FREESCALE_MX25_3STACK)	:= freescale-mx25-3-stack
 board-$(CONFIG_MACH_FREESCALE_MX35_3STACK)	:= freescale-mx35-3-stack
 board-$(CONFIG_MACH_GE863)			:= telit-evk-pro3
+board-$(CONFIG_MACH_GLOBALSCALE_MIRABOX)        := globalscale-mirabox
 board-$(CONFIG_MACH_HIGHBANK)			:= highbank
 board-$(CONFIG_MACH_IMX21ADS)			:= imx21ads
 board-$(CONFIG_MACH_IMX27ADS)			:= imx27ads
arch/arm/boards/globalscale-mirabox/Makefile new file +2 -0
new file mode 100644
index 0000000..bd5d47e
@@ -0,0 +1,2 @@
+obj-y = globalscale-mirabox.o
+lwl-y += lowlevel.o
arch/arm/boards/globalscale-mirabox/config.h new file +4 -0
new file mode 100644
index 0000000..ca15136
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
arch/arm/boards/globalscale-mirabox/globalscale-mirabox.c new file +26 -0
new file mode 100644
index 0000000..b8f4bff
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <init.h>
+#include <sizes.h>
+#include <mach/mvebu.h>
+
+static int globalscale_mirabox_console_init(void)
+{
+	return mvebu_add_uart0();
+}
+
+console_initcall(globalscale_mirabox_console_init);
arch/arm/boards/globalscale-mirabox/kwbimage.cfg new file +5 -0
new file mode 100644
index 0000000..3e20502
@@ -0,0 +1,5 @@
+VERSION 1
+BOOT_FROM nand
+NAND_BLKSZ 00020000
+NAND_BADBLK_LOCATION 01
+BINARY binary.0 0000005b 00000068
arch/arm/boards/globalscale-mirabox/lowlevel.c new file +26 -0
new file mode 100644
index 0000000..3ca202e
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <sizes.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/mvebu.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+	arm_cpu_lowlevel_init();
+	mvebu_barebox_entry();
+}
arch/arm/configs/globalscale_mirabox_defconfig new file +8 -0
new file mode 100644
index 0000000..ed9d94d
@@ -0,0 +1,8 @@
+CONFIG_ARCH_MVEBU=y
+CONFIG_AEABI=y
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_LOADS=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_CLK=y
+CONFIG_DRIVER_SERIAL_NS16550=y
arch/arm/mach-mvebu/Kconfig +5 -0
index 9196251..8489335 100644
@@ -3,9 +3,11 @@ if ARCH_MVEBU
 config ARCH_TEXT_BASE
 	hex
 	default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3
+	default 0x2000000 if MACH_GLOBALSCALE_MIRABOX
 
 config BOARDINFO
 	default "PlatHome OpenBlocks AX3" if MACH_PLATHOME_OPENBLOCKS_AX3
+	default "Globalscale Mirabox" if MACH_GLOBALSCALE_MIRABOX
 
 choice
 	prompt "Marvell EBU Processor"
@@ -25,6 +27,9 @@ if ARCH_ARMADA_370
 choice
 	prompt "Armada 370 Board Type"
 
+config MACH_GLOBALSCALE_MIRABOX
+	bool "Globalscale Mirabox"
+
 endchoice
 
 endif # ARCH_ARMADA_370
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH v2 7/7 arm: add basic support for the Armada XP GP platform

In reply to Thomas Petazzoni

The Armada XP GP platform is an evaluation platform designed by Marvell, that uses the MV78460 quad-core SoC from the Armada XP family.

---
 arch/arm/Makefile                                  |    1 +
 arch/arm/boards/marvell-armada-xp-gp/Makefile      |    2 ++
 arch/arm/boards/marvell-armada-xp-gp/config.h      |    4 ++++
 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg  |    3 +++
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |   25 ++++++++++++++++++++
 .../marvell-armada-xp-gp/marvell-armada-xp-gp.c    |   25 ++++++++++++++++++++
 arch/arm/configs/marvell_armada_xp_gp_defconfig    |   10 ++++++++
 arch/arm/mach-mvebu/Kconfig                        |    5 ++++
 8 files changed, 75 insertions(+)
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/Makefile
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/config.h
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/marvell-armada-xp-gp.c
 create mode 100644 arch/arm/configs/marvell_armada_xp_gp_defconfig
arch/arm/Makefile +1 -0
index c8bdba7..a46e3b3 100644
@@ -107,6 +107,7 @@ board-$(CONFIG_MACH_HIGHBANK)			:= highbank
 board-$(CONFIG_MACH_IMX21ADS)			:= imx21ads
 board-$(CONFIG_MACH_IMX27ADS)			:= imx27ads
 board-$(CONFIG_MACH_IMX233_OLINUXINO)	:= imx233-olinuxino
+board-$(CONFIG_MACH_MARVELL_ARMADA_XP_GP)	:= marvell-armada-xp-gp
 board-$(CONFIG_MACH_MIOA701)			:= mioa701
 board-$(CONFIG_MACH_MMCCPU)			:= mmccpu
 board-$(CONFIG_MACH_NOMADIK_8815NHK)		:= nhk8815
arch/arm/boards/marvell-armada-xp-gp/Makefile new file +2 -0
new file mode 100644
index 0000000..ea89963
@@ -0,0 +1,2 @@
+obj-y = marvell-armada-xp-gp.o
+lwl-y += lowlevel.o
arch/arm/boards/marvell-armada-xp-gp/config.h new file +4 -0
new file mode 100644
index 0000000..ca15136
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg new file +3 -0
new file mode 100644
index 0000000..05d398c
@@ -0,0 +1,3 @@
+VERSION 1
+BOOT_FROM spi
+BINARY binary.0 0000005b 00000068
arch/arm/boards/marvell-armada-xp-gp/lowlevel.c new file +25 -0
new file mode 100644
index 0000000..e9b2e30
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <mach/mvebu.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+	arm_cpu_lowlevel_init();
+	mvebu_barebox_entry();
+}
arch/arm/boards/marvell-armada-xp-gp/marvell-armada-xp-gp.c new file +25 -0
new file mode 100644
index 0000000..7351329
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <init.h>
+#include <mach/mvebu.h>
+
+static int marvell_armada_xp_gp_console_init(void)
+{
+	return mvebu_add_uart0();
+}
+
+console_initcall(marvell_armada_xp_gp_console_init);
arch/arm/configs/marvell_armada_xp_gp_defconfig new file +10 -0
new file mode 100644
index 0000000..5a7ef52
@@ -0,0 +1,10 @@
+CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_ARMADA_XP=y
+CONFIG_MACH_MARVELL_ARMADA_XP_GP=y
+CONFIG_AEABI=y
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_LOADS=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_CLK=y
+CONFIG_DRIVER_SERIAL_NS16550=y
arch/arm/mach-mvebu/Kconfig +5 -0
index 8489335..e553e2d 100644
@@ -4,10 +4,12 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3
 	default 0x2000000 if MACH_GLOBALSCALE_MIRABOX
+	default 0x2000000 if MACH_MARVELL_ARMADA_XP_GP
 
 config BOARDINFO
 	default "PlatHome OpenBlocks AX3" if MACH_PLATHOME_OPENBLOCKS_AX3
 	default "Globalscale Mirabox" if MACH_GLOBALSCALE_MIRABOX
+	default "Marvell Armada XP GP" if MACH_MARVELL_ARMADA_XP_GP
 
 choice
 	prompt "Marvell EBU Processor"
@@ -42,6 +44,9 @@ choice
 config MACH_PLATHOME_OPENBLOCKS_AX3
 	bool "PlatHome OpenBlocks AX3"
 
+config MACH_MARVELL_ARMADA_XP_GP
+	bool "Marvell Armada XP GP"
+
 endchoice
 
 endif # ARCH_ARMADA_XP
Signature · 7 lines
1.7.9.5


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw
In reply to Thomas Petazzoni

Hi Thomas,

Quoted 23 lines · Thomas Petazzoni

Hello,

Here is a patch set that adds basic support for the Marvell Armada 370 and Armada XP SOCs. For now, the support is quite minimal, since only the serial port is supported. However, a significant part of the work has been the development of the tools that allow to extract/create bootable images and to push a bootable image through the UART to the hardware platform.

I expect to work on adding support for more devices (such as the network interface) and possibly to add support for the older, but popular, Marvell Kirkwood SoC family. Contributions are of course welcome.

Changes since v1:

- Drop the patch fixing scripts/checkpatch.pl since it has been merged upstream.

- Improve kwbimage to add options that allow to override the payload filename, the boot media, the destination address and execution address from the command line. Suggested by Sascha Hauer.

Quoted 5 lines

- Add an integration of kwbimage to the Barebox build process. Now, when an ARCH_MVEBU platform is selected, a barebox.kwb file is automatically generated using the board kwbimage.cfg, and a barebox.kwbuart is generated using the board kwbimage.cfg + an override of the boot media to be UART.

It is a very nice improvement however, you should maybe mention somwhere that you expect to find a file named binary.0 at the root of the barebox sources. But it is not very important.

However you didn't manage the out of tree building when KBUILD_OUTPUT is set. This is more annoying but it should be easily fixed.

Quoted 7 lines

- Simplify the kwbimage.cfg to no longer contain the payload filename (it is passed by Barebox using kwbimage -p option), the destination and execution addresses (those are passed by Barebox using kwbimage -d and -e options, which allows to ensure they match CONFIG_TEXT_BASE).

Quoted 5 lines

- Change the default boot media of the kwbimage.cfg to be the real boot media used on the platform, typically SPI or NAND. Since an image for UART is always automatically generated by overriding the boot media, it makes sense to have the real boot media in kwbimage.cfg.

It didn't work for me when I tested the on the OpenBlocks AX3. The boot media didn't seem to have been overridden ie it still try to boot on the NOR. And if I modify the file arch/arm/boards/plathome-openblocks-ax3//kwbimage.cfg and replace spi by uart, then it works.

Thanks for your work,

Quoted 144 lines

- Remove incorrect whitespace change in scripts/Makefile. Noticed by Sascha Hauer.

In detail, the patch set contains:

* A kwbimage tool. This tool allows to extract existing bootloader images, and create new bootloader images. It is more or less similar in purpose to the kwbimage tool from U-Boot, but is capable of handling 'version 1' images used by Armada 370/XP, and not only allows to create images, but also extract images.

A typical usage is to first extract an existing bootloader image:

./scripts/kwbimage -x -i <existing-image> -o <some-directory>

As an output, you typically get 3 files: kwbimage.cfg (a text file that describes the configuration of the image in a format ressembling the one used by U-Boot), binary.0 (the binary blob that does the DDR3 training) and payload (the bootloader itself).

Being able to extract an image is needed in order to get the DDR3 training code, and re-use it with Barebox.

An image is then later created with:

./scripts/kwbimage -c -i <path/to/kwbimage.cfg> -o <image>

For each board, the kwbimage.cfg file is typically located in arch/arm/boards/<board-name>/. The DDR3 training code must however be extracted from an existing bootloader image of your board, usually the one provided by the board manufacturer.

* A kwboot tool to push a bootloader through UART. It is directly taken from U-Boot source code, to which I've added some fixes:

- Extend the timeouts, to actually make it work on Armada 370/XP. This has originally been found by Willy Tarreau.

- Ignore non-Xmodem characters, so that the original DDR3 training code can be used without modifications (Willy had to change it to make it output its messages on a different serial port, otherwise it was confusing the Xmodem implementation)

- Output to stdout all the non-Xmodem characters so that if something goes wrong during the transfer, we have some informations. It also shows the messages output by the DDR3 training code.

- Remove the 'patch' feature that patches an image to have the UART type. This requires a knowledge of the header format, which is different between version 0 (kirkwood) and version 1 (armada 370/xp). It is not really needed anyway since kwbimage can extract and create images.

* The SoC-level code, which for now only consists in a minimal clocksource driver, a function to register an UART, a fixed-rate clock, and a function that determines the amount of RAM by looking at the SDRAM windows registers.

* An integration of kwbimage generation. When an ARCH_MVEBU platform is selected, both barebox.kwb and barebox.kwbuart images are generated automatically.

* The board-level code for the Armada 370 Mirabox from Globalscale, the Armada XP OpenBlocks AX3 from Plathome and the Armada XP GP from Marvell.

Best regards,

Thomas

Thomas Petazzoni (7):
scripts: new kwbimage manipulation tool for Marvell SoC boot images
scripts: add kwboot tool
arm: initial support for Marvell Armada 370/XP SoCs
arm: integrate kwbimage in the image generation
arm: add basic support for Armada XP OpenBlocks AX3 platform
arm: add basic support for the Armada 370 Mirabox platform
arm: add basic support for the Armada XP GP platform

 Makefile                                           |    2 +-
 arch/arm/Kconfig                                   |    8 +
 arch/arm/Makefile                                  |   24 +
 arch/arm/boards/globalscale-mirabox/Makefile       |    2 +
 arch/arm/boards/globalscale-mirabox/config.h       |    4 +
 .../globalscale-mirabox/globalscale-mirabox.c      |   26 +
 arch/arm/boards/globalscale-mirabox/kwbimage.cfg   |    5 +
 arch/arm/boards/globalscale-mirabox/lowlevel.c     |   26 +
 arch/arm/boards/marvell-armada-xp-gp/Makefile      |    2 +
 arch/arm/boards/marvell-armada-xp-gp/config.h      |    4 +
 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg  |    3 +
 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c    |   25 +
 .../marvell-armada-xp-gp/marvell-armada-xp-gp.c    |   25 +
 arch/arm/boards/plathome-openblocks-ax3/Makefile   |    2 +
 arch/arm/boards/plathome-openblocks-ax3/config.h   |    4 +
 .../boards/plathome-openblocks-ax3/kwbimage.cfg    |    3 +
 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c |   25 +
 .../plathome-openblocks-ax3.c                      |   25 +
 arch/arm/configs/globalscale_mirabox_defconfig     |    8 +
 arch/arm/configs/marvell_armada_xp_gp_defconfig    |   10 +
 arch/arm/configs/plathome_openblocks_ax3_defconfig |    9 +
 arch/arm/mach-mvebu/Kconfig                        |   54 +
 arch/arm/mach-mvebu/Makefile                       |    1 +
 arch/arm/mach-mvebu/core.c                         |  142 ++
 arch/arm/mach-mvebu/include/mach/clkdev.h          |    7 +
 arch/arm/mach-mvebu/include/mach/debug_ll.h        |   40 +
 arch/arm/mach-mvebu/include/mach/mvebu.h           |   22 +
 drivers/clocksource/Kconfig                        |    4 +
 drivers/clocksource/Makefile                       |    1 +
 drivers/clocksource/mvebu.c                        |   90 ++
 scripts/.gitignore                                 |    2 +
 scripts/Makefile                                   |    1 +
 scripts/kwbimage.c                                 | 1443 ++++++++++++++++++++
 scripts/kwboot.c                                   |  717 ++++++++++
 34 files changed, 2765 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boards/globalscale-mirabox/Makefile
 create mode 100644 arch/arm/boards/globalscale-mirabox/config.h
 create mode 100644 arch/arm/boards/globalscale-mirabox/globalscale-mirabox.c
 create mode 100644 arch/arm/boards/globalscale-mirabox/kwbimage.cfg
 create mode 100644 arch/arm/boards/globalscale-mirabox/lowlevel.c
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/Makefile
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/config.h
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/lowlevel.c
 create mode 100644 arch/arm/boards/marvell-armada-xp-gp/marvell-armada-xp-gp.c
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/Makefile
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/config.h
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/lowlevel.c
 create mode 100644 arch/arm/boards/plathome-openblocks-ax3/plathome-openblocks-ax3.c
 create mode 100644 arch/arm/configs/globalscale_mirabox_defconfig
 create mode 100644 arch/arm/configs/marvell_armada_xp_gp_defconfig
 create mode 100644 arch/arm/configs/plathome_openblocks_ax3_defconfig
 create mode 100644 arch/arm/mach-mvebu/Kconfig
 create mode 100644 arch/arm/mach-mvebu/Makefile
 create mode 100644 arch/arm/mach-mvebu/core.c
 create mode 100644 arch/arm/mach-mvebu/include/mach/clkdev.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/mvebu.h
 create mode 100644 drivers/clocksource/mvebu.c
 create mode 100644 scripts/kwbimage.c
 create mode 100644 scripts/kwboot.c
Signature · 9 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

Dear Gregory CLEMENT,

Quoted 9 lines · Gregory CLEMENT
Quoted 5 lines

- Add an integration of kwbimage to the Barebox build process. Now, when an ARCH_MVEBU platform is selected, a barebox.kwb file is automatically generated using the board kwbimage.cfg, and a barebox.kwbuart is generated using the board kwbimage.cfg + an override of the boot media to be UART.

It is a very nice improvement however, you should maybe mention somwhere that you expect to find a file named binary.0 at the root of the barebox sources. But it is not very important.

Indeed, but which "somewhere" do you suggest?

Quoted 2 lines

However you didn't manage the out of tree building when KBUILD_OUTPUT is set. This is more annoying but it should be easily fixed.

Aah, I haven't thought of out-of-tree build. I'll test that and I'll have a look.

Quoted 4 lines

It didn't work for me when I tested the on the OpenBlocks AX3. The boot media didn't seem to have been overridden ie it still try to boot on the NOR. And if I modify the file arch/arm/boards/plathome-openblocks-ax3//kwbimage.cfg and replace spi by uart, then it works.

Are you sure you used barebox.kwbuart and not barebox.kwb?

Thanks for your testing!

Thomas

Signature · 9 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw
Quoted 10 lines · Thomas Petazzoni

Dear Gregory CLEMENT,

Quoted 6 lines · Gregory CLEMENT
Quoted 5 lines

- Add an integration of kwbimage to the Barebox build process. Now, when an ARCH_MVEBU platform is selected, a barebox.kwb file is automatically generated using the board kwbimage.cfg, and a barebox.kwbuart is generated using the board kwbimage.cfg + an override of the boot media to be UART.

Quoted 5 lines
Quoted 3 lines

It is a very nice improvement however, you should maybe mention somwhere that you expect to find a file named binary.0 at the root of the barebox sources. But it is not very important.

Indeed, but which "somewhere" do you suggest?

My first thought was in the help of the menuconfig, but in the case of someone just do a make board_configs, make, he won't see it. So maybe the best option should just to make the error message more verbose. Instead of "Cannot stat binary file binary.0" some thing like "Didn't find the file binary.0 at /absolute/path/to/barebox/source which is mandatory to generate the kwboot image"

Quoted 7 lines
Quoted 3 lines

However you didn't manage the out of tree building when KBUILD_OUTPUT is set. This is more annoying but it should be easily fixed.

Aah, I haven't thought of out-of-tree build. I'll test that and I'll have a look.

Quoted 6 lines
Quoted 4 lines

It didn't work for me when I tested the on the OpenBlocks AX3. The boot media didn't seem to have been overridden ie it still try to boot on the NOR. And if I modify the file arch/arm/boards/plathome-openblocks-ax3//kwbimage.cfg and replace spi by uart, then it works.

Are you sure you used barebox.kwbuart and not barebox.kwb?

Oh I didn't notice this one! Indeed if I use barebox.kwbuart it works. Sorry for the noise.

Gregory

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox