From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7EAC3C004D4 for ; Thu, 19 Jan 2023 17:42:00 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 570AE85678; Thu, 19 Jan 2023 18:41:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kicherer.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=kicherer.org header.i=@kicherer.org header.b="KqiuT6VG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1151C85638; Thu, 19 Jan 2023 16:28:40 +0100 (CET) Received: from mail.zeus06.de (www.zeus06.de [194.117.254.36]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFBB185681 for ; Thu, 19 Jan 2023 16:28:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=kicherer.org Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=dev@kicherer.org DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=kicherer.org; h=from:to :cc:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=k1; bh=sAtErJtofBejvrbawssfHhJ2j2I LtecxLI/RsF9F1/c=; b=KqiuT6VGl01iffZyTx4A4btsqZS+verFRTd96QrCvTX fpaRhEYrW4bpxPPC+thQjF7eulZkQIHCLJ3EEGen3SvZAG+Vj1N9M+ug4X13ijJN dfGVZ1LtsbnwyGlaUE/OAPKTQKg4q5uHXyv+kfHZcR1q2ynxfAO24fFjzFXKbuBc = Received: (qmail 1972927 invoked from network); 19 Jan 2023 16:28:35 +0100 Received: by mail.zeus06.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 19 Jan 2023 16:28:35 +0100 X-UD-Smtp-Session: l3s6476p2@2uPblZ/ynINd7WR9 From: Mario Kicherer To: u-boot@lists.denx.de Cc: sbabic@denx.de, festevam@gmail.com, uboot-imx@nxp.com, daniel.schwierzeck@gmail.com, weijie.gao@mediatek.com, GSS_MTK_Uboot_upstream@mediatek.com, rick@andestech.com, ycliang@andestech.com, Mario Kicherer Subject: [PATCH v2 2/2] spl: spl_nor: add spl_boot_device parameter to spl_nor_get_uboot_base() Date: Thu, 19 Jan 2023 16:28:22 +0100 Message-Id: <20230119152822.1214202-3-dev@kicherer.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119152822.1214202-1-dev@kicherer.org> References: <20230119152822.1214202-1-dev@kicherer.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 19 Jan 2023 18:41:30 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean With this additional parameter, a board-specific implementation of this function can return an alternative address in case booting from the first address in the NOR flash fails. Signed-off-by: Mario Kicherer --- arch/arm/mach-imx/image-container.c | 2 +- arch/mips/mach-mtmips/mt7621/spl/spl.c | 2 +- arch/mips/mach-mtmips/spl.c | 2 +- common/spl/spl_nor.c | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-imx/image-container.c b/arch/arm/mach-imx/image-container.c index 0e76786482..41fb9470a4 100644 --- a/arch/arm/mach-imx/image-container.c +++ b/arch/arm/mach-imx/image-container.c @@ -243,7 +243,7 @@ uint32_t spl_nand_get_uboot_raw_page(void) #endif #ifdef CONFIG_SPL_NOR_SUPPORT -unsigned long spl_nor_get_uboot_base(void) +unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev) { int end; diff --git a/arch/mips/mach-mtmips/mt7621/spl/spl.c b/arch/mips/mach-mtmips/mt7621/spl/spl.c index aa5b267bb9..76719ad2f6 100644 --- a/arch/mips/mach-mtmips/mt7621/spl/spl.c +++ b/arch/mips/mach-mtmips/mt7621/spl/spl.c @@ -61,7 +61,7 @@ void board_boot_order(u32 *spl_boot_list) #endif } -unsigned long spl_nor_get_uboot_base(void) +unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev) { const struct tpl_info *tpli; const struct legacy_img_hdr *hdr; diff --git a/arch/mips/mach-mtmips/spl.c b/arch/mips/mach-mtmips/spl.c index fe5b49e702..ac7ca20027 100644 --- a/arch/mips/mach-mtmips/spl.c +++ b/arch/mips/mach-mtmips/spl.c @@ -34,7 +34,7 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[0] = BOOT_DEVICE_NOR; } -unsigned long spl_nor_get_uboot_base(void) +unsigned long spl_nor_get_uboot_base(struct spl_boot_device *bootdev) { void *uboot_base = __image_copy_end; diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c index 5e8b3bf621..e2ec2b9edf 100644 --- a/common/spl/spl_nor.c +++ b/common/spl/spl_nor.c @@ -17,7 +17,7 @@ static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector, return count; } -unsigned long __weak spl_nor_get_uboot_base(void) +unsigned long __weak spl_nor_get_uboot_base(struct spl_boot_device *bootdev) { return CONFIG_SYS_UBOOT_BASE; } @@ -91,13 +91,13 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, * defined location in SDRAM */ #ifdef CONFIG_SPL_LOAD_FIT - header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base(); + header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base(bootdev); if (image_get_magic(header) == FDT_MAGIC) { debug("Found FIT format U-Boot\n"); load.bl_len = 1; load.read = spl_nor_load_read; return spl_load_simple_fit(spl_image, &load, - spl_nor_get_uboot_base(), + spl_nor_get_uboot_base(bootdev), (void *)header); } #endif @@ -105,7 +105,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, load.bl_len = 1; load.read = spl_nor_load_read; return spl_load_imx_container(spl_image, &load, - spl_nor_get_uboot_base()); + spl_nor_get_uboot_base(bootdev)); } /* Legacy image handling */ @@ -116,7 +116,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image, load.read = spl_nor_load_read; spl_nor_load_read(&load, spl_nor_get_uboot_base(bootdev), sizeof(hdr), &hdr); return spl_load_legacy_img(spl_image, bootdev, &load, - spl_nor_get_uboot_base(), + spl_nor_get_uboot_base(bootdev), &hdr); } -- 2.34.1