From: Pali =?utf-8?B?Um9ow6Fy?= Date: Thu, 20 Aug 2020 10:51:28 +0200 Subject: [PATCH 2/2] arm: mvebu: Espressobin: Setup MTD partitions when booting kernel In-Reply-To: References: <20200819142417.15771-1-pali@kernel.org> <20200819142417.15771-2-pali@kernel.org> <20200820074002.jhdfgfnv3ip22cot@pali> Message-ID: <20200820085128.er7wxkmeyllixfkr@pali> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thursday 20 August 2020 10:17:55 Stefan Roese wrote: > On 20.08.20 09:40, Pali Roh?r wrote: > > On Thursday 20 August 2020 07:02:18 Stefan Roese wrote: > > > Can't you just use "mtdparts=" kernel cmdline parameter instead to pass > > > the MTD layout to the kernel? > > > > Maybe it is possible too, I have not tried it. > > > > I thought that more common is to update DTS file by uboot when loading > > kernel as it is already done e.g. for ethernet MAC address on > > Espressobin. > > Updating the MAC address is very common, yes. But passing the > MTD partition layout via the mtdparts= cmdline is also very > common and used very frequently. From my experience, its the > defacto recommended method to pass this info and also easier than > generating these DTS lines via some code. > > Please take a look at the mtdparts U-Boot command and its usage > in other targets. > > > Also I see that uboot has function fdt_fixup_mtdparts() via > > CONFIG_FDT_FIXUP_PARTITIONS option which do this, but uses uboot MTD > > code which IIRC cannot initialize SPI NOR. > > Why not? I had an impression that U-Boot does not support. > SPI NOR is also integrated into the U-Boot MTD world as > well. Please see this GARDENA MT7688 target, which uses SPI NOR & > SPI NAND: Ok, I'm going to look at it. > > Anyway, updating DTS has advantage that it is not needed to update > > existing boot scripts for OS. There are more distributions for > > Espressobin which have own boot scripts stored on SD card for loading > > kernel. And therefore to use command line parameters it would be needed > > to update all of them. > > I see. This is an argument I understand. But can't you use the common > fdt_fixup_mtdparts() then? > > > And I see there another problem. For specifying size of mtd partitions > > in command line, it is required to know offsets of those partitions. And > > e.g. uboot env partition depends on CONFIG_ENV_OFFSET option which is > > not available for uboot boot script code. > > > > But if you have other idea, I'm open to also other solutions. > > I have not investigated a multi-distribution solution here. Perhaps > the common fdt_fixup_mtdparts() is able to handle this? In case U-Boot would see MTD SPI partitions, then fdt_fixup_mtdparts() should work.