From 0a245862c2ba7a4a63dc6f6c1afbdcdb50c4ed89 Mon Sep 17 00:00:00 2001 From: Paul Geurts Date: Fri, 1 Nov 2024 09:49:20 +0100 Subject: [PATCH 1/8] imx: hab: rename imx_sec_config_fuse_t to imx_fuse The imx_sec_config_fuse_t structure is not specific to the sec_config fuse, but can be used for all fuse words. Rename the structure to a more generic name to be reused for other fuses. Signed-off-by: Paul Geurts --- arch/arm/include/asm/mach-imx/hab.h | 4 ++-- arch/arm/mach-imx/hab.c | 4 ++-- arch/arm/mach-imx/imx8m/soc.c | 2 +- arch/arm/mach-imx/mx6/soc.c | 2 +- arch/arm/mach-imx/mx7/soc.c | 2 +- arch/arm/mach-imx/mx7ulp/soc.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 2abf28ea45b..9410f30eef2 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -132,13 +132,13 @@ enum hab_target { HAB_TGT_ANY = 0x55, }; -struct imx_sec_config_fuse_t { +struct imx_fuse { int bank; int word; }; #if defined(CONFIG_IMX_HAB) -extern struct imx_sec_config_fuse_t const imx_sec_config_fuse; +extern struct imx_fuse const imx_sec_config_fuse; #endif /*Function prototype description*/ diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index a8107f46ae5..7e4eaa4b14f 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -870,8 +870,8 @@ static int validate_ivt(struct ivt *ivt_initial) bool imx_hab_is_enabled(void) { - struct imx_sec_config_fuse_t *fuse = - (struct imx_sec_config_fuse_t *)&imx_sec_config_fuse; + struct imx_fuse *fuse = + (struct imx_fuse *)&imx_sec_config_fuse; uint32_t reg; int ret; diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index a72329ea919..e6c00e85412 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -37,7 +37,7 @@ DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_IMX_HAB) -struct imx_sec_config_fuse_t const imx_sec_config_fuse = { +struct imx_fuse const imx_sec_config_fuse = { .bank = 1, .word = 3, }; diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index 9b40fe9235a..e9dd3384563 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -51,7 +51,7 @@ U_BOOT_DRVINFO(imx6_thermal) = { #endif #if defined(CONFIG_IMX_HAB) -struct imx_sec_config_fuse_t const imx_sec_config_fuse = { +struct imx_fuse const imx_sec_config_fuse = { .bank = 0, .word = 6, }; diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index 1b891a2db3d..11e8ac06608 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -127,7 +127,7 @@ static void isolate_resource(void) #endif #if defined(CONFIG_IMX_HAB) -struct imx_sec_config_fuse_t const imx_sec_config_fuse = { +struct imx_fuse const imx_sec_config_fuse = { .bank = 1, .word = 3, }; diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index 980e0226156..b50ad1cfa19 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -38,7 +38,7 @@ static char *get_reset_cause(char *); #if defined(CONFIG_IMX_HAB) -struct imx_sec_config_fuse_t const imx_sec_config_fuse = { +struct imx_fuse const imx_sec_config_fuse = { .bank = 29, .word = 6, }; From 0bf7d6b4979835616f396337870d065543a2db4e Mon Sep 17 00:00:00 2001 From: Paul Geurts Date: Fri, 1 Nov 2024 09:49:21 +0100 Subject: [PATCH 2/8] imx: hab: Make imx_hab_is_enabled dependent on FIELD_RETURN The decision on whether HAB is enabled is solely based on the SEC_CONFIG fuse. The HAB FIELD_RETURN feature is able to permanently disable HAB on a CPU, after which it is able to boot unsigned firmware. U-Boot however does not take into account the FIELD_RETURN mode, and refuses to boot unsigned software when the feature is enabled. Also take the FIELD_RETURN fuse into account when deciding whether HAB is enabled. When The FIELD_RETURN fuse is blown, HAB is not enabled. Tested on i.MX8M Mini, i.MX8M Plus, i.MX8M Nano and i.MX6ULL Signed-off-by: Paul Geurts --- arch/arm/include/asm/mach-imx/hab.h | 1 + arch/arm/mach-imx/hab.c | 28 ++++++++++++++++++++++++---- arch/arm/mach-imx/imx8m/soc.c | 5 +++++ arch/arm/mach-imx/mx6/soc.c | 5 +++++ arch/arm/mach-imx/mx7/soc.c | 5 +++++ arch/arm/mach-imx/mx7ulp/soc.c | 5 +++++ 6 files changed, 45 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/mach-imx/hab.h b/arch/arm/include/asm/mach-imx/hab.h index 9410f30eef2..c0caf57fe61 100644 --- a/arch/arm/include/asm/mach-imx/hab.h +++ b/arch/arm/include/asm/mach-imx/hab.h @@ -139,6 +139,7 @@ struct imx_fuse { #if defined(CONFIG_IMX_HAB) extern struct imx_fuse const imx_sec_config_fuse; +extern struct imx_fuse const imx_field_return_fuse; #endif /*Function prototype description*/ diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c index 7e4eaa4b14f..600092389a3 100644 --- a/arch/arm/mach-imx/hab.c +++ b/arch/arm/mach-imx/hab.c @@ -26,6 +26,14 @@ DECLARE_GLOBAL_DATA_PTR; #define IS_HAB_ENABLED_BIT \ (is_soc_type(MXC_SOC_MX7ULP) ? 0x80000000 : \ ((is_soc_type(MXC_SOC_MX7) || is_soc_type(MXC_SOC_IMX8M)) ? 0x2000000 : 0x2)) +#define FIELD_RETURN_FUSE_MASK \ + (is_imx8mp() ? 0xFFFFFFFF : 0x00000001) +/* + * The fuse pattern for i.MX8M Plus is 0x28001401, but bit 2 is already set from factory. + * This means when field return is set, the fuse word value reads 0x28001405 + */ +#define FIELD_RETURN_PATTERN \ + (is_imx8mp() ? 0x28001405 : 0x00000001) #ifdef CONFIG_MX7ULP #define HAB_M4_PERSISTENT_START ((soc_rev() >= CHIP_REV_2_0) ? 0x20008040 : \ @@ -870,18 +878,30 @@ static int validate_ivt(struct ivt *ivt_initial) bool imx_hab_is_enabled(void) { - struct imx_fuse *fuse = + struct imx_fuse *sec_config = (struct imx_fuse *)&imx_sec_config_fuse; + struct imx_fuse *field_return = + (struct imx_fuse *)&imx_field_return_fuse; uint32_t reg; + bool is_enabled; int ret; - ret = fuse_read(fuse->bank, fuse->word, ®); + ret = fuse_read(sec_config->bank, sec_config->word, ®); if (ret) { - puts("\nSecure boot fuse read error\n"); + puts("Secure boot fuse read error\n"); return ret; } + is_enabled = reg & IS_HAB_ENABLED_BIT; + if (is_enabled) { + ret = fuse_read(field_return->bank, field_return->word, ®); + if (ret) { + puts("Field return fuse read error\n"); + return ret; + } + is_enabled = (reg & FIELD_RETURN_FUSE_MASK) != FIELD_RETURN_PATTERN; + } - return (reg & IS_HAB_ENABLED_BIT) == IS_HAB_ENABLED_BIT; + return is_enabled; } int imx_hab_authenticate_image(uint32_t ddr_start, uint32_t image_size, diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index e6c00e85412..09a528a64f8 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -41,6 +41,11 @@ struct imx_fuse const imx_sec_config_fuse = { .bank = 1, .word = 3, }; + +struct imx_fuse const imx_field_return_fuse = { + .bank = 8, + .word = 3, +}; #endif int timer_init(void) diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c index e9dd3384563..d4a61731a67 100644 --- a/arch/arm/mach-imx/mx6/soc.c +++ b/arch/arm/mach-imx/mx6/soc.c @@ -55,6 +55,11 @@ struct imx_fuse const imx_sec_config_fuse = { .bank = 0, .word = 6, }; + +struct imx_fuse const imx_field_return_fuse = { + .bank = 5, + .word = 6, +}; #endif u32 get_nr_cpus(void) diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c index 11e8ac06608..e504c1fd52a 100644 --- a/arch/arm/mach-imx/mx7/soc.c +++ b/arch/arm/mach-imx/mx7/soc.c @@ -131,6 +131,11 @@ struct imx_fuse const imx_sec_config_fuse = { .bank = 1, .word = 3, }; + +struct imx_fuse const imx_field_return_fuse = { + .bank = 8, + .word = 3, +}; #endif static bool is_mx7d(void) diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index b50ad1cfa19..61d331e0181 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -42,6 +42,11 @@ struct imx_fuse const imx_sec_config_fuse = { .bank = 29, .word = 6, }; + +struct imx_fuse const imx_field_return_fuse = { + .bank = 9, + .word = 6, +}; #endif #define ROM_VERSION_ADDR 0x80 From 6bc9d4407c354a21e2058b08f8fdb1e28d19e883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Sz=C5=91ke?= Date: Fri, 1 Nov 2024 16:26:18 +0100 Subject: [PATCH 3/8] imx9: Improve boot mode autodetection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve "mmcautodetect=yes" boot mode autodetection to able to use it if CONFIG_ENV_IS_NOWHERE=y is used for i.MX9 SoCs and i.MX93 EVK board. If both CONFIG_ENV_IS_IN_MMC=y and CONFIG_ENV_IS_NOWHERE=y are in the defconfig, CONFIG_ENV_IS_IN_MMC=y will be overiden default CONFIG_ENV_IS_NOWHERE settings. Goal is in this patch to able to use the boot mode autodetection if defconfig use only CONFIG_ENV_IS_NOWHERE=y option (without CONFIG_ENV_IS_IN_MMC) for any i.MX9 SoC. Signed-off-by: Benjamin Szőke --- arch/arm/mach-imx/imx9/soc.c | 12 +++++++++--- board/freescale/imx93_evk/imx93_evk.c | 2 +- include/configs/imx93_evk.h | 8 +++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/imx9/soc.c b/arch/arm/mach-imx/imx9/soc.c index 7c28fa39e14..21e0e7dd1e8 100644 --- a/arch/arm/mach-imx/imx9/soc.c +++ b/arch/arm/mach-imx/imx9/soc.c @@ -42,12 +42,18 @@ DECLARE_GLOBAL_DATA_PTR; struct rom_api *g_rom_api = (struct rom_api *)0x1980; -#ifdef CONFIG_ENV_IS_IN_MMC +#if CONFIG_IS_ENABLED(ENV_IS_IN_MMC) || CONFIG_IS_ENABLED(ENV_IS_NOWHERE) __weak int board_mmc_get_env_dev(int devno) { return devno; } +#ifdef CONFIG_SYS_MMC_ENV_DEV +#define IMX9_MMC_ENV_DEV CONFIG_SYS_MMC_ENV_DEV +#else +#define IMX9_MMC_ENV_DEV 0 +#endif + int mmc_get_env_dev(void) { int ret; @@ -59,7 +65,7 @@ int mmc_get_env_dev(void) if (ret != ROM_API_OKAY) { puts("ROMAPI: failure at query_boot_info\n"); - return CONFIG_SYS_MMC_ENV_DEV; + return IMX9_MMC_ENV_DEV; } boot_type = boot >> 16; @@ -69,7 +75,7 @@ int mmc_get_env_dev(void) /* If not boot from sd/mmc, use default value */ if (boot_type != BOOT_TYPE_SD && boot_type != BOOT_TYPE_MMC) - return env_get_ulong("mmcdev", 10, CONFIG_SYS_MMC_ENV_DEV); + return env_get_ulong("mmcdev", 10, IMX9_MMC_ENV_DEV); return board_mmc_get_env_dev(boot_instance); } diff --git a/board/freescale/imx93_evk/imx93_evk.c b/board/freescale/imx93_evk/imx93_evk.c index 341831a7d30..c9171df330e 100644 --- a/board/freescale/imx93_evk/imx93_evk.c +++ b/board/freescale/imx93_evk/imx93_evk.c @@ -58,7 +58,7 @@ int board_init(void) int board_late_init(void) { -#ifdef CONFIG_ENV_IS_IN_MMC +#if CONFIG_IS_ENABLED(ENV_IS_IN_MMC) || CONFIG_IS_ENABLED(ENV_IS_NOWHERE) board_late_mmc_env_init(); #endif diff --git a/include/configs/imx93_evk.h b/include/configs/imx93_evk.h index 53fb8c9b1ba..260a5043d53 100644 --- a/include/configs/imx93_evk.h +++ b/include/configs/imx93_evk.h @@ -27,6 +27,12 @@ #define BOOTENV #endif +#ifdef CONFIG_SYS_MMC_ENV_DEV +#define IMX93_EVK_MMC_ENV_DEV CONFIG_SYS_MMC_ENV_DEV +#else +#define IMX93_EVK_MMC_ENV_DEV 0 +#endif + /* Initial environment variables */ #define CFG_EXTRA_ENV_SETTINGS \ BOOTENV \ @@ -42,7 +48,7 @@ "boot_fit=no\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "bootm_size=0x10000000\0" \ - "mmcdev=" __stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ + "mmcdev=" __stringify(IMX93_EVK_MMC_ENV_DEV)"\0" \ "mmcpart=1\0" \ "mmcroot=/dev/mmcblk1p2 rootwait rw\0" \ "mmcautodetect=yes\0" \ From 254c00803b63b1cefeddac9753f70cfff42ca892 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Mon, 4 Nov 2024 19:02:03 +0100 Subject: [PATCH 4/8] tools: imx8image: add possibility to skip dcd Currently U-Boot always adds DCD Image to boot container. On imx8qxp SoC it is possible to init RAM from within SCFW, and adding a DCD image type to the boot container in this case breaks booting (No debug output anymore from SCFW! Nor any output from SPL), so we need to configure a dcd skip somehow. This patch adds a new imx8image_cmd entry CMD_DCD_SKIP and a new entry in imximage.cfg "DCD_SKIP". If set to "true" no DCD image type will be added to the container. Signed-off-by: Heiko Schocher Reviewed-by: Peng Fan --- include/imx8image.h | 1 + tools/imx8image.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/imx8image.h b/include/imx8image.h index 85fb642ae39..6b95e93fb50 100644 --- a/include/imx8image.h +++ b/include/imx8image.h @@ -146,6 +146,7 @@ struct image_array { enum imx8image_cmd { CMD_INVALID, CMD_BOOT_FROM, + CMD_DCD_SKIP, CMD_FUSE_VERSION, CMD_SW_VERSION, CMD_MSG_BLOCK, diff --git a/tools/imx8image.c b/tools/imx8image.c index 5eb4b9612c8..96ece28bd6c 100644 --- a/tools/imx8image.c +++ b/tools/imx8image.c @@ -14,6 +14,7 @@ static soc_type_t soc; static int container = -1; static int32_t core_type = CFG_CORE_INVALID; static bool emmc_fastboot; +static bool dcd_skip; static image_t param_stack[IMG_STACK_SIZE]; static uint8_t fuse_version; static uint16_t sw_version; @@ -41,6 +42,7 @@ static int imx8image_check_image_types(uint8_t type) static table_entry_t imx8image_cmds[] = { {CMD_BOOT_FROM, "BOOT_FROM", "boot command", }, + {CMD_DCD_SKIP, "DCD_SKIP", "skip DCD init", }, {CMD_FUSE_VERSION, "FUSE_VERSION", "fuse version", }, {CMD_SW_VERSION, "SW_VERSION", "sw version", }, {CMD_MSG_BLOCK, "MSG_BLOCK", "msg block", }, @@ -88,6 +90,9 @@ static void parse_cfg_cmd(image_t *param_stack, int32_t cmd, char *token, if (!strncmp("emmc_fastboot", token, 13)) emmc_fastboot = true; break; + case CMD_DCD_SKIP: + if (!strncmp("true", token, 4)) + dcd_skip = true; case CMD_FUSE_VERSION: fuse_version = (uint8_t)(strtoll(token, NULL, 0) & 0xFF); break; @@ -1024,7 +1029,7 @@ int imx8image_copy_image(int outfd, struct image_tool_params *mparams) fprintf(stdout, "CONTAINER SW VERSION:\t0x%04x\n", sw_version); build_container(soc, sector_size, emmc_fastboot, - img_sp, false, fuse_version, sw_version, outfd); + img_sp, dcd_skip, fuse_version, sw_version, outfd); return 0; } From c5c700ca630a2b08195dd579017ebeec3c8a84a5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Nov 2024 00:06:52 +0100 Subject: [PATCH 5/8] ARM: dts: imx6dl: Add support for i.MX6DL DHCOM SoM on PDK2 carrier board Add support for the DH electronics i.MX6DL DHCOM SoM and a PDK2 evaluation board. The evaluation board features three serial ports, USB OTG, USB host with an USB hub, Fast or Gigabit ethernet, eMMC, uSD, SD, analog audio, PCIe and HDMI video output. All of the aforementioned features except for mSATA are supported, mSATA is not available on i.MX6DL and is only available on DHCOM populated with i.MX6Q SoC which is already supported upstream. Backport from linux-next commit c3f5d76a6e03 ("ARM: dts: imx6dl: Add support for i.MX6DL DHCOM SoM on PDK2 carrier board") Signed-off-by: Marek Vasut Reviewed-by: Christoph Niedermaier Signed-off-by: Shawn Guo --- .../src/arm/nxp/imx/imx6dl-dhcom-pdk2.dts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 dts/upstream/src/arm/nxp/imx/imx6dl-dhcom-pdk2.dts diff --git a/dts/upstream/src/arm/nxp/imx/imx6dl-dhcom-pdk2.dts b/dts/upstream/src/arm/nxp/imx/imx6dl-dhcom-pdk2.dts new file mode 100644 index 00000000000..38235925257 --- /dev/null +++ b/dts/upstream/src/arm/nxp/imx/imx6dl-dhcom-pdk2.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2024 Marek Vasut + * + * DHCOM iMX6 variant: + * DHCM-iMX6DL-C080-R102-F0819-E-SD-RTC-T-HS-I-01D2 + * DHCOM PCB number: 493-400 or newer + * PDK2 PCB number: 516-400 or newer + */ +/dts-v1/; + +#include "imx6dl.dtsi" +#include "imx6qdl-dhcom-som.dtsi" +#include "imx6qdl-dhcom-pdk2.dtsi" + +/ { + model = "DH electronics i.MX6DL DHCOM on Premium Developer Kit (2)"; + compatible = "dh,imx6dl-dhcom-pdk2", "dh,imx6dl-dhcom-som", + "fsl,imx6dl"; +}; From 354e33d06c0bc8463db430dbe794063fe47d366c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Wed, 6 Nov 2024 00:06:53 +0100 Subject: [PATCH 6/8] ARM: dts: imx: Switch to using upstream DT on DH i.MX6 DHCOM Enable OF_UPSTREAM to use upstream DT and add nxp/imx/ prefix to the DEFAULT_DEVICE_TREE. And thereby directly build DTB from dts/upstream/src/ including *-u-boot.dtsi files from arch/$(ARCH)/dts/ directory. Signed-off-by: Marek Vasut --- arch/arm/dts/Makefile | 6 +----- arch/arm/dts/imx6dl-dhcom-pdk2.dts | 15 -------------- arch/arm/dts/imx6dl-dhcom-picoitx.dts | 20 ------------------ arch/arm/dts/imx6q-dhcom-pdk2.dts | 25 ---------------------- arch/arm/dts/imx6s-dhcom-drc02.dts | 30 --------------------------- configs/dh_imx6_defconfig | 5 +++-- 6 files changed, 4 insertions(+), 97 deletions(-) delete mode 100644 arch/arm/dts/imx6dl-dhcom-pdk2.dts delete mode 100644 arch/arm/dts/imx6dl-dhcom-picoitx.dts delete mode 100644 arch/arm/dts/imx6q-dhcom-pdk2.dts delete mode 100644 arch/arm/dts/imx6s-dhcom-drc02.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index aeccfa93fc5..6ecc7bbdf25 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -778,8 +778,6 @@ dtb-y += \ imx6dl-cubox-i.dtb \ imx6dl-cubox-i-emmc-som-v15.dtb \ imx6dl-cubox-i-som-v15.dtb \ - imx6dl-dhcom-pdk2.dtb \ - imx6dl-dhcom-picoitx.dts \ imx6dl-gw51xx.dtb \ imx6dl-gw52xx.dtb \ imx6dl-gw53xx.dtb \ @@ -811,8 +809,7 @@ dtb-y += \ imx6dl-sabreauto.dtb \ imx6dl-sabresd.dtb \ imx6dl-sielaff.dtb \ - imx6dl-wandboard-revd1.dtb \ - imx6s-dhcom-drc02.dtb + imx6dl-wandboard-revd1.dtb endif @@ -824,7 +821,6 @@ dtb-y += \ imx6q-cubox-i.dtb \ imx6q-cubox-i-emmc-som-v15.dtb \ imx6q-cubox-i-som-v15.dtb \ - imx6q-dhcom-pdk2.dtb \ imx6q-display5.dtb \ imx6q-gw51xx.dtb \ imx6q-gw52xx.dtb \ diff --git a/arch/arm/dts/imx6dl-dhcom-pdk2.dts b/arch/arm/dts/imx6dl-dhcom-pdk2.dts deleted file mode 100644 index d59687490cf..00000000000 --- a/arch/arm/dts/imx6dl-dhcom-pdk2.dts +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: (GPL-2.0+) -/* - * Copyright (C) 2019 DH electronics GmbH - */ - -/dts-v1/; - -#include "imx6dl.dtsi" -#include "imx6qdl-dhcom-som.dtsi" -#include "imx6qdl-dhcom-pdk2.dtsi" - -/ { - model = "Freescale i.MX6 Duallite/Solo DHCOM Premium Developer Kit (2)"; - compatible = "dh,imx6dl-dhcom-pdk2", "dh,imx6dl-dhcom", "fsl,imx6dl"; -}; diff --git a/arch/arm/dts/imx6dl-dhcom-picoitx.dts b/arch/arm/dts/imx6dl-dhcom-picoitx.dts deleted file mode 100644 index 038bb002555..00000000000 --- a/arch/arm/dts/imx6dl-dhcom-picoitx.dts +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2021 DH electronics GmbH - * - * DHCOM iMX6 variant: - * DHCM-iMX6DL-C0800-R102-F0819-E-SD-RTC-T-HS-I-01D2 - * DHCOM PCB number: 493-300 or newer - * PicoITX PCB number: 487-600 or newer - */ -/dts-v1/; - -#include "imx6dl.dtsi" -#include "imx6qdl-dhcom-som.dtsi" -#include "imx6qdl-dhcom-picoitx.dtsi" - -/ { - model = "DH electronics i.MX6DL DHCOM on PicoITX"; - compatible = "dh,imx6dl-dhcom-picoitx", "dh,imx6dl-dhcom-som", - "fsl,imx6dl"; -}; diff --git a/arch/arm/dts/imx6q-dhcom-pdk2.dts b/arch/arm/dts/imx6q-dhcom-pdk2.dts deleted file mode 100644 index d4d57370615..00000000000 --- a/arch/arm/dts/imx6q-dhcom-pdk2.dts +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2015-2021 DH electronics GmbH - * Copyright (C) 2018 Marek Vasut - * - * DHCOM iMX6 variant: - * DHCM-iMX6Q-C0800-R102-F0819-E-SD-RTC-T-HS-I-01D2 - * DHCOM PCB number: 493-300 or newer - * PDK2 PCB number: 516-400 or newer - */ -/dts-v1/; - -#include "imx6q.dtsi" -#include "imx6qdl-dhcom-som.dtsi" -#include "imx6qdl-dhcom-pdk2.dtsi" - -/ { - model = "DH electronics i.MX6Q DHCOM on Premium Developer Kit (2)"; - compatible = "dh,imx6q-dhcom-pdk2", "dh,imx6q-dhcom-som", - "fsl,imx6q"; -}; - -&sata { - status = "okay"; -}; diff --git a/arch/arm/dts/imx6s-dhcom-drc02.dts b/arch/arm/dts/imx6s-dhcom-drc02.dts deleted file mode 100644 index 4077b607c29..00000000000 --- a/arch/arm/dts/imx6s-dhcom-drc02.dts +++ /dev/null @@ -1,30 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (C) 2021 DH electronics GmbH - * - * DHCOM iMX6 variant: - * DHCM-iMX6S-C0800-R102-F0409-E-CAN2-RTC-I-01D2 - * DHCOM PCB number: 493-400 or newer - * DRC02 PCB number: 568-100 or newer - */ -/dts-v1/; - -/* - * The kernel only distinguishes between i.MX6 Quad and DualLite, - * but the Solo is actually a DualLite with only one CPU. So use - * DualLite for the Solo and disable one CPU node. - */ - -#include "imx6dl.dtsi" -#include "imx6qdl-dhcom-som.dtsi" -#include "imx6qdl-dhcom-drc02.dtsi" - -/ { - model = "DH electronics i.MX6S DHCOM on DRC02"; - compatible = "dh,imx6s-dhcom-drc02", "dh,imx6s-dhcom-som", - "fsl,imx6dl"; - - cpus { - /delete-node/ cpu@1; - }; -}; diff --git a/configs/dh_imx6_defconfig b/configs/dh_imx6_defconfig index 468ec3805f6..43ac5a567ba 100644 --- a/configs/dh_imx6_defconfig +++ b/configs/dh_imx6_defconfig @@ -5,11 +5,12 @@ CONFIG_ARCH_MX6=y CONFIG_MX6QDL=y CONFIG_TARGET_DHCOMIMX6=y CONFIG_SPL_SYS_L2_PL310=y -CONFIG_DEFAULT_DEVICE_TREE="imx6q-dhcom-pdk2" +CONFIG_DEFAULT_DEVICE_TREE="nxp/imx/imx6q-dhcom-pdk2" CONFIG_MX6_DDRCAL=y CONFIG_NR_DRAM_BANKS=1 CONFIG_OF_LIBFDT_OVERLAY=y -CONFIG_OF_LIST="imx6q-dhcom-pdk2 imx6dl-dhcom-pdk2 imx6s-dhcom-drc02 imx6dl-dhcom-picoitx" +CONFIG_OF_LIST="nxp/imx/imx6q-dhcom-pdk2 nxp/imx/imx6dl-dhcom-pdk2 nxp/imx/imx6s-dhcom-drc02 nxp/imx/imx6dl-dhcom-picoitx" +CONFIG_OF_UPSTREAM=y CONFIG_FIT_VERBOSE=y CONFIG_MULTI_DTB_FIT=y CONFIG_LTO=y From d6893740c15cc5aeaf2fd891217bef953b6328ed Mon Sep 17 00:00:00 2001 From: Ian Ray Date: Fri, 8 Nov 2024 16:03:54 +0200 Subject: [PATCH 7/8] arm: mach-imx: move snvs module Commit 723f8359c1 ("imx: mx7: snvs: Add an SNVS init routine") noted that the init_snvs() call likely applies to other i.MX processors, and this has been found to be true for i.MX8MP. Move snvs module for future re-use. Signed-off-by: Ian Ray --- arch/arm/mach-imx/Makefile | 2 ++ arch/arm/mach-imx/mx7/Makefile | 2 +- arch/arm/mach-imx/{mx7 => }/snvs.c | 0 arch/arm/mach-imx/snvs.h | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) rename arch/arm/mach-imx/{mx7 => }/snvs.c (100%) create mode 100644 arch/arm/mach-imx/snvs.h diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 21d955b4aef..0de207c0681 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -293,3 +293,5 @@ obj-$(CONFIG_ARCH_IMXRT) += imxrt/ obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o obj-$(CONFIG_IMX8_ROMAPI) += romapi.o + +obj-$(CONFIG_MX7) += snvs.o diff --git a/arch/arm/mach-imx/mx7/Makefile b/arch/arm/mach-imx/mx7/Makefile index f1436e2d0d7..fec228a616a 100644 --- a/arch/arm/mach-imx/mx7/Makefile +++ b/arch/arm/mach-imx/mx7/Makefile @@ -3,5 +3,5 @@ # (C) Copyright 2015 Freescale Semiconductor, Inc. # -obj-y := soc.o clock.o clock_slice.o ddr.o snvs.o +obj-y := soc.o clock.o clock_slice.o ddr.o obj-$(CONFIG_ARMV7_PSCI) += psci-mx7.o psci-suspend.o diff --git a/arch/arm/mach-imx/mx7/snvs.c b/arch/arm/mach-imx/snvs.c similarity index 100% rename from arch/arm/mach-imx/mx7/snvs.c rename to arch/arm/mach-imx/snvs.c diff --git a/arch/arm/mach-imx/snvs.h b/arch/arm/mach-imx/snvs.h new file mode 100644 index 00000000000..4ce9781ca6d --- /dev/null +++ b/arch/arm/mach-imx/snvs.h @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 Linaro + */ + +void init_snvs(void); From 28958998f6301bc4a247a9057a623f997ee78c11 Mon Sep 17 00:00:00 2001 From: Ian Ray Date: Fri, 8 Nov 2024 16:03:55 +0200 Subject: [PATCH 8/8] arm: mach-imx: imx8m: re-use SNVS init routine Working with HAB on the i.MX8MP we've encountered a case where a board that successfully authenticates u-boot when booting Linux subsequently fails to properly bring up the RTC. The RTC registers live in the low-power block of the Secure Non-Volatile Storage (SNVS) block. The root cause of the error has been traced to the HAB handing off the SNVS-RTC in a state where HPCOMR::NPSWA_EN = 0 in other words where the Non-Privileged Software Access Enable bit is zero. Configure SNVS to allow unpriv access to SNVS LP for imx8m and imx8mp. This commit generalizes 723f8359c1 ("imx: mx7: snvs: Add an SNVS init routine") to also be used on i.MX8M SoCs, and was testeed on i.MX8MP. Signed-off-by: Ian Ray --- arch/arm/mach-imx/Makefile | 2 +- arch/arm/mach-imx/imx8m/soc.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 0de207c0681..011cca5d975 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -294,4 +294,4 @@ obj-$(CONFIG_ARCH_IMXRT) += imxrt/ obj-$(CONFIG_SPL_BOOTROM_SUPPORT) += spl_imx_romapi.o obj-$(CONFIG_IMX8_ROMAPI) += romapi.o -obj-$(CONFIG_MX7) += snvs.o +obj-$(CONFIG_MX7)$(CONFIG_IMX8M) += snvs.o diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c index 09a528a64f8..9588b8b28bf 100644 --- a/arch/arm/mach-imx/imx8m/soc.c +++ b/arch/arm/mach-imx/imx8m/soc.c @@ -34,6 +34,8 @@ #include #include +#include "../snvs.h" + DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_IMX_HAB) @@ -576,6 +578,8 @@ static void imx8m_setup_snvs(void) writel(SNVS_LPPGDR_INIT, SNVS_BASE_ADDR + SNVS_LPLVDR); /* Clear interrupt status */ writel(0xffffffff, SNVS_BASE_ADDR + SNVS_LPSR); + + init_snvs(); } static void imx8m_setup_csu_tzasc(void)