public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vaishnav Achath <vaishnav.a@ti.com>
To: <u-boot@lists.denx.de>, <a-govindraju@ti.com>, <vigneshr@ti.com>,
	<s-anna@ti.com>, <kishon@ti.com>, <kristo@kernel.org>,
	<j-keerthy@ti.com>, <p.yadav@ti.com>
Cc: <vaishnav.a@ti.com>
Subject: [PATCH 6/9] arm: k3: sysfw-loader: add hyperflash support
Date: Mon, 9 May 2022 11:50:14 +0530	[thread overview]
Message-ID: <20220509062017.27623-7-vaishnav.a@ti.com> (raw)
In-Reply-To: <20220509062017.27623-1-vaishnav.a@ti.com>

add support for loading system firmware from hyperflash.

Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com>
---
 arch/arm/mach-k3/sysfw-loader.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 5e48c36ccd..988e758629 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -346,6 +346,25 @@ static void k3_sysfw_spi_copy(u32 *dst, u32 *src, size_t len)
 }
 #endif
 
+#if CONFIG_IS_ENABLED(NOR_SUPPORT)
+static void *get_sysfw_hf_addr(void)
+{
+	struct udevice *dev;
+	fdt_addr_t addr;
+	int ret;
+
+	ret = uclass_find_first_device(UCLASS_MTD, &dev);
+	if (ret)
+		return NULL;
+
+	addr = dev_read_addr_index(dev, 1);
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return (void *)(addr + CONFIG_K3_SYSFW_IMAGE_SPI_OFFS);
+}
+#endif
+
 void k3_sysfw_loader(bool rom_loaded_sysfw,
 		     void (*config_pm_pre_callback)(void),
 		     void (*config_pm_done_callback)(void))
@@ -413,6 +432,15 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
 				  CONFIG_K3_SYSFW_IMAGE_SIZE_MAX);
 		break;
 #endif
+#if CONFIG_IS_ENABLED(NOR_SUPPORT)
+	case BOOT_DEVICE_HYPERFLASH:
+		sysfw_spi_base = get_sysfw_hf_addr();
+		if (!sysfw_spi_base)
+			ret = -ENODEV;
+		k3_sysfw_spi_copy(sysfw_load_address, sysfw_spi_base,
+				  CONFIG_K3_SYSFW_IMAGE_SIZE_MAX);
+		break;
+#endif
 #if CONFIG_IS_ENABLED(YMODEM_SUPPORT)
 	case BOOT_DEVICE_UART:
 #ifdef CONFIG_K3_EARLY_CONS
-- 
2.17.1


  parent reply	other threads:[~2022-05-09 12:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  6:20 [PATCH 0/9] j721e: Add HyperFlash boot support Vaishnav Achath
2022-05-09  6:20 ` [PATCH 1/9] arm: dts: k3-j721e-mcu-wakeup: Add HyperBus Controller node Vaishnav Achath
2022-06-10 21:39   ` Tom Rini
2022-05-09  6:20 ` [PATCH 2/9] arm: dts: k3-j721e-som-p0: Add HyperFlash node Vaishnav Achath
2022-05-09  6:20 ` [PATCH 3/9] arm: dts: k3-j721e-r5-common-proc-board: " Vaishnav Achath
2022-05-09  6:20 ` [PATCH 4/9] arm: dts: k3-j721e-common-proc-board-u-boot: enable HyperFlash in SPL Vaishnav Achath
2022-05-09  6:20 ` [PATCH 5/9] arm: dts: k3-j721e-common-proc-board: enable hyperflash mux sel GPIO Vaishnav Achath
2022-05-09  6:20 ` Vaishnav Achath [this message]
2022-05-09  6:20 ` [PATCH 7/9] configs: j721e_evm.h: define CONFIG_SYS_FLASH_BASE Vaishnav Achath
2022-05-09  6:20 ` [PATCH 8/9] ti: j721e: enable hyperflash spl fixup for j721e Vaishnav Achath
2022-05-09  6:20 ` [PATCH 9/9] configs: j721e_evm_defconfig: Add HBMC related configs Vaishnav Achath

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=20220509062017.27623-7-vaishnav.a@ti.com \
    --to=vaishnav.a@ti.com \
    --cc=a-govindraju@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=kishon@ti.com \
    --cc=kristo@kernel.org \
    --cc=p.yadav@ti.com \
    --cc=s-anna@ti.com \
    --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