u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] AM64: Add support for booting to kernel from USB MSC device
@ 2021-08-04 13:12 Aswath Govindraju
  2021-08-04 13:12 ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB Aswath Govindraju
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Aswath Govindraju @ 2021-08-04 13:12 UTC (permalink / raw)
  Cc: Kishon Vijay Abraham I, Aswath Govindraju, Lokesh Vutla,
	Vignesh Raghavendra, Dave Gerlach, Simon Glass,
	Matwey V. Kornilov, u-boot

The following series of patches add support for booting to kernel using USB
MSC device as the boot media, in AM64

Aswath Govindraju (3):
  board: ti: am64x: Add support for fixing dr_mode while booting from
    USB
  environment: ti: mmc.h: Make the finduuid generic for usage across
    different device types
  include: configs: am64x_evm: Add env variables for booting to kernel
    using USB MSC device

 board/ti/am64x/evm.c         | 32 ++++++++++++++++++++++++++++++++
 include/configs/am64x_evm.h  | 31 ++++++++++++++++++++++++++++++-
 include/environment/ti/mmc.h |  2 +-
 3 files changed, 63 insertions(+), 2 deletions(-)

-- 
2.17.1


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

* [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB
  2021-08-04 13:12 [PATCH 0/3] AM64: Add support for booting to kernel from USB MSC device Aswath Govindraju
@ 2021-08-04 13:12 ` Aswath Govindraju
  2021-09-11 12:16   ` Tom Rini
  2021-08-04 13:12 ` [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types Aswath Govindraju
  2021-08-04 13:12 ` [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device Aswath Govindraju
  2 siblings, 1 reply; 7+ messages in thread
From: Aswath Govindraju @ 2021-08-04 13:12 UTC (permalink / raw)
  Cc: Kishon Vijay Abraham I, Aswath Govindraju, Lokesh Vutla,
	Dave Gerlach, Vignesh Raghavendra, Simon Glass,
	Matwey V. Kornilov, u-boot

Fix the dr_mode in the U-Boot device tree blob, by reading the mode field
from the USB Boot Configuration fields. The dr_mode will only be fixed when
booting from USB.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 board/ti/am64x/evm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index 21c58c76d67a..1a9f69c6cf1b 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <spl.h>
+#include <fdt_support.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <env.h>
@@ -60,6 +61,37 @@ int board_fit_config_name_match(const char *name)
 }
 #endif
 
+#if defined(CONFIG_SPL_BUILD) && CONFIG_IS_ENABLED(USB_STORAGE)
+static int fixup_usb_boot(const void *fdt_blob)
+{
+	int ret = 0;
+
+	switch (spl_boot_device()) {
+	case BOOT_DEVICE_USB:
+		/*
+		 * If the boot mode is host, fixup the dr_mode to host
+		 * before cdns3 bind takes place
+		 */
+		ret = fdt_find_and_setprop((void *)fdt_blob,
+					   "/bus@f4000/cdns-usb@f900000/usb@f400000",
+					   "dr_mode", "host", 5, 0);
+		if (ret)
+			printf("%s: fdt_find_and_setprop() failed:%d\n",
+			       __func__, ret);
+		fallthrough;
+	default:
+		break;
+	}
+
+	return ret;
+}
+
+void spl_perform_fixups(struct spl_image_info *spl_image)
+{
+	fixup_usb_boot(spl_image->fdt_addr);
+}
+#endif
+
 #ifdef CONFIG_TI_I2C_BOARD_DETECT
 int do_board_detect(void)
 {
-- 
2.17.1


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

* [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types
  2021-08-04 13:12 [PATCH 0/3] AM64: Add support for booting to kernel from USB MSC device Aswath Govindraju
  2021-08-04 13:12 ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB Aswath Govindraju
@ 2021-08-04 13:12 ` Aswath Govindraju
  2021-09-11 12:16   ` Tom Rini
  2021-08-04 13:12 ` [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device Aswath Govindraju
  2 siblings, 1 reply; 7+ messages in thread
From: Aswath Govindraju @ 2021-08-04 13:12 UTC (permalink / raw)
  Cc: Kishon Vijay Abraham I, Aswath Govindraju, Lokesh Vutla,
	Simon Glass, Vignesh Raghavendra, Dave Gerlach,
	Matwey V. Kornilov, u-boot

Make finduuid generic by making it dependent on the boot variable. For
example, this can now be used for finding the uuid of partitions in usb
device too.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 include/environment/ti/mmc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/environment/ti/mmc.h b/include/environment/ti/mmc.h
index b86c8dc7a4f3..769ea9d5ef70 100644
--- a/include/environment/ti/mmc.h
+++ b/include/environment/ti/mmc.h
@@ -11,7 +11,7 @@
 #define DEFAULT_MMC_TI_ARGS \
 	"mmcdev=0\0" \
 	"mmcrootfstype=ext4 rootwait\0" \
-	"finduuid=part uuid mmc ${bootpart} uuid\0" \
+	"finduuid=part uuid ${boot} ${bootpart} uuid\0" \
 	"args_mmc=run finduuid;setenv bootargs console=${console} " \
 		"${optargs} " \
 		"root=PARTUUID=${uuid} rw " \
-- 
2.17.1


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

* [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device
  2021-08-04 13:12 [PATCH 0/3] AM64: Add support for booting to kernel from USB MSC device Aswath Govindraju
  2021-08-04 13:12 ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB Aswath Govindraju
  2021-08-04 13:12 ` [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types Aswath Govindraju
@ 2021-08-04 13:12 ` Aswath Govindraju
  2021-09-11 12:16   ` Tom Rini
  2 siblings, 1 reply; 7+ messages in thread
From: Aswath Govindraju @ 2021-08-04 13:12 UTC (permalink / raw)
  Cc: Kishon Vijay Abraham I, Aswath Govindraju, Lokesh Vutla,
	Dave Gerlach, Simon Glass, Vignesh Raghavendra,
	Matwey V. Kornilov, u-boot

Add env variables for booting to kernel from USB MSC device. The second
partition in the USB MSC device needs to formatted as ext4 file system with
kernel and dtb images, present in the /boot folder.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
---
 include/configs/am64x_evm.h | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/include/configs/am64x_evm.h b/include/configs/am64x_evm.h
index 7c520f4395b5..f3d46449011a 100644
--- a/include/configs/am64x_evm.h
+++ b/include/configs/am64x_evm.h
@@ -96,6 +96,34 @@
 		"${bootdir}/${name_fit}\0"				\
 	"partitions=" PARTS_DEFAULT
 
+#define EXTRA_ENV_AM642_BOARD_SETTING_USBMSC				\
+	"args_usb=run finduuid;setenv bootargs console=${console} "	\
+		"${optargs} "						\
+		"root=PARTUUID=${uuid} rw "				\
+		"rootfstype=${mmcrootfstype}\0"				\
+	"init_usb=run args_all args_usb\0"				\
+	"get_fdt_usb=load usb ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"get_overlay_usb="						\
+		"fdt address ${fdtaddr};"				\
+		"fdt resize 0x100000;"					\
+		"for overlay in $name_overlays;"			\
+		"do;"							\
+		"load usb ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && "	\
+		"fdt apply ${dtboaddr};"				\
+		"done;\0"						\
+	"get_kern_usb=load usb ${bootpart} ${loadaddr} "		\
+		"${bootdir}/${name_kern}\0"				\
+	"get_fit_usb=load usb ${bootpart} ${addr_fit} "			\
+		"${bootdir}/${name_fit}\0"				\
+	"usbboot=setenv boot usb;"					\
+		"setenv bootpart 0:2;"					\
+		"usb start;"						\
+		"run findfdt;"						\
+		"run init_usb;"						\
+		"run get_kern_usb;"					\
+		"run get_fdt_usb;"					\
+		"run run_kern\0"
+
 #define EXTRA_ENV_DFUARGS \
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_EMMC \
@@ -108,7 +136,8 @@
 	DEFAULT_MMC_TI_ARGS						\
 	EXTRA_ENV_AM642_BOARD_SETTINGS					\
 	EXTRA_ENV_AM642_BOARD_SETTINGS_MMC				\
-	EXTRA_ENV_DFUARGS
+	EXTRA_ENV_DFUARGS						\
+	EXTRA_ENV_AM642_BOARD_SETTING_USBMSC
 
 /* Now for the remaining common defines */
 #include <configs/ti_armv7_common.h>
-- 
2.17.1


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

* Re: [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB
  2021-08-04 13:12 ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB Aswath Govindraju
@ 2021-09-11 12:16   ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2021-09-11 12:16 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Kishon Vijay Abraham I, Lokesh Vutla, Dave Gerlach,
	Vignesh Raghavendra, Simon Glass, Matwey V. Kornilov, u-boot

[-- Attachment #1: Type: text/plain, Size: 358 bytes --]

On Wed, Aug 04, 2021 at 06:42:44PM +0530, Aswath Govindraju wrote:

> Fix the dr_mode in the U-Boot device tree blob, by reading the mode field
> from the USB Boot Configuration fields. The dr_mode will only be fixed when
> booting from USB.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types
  2021-08-04 13:12 ` [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types Aswath Govindraju
@ 2021-09-11 12:16   ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2021-09-11 12:16 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Kishon Vijay Abraham I, Lokesh Vutla, Simon Glass,
	Vignesh Raghavendra, Dave Gerlach, Matwey V. Kornilov, u-boot

[-- Attachment #1: Type: text/plain, Size: 345 bytes --]

On Wed, Aug 04, 2021 at 06:42:45PM +0530, Aswath Govindraju wrote:

> Make finduuid generic by making it dependent on the boot variable. For
> example, this can now be used for finding the uuid of partitions in usb
> device too.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

* Re: [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device
  2021-08-04 13:12 ` [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device Aswath Govindraju
@ 2021-09-11 12:16   ` Tom Rini
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Rini @ 2021-09-11 12:16 UTC (permalink / raw)
  To: Aswath Govindraju
  Cc: Kishon Vijay Abraham I, Lokesh Vutla, Dave Gerlach, Simon Glass,
	Vignesh Raghavendra, Matwey V. Kornilov, u-boot

[-- Attachment #1: Type: text/plain, Size: 390 bytes --]

On Wed, Aug 04, 2021 at 06:42:46PM +0530, Aswath Govindraju wrote:

> Add env variables for booting to kernel from USB MSC device. The second
> partition in the USB MSC device needs to formatted as ext4 file system with
> kernel and dtb images, present in the /boot folder.
> 
> Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2021-09-11 12:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 13:12 [PATCH 0/3] AM64: Add support for booting to kernel from USB MSC device Aswath Govindraju
2021-08-04 13:12 ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB Aswath Govindraju
2021-09-11 12:16   ` Tom Rini
2021-08-04 13:12 ` [PATCH 2/3] environment: ti: mmc.h: Make the finduuid generic for usage across different device types Aswath Govindraju
2021-09-11 12:16   ` Tom Rini
2021-08-04 13:12 ` [PATCH 3/3] include: configs: am64x_evm: Add env variables for booting to kernel using USB MSC device Aswath Govindraju
2021-09-11 12:16   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).