From 206426aa0b636446bfe874f8a5cd3fc0a8a95119 Mon Sep 17 00:00:00 2001 From: Pierre-Jean TEXIER Date: Sun, 1 Apr 2018 00:49:04 +0200 Subject: warp7: include/configs: use generic fs commands in CONFIG_EXTRA_ENV_SETTINGS use the generic filesystem command 'load' rather than 'fatload' to avoid per-fs specific commands. Signed-off-by: Pierre-Jean TEXIER Reviewed-by: Fabio Estevam Acked-by: Bryan O'Donoghue --- include/configs/warp7.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 0c3b605de33..98fedb89246 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -48,11 +48,11 @@ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=PARTUUID=${uuid} rootwait rw\0" \ "loadbootscript=" \ - "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ + "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ "source\0" \ - "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ "mmcboot=echo Booting from mmc ...; " \ "run finduuid; " \ "run mmcargs; " \ -- cgit v1.3.1 From 69f0695067a1938946a3b3e492e0c9cb6e79132d Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:31 +0100 Subject: imximage: Specify default IVT offset in IMX image This patch adds BOOTROM_IVT_HDR_OFFSET at 0xC00. The BootROM expects to find the IVT header at a particular offset in an i.MX image. Defining the expected offset of the IVT header in the first-stage BootROM image format is of use of later stage authentication routines where those routines continue to follow the first-stage authentication layout. This patch defines the first stage offset which later patch make use of. Signed-off-by: Bryan O'Donoghue Cc: Utkarsh Gupta Cc: Breno Lima Cc: Fabio Estevam Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/imximage.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/imximage.h b/include/imximage.h index 553b8523672..800fd6383b3 100644 --- a/include/imximage.h +++ b/include/imximage.h @@ -14,6 +14,9 @@ #define APP_CODE_BARKER 0xB1 #define DCD_BARKER 0xB17219E9 +/* Specify the offset of the IVT in the IMX header as expected by BootROM */ +#define BOOTROM_IVT_HDR_OFFSET 0xC00 + /* * NOTE: This file must be kept in sync with arch/arm/include/asm/\ * mach-imx/imximage.cfg because tools/imximage.c can not -- cgit v1.3.1 From a2accd843b8171ff60e5684214a19bba94c655e4 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:33 +0100 Subject: warp7: hab: Set environment variable indicating HAB enable This patch adds an environment variable called "hab_enabled" which gets set to a boolean status indicating whether HAB is enabled or not. Subsequent patches can use this environment variable to determine if its necessary to run a given binary through the hab_auth_img console command. Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- board/warp7/warp7.c | 8 ++++++++ include/configs/warp7.h | 3 +++ 2 files changed, 11 insertions(+) (limited to 'include') diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c index 327f656c44c..0d3d3245710 100644 --- a/board/warp7/warp7.c +++ b/board/warp7/warp7.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -203,6 +204,13 @@ int board_late_init(void) */ clrsetbits_le16(&wdog->wcr, 0, 0x10); +#ifdef CONFIG_SECURE_BOOT + /* Determine HAB state */ + env_set_ulong(HAB_ENABLED_ENVNAME, imx_hab_is_enabled()); +#else + env_set_ulong(HAB_ENABLED_ENVNAME, 0); +#endif + #ifdef CONFIG_SERIAL_TAG /* Set serial# standard environment variable based on OTP settings */ get_board_serial(&serialnr); diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 98fedb89246..10db716cff4 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -139,4 +139,7 @@ #define CONFIG_USBNET_DEV_ADDR "de:ad:be:af:00:01" +/* Environment variable name to represent HAB enable state */ +#define HAB_ENABLED_ENVNAME "hab_enabled" + #endif -- cgit v1.3.1 From 4bcbfcf458744a84bd82bd7239593f371574bd2c Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:37 +0100 Subject: warp7: Specify CONFIG_OPTEE_LOAD_ADDR In order to sign images with the IMX code-signing-tool (CST) we need to know the load address of a given image. The best way to derive this load address is to make it into a define - so that u-boot.cfg contains the address - which we can then parse when generating the IMX CST headers. This patch makes the OPTEE_LOAD_ADDR available via u-boot.cfg for further parsing by external tools. Signed-off-by: Bryan O'Donoghue Reviewed-by: Ryan Harkin Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- configs/warp7_defconfig | 1 + include/configs/warp7.h | 1 + 2 files changed, 2 insertions(+) (limited to 'include') diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig index c72e6b3f4eb..8152e8e959d 100644 --- a/configs/warp7_defconfig +++ b/configs/warp7_defconfig @@ -45,3 +45,4 @@ CONFIG_USB_ETH_CDC=y CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00" CONFIG_OF_LIBFDT=y CONFIG_OPTEE=y +CONFIG_OPTEE_LOAD_ADDR=0x84000000 diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 10db716cff4..e12b90bc166 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -40,6 +40,7 @@ "initrd_high=0xffffffff\0" \ "fdt_file=imx7s-warp.dtb\0" \ "fdt_addr=0x83000000\0" \ + "optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \ "boot_fdt=try\0" \ "ip_dyn=yes\0" \ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ -- cgit v1.3.1 From 56eca404e1dc7aed65fb5268826eba1c548434ae Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:40 +0100 Subject: warp7: Make CONFIG_SYS_FDT_ADDR a define In order to sign images with the IMX code-signing-tool (CST) we need to know the load address of a given image. The best way to derive this load address is to make it into a define - so that u-boot.cfg contains the address - which we can then parse when generating the IMX CST headers. Signed-off-by: Bryan O'Donoghue Reviewed-by: Ryan Harkin Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- board/warp7/Kconfig | 6 ++++++ include/configs/warp7.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/board/warp7/Kconfig b/board/warp7/Kconfig index 61c33fb53e1..00df19d47ff 100644 --- a/board/warp7/Kconfig +++ b/board/warp7/Kconfig @@ -6,4 +6,10 @@ config SYS_BOARD config SYS_CONFIG_NAME default "warp7" +config SYS_FDT_ADDR + hex "FDT load address" + default 0x83000000 + help + The address the FDT file should be loaded to. + endif diff --git a/include/configs/warp7.h b/include/configs/warp7.h index e12b90bc166..344042c9b33 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -39,7 +39,7 @@ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ "fdt_file=imx7s-warp.dtb\0" \ - "fdt_addr=0x83000000\0" \ + "fdt_addr=" __stringify(CONFIG_SYS_FDT_ADDR)"\0" \ "optee_addr=" __stringify(CONFIG_OPTEE_LOAD_ADDR)"\0" \ "boot_fdt=try\0" \ "ip_dyn=yes\0" \ -- cgit v1.3.1 From 2948089815437232aab9eff54d0abdc2949a22ae Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:42 +0100 Subject: warp7: select uuid partition based on rootpart Assigning the UUID discovery path to a tweakable environment variable means that later steps in the boot process - particularly a boot script can change the target root partition of a particular Linux boot. Retargeting the rootfs is an important feature when doing ping/pong upgrades allowing a boot script to select ping or pong as necessary without reprogramming the bootloader. Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 344042c9b33..54b3b31608d 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -45,7 +45,8 @@ "ip_dyn=yes\0" \ "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ - "finduuid=part uuid mmc 0:2 uuid\0" \ + "rootpart=" __stringify(CONFIG_WARP7_ROOT_PART) "\0" \ + "finduuid=part uuid mmc 0:${rootpart} uuid\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=PARTUUID=${uuid} rootwait rw\0" \ "loadbootscript=" \ -- cgit v1.3.1 From e4514051fca3a89850d7e62c29dff4e1194d225d Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:43 +0100 Subject: warp7: Define the name of a signed boot-script file We need to know the name of a signed boot-script, its better to have a separate variable for this then to simply append some fixed string to an existing image name. Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 54b3b31608d..0ed95d820c2 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -33,6 +33,7 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_DFU_ENV_SETTINGS \ "script=boot.scr\0" \ + "script_signed=boot.scr.imx-signed\0" \ "image=zImage\0" \ "console=ttymxc0\0" \ "ethact=usb_ether\0" \ -- cgit v1.3.1 From c0df0caeb8d6722cc61e3a8f777f8a47e0167fb9 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:44 +0100 Subject: warp7: add warp7_auth_or_fail Doing secure boot on the WaRP7 using a common image format and the same variable to represent the base address for each call means we can reduce down the command to a single environment command. This patch adds warp7_auth_or_fail as a wrapper around "hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0". Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 0ed95d820c2..454bc1cd080 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -50,6 +50,7 @@ "finduuid=part uuid mmc 0:${rootpart} uuid\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=PARTUUID=${uuid} rootwait rw\0" \ + "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \ "loadbootscript=" \ "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ -- cgit v1.3.1 From d9cb9aec743265b56a57e89ec20dde6f38d5e554 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:45 +0100 Subject: warp7: hab: Set environment variable indicating IVT offset This patch introduces the environment variable ivt_offset. When we define a load address for Linux or DTB or any file the IVT associated with that file is prepended. We extract the actual load addresses from u-boot.cfg and feed these values into the code-signing process - hence we want u-boot to have the real load addresses exported in uboot.cfg. ivt_offset represents the addition or subtraction from the load address that must happen to find an IVT header. Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 454bc1cd080..fe9b7d57d76 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -10,6 +10,7 @@ #define __WARP7_CONFIG_H #include "mx7_common.h" +#include #define PHYS_SDRAM_SIZE SZ_512M @@ -50,6 +51,7 @@ "finduuid=part uuid mmc 0:${rootpart} uuid\0" \ "mmcargs=setenv bootargs console=${console},${baudrate} " \ "root=PARTUUID=${uuid} rootwait rw\0" \ + "ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\ "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \ "loadbootscript=" \ "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ -- cgit v1.3.1 From bb96a08d5b48f0ee3415619c2119d7153de1d0c2 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 24 Apr 2018 18:46:47 +0100 Subject: warp7: Add support for automated secure boot.scr verification This patch adds support for verifying a signed boot.scr. With this in place it's possible for run-time Linux to update boot.scr to set different variables such as switching between different boot partitions, pointing to different kernels etc and for u-boot to verify these changes via the HAB prior to executing the commands contained in boot.scr. Signed-off-by: Bryan O'Donoghue Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/configs/warp7.h b/include/configs/warp7.h index fe9b7d57d76..f340bff3e70 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -53,6 +53,14 @@ "root=PARTUUID=${uuid} rootwait rw\0" \ "ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\ "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \ + "do_bootscript_hab=" \ + "if test ${hab_enabled} -eq 1; then " \ + "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \ + "setenv script ${script_signed}; " \ + "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \ + "run warp7_auth_or_fail; " \ + "run bootscript; "\ + "fi;\0" \ "loadbootscript=" \ "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ @@ -79,6 +87,7 @@ #define CONFIG_BOOTCOMMAND \ "mmc dev ${mmcdev};" \ "mmc dev ${mmcdev}; if mmc rescan; then " \ + "run do_bootscript_hab;" \ "if run loadbootscript; then " \ "run bootscript; " \ "else " \ -- cgit v1.3.1 From 30754ef77c3e88acb5a378d4e2c2bcce6228a118 Mon Sep 17 00:00:00 2001 From: Sébastien Szymanski Date: Tue, 17 Apr 2018 17:29:31 +0200 Subject: imx6ul: opos6ul: add SPL_DM support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit commit 152038ea1886 ("i.MX6UL: icore: Add SPL_OF_CONTROL support") the OPOS6UL board doesn't boot anymore. Adding SPL_DM support makes the board boot again. Fixes: commit 152038ea1886 ("i.MX6UL: icore: Add SPL_OF_CONTROL support") Signed-off-by: Sébastien Szymanski --- arch/arm/dts/imx6ul-opos6ul.dtsi | 4 ++- arch/arm/dts/imx6ul-opos6uldev.dts | 2 ++ arch/arm/dts/imx6ul.dtsi | 1 + arch/arm/include/asm/arch-mx6/opos6ul.h | 4 --- arch/arm/mach-imx/mx6/Kconfig | 4 +++ arch/arm/mach-imx/mx6/opos6ul.c | 50 ++++----------------------------- board/armadeus/opos6uldev/board.c | 20 +------------ configs/opos6uldev_defconfig | 5 ++++ include/configs/opos6uldev.h | 9 ++---- 9 files changed, 25 insertions(+), 74 deletions(-) (limited to 'include') diff --git a/arch/arm/dts/imx6ul-opos6ul.dtsi b/arch/arm/dts/imx6ul-opos6ul.dtsi index 51095df33a9..d51ad4de20a 100644 --- a/arch/arm/dts/imx6ul-opos6ul.dtsi +++ b/arch/arm/dts/imx6ul-opos6ul.dtsi @@ -1,5 +1,5 @@ /* - * Copyright 2017 Armadeus Systems + * Copyright 2018 Armadeus Systems * * This file is dual-licensed: you can use it either under the terms * of the GPL or the X11 license, at your option. Note that this dual @@ -99,6 +99,7 @@ /* eMMC */ &usdhc1 { + u-boot,dm-spl; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usdhc1>; bus-width = <8>; @@ -161,6 +162,7 @@ }; pinctrl_usdhc1: usdhc1grp { + u-boot,dm-spl; fsl,pins = < MX6UL_PAD_SD1_CMD__USDHC1_CMD 0x17059 MX6UL_PAD_SD1_CLK__USDHC1_CLK 0x10059 diff --git a/arch/arm/dts/imx6ul-opos6uldev.dts b/arch/arm/dts/imx6ul-opos6uldev.dts index 0e59ee57fd5..9a51d1e54f6 100644 --- a/arch/arm/dts/imx6ul-opos6uldev.dts +++ b/arch/arm/dts/imx6ul-opos6uldev.dts @@ -228,6 +228,7 @@ }; &uart1 { + u-boot,dm-spl; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>; status = "okay"; @@ -373,6 +374,7 @@ }; pinctrl_uart1: uart1grp { + u-boot,dm-spl; fsl,pins = < MX6UL_PAD_UART1_TX_DATA__UART1_DCE_TX 0x1b0b1 MX6UL_PAD_UART1_RX_DATA__UART1_DCE_RX 0x1b0b1 diff --git a/arch/arm/dts/imx6ul.dtsi b/arch/arm/dts/imx6ul.dtsi index b63f5a53acf..d5ce3f13c24 100644 --- a/arch/arm/dts/imx6ul.dtsi +++ b/arch/arm/dts/imx6ul.dtsi @@ -194,6 +194,7 @@ #size-cells = <1>; reg = <0x02000000 0x40000>; ranges; + u-boot,dm-spl; ecspi1: ecspi@02008000 { #address-cells = <1>; diff --git a/arch/arm/include/asm/arch-mx6/opos6ul.h b/arch/arm/include/asm/arch-mx6/opos6ul.h index b5363850d23..8adff67cea4 100644 --- a/arch/arm/include/asm/arch-mx6/opos6ul.h +++ b/arch/arm/include/asm/arch-mx6/opos6ul.h @@ -9,8 +9,4 @@ int opos6ul_board_late_init(void); -#ifdef CONFIG_SPL_BUILD -void opos6ul_setup_uart_debug(void); -#endif - #endif diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index aa6f5facbf8..98ea1f566c4 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -73,6 +73,10 @@ config MX6UL_OPOS6UL select DM_MMC select DM_THERMAL select SUPPORT_SPL + select SPL_DM if SPL + select SPL_OF_CONTROL if SPL + select SPL_SEPARATE_BSS if SPL + select SPL_PINCTRL if SPL config MX6ULL select SYS_L2CACHE_OFF diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c index 2de1321b56b..ef70a7d3230 100644 --- a/arch/arm/mach-imx/mx6/opos6ul.c +++ b/arch/arm/mach-imx/mx6/opos6ul.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Armadeus Systems + * Copyright (C) 2018 Armadeus Systems * * SPDX-License-Identifier: GPL-2.0+ */ @@ -9,15 +9,12 @@ #include #include #include -#include #include #include #include #include #include #include -#include -#include DECLARE_GLOBAL_DATA_PTR; @@ -138,12 +135,6 @@ int board_late_init(void) return opos6ul_board_late_init(); } -int board_mmc_getcd(struct mmc *mmc) -{ - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - return cfg->esdhc_base == USDHC1_BASE_ADDR; -} - int dram_init(void) { gd->ram_size = imx_ddr_size(); @@ -153,32 +144,9 @@ int dram_init(void) #ifdef CONFIG_SPL_BUILD #include -#include #include #include -#define USDHC_PAD_CTRL ( \ - PAD_CTL_HYS | PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_MED | \ - PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST \ -) - -struct fsl_esdhc_cfg usdhc_cfg[1] = { - {USDHC1_BASE_ADDR, 0, 8}, -}; - -static iomux_v3_cfg_t const usdhc1_pads[] = { - MX6_PAD_SD1_CLK__USDHC1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD1_CMD__USDHC1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD1_DATA0__USDHC1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD1_DATA1__USDHC1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD1_DATA2__USDHC1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_SD1_DATA3__USDHC1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_NAND_READY_B__USDHC1_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_NAND_CE0_B__USDHC1_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_NAND_CE1_B__USDHC1_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), - MX6_PAD_NAND_CLE__USDHC1_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), -}; - static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = { .grp_addds = 0x00000030, .grp_ddrmode_ctl = 0x00020000, @@ -240,13 +208,6 @@ static struct mx6_ddr3_cfg mem_ddr = { .trasmin = 3750, }; -int board_mmc_init(bd_t *bis) -{ - imx_iomux_v3_setup_multiple_pads(usdhc1_pads, ARRAY_SIZE(usdhc1_pads)); - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); - return fsl_esdhc_initialize(bis, &usdhc_cfg[0]); -} - static void ccgr_init(void) { struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; @@ -282,6 +243,11 @@ static void spl_dram_init(void) mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); } +void spl_board_init(void) +{ + preloader_console_init(); +} + void board_init_f(ulong dummy) { ccgr_init(); @@ -292,10 +258,6 @@ void board_init_f(ulong dummy) /* setup GP timer */ timer_init(); - /* UART clocks enabled and gd valid - init serial console */ - opos6ul_setup_uart_debug(); - preloader_console_init(); - /* DDR initialization */ spl_dram_init(); } diff --git a/board/armadeus/opos6uldev/board.c b/board/armadeus/opos6uldev/board.c index 646094aef4c..a830dc326d1 100644 --- a/board/armadeus/opos6uldev/board.c +++ b/board/armadeus/opos6uldev/board.c @@ -1,12 +1,11 @@ /* - * Copyright (C) 2017 Armadeus Systems + * Copyright (C) 2018 Armadeus Systems * * SPDX-License-Identifier: GPL-2.0+ */ #include #include -#include #include #include #include @@ -106,20 +105,3 @@ int opos6ul_board_late_init(void) return 0; } - -#ifdef CONFIG_SPL_BUILD -#define UART_PAD_CTRL ( \ - PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ - PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST \ -) - -static iomux_v3_cfg_t const uart1_pads[] = { - MX6_PAD_UART1_TX_DATA__UART1_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL), - MX6_PAD_UART1_RX_DATA__UART1_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL), -}; - -void opos6ul_setup_uart_debug(void) -{ - imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); -} -#endif /* CONFIG_SPL_BUILD */ diff --git a/configs/opos6uldev_defconfig b/configs/opos6uldev_defconfig index a2735bc9a8d..2fd684ae5e1 100644 --- a/configs/opos6uldev_defconfig +++ b/configs/opos6uldev_defconfig @@ -1,8 +1,10 @@ CONFIG_ARM=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_OPOS6ULDEV=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y @@ -11,6 +13,8 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_SPL=y # CONFIG_CMD_BMODE is not set CONFIG_DEFAULT_DEVICE_TREE="imx6ul-opos6uldev" +CONFIG_SPL_SYS_MALLOC_F_LEN=0x400 +CONFIG_TPL_SYS_MALLOC_F_LEN=0x400 CONFIG_BOOTDELAY=5 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="console=ttymxc0,115200" @@ -19,6 +23,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SUPPORT_RAW_INITRD=y CONFIG_DEFAULT_FDT_FILE="imx6ul-opos6uldev.dtb" CONFIG_VERSION_VARIABLE=y +CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_ENV_SUPPORT=y CONFIG_SPL_YMODEM_SUPPORT=y CONFIG_HUSH_PARSER=y diff --git a/include/configs/opos6uldev.h b/include/configs/opos6uldev.h index 24e1f80474d..9e853f3d841 100644 --- a/include/configs/opos6uldev.h +++ b/include/configs/opos6uldev.h @@ -15,11 +15,7 @@ #include "imx6_spl.h" #ifdef CONFIG_SPL_BUILD -#undef CONFIG_DM_GPIO -#undef CONFIG_DM_MMC -#undef CONFIG_BLK - -#define CONFIG_MXC_UART_BASE UART1_BASE +#undef CONFIG_DM_REGULATOR #endif #endif @@ -40,7 +36,6 @@ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) /* MMC */ -#define CONFIG_SYS_FSL_ESDHC_ADDR 0 #define CONFIG_SUPPORT_EMMC_BOOT /* USB */ @@ -61,6 +56,7 @@ #endif /* LCD */ +#ifndef CONFIG_SPL_BUILD #ifdef CONFIG_VIDEO #define CONFIG_VIDEO_LOGO #define CONFIG_SPLASH_SCREEN @@ -72,6 +68,7 @@ #define CONFIG_VIDEO_MXS #define MXS_LCDIF_BASE MX6UL_LCDIF1_BASE_ADDR #endif +#endif /* Environment is stored in the eMMC boot partition */ #define CONFIG_SYS_MMC_ENV_DEV 0 -- cgit v1.3.1 From 07a8f79ee850b1e59371519f179d32fea171bbec Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sat, 21 Apr 2018 16:11:10 +0100 Subject: ARM: mxs: support full SPL framework This allows using the full SPL framework on mxs devices. In this mode, the u-boot.sb image loaded by the boot ROM contains only the SPL which then loads U-Boot proper or a kernel in falcon mode. Signed-off-by: Mans Rullgard --- arch/arm/Kconfig | 2 +- arch/arm/cpu/arm926ejs/mxs/Makefile | 4 ++-- arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx23.cfg | 5 +++++ arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg | 6 ++++++ arch/arm/cpu/arm926ejs/mxs/spl_boot.c | 2 ++ include/configs/mxs.h | 2 ++ 6 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx23.cfg create mode 100644 arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg (limited to 'include') diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 7212fc5afa7..0acdd162b4b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1352,7 +1352,7 @@ source "arch/arm/Kconfig.debug" endmenu config SPL_LDSCRIPT - default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if ARCH_MX23 || ARCH_MX28 + default "arch/arm/cpu/arm926ejs/mxs/u-boot-spl.lds" if (ARCH_MX23 || ARCH_MX28) && !SPL_FRAMEWORK default "arch/arm/cpu/arm1136/u-boot-spl.lds" if CPU_ARM1136 default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARM64 diff --git a/arch/arm/cpu/arm926ejs/mxs/Makefile b/arch/arm/cpu/arm926ejs/mxs/Makefile index 71c2c0e7b40..83b05acfa4e 100644 --- a/arch/arm/cpu/arm926ejs/mxs/Makefile +++ b/arch/arm/cpu/arm926ejs/mxs/Makefile @@ -14,8 +14,8 @@ obj-y += spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o endif # Specify the target for use in elftosb call -MKIMAGE_TARGET-$(CONFIG_MX23) = mxsimage.mx23.cfg -MKIMAGE_TARGET-$(CONFIG_MX28) = mxsimage.mx28.cfg +MKIMAGE_TARGET-$(CONFIG_MX23) = mxsimage$(CONFIG_SPL_FRAMEWORK:%=-spl).mx23.cfg +MKIMAGE_TARGET-$(CONFIG_MX28) = mxsimage$(CONFIG_SPL_FRAMEWORK:%=-spl).mx28.cfg # Generate HAB-capable IVT # diff --git a/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx23.cfg b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx23.cfg new file mode 100644 index 00000000000..ab2183ed379 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx23.cfg @@ -0,0 +1,5 @@ +DISPLAYPROGRESS +SECTION 0x0 BOOTABLE + TAG LAST + LOAD 0x1000 spl/u-boot-spl.bin + CALL 0x1000 0x0 diff --git a/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg new file mode 100644 index 00000000000..0d95064ff7f --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mxs/mxsimage-spl.mx28.cfg @@ -0,0 +1,6 @@ +DISPLAYPROGRESS +SECTION 0x0 BOOTABLE + TAG LAST + LOAD 0x1000 spl/u-boot-spl.bin + LOAD IVT 0x8000 0x1000 + CALL HAB 0x8000 0x0 diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c index 0c3925640dc..bc39465fc4e 100644 --- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c +++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c @@ -146,6 +146,7 @@ void mxs_common_spl_init(const uint32_t arg, const uint32_t *resptr, } } +#ifndef CONFIG_SPL_FRAMEWORK /* Support aparatus */ inline void board_init_f(unsigned long bootflag) { @@ -158,3 +159,4 @@ inline void board_init_r(gd_t *id, ulong dest_addr) for (;;) ; } +#endif diff --git a/include/configs/mxs.h b/include/configs/mxs.h index f07f81c8415..0fe0770e13f 100644 --- a/include/configs/mxs.h +++ b/include/configs/mxs.h @@ -44,8 +44,10 @@ /* Startup hooks */ /* SPL */ +#ifndef CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_NO_CPU_SUPPORT_CODE #define CONFIG_SPL_START_S_PATH "arch/arm/cpu/arm926ejs/mxs" +#endif /* Memory sizes */ #define CONFIG_SYS_MALLOC_LEN 0x00400000 /* 4 MB for malloc */ -- cgit v1.3.1