[PATCH 3/4] mtd: spi-nor-core: Rework default_init() to take flash_parameter

Tudor Ambarus tudor.ambarus at linaro.org
Mon Apr 15 09:27:12 CEST 2024



On 4/15/24 08:09, Takahiro Kuwano wrote:
> Hi Tudor,

Hi!

> 
> On 4/15/2024 3:47 PM, Tudor Ambarus wrote:
>>
>>
>> On 4/15/24 05:33, tkuw584924 at gmail.com wrote:
>>> From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
>>>
>>> default_init() fixup hook should be used to initialize flash parameters
>>> when its information is not provided in SFDP. To support that case, it
>>> needs to take flash_parameter structure like as other hooks.
>>>
>>> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
>>> ---
>>
>> I'd like to get rid of the default_init hook, let's not extend it if
>> possible. Can you use the late_init hook instead?
>>
> It looks easy to migrate from default_init to late_init so I will do it.
> Could you provide the links to related discussion in Linux MTD side so that
> I can summarize it in commit message?
> 

I can't, I don't remember if I brought this up or when, but I can
explain why.

default_init() is wrong, it contributes to the maze of initializing
flash parameters. We'd like to get rid of it because the flash
parameters that it initializes are not really used at SFDP parsing time,
thus they can be initialized later.

Ideally we want SFDP to initialize all the flash parameters. If (when)
SFDP tables are wrong, we fix them with the post_sfdp/bfpt hooks, to
emphasize that SFDP is indeed wrong. When there are parameters that are
not covered by SFDP, we initialize them in late_init() - these
parameters have nothing to do with SFDP and they are not needed earlier.
With this we'll have a clearer view of who initializes what.

Feel free to use this in the commit message if you think it helps.
Cheers,
ta


More information about the U-Boot mailing list