public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vignesh Raghavendra <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 03/12] ARM: mach-k3: sysfw-loader: Use SPI memmapped addr when loading SYSFW
Date: Tue, 4 Feb 2020 11:09:50 +0530	[thread overview]
Message-ID: <20200204053959.8802-4-vigneshr@ti.com> (raw)
In-Reply-To: <20200204053959.8802-1-vigneshr@ti.com>

From: Lokesh Vutla <lokeshvutla@ti.com>

Since ROM configures OSPI controller to be in memory mapped mode in OSPI
boot, R5 SPL can directly pass the memory mapped pointer to ROM. With
this ROM can directly pull the SYSFW image from OSPI.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 arch/arm/mach-k3/Kconfig        |  8 ++++++++
 arch/arm/mach-k3/sysfw-loader.c | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 2e111bbf27ee..c98a5c66749f 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -126,6 +126,14 @@ config K3_SYSFW_IMAGE_SIZE_MAX
 	  tree blob. Keep it as tight as possible, as this directly affects the
 	  overall SPL memory footprint.
 
+config K3_SYSFW_IMAGE_SPI_OFFS
+	hex "SPI offset of SYSFW firmware and configuration blob"
+	depends on K3_LOAD_SYSFW
+	default	0x6C0000
+	help
+	  Offset of the combined System Firmware and configuration image tree
+	  blob to be loaded when booting from a SPI flash memory.
+
 config SYS_K3_SPL_ATF
 	bool "Start Cortex-A from SPL"
 	depends on SPL && CPU_V7R
diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 94dbeb9437d9..3677a37f55a2 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -14,6 +14,8 @@
 #include <g_dnl.h>
 #include <usb.h>
 #include <dfu.h>
+#include <dm/uclass-internal.h>
+#include <spi_flash.h>
 
 #include <asm/arch/sys_proto.h>
 #include "common.h"
@@ -197,12 +199,32 @@ exit:
 }
 #endif
 
+#if CONFIG_IS_ENABLED(SPI_LOAD)
+static void *k3_sysfw_get_spi_addr(void)
+{
+	struct udevice *dev;
+	fdt_addr_t addr;
+	int ret;
+
+	ret = uclass_find_device_by_seq(UCLASS_SPI, CONFIG_SF_DEFAULT_BUS,
+					true, &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(void (*config_pm_done_callback)(void))
 {
 	struct spl_image_info spl_image = { 0 };
 	struct spl_boot_device bootdev = { 0 };
 	struct ti_sci_handle *ti_sci;
-	int ret;
+	int ret = 0;
 
 	/* Reserve a block of aligned memory for loading the SYSFW image */
 	sysfw_load_address = memalign(ARCH_DMA_MINALIGN,
@@ -243,6 +265,13 @@ void k3_sysfw_loader(void (*config_pm_done_callback)(void))
 #endif
 		break;
 #endif
+#if CONFIG_IS_ENABLED(SPI_LOAD)
+	case BOOT_DEVICE_SPI:
+		sysfw_load_address = k3_sysfw_get_spi_addr();
+		if (!sysfw_load_address)
+			ret = -ENODEV;
+		break;
+#endif
 #if CONFIG_IS_ENABLED(YMODEM_SUPPORT)
 	case BOOT_DEVICE_UART:
 #ifdef CONFIG_K3_EARLY_CONS
-- 
2.25.0

  parent reply	other threads:[~2020-02-04  5:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  5:39 [PATCH v2 00/12] TI: AM654/J721e: Add support to boot from OSPI Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 01/12] drivers: Descend to drivers/soc unconditionally Vignesh Raghavendra
2020-06-02 13:46   ` Simon Glass
2020-02-04  5:39 ` [PATCH v2 02/12] ARM: mach-k3: arm64-mmu: map 64bit FSS MMIO space in A53 MMU Vignesh Raghavendra
2020-02-04  5:39 ` Vignesh Raghavendra [this message]
2020-02-04  5:39 ` [PATCH v2 04/12] ARM: dts: k3-am65: Add OSPI DT nodes Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 05/12] ARM: dts: k3-j721e: " Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 06/12] configs: am65x_evm: Setup mtdparts for OSPI Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 07/12] configs: j721e_evm: " Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 08/12] configs: j721e_evm_defconfig: Enable OSPI configs Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 09/12] configs: am65x_evm_defconfig: " Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 10/12] board: ti: Update AM65x and J721e READMEs for OSPI boot Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 11/12] configs: ama65x_hs_evm: Enable OSPI related configs Vignesh Raghavendra
2020-02-04  5:39 ` [PATCH v2 12/12] configs: j721e_hs_evm: " Vignesh Raghavendra
2020-02-04 13:36 ` [PATCH v2 00/12] TI: AM654/J721e: Add support to boot from OSPI Andreas Dannenberg
2020-02-23  8:13 ` Lokesh Vutla

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=20200204053959.8802-4-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=u-boot@lists.denx.de \
    /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