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 8AECCC433F5 for ; Thu, 31 Mar 2022 16:41:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 17AC1841B4; Thu, 31 Mar 2022 18:41:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1648744904; bh=kzuEgVTQLtirOpxiQI0hID9y3VEGNoIxUnkUcGBYX88=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VHvgVwutrHXeK0SoFpQ98Aycbk7HMWNMGCs1GOetHCz33dcLBTTCta8kNeJ34j1HH A+51DrEZFcp0/uoAVvuTxT1ubwb+0aWfn0c+ReK+LrP2qy/8bRxjQF40VTDoU5mVU9 nH1GKRKiWSo2dIboxLP71aBYvNJuu836hPyouGhd1TCnv11dRAugJhvPy7r6xezrfE zK0f+Q9hYvFMXcRy7SDev/bQWbOJYXdU3pQMol7m25Dcfr1NTsMvItmLiBjYHs5oVg +xXyOmJ9gDy2NpPlP13s0vLGRaYGxn90bSJMKhQg5HO+F4yWJzb4mMtcAZBNOqWgaM VqTy3tLwQl68Q== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1533F841AD; Thu, 31 Mar 2022 18:41:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1648744902; bh=kzuEgVTQLtirOpxiQI0hID9y3VEGNoIxUnkUcGBYX88=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ToIpLEzVMD3f7OO4P1yhWTVvlkYJBULamYbEUZNnbVDzU+m0r4a5lw69dZcNCGJps F6M/3EMbNedvQTTN56+gb5gBhDClV1UETDWQy9bx8y/z3QNlRiJdyLaqmuaB8coeTG BGVt8Lz7iP/CXWV+MgMikoSp8FJR7Bzrd6OPIjOOQqVOTEVzJeCXv/VsAfxpSx48PV nBcU/zrVp9XfHFRnrqAeVMxfQ7FkTMnDfPLAja1qe5uuadSUXYuGO1GjOdPT+WqAkB Bd6q2H7Eli1APrACy5rw1aiCUGInzRd6Wc6WiGZ0IhlUgW1630ZFsUJ8b1ndA/ZSLS Jx9j3GkF60WgA== Message-ID: <5335ff95-ff95-9864-2f46-1835c69ccde1@denx.de> Date: Thu, 31 Mar 2022 18:41:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [EXT] [PATCH] ARM: imx: romapi: Repair FlexSPI NOR boot offset Content-Language: en-US To: Tim Harvey Cc: Ye Li , "u-boot@lists.denx.de" , Peng Fan , "festevam@denx.de" , "sbabic@denx.de" References: <20220309160945.214591-1-marex@denx.de> <1647832589.20403.9.camel@nxp.com> <1eb56ad6-0158-5600-0ef9-6970316e96e7@denx.de> <1648002489.7912.21.camel@nxp.com> <1648450458.123397.21.camel@nxp.com> <65ea21e4-fc25-e33b-6196-ed133ff3211c@denx.de> <5ccf9837-2ff5-d864-464f-fb74948900b4@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 On 3/31/22 18:03, Tim Harvey wrote: > On Thu, Mar 31, 2022 at 8:26 AM Marek Vasut wrote: >> >> On 3/31/22 17:09, Tim Harvey wrote: >>> On Mon, Mar 28, 2022 at 7:55 AM Marek Vasut wrote: >>>> >>>> On 3/28/22 08:54, Ye Li wrote: >>>>> Hi Marek, >>>> >>>> Hi, >>>> >>>> [...] >>>> >>>>>>> 2. Update the u-boot.itb offset in imx8mp-u-boot.dtsi, set the >>>>>>> offset >>>>>>> to 0x5f000. The previous offset 0x58000 is for SD, calculated by >>>>>>> 0x60000 - 0x8000 (32KB image offset). >>>>>>> >>>>>>> uboot: blob-ext@2 { >>>>>>> filename = "u-boot.itb"; >>>>>>> offset = <0x5f000>; >>>>>>> }; >>>>>> But that breaks booting from SD card for me ? >>>>> >>>>> Do you want to use one flash.bin for both SD and flexspi? >>>> >>>> Yes, the board I use can boot from SD/eMMC/FlexSPI. I don't want to >>>> build multiple confusing "flash.bin" files, one for each boot media. >>>> >>>>> When first introduced 8m support by imx8mimage.c, we expected the u- >>>>> boot.itb at same device offset (0x60000) on SD/emmc and flexspi. The >>>>> imx8mimage will calculate the offset inside the flash.bin automatically >>>>> according to different IVT offset. The ROMAPI driver also works >>>>> correspondingly. >>>>> After using binman, the u-boot.itb offset inside the flash.bin has to >>>>> be manually set in this DTS node. To follow the original design, this >>>>> offset should be different. That's why I asked to update this dts node >>>>> for flexspi. >>>> >>>> This does imply that there are currently no users that boot from flexspi >>>> in upstream U-Boot, because such users would have to manually modify >>>> both arch/arm/dts/imx8m?-u-boot.dtsi and board/*/imximage.cfg to >>>> generate suitable flash.bin which can be started from FlexSPI. >>>> >>>> Also, git grep confirms that there are no users: >>>> >>>> u-boot$ git grep BOOT_FROM.*fspi >>>> doc/imx/mkimage/imx8image.txt:BOOT_FROM >>>> [sd|emmc_fastboot|fspi|nand_4k|nand_8k|nand_16k] [sector_size] >>>> >>>>> If you change the ROM API driver, that will break our design. You can >>>>> try to overwrite spl_romapi_get_uboot_base for your board only. >>>> >>>> Since there are no users which boot from flexspi upstream, this design >>>> can still be fixed such that it does not require different flash.bin for >>>> different boot media, but rather one flash.bin works on all boot media. >>>> I think that is much better. >>>> >>> >>> Marek, >>> >>> I'm also a fan of single U-Boot binaries supporting multiple boards >>> and configurations. >>> >>> How are you handling env for the various boot devices? I haven't >>> looked in a while... can multiple env support co-exist now between >>> MMC/SPI and be selected at runtime? >> >> Do '$ git grep env_get_location' , you will find board-level examples >> where this function is implemented and it returns ENVL_* based on >> various hardware-specific conditions. >> >> I _think_ there is even imx arch specific implementation for this >> env_get_location() which automatically picks SD/eMMC/FlexSPI for you >> right now. > > Marek, > > I guess where I keep getting hung up is how to configure the ENV for > multiple env drivers as there is only one CONFIG_ENV_OFFSET Kconfig > which means for all devices your going to have the same offset/redund > configuration which is likely not appropriate for mmc/nand/spi for > example. I don't see any way currently to configure those separately. > Unless I'm missing something obvious I suppose get_env_location() > could be augmented to be able to return board-specific env location > config as well. e.g. env/mmc.c has the following: 78 } dt_prop = { 79 .offset_redund = "u-boot,mmc-env-offset-redundant", 80 .partition = "u-boot,mmc-env-partition", 81 .offset = "u-boot,mmc-env-offset", 82 }; So use that to specify per-env-driver offset. Indeed, the CONFIG_ENV*OFFSET is shared by all env driver.