U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Aswath Govindraju <a-govindraju@ti.com>
Cc: Kishon Vijay Abraham I <kishon@ti.com>,
	Aswath Govindraju <a-govindraju@ti.com>,
	Lokesh Vutla <lokeshvutla@ti.com>,
	Dave Gerlach <d-gerlach@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Simon Glass <sjg@chromium.org>,
	"Matwey V. Kornilov" <matwey.kornilov@gmail.com>,
	<u-boot@lists.denx.de>
Subject: [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB
Date: Wed, 4 Aug 2021 18:42:44 +0530	[thread overview]
Message-ID: <20210804131247.6672-2-a-govindraju@ti.com> (raw)
In-Reply-To: <20210804131247.6672-1-a-govindraju@ti.com>

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


  reply	other threads:[~2021-08-04 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-09-11 12:16   ` [PATCH 1/3] board: ti: am64x: Add support for fixing dr_mode while booting from USB 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210804131247.6672-2-a-govindraju@ti.com \
    --to=a-govindraju@ti.com \
    --cc=d-gerlach@ti.com \
    --cc=kishon@ti.com \
    --cc=lokeshvutla@ti.com \
    --cc=matwey.kornilov@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox