[PATCH 1/3] arm: rockchip: rk3568: fix mmc boot source instances

Michael Riesch michael.riesch at wolfvision.net
Mon Nov 15 01:24:16 PST 2021


Hello Sascha,

On 11/15/21 9:06 AM, Sascha Hauer wrote:
> On Mon, Nov 15, 2021 at 08:51:16AM +0100, Sascha Hauer wrote:
>> On Thu, Nov 11, 2021 at 03:03:14PM +0100, Michael Riesch wrote:
>>> The mainline DTS for the RK3568 EVB1 introduces mmc aliases sorted
>>> by the addresses of the corresponding controller. This commit
>>> fixes the instance number and aligns it with these aliases.
>>
>> The board dts sorts them differently, but the file is a SoC specific
>> one. We have a problem here.

Indeed. FWIW Ahmad and I had a discussion about this topic in which
having the mmc aliases in the SoC dtsi file was suggested as nice
solution. However, the ARM SoC community is about to move the aliases to
the board files and the corresponding patch was declined [0].
Hence, currently we rely on the board dts files to be consistent. At the
moment this is the case, but I take it that you are not too fond of this
approach.
BTW if I am not mistaken, this is an issue on other platforms as well,
e.g., on the ZynqMP machines.

>> Sascha
>>
>>>
>>> Signed-off-by: Michael Riesch <michael.riesch at wolfvision.net>
>>> ---
>>>  arch/arm/mach-rockchip/rk3568.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-rockchip/rk3568.c b/arch/arm/mach-rockchip/rk3568.c
>>> index 234c6d22d..95f462eca 100644
>>> --- a/arch/arm/mach-rockchip/rk3568.c
>>> +++ b/arch/arm/mach-rockchip/rk3568.c
>>> @@ -144,10 +144,10 @@ struct rk_bootsource {
>>>  
>>>  static struct rk_bootsource bootdev_map[] = {
>>>  	[0x1] = { .src = BOOTSOURCE_NAND, .instance = 0 },
>>> -	[0x2] = { .src = BOOTSOURCE_MMC, .instance = 0 },
>>> +	[0x2] = { .src = BOOTSOURCE_MMC, .instance = 1 },
>>>  	[0x3] = { .src = BOOTSOURCE_SPI_NOR, .instance = 0 },
>>>  	[0x4] = { .src = BOOTSOURCE_SPI_NAND, .instance = 0 },
>>> -	[0x5] = { .src = BOOTSOURCE_MMC, .instance = 1 },
>>> +	[0x5] = { .src = BOOTSOURCE_MMC, .instance = 0 },
> 
> Instead of storing the .src and .instance directly here we could store
> the base address of the peripheral here. Then search in the device tree
> for the node with that address and get the corresponding alias.

Sounds good to me.

> We would then have to translate this into our BOOTSOURCE_ defines and
> instance numbers. Or maybe it was a bad idea to have defines for these
> and we should have used strings for the bootsources in the first place.

AFAIC having a clear classification of the boot sources with enums is
helpful, and it is just the link to the actual device that might need a
revision.

I might give this a spin and come up with something.

Best regards,
Michael

[0]
https://lore.kernel.org/all/20210917110528.24454-1-michael.riesch@wolfvision.net/



More information about the barebox mailing list