[PATCH COVER] rockchip: rk3399: fix SPI-NOR flash not found in U-Boot pre-reloc

Quentin Schulz quentin.schulz at cherry.de
Wed Jun 19 13:30:20 CEST 2024


Hi,

On 6/19/24 12:33 PM, Quentin Schulz wrote:
> Hi Jonas,
> 
> On 6/17/24 8:53 PM, Jonas Karlman wrote:
> [...]
>>> I'm wondering if we shouldn't do the same for U-Boot proper DTB as well?
>>
>> I think that would be good, and should also remove the need for the
>> recursive pinctrl lookup for bootph props during pre-reloc.
>>
>>>
>>> i.e.
>>>
>>> cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@
>>>
>>> to
>>>
>>> cmd_fdt_rm_props = $(objtree)/tools/fdtgrep $(fdtgrep_props) -u  $< |
>>> $(objtree)/tools/fdtgrep -r -O dtb - -o $@
>>>
>>> I assume we need to add a bunch more options though.
>>>
>>> But that would make sense to me, the fact that there's a pre-reloc stage
>>> in U-Boot proper is already a bit odd (to me), but if we have something
>>> that behaves differently than the pre-reloc stage in earlier stages...
>>> I'm not sure this is a good idea?
>>
>> Fully agree that part of the pre-reloc stage make little sense at least
>> on Rockchip platform where full memory is available before pre-reloc.
>>
> 
> Will try to come up with something.
> 

Ok so nothing straightforward. The issue is that the SPL/TPL/VPL DTB is 
built this way:

1) take full DTB
2) include all nodes which have the bootph-all, bootph-pre-sram/pre-ram, 
bootph-verify
3) include all parent nodes recursively of nodes from 2)
4) include /, /config, /chosen, /aliases

This generates a DTB. The parent nodes of nodes matching 2) and nodes 
matching 2) and / and /config and /chosen and /aliases are there, 
nothing else. No change made to DTB.

Step 2.

5) take DTB from 4)
6) remove bootph-all, bootph-pre-sram/pre-ram, bootph-verify properties 
and the ones in CONFIG_OF_SPL_REMOVE_PROPS

So.... '-u' option documentation is a lie :) It's not adding the 
property to the parents, it's including the parents of nodes matching 2).

I'm also a bit perplexed with the documentation stating it's the '-p' 
properties that are propagated as this is used for SPL/TPL/VPL and we 
don't have a '-p' option for it, only '-b' (the sounds being close in 
English, maybe just an unfortunate typo).

For U-Boot proper DTB, nothing is done except removing properties listed 
in CONFIG_OF_REMOVE_PROPS. And we would need to **add** boopth-some-ram 
properties to parent nodes instead.

 From the look of it, this isn't a straightforward change to fdtgrep as 
fdtgrep only cares if a node needs to be included not really which 
property actually matched in order for it to be included.

Cheers,
Quentin


More information about the U-Boot mailing list