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 3409BC433EF for ; Wed, 11 May 2022 19:32:59 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C3278436F; Wed, 11 May 2022 21:22:58 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="mfyztNCl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 719FD84387; Wed, 11 May 2022 21:22:54 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 346028436F for ; Wed, 11 May 2022 21:22:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A98BCB825EA; Wed, 11 May 2022 18:34:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AD3AC34100; Wed, 11 May 2022 18:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652294064; bh=DXqYyTHxr/QB0v/eGkEF28QQOKV99RwXKBZgB/Vjet0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mfyztNCl6GvGRkrTtbqEkbUb4AtczWC86ch/unpBZQ4bynzXhZNdchl4uGksyduKL 7fxva2cInOMFS3q891x0UzyI/FBlhpjhSzXDc82RArsAnKLn0mKtUy9BKeaHm0L72U zDD2myASFrCP7oKpznNoLCqIrTZAdLApaVCekVsTHfjMCw7rNfp6V31a83ggWLWbXO rBoq0lnKAA5ccmUZkPU6qxMPMVNTaD5iz/syPtHji8cn8NC8eJaWDGuczgYL9KkI+J nzANXs0bEAGn1OxrkkKrauoykFJ9Vqpp3ZnDmD4BD3VhQAh+ABlxRw489FwKRKWFyc nLnQKsSTuactQ== Received: by pali.im (Postfix) id EA50922D3; Wed, 11 May 2022 20:34:21 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Peng Fan , Jaehoon Chung , Priyanka Jain , Sinan Akman Cc: u-boot@lists.denx.de Subject: [PATCH 2/3] mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFS Date: Wed, 11 May 2022 20:33:31 +0200 Message-Id: <20220511183332.1362-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220511183332.1362-1-pali@kernel.org> References: <20220511183332.1362-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.5 at phobos.denx.de X-Virus-Status: Clean When fixed offset via CONFIG_SYS_MMC_U_BOOT_OFFS is not specified then expects that U-Boot proper is placed immediately after SPL without any additional padding. This allows to generate smaller SPL+U-Boot final binary as it is not required to specify fixed offset to U-Boot proper at SPL compile time. In this case offset to U-Boot proper is calculated at SPL compile time in linker script. Signed-off-by: Pali Rohár --- arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 10 ++++++++++ drivers/mmc/fsl_esdhc_spl.c | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds index 272e94a1f169..cfb55939468a 100644 --- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds @@ -59,6 +59,13 @@ SECTIONS __init_begin = .; __init_end = .; _end = .; + +#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC +#if defined(CONFIG_SDCARD) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS) + mmc_u_boot_offs = .; +#endif +#endif + #ifdef CONFIG_SPL_SKIP_RELOCATE . = ALIGN(4); __bss_start = .; @@ -91,6 +98,9 @@ SECTIONS .resetvec IMAGE_TEXT_BASE + RESET_VECTOR_OFFSET : { KEEP(*(.resetvec)) } = 0xffff +#if defined(CONFIG_SDCARD) && !defined(CONFIG_SYS_MMC_U_BOOT_OFFS) + mmc_u_boot_offs = .; +#endif #endif #ifndef CONFIG_SPL_SKIP_RELOCATE diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index e3175de16bab..139b4d853b7a 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -9,6 +9,10 @@ #include #include +#ifndef CONFIG_SYS_MMC_U_BOOT_OFFS +extern uchar mmc_u_boot_offs[]; +#endif + /* * The environment variables are written to just after the u-boot image * on SDCard, so we must read the MBR to get the start address and code @@ -149,7 +153,11 @@ again: val = *(tmp_buf + blk_off + ESDHC_BOOT_IMAGE_ADDR + i); offset = (offset << 8) + val; } +#ifndef CONFIG_SYS_MMC_U_BOOT_OFFS + offset += (ulong)&mmc_u_boot_offs - CONFIG_SPL_TEXT_BASE; +#else offset += CONFIG_SYS_MMC_U_BOOT_OFFS; +#endif #endif /* * Load U-Boot image from mmc into RAM -- 2.20.1