All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL
@ 2018-12-19 13:30 Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 01/10] imx8qxp: add SUPPORT_SPL option Peng Fan
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:30 UTC (permalink / raw)
  To: u-boot

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.

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

-- 
2.14.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 01/10] imx8qxp: add SUPPORT_SPL option
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
@ 2018-12-19 13:30 ` Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 02/10] imx8: scu: use dedicated MU for SPL Peng Fan
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:30 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig
index 0d3a87cd74..9671107cb6 100644
--- a/arch/arm/mach-imx/imx8/Kconfig
+++ b/arch/arm/mach-imx/imx8/Kconfig
@@ -5,6 +5,7 @@ config IMX8
 
 config IMX8QXP
 	select IMX8
+	select SUPPORT_SPL
 	bool
 
 config SYS_SOC
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 02/10] imx8: scu: use dedicated MU for SPL
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 01/10] imx8qxp: add SUPPORT_SPL option Peng Fan
@ 2018-12-19 13:30 ` Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 03/10] arm: imx: build mach-imx for i.MX8 Peng Fan
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:30 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/imx8/Kconfig | 7 +++++++
 drivers/misc/imx8/scu.c        | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/arch/arm/mach-imx/imx8/Kconfig b/arch/arm/mach-imx/imx8/Kconfig
index 9671107cb6..f76a139684 100644
--- a/arch/arm/mach-imx/imx8/Kconfig
+++ b/arch/arm/mach-imx/imx8/Kconfig
@@ -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
diff --git a/drivers/misc/imx8/scu.c b/drivers/misc/imx8/scu.c
index 15101b3e5f..1b9c49c99c 100644
--- a/drivers/misc/imx8/scu.c
+++ b/drivers/misc/imx8/scu.c
@@ -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);
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 03/10] arm: imx: build mach-imx for i.MX8
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 01/10] imx8qxp: add SUPPORT_SPL option Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 02/10] imx8: scu: use dedicated MU for SPL Peng Fan
@ 2018-12-19 13:30 ` Peng Fan
  2018-12-19 13:30 ` [U-Boot] [PATCH 04/10] gpio: introduce CONFIG_SPL_DM_PCA953X Peng Fan
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:30 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/Makefile          | 2 +-
 arch/arm/mach-imx/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 87d9d4b9f7..0e2cfd4534 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -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
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 04783fa04e..5424848ad3 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -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
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 04/10] gpio: introduce CONFIG_SPL_DM_PCA953X
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (2 preceding siblings ...)
  2018-12-19 13:30 ` [U-Boot] [PATCH 03/10] arm: imx: build mach-imx for i.MX8 Peng Fan
@ 2018-12-19 13:30 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 05/10] spl: imx8: add spl boot device Peng Fan
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:30 UTC (permalink / raw)
  To: u-boot

Introduce CONFIG_SPL_DM_PCA953X for SPL usage.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/gpio/Kconfig  | 23 +++++++++++++++++++++++
 drivers/gpio/Makefile |  2 +-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 35344e57c6..b1c9404aaf 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -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
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 7ed9a4ec42..dac238ae06 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -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
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 05/10] spl: imx8: add spl boot device
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (3 preceding siblings ...)
  2018-12-19 13:30 ` [U-Boot] [PATCH 04/10] gpio: introduce CONFIG_SPL_DM_PCA953X Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 06/10] dts: imx8qxp-mek: introduce u-boot dtsi Peng Fan
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/spl.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 58a92278df..3ee5061b08 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -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)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 06/10] dts: imx8qxp-mek: introduce u-boot dtsi
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (4 preceding siblings ...)
  2018-12-19 13:31 ` [U-Boot] [PATCH 05/10] spl: imx8: add spl boot device Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 07/10] imx: mkimage_fit_atf: introduce BL33_BASE_ADDR Peng Fan
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 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

diff --git a/arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi b/arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi
new file mode 100644
index 0000000000..5d50eb028e
--- /dev/null
+++ b/arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi
@@ -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;
+};
diff --git a/arch/arm/dts/fsl-imx8qxp-mek.dts b/arch/arm/dts/fsl-imx8qxp-mek.dts
index adab494cdf..41f7ec1763 100644
--- a/arch/arm/dts/fsl-imx8qxp-mek.dts
+++ b/arch/arm/dts/fsl-imx8qxp-mek.dts
@@ -6,6 +6,7 @@
 /dts-v1/;
 
 #include "fsl-imx8qxp.dtsi"
+#include "fsl-imx8qxp-mek-u-boot.dtsi"
 
 / {
 	model = "Freescale i.MX8QXP MEK";
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 07/10] imx: mkimage_fit_atf: introduce BL33_BASE_ADDR
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (5 preceding siblings ...)
  2018-12-19 13:31 ` [U-Boot] [PATCH 06/10] dts: imx8qxp-mek: introduce u-boot dtsi Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 08/10] imx: build flash.bin for i.MX8 Peng Fan
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm/mach-imx/mkimage_fit_atf.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/mkimage_fit_atf.sh b/arch/arm/mach-imx/mkimage_fit_atf.sh
index 77f7143263..38c9858e84 100755
--- a/arch/arm/mach-imx/mkimage_fit_atf.sh
+++ b/arch/arm/mach-imx/mkimage_fit_atf.sh
@@ -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";
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 08/10] imx: build flash.bin for i.MX8
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (6 preceding siblings ...)
  2018-12-19 13:31 ` [U-Boot] [PATCH 07/10] imx: mkimage_fit_atf: introduce BL33_BASE_ADDR Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 09/10] imx8qxp: mek: default enable SPL Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 10/10] imx8qxp: mek: update README Peng Fan
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 Makefile                   |  2 +-
 arch/arm/mach-imx/Makefile | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 74d4259eb6..e9a0d3ab3a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 5424848ad3..e84798b35c 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -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)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 09/10] imx8qxp: mek: default enable SPL
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (7 preceding siblings ...)
  2018-12-19 13:31 ` [U-Boot] [PATCH 08/10] imx: build flash.bin for i.MX8 Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  2018-12-19 13:31 ` [U-Boot] [PATCH 10/10] imx8qxp: mek: update README Peng Fan
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 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

diff --git a/board/freescale/imx8qxp_mek/Makefile b/board/freescale/imx8qxp_mek/Makefile
index f9ee8aeff3..acaadcd84a 100644
--- a/board/freescale/imx8qxp_mek/Makefile
+++ b/board/freescale/imx8qxp_mek/Makefile
@@ -5,3 +5,4 @@
 #
 
 obj-y += imx8qxp_mek.o
+obj-$(CONFIG_SPL_BUILD) += spl.o
diff --git a/board/freescale/imx8qxp_mek/imximage.cfg b/board/freescale/imx8qxp_mek/imximage.cfg
index bbffb1a88f..259a1646bf 100644
--- a/board/freescale/imx8qxp_mek/imximage.cfg
+++ b/board/freescale/imx8qxp_mek/imximage.cfg
@@ -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
diff --git a/board/freescale/imx8qxp_mek/spl.c b/board/freescale/imx8qxp_mek/spl.c
new file mode 100644
index 0000000000..95ce9f37e8
--- /dev/null
+++ b/board/freescale/imx8qxp_mek/spl.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2018 NXP
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <spl.h>
+#include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void spl_board_init(void)
+{
+	struct udevice *dev;
+	int offset;
+
+	uclass_find_first_device(UCLASS_MISC, &dev);
+
+	for (; dev; uclass_find_next_device(&dev)) {
+		if (device_probe(dev))
+			continue;
+	}
+
+	offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "nxp,imx8-pd");
+	while (offset != -FDT_ERR_NOTFOUND) {
+		lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
+			       NULL, true);
+		offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
+						       "nxp,imx8-pd");
+	}
+
+	uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev);
+
+	for (; dev; uclass_find_next_device(&dev)) {
+		if (device_probe(dev))
+			continue;
+	}
+
+	arch_cpu_init();
+
+	board_early_init_f();
+
+	timer_init();
+
+	preloader_console_init();
+
+	puts("Normal Boot\n");
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	/* Just empty function now - can't decide what to choose */
+	debug("%s: %s\n", __func__, name);
+
+	return 0;
+}
+#endif
+
+void board_init_f(ulong dummy)
+{
+	/* Clear global data */
+	memset((void *)gd, 0, sizeof(gd_t));
+
+	/* Clear the BSS. */
+	memset(__bss_start, 0, __bss_end - __bss_start);
+
+	board_init_r(NULL, 0);
+}
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index 58b4ca0861..a87dbd17ff 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -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
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index d34d174cac..5372e7f95e 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -9,6 +9,32 @@
 #include <linux/sizes.h>
 #include <asm/arch/imx-regs.h>
 
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SPL_TEXT_BASE				0x100000
+#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
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 10/10] imx8qxp: mek: update README
  2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
                   ` (8 preceding siblings ...)
  2018-12-19 13:31 ` [U-Boot] [PATCH 09/10] imx8qxp: mek: default enable SPL Peng Fan
@ 2018-12-19 13:31 ` Peng Fan
  9 siblings, 0 replies; 11+ messages in thread
From: Peng Fan @ 2018-12-19 13:31 UTC (permalink / raw)
  To: u-boot

Update README after we switch to use SPL

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 board/freescale/imx8qxp_mek/README | 8 +++++---
 include/configs/imx8qxp_mek.h      | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/board/freescale/imx8qxp_mek/README b/board/freescale/imx8qxp_mek/README
index e91e193d11..f32290e3a2 100644
--- a/board/freescale/imx8qxp_mek/README
+++ b/board/freescale/imx8qxp_mek/README
@@ -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
 ====
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index 5372e7f95e..312e30dc6c 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -10,7 +10,7 @@
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SPL_BUILD
-#define CONFIG_SPL_TEXT_BASE				0x100000
+#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
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-12-19 13:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-19 13:30 [U-Boot] [PATCH 00/10] i.MX8QXP: MEK: support SPL Peng Fan
2018-12-19 13:30 ` [U-Boot] [PATCH 01/10] imx8qxp: add SUPPORT_SPL option Peng Fan
2018-12-19 13:30 ` [U-Boot] [PATCH 02/10] imx8: scu: use dedicated MU for SPL Peng Fan
2018-12-19 13:30 ` [U-Boot] [PATCH 03/10] arm: imx: build mach-imx for i.MX8 Peng Fan
2018-12-19 13:30 ` [U-Boot] [PATCH 04/10] gpio: introduce CONFIG_SPL_DM_PCA953X Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 05/10] spl: imx8: add spl boot device Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 06/10] dts: imx8qxp-mek: introduce u-boot dtsi Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 07/10] imx: mkimage_fit_atf: introduce BL33_BASE_ADDR Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 08/10] imx: build flash.bin for i.MX8 Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 09/10] imx8qxp: mek: default enable SPL Peng Fan
2018-12-19 13:31 ` [U-Boot] [PATCH 10/10] imx8qxp: mek: update README Peng Fan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.