From patchwork Fri May 23 13:18:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4059 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 897993F0CA for ; Fri, 23 May 2025 15:18:32 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-60007c2cef6sf1168798a12.0 for ; Fri, 23 May 2025 06:18:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1748006312; cv=pass; d=google.com; s=arc-20240605; b=YI4HrdP5bRZJpLcP5wCVFfMhqeG2QxZD7nVcDSCfOqcWLY+/K7EN4iOtUAyDIJgpO5 Igx/6CI1KzyvCGzdb6ozVJqEAFguDdp1VKGJ+Q+iX3paFdxoTDpFRHy3R69d5yNQHByo OQwjQ5yZZMO29IgoMxyflDZr7YPiMPu4TcyIPlZZ9CGLVmX7oi673EhHpKmKaf1nCL1I jfxTTXJdFwjlN2WoxfG5alvsh8K6/tNG7mqxmquU0uP12/BkuwpeQ1+8pp3tg2NywBxZ bTJpcKXoupu5LoMN6dTiUI5RyLr0AfCyabj2x+jIX5BQ3zTBVWsg3zpUIBaJz+utI9dG MhWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=to5nECH9vDGVOBuP3pK3i5XfWnriI/fdR8Z5dG+XjrU=; fh=YshVPOifuqbyyop2wpLWnWhP1SztMaCNaSnEEYugbzM=; b=jBFbE7x0bNxc34FdkiCHOdgrHeLgSQgQMpJBCrkIOUvsbnhcNSUiTTZlt1ShvUAbfn vFZHHzFBpAYYNPvljDZyDSBc2+80iXYW5b1/5tnjrDNdkRWQgexQUNdVgDe08NiQ03SW MZhwETqm7VI4A4aoE15bqOzNkZLuOLd85eWe9FdCRVscGxKn79FDKJKKdwm0vyh61CFV vEu7SYfRC6NQ31EB4EseA6U1G6VmgoqsOQ7biXzhYHf4Ibn8IZpJRzeADX8IPTZKSaTs hugwWJzv4jCGrOmTvMV53Q1UQ3F4+QJ6k2OIbvUgBuI0k3H8XeL8SCbbb246aQGIrAoG WJtA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z2WSvR1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1748006312; x=1748611112; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:mime-version:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=to5nECH9vDGVOBuP3pK3i5XfWnriI/fdR8Z5dG+XjrU=; b=FhjsQCMSwoiGmv9mY3w1FTWTYHvrDQMLSeo+oB0LuRowR4Sb3OHDKJYBLjEj4HOc1D CppYwpMzIThNRO6YRsto0JWM6f9Kq/SlAEDzrEpn97QiUCu2vuyE2INUOutNQJP3QNcn VBXkhZ6Z7caTDAW2Jo8a4hwFdKemCtHly92WU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748006312; x=1748611112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=to5nECH9vDGVOBuP3pK3i5XfWnriI/fdR8Z5dG+XjrU=; b=djaylWnPR6nrhw7l0xqaFeBaewg46pXihwEb2ejY3nAxyYmZEgp+vKGDsyTfdgucNn iJaF29ZUihr2FbWBMNqtYk+/14Kw3YoBxlIlrBpXFxpZsika8GnOHCdkgs+0kFpx+t5Z V6vZCOBLxIMGSQMCVb3hnqYHR5KBJL2UEGW7ykvburd99JRsibv5IMYetWTBfEYmudgt m6udYWXJvwed/VBVwpa/o/Ohi1tnrCQfifr5YOW7g1M09dtWkdqtP0fkCGwDdKaI26F3 2EHFaZUBQkcZq5SMqeNKeU0Dc6ObH+Eqy40WyOn+wD07miIwPT/72O9FMq/AWjaBn4xT +/Ig== X-Forwarded-Encrypted: i=2; AJvYcCVPtuLkmBBfs+76AamZOnx7U1kcUG72Ap6su2R1zTG92JirKQbfpOR/l6xtGfh9Byu9EbZZEb1N7srpY0fL@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YxOR7qbKN/cM9lsZ72hcfKh1Fc2neEIfhpIBs8gMZ5c5iHZrZjQ mHgxNvu4opvM3dmv1U1C2p8C9O0aRlTZBUJP82vWQk1COraf/szzfIaJ5LMs6z/86fIXv57ba3e I4Q== X-Google-Smtp-Source: AGHT+IF5lj3wrr+XaZQPTBb2MiE7tWEoiFStvXmi9JvP1/fJkRsDyE1i455uKVpL61Ek8ZNZ5NIYjw== X-Received: by 2002:a05:6402:1ecb:b0:5f7:f4ff:6267 with SMTP id 4fb4d7f45d1cf-6028d7a286dmr3229434a12.17.1748006311782; Fri, 23 May 2025 06:18:31 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com; h=AVT/gBHvwk2PT+kz7sHQ2Huq0BkLdEoQAW2dsSW9AmEOhVZBMg== Received: by 2002:a05:6402:40d1:b0:601:956f:a0cb with SMTP id 4fb4d7f45d1cf-602891d78e4ls68914a12.0.-pod-prod-00-eu; Fri, 23 May 2025 06:18:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWMxylucSZvswaGT3KlagoOZWS20xgcdVk1jmqEPO3pL78oDDnqZhPPXra6/smH/3nWsLvc+crFcIj/xi5A@amarulasolutions.com X-Received: by 2002:a17:906:c149:b0:ad5:74cd:1813 with SMTP id a640c23a62f3a-ad63f9dbb75mr259500566b.9.1748006309520; Fri, 23 May 2025 06:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1748006309; cv=none; d=google.com; s=arc-20240605; b=i4EQMxnVGTBed4kcYgJKEDfX4JeoEvWEt8+Zgb8PHmJkiRr+n2yLUl/jV5DZ8YNp+n hxedWY+jyoiIiqFBLlclMb44Fg9+VQ29FVGvRj/nfxX8RUd5gkF6S/yxVtIzjFN4o4dC nL78gpfVC0a3w47MuXc9WVQjliGGwqLf+X3rb65PjpHAuCHcQlplRe7BIgTPw9I7RswA JihpuPmhrA9lpxLcNAB+WJkHJhdwXWMg2TsEsQyaVBTZvIubXGd6qxp4UA5ptekwQXZh AtWIcpRkANf4uNsNCWerAeC2DJtIa7OYWqTyxndaahbz5DADhUwIrthS5jsoEmpTVKh+ wY6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=8PwSrpkwf4N2YcDk/v+FL0Ux51aARqSjbrVvN9y2j68=; fh=vrx7AY3HSEEFykMa7agBf8vwpx+YvDf4si5WNBlSg6w=; b=Nxyae2JzpIonFSfl1Zesn+TCHzLnbDFflXz4rNjXwbL8IFjjW6++GCSQ75w7IN5m2F eDcx2tLt2wef6Qk8sC1TihN1W/ZqyCkzRm5BhFL1WilPWoWIOUkLm5kcSie8WcPVKzuO pynk7JFt8J/hNVuS1zWToGKaLRanKtSEK+p5iYTmMzudO7U5rl27HM4iu2qxITTeLofA cZi4w0M9GvSXMZPUXMoJxQ17tYDJjmwON+zTCBYF+Gzc6qfO96zBZR6GD7e5RA/isdhM dnyYxJbpPvcrsdPvXc61sTUwU6FON+FgNwAaE9vs94BUgzXkSdcCjEwhMEA21Uf3ynen ppRQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z2WSvR1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-ad84cecdafdsor59484766b.1.2025.05.23.06.18.29 for (Google Transport Security); Fri, 23 May 2025 06:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Forwarded-Encrypted: i=1; AJvYcCVF1JE91eTjCiKqDxnQzbI13AnGDuQNV3GLBQxwFtxODm5kH+V4ZAh4yuWuQ/NknPsiHTajPZQgpGhog/EG@amarulasolutions.com X-Gm-Gg: ASbGncvwFHh997heG6iLziLHBxeA3CIJ3CXrPGHy5nwXUHGRNq0tWAYfzAe8NJDZ06e Nxt2aHkXWThuQSDO8RambMbJPtHe4T/1/xi7MWxrSOuJ1cUNDBA0YAiWUwFct8ee6jCUB/gpAeO Im27TTVY9LNvP50kgXSo3LXiynO03zyCdzcN6/jtFIVoZ9QGqz0QzbyXAzhRXAOE/rjKqgzzB+H KLQYXanMSi8OM2UcLg28uiBg+fob0dJ94n4szNFdBWjUHl1luTokk7oVFfc5Vd+TVZa3qI5zZHI hkkHjP8FovY1HN3Hht2tj6Sj3oeR5M3d4Zg0EIVGjQ5iHzN0jXQUr9IjSoLBFVEffc7it1R/Uto o8oKh7kKuEPPwM0IAPnkKbi3kjhjgD95UDF913M+E6suj+vayW7LUVRvaQg== X-Received: by 2002:a17:907:6d01:b0:ad5:fae:54c4 with SMTP id a640c23a62f3a-ad64e289c24mr319770666b.4.1748006308691; Fri, 23 May 2025 06:18:28 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.. (host-87-5-95-99.retail.telecomitalia.it. [87.5.95.99]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ad52d441fe5sm1226154666b.111.2025.05.23.06.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 May 2025 06:18:28 -0700 (PDT) From: Dario Binacchi To: buildroot@buildroot.org Cc: Dario Binacchi , Michael Trimarchi , linux-amarula@amarulasolutions.com, simon.holesch@bshg.com, Sven.Dembianny@bshg.com Subject: [PATCH 1/1] board: bsh: imx8mn-bsh-smm-s2: fix U-Boot startup Date: Fri, 23 May 2025 15:18:23 +0200 Message-ID: <20250523131823.1219155-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Z2WSvR1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Commit e3329a1e8203 ("configs/imx8mn_bsh_smm_s2[_pro]: bump Linux to 6.12.23 and U-Boot to 2025.04") broke the U-Boot boot process on the BSH SMM S2 board. I didn’t notice it because I mistakenly tested the patch on the SMM S2PRO board, which boots from eMMC instead of NAND. Next time, I won’t forget to test on both boards :). Fixes: e3329a1e8203 ("configs/imx8mn_bsh_smm_s2[_pro]: bump Linux to 6.12.23 and U-Boot to 2025.04") Signed-off-by: Dario Binacchi --- ...arm-imx-imx8m-soc-fix-the-macro-name.patch | 45 +++++ ...mx8m-soc-replace-ifdef-by-IS_ENABLED.patch | 178 ++++++++++++++++++ ...ig-support-U-Boot-load-from-raw-NAND.patch | 49 +++++ ...l_imx_romapi-support-raw-NAND-sector.patch | 42 +++++ ...bsh_smm_s2-load-U-Boot-from-raw-NAND.patch | 32 ++++ 5 files changed, 346 insertions(+) create mode 100644 board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0001-arm-imx-imx8m-soc-fix-the-macro-name.patch create mode 100644 board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0002-arm-imx-imx8m-soc-replace-ifdef-by-IS_ENABLED.patch create mode 100644 board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0003-spl-Kconfig-support-U-Boot-load-from-raw-NAND.patch create mode 100644 board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0004-imx-spl_imx_romapi-support-raw-NAND-sector.patch create mode 100644 board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0005-configs-imx8mn_bsh_smm_s2-load-U-Boot-from-raw-NAND.patch diff --git a/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0001-arm-imx-imx8m-soc-fix-the-macro-name.patch b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0001-arm-imx-imx8m-soc-fix-the-macro-name.patch new file mode 100644 index 000000000000..6d53dddfb89e --- /dev/null +++ b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0001-arm-imx-imx8m-soc-fix-the-macro-name.patch @@ -0,0 +1,45 @@ +From f7cddc4c6f4e4da57c6500cd0d88ea06e937b239 Mon Sep 17 00:00:00 2001 +From: Michael Trimarchi +Date: Thu, 15 May 2025 17:09:51 +0200 +Subject: [PATCH] arm: imx: imx8m: soc: fix the macro name + +The function arch_spl_mmc_get_uboot_raw_sector() was never compiled, +even when the option CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION was +enabled. So rename the macro SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION to +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION. + +Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") +Signed-off-by: Michael Trimarchi +Signed-off-by: Dario Binacchi +Reviewed-by: Quentin Schulz +Reviewed-by: Peng Fan +Upstream: https://source.denx.de/u-boot/u-boot/-/commit/f7cddc4c6f4e4da57c6500cd0d88ea06e937b239 +--- + arch/arm/mach-imx/imx8m/soc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c +index 567e8e9e81a0..806adcf145fa 100644 +--- a/arch/arm/mach-imx/imx8m/soc.c ++++ b/arch/arm/mach-imx/imx8m/soc.c +@@ -791,7 +791,7 @@ int boot_mode_getprisec(void) + #endif + + #if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) +-#ifdef SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION ++#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION + #define IMG_CNTN_SET1_OFFSET GENMASK(22, 19) + unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + unsigned long raw_sect) +@@ -826,7 +826,7 @@ unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + + return raw_sect; + } +-#endif /* SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION */ ++#endif /* CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION */ + #endif + + bool is_usb_boot(void) +-- +2.43.0 + diff --git a/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0002-arm-imx-imx8m-soc-replace-ifdef-by-IS_ENABLED.patch b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0002-arm-imx-imx8m-soc-replace-ifdef-by-IS_ENABLED.patch new file mode 100644 index 000000000000..5f57c69481ab --- /dev/null +++ b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0002-arm-imx-imx8m-soc-replace-ifdef-by-IS_ENABLED.patch @@ -0,0 +1,178 @@ +From 4c82eeab9840983693791117aa75f7bd7fbc805b Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Thu, 15 May 2025 17:09:52 +0200 +Subject: [PATCH] arm: imx: imx8m: soc: replace ifdef by IS_ENABLED() + +Standardize on using the IS_ENABLED macro. + +Signed-off-by: Dario Binacchi +Reviewed-by: Peng Fan +Upstream: https://source.denx.de/u-boot/u-boot/-/commit/4c82eeab9840983693791117aa75f7bd7fbc805b +--- + arch/arm/mach-imx/imx8m/soc.c | 40 +++++++++++++++++------------------ + 1 file changed, 20 insertions(+), 20 deletions(-) + +diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c +index 806adcf145fa..3cdb71a25284 100644 +--- a/arch/arm/mach-imx/imx8m/soc.c ++++ b/arch/arm/mach-imx/imx8m/soc.c +@@ -38,7 +38,7 @@ + + DECLARE_GLOBAL_DATA_PTR; + +-#if defined(CONFIG_IMX_HAB) ++#if IS_ENABLED(CONFIG_IMX_HAB) + struct imx_fuse const imx_sec_config_fuse = { + .bank = 1, + .word = 3, +@@ -52,7 +52,7 @@ struct imx_fuse const imx_field_return_fuse = { + + int timer_init(void) + { +-#ifdef CONFIG_XPL_BUILD ++#if IS_ENABLED(CONFIG_XPL_BUILD) + struct sctr_regs *sctr = (struct sctr_regs *)SYSCNT_CTRL_BASE_ADDR; + unsigned long freq = readl(&sctr->cntfid0); + +@@ -110,7 +110,7 @@ void set_wdog_reset(struct wdog_regs *wdog) + setbits_le16(&wdog->wcr, WDOG_WDT_MASK | WDOG_WDZST_MASK); + } + +-#ifdef CONFIG_ARMV8_PSCI ++#if IS_ENABLED(CONFIG_ARMV8_PSCI) + #define PTE_MAP_NS PTE_BLOCK_NS + #else + #define PTE_MAP_NS 0 +@@ -700,11 +700,11 @@ int arch_cpu_init(void) + return 0; + } + +-#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) ++#if IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP) + struct rom_api *g_rom_api = (struct rom_api *)0x980; + #endif + +-#if defined(CONFIG_IMX8M) ++#if IS_ENABLED(CONFIG_IMX8M) + #include + int imx8m_detect_secondary_image_boot(void) + { +@@ -790,8 +790,8 @@ int boot_mode_getprisec(void) + } + #endif + +-#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) +-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION ++#if IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP) ++#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) + #define IMG_CNTN_SET1_OFFSET GENMASK(22, 19) + unsigned long arch_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + unsigned long raw_sect) +@@ -834,7 +834,7 @@ bool is_usb_boot(void) + return get_boot_device() == USB_BOOT; + } + +-#ifdef CONFIG_OF_SYSTEM_SETUP ++#if IS_ENABLED(CONFIG_OF_SYSTEM_SETUP) + bool check_fdt_new_path(void *blob) + { + const char *soc_path = "/soc@0"; +@@ -880,7 +880,7 @@ add_status: + return 0; + } + +-#ifdef CONFIG_IMX8MQ ++#if IS_ENABLED(CONFIG_IMX8MQ) + bool check_dcss_fused(void) + { + struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR; +@@ -1026,7 +1026,7 @@ int disable_vpu_nodes(void *blob) + return -EPERM; + } + +-#ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE ++#if IS_ENABLED(CONFIG_IMX8MN_LOW_DRIVE_MODE) + static int low_drive_gpu_freq(void *blob) + { + static const char *nodes_path_8mn[] = { +@@ -1311,7 +1311,7 @@ int ft_system_setup(void *blob, struct bd_info *bd) + "/cpus/cpu@3", + }; + +-#ifdef CONFIG_IMX8MQ ++#if IS_ENABLED(CONFIG_IMX8MQ) + int i = 0; + int rc; + int nodeoff; +@@ -1387,7 +1387,7 @@ usb_modify_speed: + if (is_imx8md()) + disable_cpu_nodes(blob, nodes_path, 2, 4); + +-#elif defined(CONFIG_IMX8MM) ++#elif IS_ENABLED(CONFIG_IMX8MM) + if (is_imx8mml() || is_imx8mmdl() || is_imx8mmsl()) + disable_vpu_nodes(blob); + +@@ -1396,10 +1396,10 @@ usb_modify_speed: + else if (is_imx8mms() || is_imx8mmsl()) + disable_cpu_nodes(blob, nodes_path, 3, 4); + +-#elif defined(CONFIG_IMX8MN) ++#elif IS_ENABLED(CONFIG_IMX8MN) + if (is_imx8mnl() || is_imx8mndl() || is_imx8mnsl()) + disable_gpu_nodes(blob); +-#ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE ++#if IS_ENABLED(CONFIG_IMX8MN_LOW_DRIVE_MODE) + else { + int ldm_gpu = low_drive_gpu_freq(blob); + +@@ -1415,7 +1415,7 @@ usb_modify_speed: + else if (is_imx8mns() || is_imx8mnsl() || is_imx8mnus()) + disable_cpu_nodes(blob, nodes_path, 3, 4); + +-#elif defined(CONFIG_IMX8MP) ++#elif IS_ENABLED(CONFIG_IMX8MP) + if (is_imx8mpul()) { + /* Disable GPU */ + disable_gpu_nodes(blob); +@@ -1471,7 +1471,7 @@ void reset_cpu(void) + } + #endif + +-#if defined(CONFIG_ARCH_MISC_INIT) ++#if IS_ENABLED(CONFIG_ARCH_MISC_INIT) + int arch_misc_init(void) + { + if (IS_ENABLED(CONFIG_FSL_CAAM)) { +@@ -1487,8 +1487,8 @@ int arch_misc_init(void) + } + #endif + +-#if defined(CONFIG_XPL_BUILD) +-#if defined(CONFIG_IMX8MQ) || defined(CONFIG_IMX8MM) || defined(CONFIG_IMX8MN) ++#if IS_ENABLED(CONFIG_XPL_BUILD) ++#if IS_ENABLED(CONFIG_IMX8MQ) || IS_ENABLED(CONFIG_IMX8MM) || IS_ENABLED(CONFIG_IMX8MN) + bool serror_need_skip = true; + + void do_error(struct pt_regs *pt_regs) +@@ -1523,7 +1523,7 @@ void do_error(struct pt_regs *pt_regs) + #endif + #endif + +-#if defined(CONFIG_IMX8MN) || defined(CONFIG_IMX8MP) ++#if IS_ENABLED(CONFIG_IMX8MN) || IS_ENABLED(CONFIG_IMX8MP) + enum env_location arch_env_get_location(enum env_operation op, int prio) + { + enum boot_device dev = get_boot_device(); +@@ -1571,7 +1571,7 @@ enum env_location arch_env_get_location(enum env_operation op, int prio) + + #endif + +-#ifdef CONFIG_IMX_BOOTAUX ++#if IS_ENABLED(CONFIG_IMX_BOOTAUX) + const struct rproc_att hostmap[] = { + /* aux core , host core, size */ + { 0x00000000, 0x007e0000, 0x00020000 }, +-- +2.43.0 + diff --git a/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0003-spl-Kconfig-support-U-Boot-load-from-raw-NAND.patch b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0003-spl-Kconfig-support-U-Boot-load-from-raw-NAND.patch new file mode 100644 index 000000000000..4e8ade441a5e --- /dev/null +++ b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0003-spl-Kconfig-support-U-Boot-load-from-raw-NAND.patch @@ -0,0 +1,49 @@ +From 8acea298bb82c38b20855cd46a46b9e418dc1fb0 Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Tue, 20 May 2025 10:54:16 +0200 +Subject: [PATCH] spl: Kconfig: support U-Boot load from raw NAND + +Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks +the boot of the BSH SMM S2 board. As stated in the commit itself, "Some +boards use this value even though MMC is not enabled in SPL, for example +imx8mn_bsh_smm_s2". + +Support load of the U-Boot image from raw NAND sector. This is equivalent +to load from MMC raw sector. + +Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") +Signed-off-by: Dario Binacchi +Upstream: https://source.denx.de/u-boot/u-boot/-/commit/8acea298bb82c38b20855cd46a46b9e418dc1fb0 +--- + common/spl/Kconfig | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/common/spl/Kconfig b/common/spl/Kconfig +index aa3a85eea54d..77cf04d38ed0 100644 +--- a/common/spl/Kconfig ++++ b/common/spl/Kconfig +@@ -974,6 +974,21 @@ config SPL_NAND_SUPPORT + This enables the drivers in drivers/mtd/nand/raw as part of an SPL + build. + ++config SPL_NAND_RAW_U_BOOT_USE_SECTOR ++ bool "NAND raw mode: by sector" ++ depends on SPL_NAND_SUPPORT ++ select SPL_LOAD_BLOCK ++ help ++ Use sector number for specifying U-Boot location on NAND in ++ raw mode. ++ ++config SPL_NAND_RAW_U_BOOT_SECTOR ++ hex "Address on the NAND to load U-Boot from" ++ depends on SPL_NAND_RAW_U_BOOT_USE_SECTOR ++ help ++ Address on the NAND to load U-Boot from, when the NAND is being used ++ in raw mode. Units: NAND disk sectors (1 sector = 512 bytes). ++ + config SPL_NAND_RAW_ONLY + bool "Support to boot only raw u-boot.bin images" + depends on SPL_NAND_SUPPORT +-- +2.43.0 + diff --git a/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0004-imx-spl_imx_romapi-support-raw-NAND-sector.patch b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0004-imx-spl_imx_romapi-support-raw-NAND-sector.patch new file mode 100644 index 000000000000..cc35a76f88ec --- /dev/null +++ b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0004-imx-spl_imx_romapi-support-raw-NAND-sector.patch @@ -0,0 +1,42 @@ +From 24d98fa63bbcb21988e4e822f11686319502fb1f Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Tue, 20 May 2025 10:54:17 +0200 +Subject: [PATCH] imx: spl_imx_romapi: support raw NAND sector + +Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks +the boot of the BSH SMM S2 board. As stated in the dropped comment, "Some +boards use this value even though MMC is not enabled in SPL, for example +imx8mn_bsh_smm_s2". + +Support load of the U-Boot image from raw NAND sector. + +Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") +Signed-off-by: Dario Binacchi +Upstream: https://source.denx.de/u-boot/u-boot/-/commit/24d98fa63bbcb21988e4e822f11686319502fb1f +--- + arch/arm/mach-imx/spl_imx_romapi.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c +index 3982f4cca184..b7008df8e35a 100644 +--- a/arch/arm/mach-imx/spl_imx_romapi.c ++++ b/arch/arm/mach-imx/spl_imx_romapi.c +@@ -35,12 +35,10 @@ ulong __weak spl_romapi_get_uboot_base(u32 image_offset, u32 rom_bt_dev) + { + u32 sector = 0; + +- /* +- * Some boards use this value even though MMC is not enabled in SPL, for +- * example imx8mn_bsh_smm_s2 +- */ +-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR ++#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR) + sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR; ++#elif IS_ENABLED(CONFIG_SPL_NAND_RAW_U_BOOT_USE_SECTOR) ++ sector = CONFIG_SPL_NAND_RAW_U_BOOT_SECTOR; + #endif + + return image_offset + sector * 512 - 0x8000; +-- +2.43.0 + diff --git a/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0005-configs-imx8mn_bsh_smm_s2-load-U-Boot-from-raw-NAND.patch b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0005-configs-imx8mn_bsh_smm_s2-load-U-Boot-from-raw-NAND.patch new file mode 100644 index 000000000000..61eccd51ff7c --- /dev/null +++ b/board/bsh/common/imx8mn-bsh-smm-s2/patches/uboot/0005-configs-imx8mn_bsh_smm_s2-load-U-Boot-from-raw-NAND.patch @@ -0,0 +1,32 @@ +From dce71922df352b0eb1b6cc3d40c374ad80a7d6c5 Mon Sep 17 00:00:00 2001 +From: Dario Binacchi +Date: Tue, 20 May 2025 10:54:18 +0200 +Subject: [PATCH] configs: imx8mn_bsh_smm_s2: load U-Boot from raw NAND + +Commit 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") breaks +the boot of the BSH SMM S2 board. Add options to load U-Boot from raw NAND +sector. + +Fixes: 2a00d73d081a ("spl: mmc: Try to clean up raw-mode options") +Signed-off-by: Dario Binacchi +Upstream: https://source.denx.de/u-boot/u-boot/-/commit/dce71922df352b0eb1b6cc3d40c374ad80a7d6c5 +--- + configs/imx8mn_bsh_smm_s2_defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/configs/imx8mn_bsh_smm_s2_defconfig b/configs/imx8mn_bsh_smm_s2_defconfig +index 9ffcd3b221c3..1c11d4705419 100644 +--- a/configs/imx8mn_bsh_smm_s2_defconfig ++++ b/configs/imx8mn_bsh_smm_s2_defconfig +@@ -47,6 +47,8 @@ CONFIG_SPL_DMA=y + CONFIG_SPL_I2C=y + CONFIG_SPL_MTD=y + CONFIG_SPL_NAND_SUPPORT=y ++CONFIG_SPL_NAND_RAW_U_BOOT_USE_SECTOR=y ++CONFIG_SPL_NAND_RAW_U_BOOT_SECTOR=0x300 + CONFIG_SPL_NAND_BASE=y + CONFIG_SPL_NAND_IDENT=y + CONFIG_SPL_POWER=y +-- +2.43.0 +