Skip to contentSkip to conversation

imx: imx8mm-beacon: Enable FlexSPI in U-Boot

PATCH New Adam Ford 2 participants 4 messages Feb 2, 2023 – Jul 11, 2023

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH v2 1/2 imx: imx8mm-beacon: Enable FlexSPI in U-Boot

In order to use the FlexSPI interface in U-Boot, configure the alias to make spi0 point to flexspi.

With that enabled, sf probe detects the QSPI part as:
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

---
V2: No Change

arch/arm/dts/imx8mm-beacon-kit-u-boot.dtsi +4 -0
index 00ac413f36..4f5b9cd23c 100644
@@ -6,6 +6,10 @@
 #include "imx8mm-u-boot.dtsi"
 
 / {
+	aliases {
+		spi0 = &flexspi;
+	};
+
 	wdt-reboot {
 		compatible = "wdt-reboot";
 		wdt = <&wdog1>;
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 2/2 configs: imx: imx8mm_beacon: Add config option for QSPI booting

The imx8mm_beacon SOM has a QSPI part attached to the FSPI controller. Update the header and spl files to support booting from NOR flash and add imx8mm_beacon_fspi_defconfig to support this configuration.

---
V2: Rebase and rename CONFIG_SYS_UBOOT_BASE to CFG_SYS_UBOOT_BASE

board/beacon/imx8mm/spl.c +7 -0
index a5f337aa17..b2830c5223 100644
@@ -36,6 +36,8 @@ int spl_board_boot_device(enum boot_device boot_dev_spl)
 		return BOOT_DEVICE_MMC2;
 	case USB_BOOT:
 		return BOOT_DEVICE_BOARD;
+	case QSPI_BOOT:
+		return BOOT_DEVICE_NOR;
 	default:
 		return BOOT_DEVICE_NONE;
 	}
@@ -46,6 +48,11 @@ static void spl_dram_init(void)
 	ddr_init(&dram_timing);
 }
 
+void spl_board_init(void)
+{
+	arch_misc_init();
+}
+
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
configs/imx8mm_beacon_fspi_defconfig new file +155 -0

155 lines not on this page · raw message

include/configs/imx8mm_beacon.h +9 -0
index d85ae21e23..6d70957e5e 100644
@@ -9,8 +9,17 @@
 #include <linux/sizes.h>
 #include <asm/arch/imx-regs.h>
 
+#define UBOOT_ITB_OFFSET			0x57C00
+#define FSPI_CONF_BLOCK_SIZE		0x1000
+#define UBOOT_ITB_OFFSET_FSPI  \
+	(UBOOT_ITB_OFFSET + FSPI_CONF_BLOCK_SIZE)
+#ifdef CONFIG_FSPI_CONF_HEADER
+#define CFG_SYS_UBOOT_BASE  \
+	(QSPI0_AMBA_BASE + UBOOT_ITB_OFFSET_FSPI)
+#else
 #define CFG_SYS_UBOOT_BASE	\
 	(QSPI0_AMBA_BASE + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512)
+#endif
 
 #ifdef CONFIG_SPL_BUILD
 /* malloc f used before GD_FLG_FULL_MALLOC_INIT set */
Signature · 1 line
2.34.1
#2 lore raw

PATCH v2 2/2 configs: imx: imx8mm_beacon: Add config option for QSPI booting

Quoted 4 lines

The imx8mm_beacon SOM has a QSPI part attached to the FSPI controller. Update the header and spl files to support booting from NOR flash and add imx8mm_beacon_fspi_defconfig to support this configuration.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================
#3 lore raw

PATCH v2 1/2 imx: imx8mm-beacon: Enable FlexSPI in U-Boot

In reply to Adam Ford
Quoted 5 lines

In order to use the FlexSPI interface in U-Boot, configure
the alias to make spi0 point to flexspi.
With that enabled, sf probe detects the QSPI part as:
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 4 KiB, total 32 MiB

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================