[U-Boot] [PATCH v10 00/27] dm: Generic MTD Subsystem, with SPI-NOR interface

Vignesh R
2018-01-03T08:48:24Z

On Tuesday 02 January 2018 03:39 PM, Jagan Teki wrote:
> On Thu, Dec 28, 2017 at 8:14 PM, Lukasz Majewski <lukma@denx.de> wrote:
>> Hi Jagan,
>>
>>> Compared to previous series’s [1], [2], [3] and [4] this patch set
>>> redefined most of the implementation suitable to fit into existing
>>> driver-model.
>>>
>>> MTD is generic subsystem for underlying flash devices like nand,
>>> parallel nor, spinor, dataflash etc. So to drive this theory with
>>> driver model(with an example of block layer) mtd is common device
>>> interaction for most of memory technology flashes like nand,
>>> parallel nor, spinor, dataflash etc, these are treated as interface
>>> types wrt u-boot driver model.
>>>
>>> Once the respective interface driver bind happen, the uclass driver
>>> will pass an 'interface type' to mtd layer to create device for it,
>>> for example once spinor ULASS_SPI_NOR driver bind happen,
>>> the uclass driver of spinor will pass MTD_IF_TYPE_SPI_NOR
>>> interface type to create mtd device for spinor devices.
>>>
>>> SPI-NOR:
>>> =======
>>> Some of the SPI device drivers at drivers/spi not a real
>>> spi controllers, Unlike normal/generic SPI controllers they
>>> operates only with SPI-NOR flash devices. these were technically
>>> termed as SPI-NOR controllers, Ex: drivers/spi/fsl_qspi.c
>>>
>>> The problem with these were resides at drivers/spi is entire
>>> SPI layer becomes SPI-NOR flash oriented which is absolutely
>>> a wrong indication where SPI layer getting effected more with
>>> flash operations - So this SPI-NOR core will resolve this issue
>>> by separating all SPI-NOR flash operations from spi layer and
>>> creats a generic layer called SPI-NOR core which can be used to
>>> interact SPI-NOR to SPI driver interface layer and the SPI-NOR
>>> controller driver.
>>
>> I must admit that I'm a bit confused....
>>
>> If you don't mind I would like to ask for clarification of a few things:
>>
>>
>>
>>>
>>> =======================================
>>> cmd/spinor.c
>>
>> ^^^^^ - this would be a new set of commands to comply
>> with DM?
>
> with this series yes, and we're working on supporting the same with non-dm.
>
>>
>> What about "sf" command which we use now to get access
>> to SPI-NOR memory? A lot of boards already use "sf"
>> command... which may be tricky to replace.
>
> end-goal will be replace sf with spinor command and removal of 'sf'
> will be done when the new spi-nor framework stable enough to handle
> all scenarios which are spi-flash supporting as of now.

I don't agree on adding new cmd and removing sf. It would be impractical
to change all boot cmds to replace sf with spinor cmd all over U-Boot.
Not to forget the envs already stored on non volatile media need
updation to work with new cmd.
If SPI NOR framework is to abstract all accesses to nor flash devices in
U-Boot, then why cannot it replace the logic implementing cmd sf? All
that is changing is that mtd/spi/* is replaced by spi-nor.c + m25p80.c.
sf probe can be modified achieve what spinor dev does
sf read for spinor read and so on. Board configs would just need to
enable MTD related configs.

--
Regards
Vignesh