diff mbox series

[U-Boot,2/2] mx6: mx6sabre common: Add distro boot config

Message ID 20190620203436.20374-2-sjoerd.simons@collabora.co.uk
State Changes Requested
Delegated to: Stefano Babic
Headers show
Series [U-Boot,1/2] mx6: mx6sabre common: Use more conventional spelling of fdtfile | expand

Commit Message

Sjoerd Simons June 20, 2019, 8:34 p.m. UTC
Allow mx6 sabreauto and sabresd to boot via the default distro boot
commands to make it easier to support general distributions. The
previous boot setup is still supported via legacy boot targets.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---

 configs/mx6sabreauto_defconfig    |  2 ++
 include/configs/mx6sabre_common.h | 52 +++++++++++++++++++++++--------
 2 files changed, 41 insertions(+), 13 deletions(-)

Comments

Fabio Estevam July 12, 2019, 1:51 p.m. UTC | #1
Hi Sjoerd,

Subject says 2/2, but I don't see a 1/2.

On Thu, Jun 20, 2019 at 5:35 PM Sjoerd Simons
<sjoerd.simons@collabora.co.uk> wrote:
>
> Allow mx6 sabreauto and sabresd to boot via the default distro boot
> commands to make it easier to support general distributions. The
> previous boot setup is still supported via legacy boot targets.
>
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> ---
>
>  configs/mx6sabreauto_defconfig    |  2 ++

It seems you missed to touch mx6sabresd_defconfig.
Sjoerd Simons July 18, 2019, 2:26 p.m. UTC | #2
On Fri, 2019-07-12 at 10:51 -0300, Fabio Estevam wrote:
> Hi Sjoerd,
> 
> Subject says 2/2, but I don't see a 1/2.

1/2 is https://patchwork.ozlabs.org/patch/1119776/ guess patman didn't
cc you.

> On Thu, Jun 20, 2019 at 5:35 PM Sjoerd Simons
> <sjoerd.simons@collabora.co.uk> wrote:
> > Allow mx6 sabreauto and sabresd to boot via the default distro boot
> > commands to make it easier to support general distributions. The
> > previous boot setup is still supported via legacy boot targets.
> > 
> > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> > ---
> > 
> >  configs/mx6sabreauto_defconfig    |  2 ++
> 
> It seems you missed to touch mx6sabresd_defconfig.

Indeed; Thanks! Will get that fixed
diff mbox series

Patch

diff --git a/configs/mx6sabreauto_defconfig b/configs/mx6sabreauto_defconfig
index 558b1cd996..e3430fd131 100644
--- a/configs/mx6sabreauto_defconfig
+++ b/configs/mx6sabreauto_defconfig
@@ -1,6 +1,8 @@ 
 CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_SYS_TEXT_BASE=0x17800000
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
index 270cd2bae2..bc4444700b 100644
--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -48,7 +48,45 @@ 
 #define EMMC_ENV ""
 #endif
 
+#define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
+	"bootcmd_" #devtypel #instance "=" \
+	"setenv mmcdev " #instance "; "\
+	"mmc dev ${mmcdev};" \
+	"if mmc rescan; then " \
+		"if run loadbootscript; then " \
+		"run bootscript; " \
+		"else " \
+			"if run loadimage; then " \
+				"run mmcboot; " \
+			"fi; " \
+		"fi; " \
+	"fi;\0"
+
+#define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
+	#devtypel #instance " "
+
+#define BOOTENV_DEV_LEGACY_NET(devtypeu, devtypel, instance) \
+	"bootcmd_" #devtypel "=" \
+	"run netboot\0"
+
+#define BOOTENV_DEV_NAME_LEGACY_NET(devtypeu, devtypel, instance) \
+	#devtypel " "
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, CONFIG_SYS_MMC_ENV_DEV) \
+	func(LEGACY_MMC, legacy_mmc, CONFIG_SYS_MMC_ENV_DEV) \
+	func(PXE, pxe, na) \
+	func(DHCP, dhcp, na) \
+	func(LEGACY_NET, legacy_net, na)
+
+#include <config_distro_bootcmd.h>
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
+	"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0"  \
+	"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
+	"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
+	"ramdisk_addr_r=0x14000000\0" \
+	"fdt_addr_r=0x18000000\0" \
 	"script=boot.scr\0" \
 	"image=zImage\0" \
 	"fdtfile=undefined\0" \
@@ -144,20 +182,8 @@ 
 				"if test $fdtfile = undefined; then " \
 					"echo WARNING: Could not determine dtb to use; fi; " \
 			"fi;\0" \
+			BOOTENV
 
-#define CONFIG_BOOTCOMMAND \
-	"run findfdt;" \
-	"mmc dev ${mmcdev};" \
-	"if mmc rescan; then " \
-		"if run loadbootscript; then " \
-		"run bootscript; " \
-		"else " \
-			"if run loadimage; then " \
-				"run mmcboot; " \
-			"else run netboot; " \
-			"fi; " \
-		"fi; " \
-	"else run netboot; fi"
 
 #define CONFIG_ARP_TIMEOUT     200UL