Skip to contentSkip to conversation

i.MX8QXP: MEK: support SPL

PATCH New Peng Fan 2 participants 21 messages Dec 21, 2018 – Jan 30, 2019

Subsystems (6)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

v2 cover i.MX8QXP: MEK: support SPL

This is to support SPL for i.MX8QXP MEK board and default support SPL. In this patchset, use SPL FIT, but actually we could not use SPL FIT for secure boot, in NXP vendor tree, there is another format called container, NXP use SPL + container for secure boot. The container support is on my TODO list. But to make SPL work in upstream, use SPL FIT here.

V2:
Correct patch 9/10 10/10, SPL_TEXT_BASE is patch 9/10 is wrong, however 10/10 corrected, so clean that.

Peng Fan (10):
imx8qxp: add SUPPORT_SPL option
imx8: scu: use dedicated MU for SPL
arm: imx: build mach-imx for i.MX8
gpio: introduce CONFIG_SPL_DM_PCA953X
spl: imx8: add spl boot device
dts: imx8qxp-mek: introduce u-boot dtsi
imx: mkimage_fit_atf: introduce BL33_BASE_ADDR
imx: build flash.bin for i.MX8
imx8qxp: mek: default enable SPL
imx8qxp: mek: update README

 Makefile                                 |   2 +-
 arch/arm/Makefile                        |   2 +-
 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi | 112 +++++++++++++++++++++++++++++++
 arch/arm/dts/fsl-imx8qxp-mek.dts         |   1 +
 arch/arm/mach-imx/Makefile               |  15 ++++-
 arch/arm/mach-imx/imx8/Kconfig           |   8 +++
 arch/arm/mach-imx/mkimage_fit_atf.sh     |   3 +-
 arch/arm/mach-imx/spl.c                  |  14 +++-
 board/freescale/imx8qxp_mek/Makefile     |   1 +
 board/freescale/imx8qxp_mek/README       |   8 ++-
 board/freescale/imx8qxp_mek/imximage.cfg |   4 +-
 board/freescale/imx8qxp_mek/spl.c        |  75 +++++++++++++++++++++
 configs/imx8qxp_mek_defconfig            |  24 +++++++
 drivers/gpio/Kconfig                     |  23 +++++++
 drivers/gpio/Makefile                    |   2 +-
 drivers/misc/imx8/scu.c                  |   4 ++
 include/configs/imx8qxp_mek.h            |  26 +++++++
 17 files changed, 311 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi
 create mode 100644 board/freescale/imx8qxp_mek/spl.c
Signature · 1 line
2.14.1
author
#1 lore raw

PATCH v2 1/10 imx8qxp: add SUPPORT_SPL option

Enable SUPPORT_SPL option for i.MX8QXP, then we could enable SPL.

---
 arch/arm/mach-imx/imx8/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/imx8/Kconfig +1 -0
index 0d3a87cd74..9671107cb6 100644
@@ -5,6 +5,7 @@ config IMX8
 
 config IMX8QXP
 	select IMX8
+	select SUPPORT_SPL
 	bool
 
 config SYS_SOC
Signature · 1 line
2.14.1
#2 lore raw

PATCH v2 1/10 imx8qxp: add SUPPORT_SPL option

Quoted 2 lines

Enable SUPPORT_SPL option for i.MX8QXP, then we could enable SPL.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH v2 2/10 imx8: scu: use dedicated MU for SPL

In reply to Peng Fan

SPL runs in EL3 mode, except MU0_A, others are not powered on, and could not be used. However normal U-Boot use MU1_A, so we could not reuse the one in dts. And we could not replace the one in dts with MU0_A, because MU0_A is reserved in secure world.

---
 arch/arm/mach-imx/imx8/Kconfig | 7 +++++++
 drivers/misc/imx8/scu.c        | 4 ++++
 2 files changed, 11 insertions(+)
arch/arm/mach-imx/imx8/Kconfig +7 -0
index 9671107cb6..f76a139684 100644
@@ -3,6 +3,13 @@ if ARCH_IMX8
 config IMX8
 	bool
 
+config MU_BASE_SPL
+	hex "MU base address used in SPL"
+	default 0x5d1b0000
+	help
+	  SPL runs in EL3 mode, it use MU0_A to communicate with SCU.
+	  So we could not reuse the one in dts which is for normal U-Boot.
+
 config IMX8QXP
 	select IMX8
 	select SUPPORT_SPL
drivers/misc/imx8/scu.c +4 -0
index 15101b3e5f..1b9c49c99c 100644
@@ -191,7 +191,11 @@ static int imx8_scu_probe(struct udevice *dev)
 	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
 
+#ifdef CONFIG_SPL_BUILD
+	plat->base = (struct mu_type *)CONFIG_MU_BASE_SPL;
+#else
 	plat->base = (struct mu_type *)addr;
+#endif
 
 	/* U-Boot not enable interrupts, so need to enable RX interrupts */
 	mu_hal_init(plat->base);
Signature · 1 line
2.14.1
#4 lore raw

PATCH v2 2/10 imx8: scu: use dedicated MU for SPL

Quoted 5 lines

SPL runs in EL3 mode, except MU0_A, others are not powered on, and could not be used. However normal U-Boot use MU1_A, so we could not reuse the one in dts. And we could not replace the one in dts with MU0_A, because MU0_A is reserved in secure world.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#5 lore raw

PATCH v2 3/10 arm: imx: build mach-imx for i.MX8

In reply to Peng Fan

To enable SPL for i.MX8, we could reuse code in arch/arm/mach-imx.

---
 arch/arm/Makefile          | 2 +-
 arch/arm/mach-imx/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/Makefile +1 -1
index 87d9d4b9f7..0e2cfd4534 100644
@@ -103,7 +103,7 @@ libs-y += arch/arm/cpu/
 libs-y += arch/arm/lib/
 
 ifeq ($(CONFIG_SPL_BUILD),y)
-ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m))
+ifneq (,$(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_MX35)$(filter $(SOC), mx25 mx5 mx6 mx7 mx35 imx8m imx8))
 libs-y += arch/arm/mach-imx/
 endif
 else
arch/arm/mach-imx/Makefile +1 -1
index 04783fa04e..5424848ad3 100644
@@ -24,7 +24,7 @@ obj-y	+= cpu.o speed.o
 obj-$(CONFIG_GPT_TIMER) += timer.o
 obj-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o
 endif
-ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m))
+ifeq ($(SOC),$(filter $(SOC),mx7 mx6 mxs imx8m imx8))
 obj-y	+= misc.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 endif
Signature · 1 line
2.14.1
#6 lore raw

PATCH v2 3/10 arm: imx: build mach-imx for i.MX8

Quoted 2 lines

To enable SPL for i.MX8, we could reuse code in arch/arm/mach-imx.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#7 lore raw

PATCH v2 4/10 gpio: introduce CONFIG_SPL_DM_PCA953X

In reply to Peng Fan

Introduce CONFIG_SPL_DM_PCA953X for SPL usage.

---
 drivers/gpio/Kconfig  | 23 +++++++++++++++++++++++
 drivers/gpio/Makefile |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)
drivers/gpio/Kconfig +23 -0
index 35344e57c6..b1c9404aaf 100644
@@ -292,6 +292,29 @@ config DM_PCA953X
 	  Now, max 24 bits chips and PCA953X compatible chips are
 	  supported
 
+config SPL_DM_PCA953X
+	bool "PCA95[357]x, PCA9698, TCA64xx, and MAX7310 I/O ports in SPL"
+	depends on DM_GPIO
+	help
+	  Say yes here to provide access to several register-oriented
+	  SMBus I/O expanders, made mostly by NXP or TI.  Compatible
+	  models include:
+
+	  4 bits:	pca9536, pca9537
+
+	  8 bits:	max7310, max7315, pca6107, pca9534, pca9538, pca9554,
+			pca9556, pca9557, pca9574, tca6408, xra1202
+
+	  16 bits:	max7312, max7313, pca9535, pca9539, pca9555, pca9575,
+			tca6416
+
+	  24 bits:	tca6424
+
+	  40 bits:	pca9505, pca9698
+
+	  Now, max 24 bits chips and PCA953X compatible chips are
+	  supported
+
 config MPC8XXX_GPIO
 	bool "Freescale MPC8XXX GPIO driver"
 	depends on DM_GPIO
drivers/gpio/Makefile +1 -1
index 7ed9a4ec42..dac238ae06 100644
@@ -9,7 +9,7 @@ obj-$(CONFIG_AXP_GPIO)		+= axp_gpio.o
 endif
 obj-$(CONFIG_DM_GPIO)		+= gpio-uclass.o
 
-obj-$(CONFIG_DM_PCA953X)	+= pca953x_gpio.o
+obj-$(CONFIG_$(SPL_)DM_PCA953X)	+= pca953x_gpio.o
 obj-$(CONFIG_DM_74X164)		+= 74x164_gpio.o
 
 obj-$(CONFIG_AT91_GPIO)	+= at91_gpio.o
Signature · 1 line
2.14.1
#8 lore raw

PATCH v2 4/10 gpio: introduce CONFIG_SPL_DM_PCA953X

Quoted 2 lines

Introduce CONFIG_SPL_DM_PCA953X for SPL usage.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#9 lore raw

PATCH v2 5/10 spl: imx8: add spl boot device

In reply to Peng Fan

Add spl_boot_device for i.MX8, also add BOOT_DEVICE_MMC2_2 for spl_boot_mode.

---
 arch/arm/mach-imx/spl.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-imx/spl.c +12 -2
index 58a92278df..3ee5061b08 100644
@@ -96,7 +96,7 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 
-#elif defined(CONFIG_MX7) || defined(CONFIG_IMX8M)
+#elif defined(CONFIG_MX7) || defined(CONFIG_IMX8M) || defined(CONFIG_IMX8)
 /* Translate iMX7/i.MX8M boot device to the SPL boot device enumeration */
 u32 spl_boot_device(void)
 {
@@ -134,6 +134,15 @@ u32 spl_boot_device(void)
 	case SD3_BOOT:
 	case MMC3_BOOT:
 		return BOOT_DEVICE_MMC1;
+#elif defined(CONFIG_IMX8)
+	case MMC1_BOOT:
+		return BOOT_DEVICE_MMC1;
+	case SD2_BOOT:
+		return BOOT_DEVICE_MMC2_2;
+	case SD3_BOOT:
+		return BOOT_DEVICE_MMC1;
+	case FLEXSPI_BOOT:
+		return BOOT_DEVICE_SPI;
 #elif defined(CONFIG_IMX8M)
 	case SD1_BOOT:
 	case MMC1_BOOT:
@@ -152,7 +161,7 @@ u32 spl_boot_device(void)
 		return BOOT_DEVICE_NONE;
 	}
 }
-#endif /* CONFIG_MX7 || CONFIG_IMX8M */
+#endif /* CONFIG_MX7 || CONFIG_IMX8M || CONFIG_IMX8 */
 
 #ifdef CONFIG_SPL_USB_GADGET_SUPPORT
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
@@ -171,6 +180,7 @@ u32 spl_boot_mode(const u32 boot_device)
 	/* for MMC return either RAW or FAT mode */
 	case BOOT_DEVICE_MMC1:
 	case BOOT_DEVICE_MMC2:
+	case BOOT_DEVICE_MMC2_2:
 #if defined(CONFIG_SPL_FAT_SUPPORT)
 		return MMCSD_MODE_FS;
 #elif defined(CONFIG_SUPPORT_EMMC_BOOT)
Signature · 1 line
2.14.1
#10 lore raw

PATCH v2 5/10 spl: imx8: add spl boot device

Quoted 3 lines

Add spl_boot_device for i.MX8, also add BOOT_DEVICE_MMC2_2 for spl_boot_mode.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#11 lore raw

PATCH v2 6/10 dts: imx8qxp-mek: introduce u-boot dtsi

In reply to Peng Fan

Introduce u-boot dtsi for i.MX8QXP MEK board.
we do not introduce a common dtsi for SoC, because different board has different requirement on which needs to be enabled in SPL DM.

---
 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi | 112 +++++++++++++++++++++++++++++++
 arch/arm/dts/fsl-imx8qxp-mek.dts         |   1 +
 2 files changed, 113 insertions(+)
 create mode 100644 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi
arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi new file +112 -0
new file mode 100644
index 0000000000..5d50eb028e
@@ -0,0 +1,112 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2018 NXP
+ */
+
+&mu {
+	u-boot,dm-spl;
+};
+
+&clk {
+	u-boot,dm-spl;
+};
+
+&iomuxc {
+	u-boot,dm-spl;
+};
+
+&pd_lsio {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio0 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio1 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio2 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio3 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio4 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio5 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio6 {
+	u-boot,dm-spl;
+};
+
+&pd_lsio_gpio7 {
+	u-boot,dm-spl;
+};
+
+&pd_conn {
+	u-boot,dm-spl;
+};
+
+&pd_conn_sdch0 {
+	u-boot,dm-spl;
+};
+
+&pd_conn_sdch1 {
+	u-boot,dm-spl;
+};
+
+&pd_conn_sdch2 {
+	u-boot,dm-spl;
+};
+
+&gpio0 {
+	u-boot,dm-spl;
+};
+
+&gpio1 {
+	u-boot,dm-spl;
+};
+
+&gpio2 {
+	u-boot,dm-spl;
+};
+
+&gpio3 {
+	u-boot,dm-spl;
+};
+
+&gpio4 {
+	u-boot,dm-spl;
+};
+
+&gpio5 {
+	u-boot,dm-spl;
+};
+
+&gpio6 {
+	u-boot,dm-spl;
+};
+
+&gpio7 {
+	u-boot,dm-spl;
+};
+
+&lpuart0 {
+	u-boot,dm-spl;
+};
+
+&usdhc1 {
+	u-boot,dm-spl;
+};
+
+&usdhc2 {
+	u-boot,dm-spl;
+};
arch/arm/dts/fsl-imx8qxp-mek.dts +1 -0
index adab494cdf..41f7ec1763 100644
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "fsl-imx8qxp.dtsi"
+#include "fsl-imx8qxp-mek-u-boot.dtsi"
 
 / {
 	model = "Freescale i.MX8QXP MEK";
Signature · 1 line
2.14.1
#12 lore raw

PATCH v2 6/10 dts: imx8qxp-mek: introduce u-boot dtsi

Quoted 4 lines

Introduce u-boot dtsi for i.MX8QXP MEK board.
we do not introduce a common dtsi for SoC, because different board has different requirement on which needs to be enabled in SPL DM.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#13 lore raw

PATCH v2 7/10 imx: mkimage_fit_atf: introduce BL33_BASE_ADDR

In reply to Peng Fan

Introduce BL33_BASE_ADDR, then we could reuse this script for i.MX8QXP.

---
 arch/arm/mach-imx/mkimage_fit_atf.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mkimage_fit_atf.sh +2 -1
index 77f7143263..38c9858e84 100755
@@ -9,6 +9,7 @@
 [ -z "$BL31" ] && BL31="bl31.bin"
 [ -z "$TEE_LOAD_ADDR" ] && TEE_LOAD_ADDR="0xfe000000"
 [ -z "$ATF_LOAD_ADDR" ] && ATF_LOAD_ADDR="0x00910000"
+[ -z "$BL33_LOAD_ADDR" ] && BL33_LOAD_ADDR="0x40200000"
 
 if [ ! -f $BL31 ]; then
 	echo "ERROR: BL31 file $BL31 NOT found" >&2
@@ -58,7 +59,7 @@ cat << __HEADER_EOF
 			type = "standalone";
 			arch = "arm64";
 			compression = "none";
-			load = <0x40200000>;
+			load = <$BL33_LOAD_ADDR>;
 		};
 		atf at 1 {
 			description = "ARM Trusted Firmware";
Signature · 1 line
2.14.1
#14 lore raw

PATCH v2 7/10 imx: mkimage_fit_atf: introduce BL33_BASE_ADDR

Quoted 2 lines

Introduce BL33_BASE_ADDR, then we could reuse this script for i.MX8QXP.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#15 lore raw

PATCH v2 8/10 imx: build flash.bin for i.MX8

In reply to Peng Fan

Build flash.bin for i.MX8 when SPL enabled.

---
 Makefile                   |  2 +-
 arch/arm/mach-imx/Makefile | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
Makefile +1 -1
index 74d4259eb6..e9a0d3ab3a 100644
@@ -1200,7 +1200,7 @@ tpl/u-boot-with-tpl.bin: tpl/u-boot-tpl.bin u-boot.bin FORCE
 SPL: spl/u-boot-spl.bin FORCE
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
 
-ifeq ($(CONFIG_ARCH_IMX8M), y)
+ifeq ($(CONFIG_ARCH_IMX8M)$(CONFIG_ARCH_IMX8), y)
 flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
 	$(Q)$(MAKE) $(build)=arch/arm/mach-imx $@
 endif
arch/arm/mach-imx/Makefile +13 -0
index 5424848ad3..e84798b35c 100644
@@ -105,6 +105,7 @@ IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
 ifeq ($(CONFIG_ARCH_IMX8), y)
 CNTR_DEPFILES := $(srctree)/tools/imx_cntr_image.sh
 IMAGE_TYPE := imx8image
+SPL_DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o spl/u-boot-spl.cfgout $(srctree)/$(IMX_CONFIG); if [ -f spl/u-boot-spl.cfgout ]; then $(CNTR_DEPFILES) spl/u-boot-spl.cfgout; echo $$?; fi)
 DEPFILE_EXISTS := $(shell $(CPP) $(cpp_flags) -x c -o u-boot-dtb.cfgout $(srctree)/$(IMX_CONFIG); if [ -f u-boot-dtb.cfgout ]; then $(CNTR_DEPFILES) u-boot-dtb.cfgout; echo $$?; fi)
 else ifeq ($(CONFIG_ARCH_IMX8M), y)
 IMAGE_TYPE := imx8mimage
@@ -153,6 +154,18 @@ ifeq ($(DEPFILE_EXISTS),0)
 endif
 endif
 
+ifeq ($(CONFIG_ARCH_IMX8), y)
+SPL:
+
+MKIMAGEFLAGS_flash.bin = -n spl/u-boot-spl.cfgout -T $(IMAGE_TYPE) -e 0x100000
+flash.bin: MKIMAGEOUTPUT = flash.log
+
+flash.bin: spl/u-boot-spl.bin u-boot.itb FORCE
+ifeq ($(SPL_DEPFILE_EXISTS),0)
+	$(call if_changed,mkimage)
+endif
+endif
+
 else
 MKIMAGEFLAGS_SPL = -n $(filter-out $(PLUGIN).bin $< $(PHONY),$^) \
 		   -T $(IMAGE_TYPE) -e $(CONFIG_SPL_TEXT_BASE)
Signature · 1 line
2.14.1
#16 lore raw

PATCH v2 8/10 imx: build flash.bin for i.MX8

Quoted 2 lines

Build flash.bin for i.MX8 when SPL enabled.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#17 lore raw

PATCH v2 9/10 imx8qxp: mek: default enable SPL

In reply to Peng Fan

Enable SPL for i.MX8QXP MEK, and currently use SPL FIT. The SPL enable SPL_DM to use MMC/PINCTRL/POWER DOMAIN/CLK.

Note: SPL FIT could not support secure boot chain, because i.MX8/8X only support i.MX container format. This container format has not been upstreamed, so we use FIT for now. When SPL container supported, we could switch to that.

---
 board/freescale/imx8qxp_mek/Makefile     |  1 +
 board/freescale/imx8qxp_mek/imximage.cfg |  4 +-
 board/freescale/imx8qxp_mek/spl.c        | 75 ++++++++++++++++++++++++++++++++
 configs/imx8qxp_mek_defconfig            | 24 ++++++++++
 include/configs/imx8qxp_mek.h            | 26 +++++++++++
 5 files changed, 127 insertions(+), 3 deletions(-)
 create mode 100644 board/freescale/imx8qxp_mek/spl.c
board/freescale/imx8qxp_mek/Makefile +1 -0
index f9ee8aeff3..acaadcd84a 100644
@@ -5,3 +5,4 @@
 #
 
 obj-y += imx8qxp_mek.o
+obj-$(CONFIG_SPL_BUILD) += spl.o
board/freescale/imx8qxp_mek/imximage.cfg +1 -3
index bbffb1a88f..259a1646bf 100644
@@ -19,6 +19,4 @@ CONTAINER
 /* Add scfw image with exec attribute */
 IMAGE SCU mx8qx-mek-scfw-tcm.bin
 /* Add ATF image with exec attribute */
-IMAGE A35 bl31.bin 0x80000000
-/* Add U-Boot image with load attribute */
-DATA A35 u-boot-dtb.bin 0x80020000
+IMAGE A35 spl/u-boot-spl.bin 0x00100000
board/freescale/imx8qxp_mek/spl.c new file +75 -0

75 lines not on this page · raw message

configs/imx8qxp_mek_defconfig +24 -0
index 58b4ca0861..a87dbd17ff 100644
@@ -1,11 +1,28 @@
 CONFIG_ARM=y
 CONFIG_ARCH_IMX8=y
 CONFIG_SYS_TEXT_BASE=0x80020000
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_TARGET_IMX8QXP_MEK=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL=y
 CONFIG_NR_DRAM_BANKS=3
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-imx/mkimage_fit_atf.sh"
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/imx8qxp_mek/imximage.cfg"
 CONFIG_BOOTDELAY=3
+CONFIG_LOG=y
+CONFIG_SPL_BOARD_INIT=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_SEPARATE_BSS=y
+CONFIG_SPL_POWER_SUPPORT=y
+CONFIG_SPL_POWER_DOMAIN=y
+CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_CMD_CPU=y
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_CLK=y
@@ -18,8 +35,11 @@ CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_FAT=y
+CONFIG_SPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-imx8qxp-mek"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SPL_DM=y
+CONFIG_SPL_CLK=y
 CONFIG_CLK_IMX8=y
 CONFIG_CPU=y
 CONFIG_DM_GPIO=y
@@ -41,12 +61,16 @@ CONFIG_FEC_MXC_MDIO_BASE=0x5B040000
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
+CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8=y
 CONFIG_POWER_DOMAIN=y
 CONFIG_IMX8_POWER_DOMAIN=y
 CONFIG_DM_REGULATOR=y
+CONFIG_SPL_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
 CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_SPL_DM_REGULATOR_GPIO=y
 CONFIG_DM_SERIAL=y
 CONFIG_FSL_LPUART=y
+CONFIG_SPL_TINY_MEMSET=y
 # CONFIG_EFI_LOADER is not set
include/configs/imx8qxp_mek.h +26 -0
index d34d174cac..312e30dc6c 100644
@@ -9,6 +9,32 @@
 #include <linux/sizes.h>
 #include <asm/arch/imx-regs.h>
 
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SPL_TEXT_BASE				0x0
+#define CONFIG_SPL_MAX_SIZE				(124 * 1024)
+#define CONFIG_SYS_MONITOR_LEN				(1024 * 1024)
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR		0x250
+#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION		0
+
+#define CONFIG_SPL_LDSCRIPT		"arch/arm/cpu/armv8/u-boot-spl.lds"
+#define CONFIG_SPL_STACK		0x013E000
+#define CONFIG_SPL_BSS_START_ADDR	0x00128000
+#define CONFIG_SPL_BSS_MAX_SIZE		0x1000	/* 4 KB */
+#define CONFIG_SYS_SPL_MALLOC_START	0x00120000
+#define CONFIG_SYS_SPL_MALLOC_SIZE	0x3000	/* 12 KB */
+#define CONFIG_SERIAL_LPUART_BASE	0x5a060000
+#define CONFIG_SYS_ICACHE_OFF
+#define CONFIG_SYS_DCACHE_OFF
+#define CONFIG_MALLOC_F_ADDR		0x00120000
+
+#define CONFIG_SPL_RAW_IMAGE_ARM_TRUSTED_FIRMWARE
+
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+
+#define CONFIG_OF_EMBED
+#endif
+
 #define CONFIG_REMAKE_ELF
 
 #define CONFIG_BOARD_EARLY_INIT_F
Signature · 1 line
2.14.1
#18 lore raw

PATCH v2 9/10 imx8qxp: mek: default enable SPL

Quoted 7 lines

Enable SPL for i.MX8QXP MEK, and currently use SPL FIT. The SPL enable SPL_DM to use MMC/PINCTRL/POWER DOMAIN/CLK.
Note: SPL FIT could not support secure boot chain, because i.MX8/8X only support i.MX container format. This container format has not been upstreamed, so we use FIT for now. When SPL container supported, we could switch to that.

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#19 lore raw

PATCH v2 10/10 imx8qxp: mek: update README

In reply to Peng Fan

Update README after we switch to use SPL

---
 board/freescale/imx8qxp_mek/README | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
board/freescale/imx8qxp_mek/README +5 -3
index e91e193d11..f32290e3a2 100644
@@ -39,16 +39,18 @@ $ cp imx-sc-firmware-0.7/mx8qx-mek-scfw-tcm.bin	.
 
 Build U-Boot
 ============
-
+$ export ATF_LOAD_ADDR=0x80000000
+$ export BL33_LOAD_ADDR=0x80020000
 $ make imx8qxp_mek_defconfig
-$ make
+$ make flash.bin
+$ dd if=u-boot.itb of=flash.bin bs=512 seek=528
 
 Flash the binary into the SD card
 =================================
 
 Burn the flash.bin binary to SD card offset 32KB:
 
-$ sudo dd if=u-boot-dtb.imx of=/dev/sd[x] bs=1024 seek=32
+$ sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32
 
 Boot
 ====
Signature · 1 line
2.14.1
#20 lore raw

PATCH v2 10/10 imx8qxp: mek: update README

Quoted 2 lines

Update README after we switch to use SPL

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

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================