diff mbox

[U-Boot] arm: mx5: Add support for USB armory board

Message ID 87619ubd0j.fsf@aikidev.net
State Changes Requested
Delegated to: Stefano Babic
Headers show

Commit Message

Vagrant Cascadian March 21, 2015, 3:12 p.m. UTC
On 2015-03-19, Andrej Rosano wrote:
> On Thu, Mar 19, 2015 at 09:55:26AM -0700, Vagrant Cascadian wrote:
>> On 2015-02-24, andrej@inversepath.com wrote:
>> > Add support for Inverse Path USB armory board, an open source
>> > flash-drive sized computer based on Freescale i.MX53 SoC.
...
>> Would you consider patches that include config_distro_defaults.h and
>> config_distro_bootcmd.h, documented in doc/README.distro? It may require
>> adding several variables such as fdt_addr_r, fdtfile, ramdisk_addr_r,
>> ramdiskfile, kernel_addr_r, bootfile, pxe_addr_r and scriptaddr,
>> documented in README and doc/README.distro. I'd be happy to work on
>> patches.
...
> Sure, it would be nice to have this included in the patch.
> I didn't know about this, I will take a look as well. Let me know if
> you need any help from my side.

Ok, here's a quick patch on top of your existing patch. It compiles, but
I haven't tested that it boots (waiting on some header pins to hook up
the serial console).

I tried to preserve default behavior, the only difference is that it
will first check for extlinux.conf and boot.scr before running the
default boot action, and has a 2 second rather than 1 second bootdelay.

Many of the things defined in config_distro_defaults.h were redundant.

Not sure if CONFIG_LOADADDR needs to be different from
kernel_addr_r/scriptaddr/pxefile_addr_r, if they can all be the same,
then they could be defined with CONFIG_LOADADDR. Hopefully
ramdisk_addr_r is at a reasonable location so it won't be clobbered by
the fdt or kernel being loaded to a lower address. It may require
removing the default bootargs to work with boot scripts.



live well,
  vagrant

Comments

andrej@inversepath.com March 24, 2015, 1:32 p.m. UTC | #1
Hi Vagrant,

On Sat, Mar 21, 2015 at 08:12:28AM -0700, Vagrant Cascadian wrote:
> On 2015-03-19, Andrej Rosano wrote:
> > On Thu, Mar 19, 2015 at 09:55:26AM -0700, Vagrant Cascadian wrote:
> >> On 2015-02-24, andrej@inversepath.com wrote:
> >> > Add support for Inverse Path USB armory board, an open source
> >> > flash-drive sized computer based on Freescale i.MX53 SoC.
> ...
> >> Would you consider patches that include config_distro_defaults.h and
> >> config_distro_bootcmd.h, documented in doc/README.distro? It may require
> >> adding several variables such as fdt_addr_r, fdtfile, ramdisk_addr_r,
> >> ramdiskfile, kernel_addr_r, bootfile, pxe_addr_r and scriptaddr,
> >> documented in README and doc/README.distro. I'd be happy to work on
> >> patches.
> ...
> > Sure, it would be nice to have this included in the patch.
> > I didn't know about this, I will take a look as well. Let me know if
> > you need any help from my side.
> 
> Ok, here's a quick patch on top of your existing patch. It compiles, but
> I haven't tested that it boots (waiting on some header pins to hook up
> the serial console).
> 
> I tried to preserve default behavior, the only difference is that it
> will first check for extlinux.conf and boot.scr before running the
> default boot action, and has a 2 second rather than 1 second bootdelay.
> 
> Many of the things defined in config_distro_defaults.h were redundant.
> 
> Not sure if CONFIG_LOADADDR needs to be different from
> kernel_addr_r/scriptaddr/pxefile_addr_r, if they can all be the same,
> then they could be defined with CONFIG_LOADADDR. Hopefully
> ramdisk_addr_r is at a reasonable location so it won't be clobbered by
> the fdt or kernel being loaded to a lower address. It may require
> removing the default bootargs to work with boot scripts.

Tested and it works as expected. I have just submitted an updated patch (v3).

Thanks

Andrej

> 
> diff --git a/include/configs/usbarmory.h b/include/configs/usbarmory.h
> index e00ec7b..7e4cc68 100644
> --- a/include/configs/usbarmory.h
> +++ b/include/configs/usbarmory.h
> @@ -22,12 +22,10 @@
>  
>  #include <asm/arch/imx-regs.h>
>  #include <config_cmd_default.h>
> +#include <config_distro_defaults.h>
>  
>  /* U-Boot commands */
> -#define CONFIG_CMD_BOOTZ
> -#define CONFIG_CMD_FAT
>  #define CONFIG_CMD_MEMTEST
> -#define CONFIG_CMD_EXT2
>  #undef CONFIG_CMD_IMLS
>  
>  /* U-Boot environment */
> @@ -39,14 +37,10 @@
>  #define CONFIG_SYS_MMC_ENV_DEV	0
>  
>  /* U-Boot general configurations */
> -#define CONFIG_SYS_LONGHELP
> -#define CONFIG_SYS_HUSH_PARSER
> -#define CONFIG_AUTO_COMPLETE
>  #define CONFIG_SYS_CBSIZE	512
>  #define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
>  #define CONFIG_SYS_MAXARGS	16
>  #define CONFIG_SYS_BARGSIZE	CONFIG_SYS_CBSIZE
> -#define CONFIG_CMDLINE_EDITING
>  
>  /* UART */
>  #define CONFIG_MXC_UART
> @@ -61,7 +55,6 @@
>  #define CONFIG_SYS_FSL_ESDHC_NUM	2
>  #define CONFIG_MMC
>  #define CONFIG_GENERIC_MMC
> -#define CONFIG_DOS_PARTITION
>  
>  /* USB */
>  #define CONFIG_CMD_USB
> @@ -82,7 +75,6 @@
>  #define CONFIG_FSL_IIM
>  
>  /* Linux boot */
> -#define CONFIG_BOOTDELAY	1
>  #define CONFIG_LOADADDR		0x72000000
>  #define CONFIG_SYS_TEXT_BASE	0x77800000
>  #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
> @@ -90,8 +82,28 @@
>  #define CONFIG_BOOTARGS \
>  	"console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw"
>  #define CONFIG_BOOTCOMMAND \
> -	"ext2load mmc 0:1 0x70800000 /boot/uImage; ext2load mmc 0:1" \
> -	"0x71000000 /boot/imx53-usbarmory.dtb; bootm 0x70800000 - 0x71000000"
> +	"run distro_bootcmd; " \
> +	"ext2load mmc 0:1 ${kernel_addr_r} /boot/uImage; " \
> +	"ext2load mmc 0:1 ${fdt_addr_r} /boot/${fdtfile}; " \
> +	"bootm ${kernel_addr_r} - ${fdt_addr_r}"
> +
> +#define BOOT_TARGET_DEVICES(func) \
> +       func(MMC, mmc, 0)
> +
> +#include <config_distro_bootcmd.h>
> +
> +#define MEM_LAYOUT_ENV_SETTINGS \
> +	"kernel_addr_r=0x70800000\0" \
> +	"fdt_addr_r=0x71000000\0" \
> +	"scriptaddr=0x70800000\0" \
> +	"pxefile_addr_r=0x70800000\0" \
> +	"ramdisk_addr_r=0x73000000\0"
> +
> +#define CONFIG_EXTRA_ENV_SETTINGS	\
> +	MEM_LAYOUT_ENV_SETTINGS		\
> +	"fdtfile=imx53-usbarmory.dtb\0"	\
> +	"console=ttymxc0,115200\0"	\
> +	BOOTENV
>  
>  /* Physical Memory Map */
>  #define CONFIG_NR_DRAM_BANKS		1
> 
> 
> live well,
>   vagrant



--
Andrej Rosano                                           Inverse Path Srl
<andrej@inversepath.com>                      http://www.inversepath.com

0x01939B21            5BB8 574E 68E8 D841 E18F  D5E9 CEAD E0CF 0193 9B21
diff mbox

Patch

diff --git a/include/configs/usbarmory.h b/include/configs/usbarmory.h
index e00ec7b..7e4cc68 100644
--- a/include/configs/usbarmory.h
+++ b/include/configs/usbarmory.h
@@ -22,12 +22,10 @@ 
 
 #include <asm/arch/imx-regs.h>
 #include <config_cmd_default.h>
+#include <config_distro_defaults.h>
 
 /* U-Boot commands */
-#define CONFIG_CMD_BOOTZ
-#define CONFIG_CMD_FAT
 #define CONFIG_CMD_MEMTEST
-#define CONFIG_CMD_EXT2
 #undef CONFIG_CMD_IMLS
 
 /* U-Boot environment */
@@ -39,14 +37,10 @@ 
 #define CONFIG_SYS_MMC_ENV_DEV	0
 
 /* U-Boot general configurations */
-#define CONFIG_SYS_LONGHELP
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_CBSIZE	512
 #define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_SYS_MAXARGS	16
 #define CONFIG_SYS_BARGSIZE	CONFIG_SYS_CBSIZE
-#define CONFIG_CMDLINE_EDITING
 
 /* UART */
 #define CONFIG_MXC_UART
@@ -61,7 +55,6 @@ 
 #define CONFIG_SYS_FSL_ESDHC_NUM	2
 #define CONFIG_MMC
 #define CONFIG_GENERIC_MMC
-#define CONFIG_DOS_PARTITION
 
 /* USB */
 #define CONFIG_CMD_USB
@@ -82,7 +75,6 @@ 
 #define CONFIG_FSL_IIM
 
 /* Linux boot */
-#define CONFIG_BOOTDELAY	1
 #define CONFIG_LOADADDR		0x72000000
 #define CONFIG_SYS_TEXT_BASE	0x77800000
 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
@@ -90,8 +82,28 @@ 
 #define CONFIG_BOOTARGS \
 	"console=ttymxc0,115200 root=/dev/mmcblk0p1 rootwait rw"
 #define CONFIG_BOOTCOMMAND \
-	"ext2load mmc 0:1 0x70800000 /boot/uImage; ext2load mmc 0:1" \
-	"0x71000000 /boot/imx53-usbarmory.dtb; bootm 0x70800000 - 0x71000000"
+	"run distro_bootcmd; " \
+	"ext2load mmc 0:1 ${kernel_addr_r} /boot/uImage; " \
+	"ext2load mmc 0:1 ${fdt_addr_r} /boot/${fdtfile}; " \
+	"bootm ${kernel_addr_r} - ${fdt_addr_r}"
+
+#define BOOT_TARGET_DEVICES(func) \
+       func(MMC, mmc, 0)
+
+#include <config_distro_bootcmd.h>
+
+#define MEM_LAYOUT_ENV_SETTINGS \
+	"kernel_addr_r=0x70800000\0" \
+	"fdt_addr_r=0x71000000\0" \
+	"scriptaddr=0x70800000\0" \
+	"pxefile_addr_r=0x70800000\0" \
+	"ramdisk_addr_r=0x73000000\0"
+
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+	MEM_LAYOUT_ENV_SETTINGS		\
+	"fdtfile=imx53-usbarmory.dtb\0"	\
+	"console=ttymxc0,115200\0"	\
+	BOOTENV
 
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS		1