[U-Boot] [PATCH v3 13/28] mtd: ensure MTD is compiled when ENV_IS_IN_FLASH is selected

Vignesh R
2018-12-09T08:41:55Z

On 06/12/18 9:49 PM, Simon Goldschmidt wrote:
> Am 06.12.2018 um 16:59 schrieb Tom Rini:
>> On Thu, Dec 06, 2018 at 04:23:00PM +0100, Miquel Raynal wrote:
>>> Hi Wolfgang,
>>>
>>> Wolfgang Denk <wd@denx.de> wrote on Thu, 06 Dec 2018 10:32:14 +0100:
>>>
[...]
>>>>>> Please understand that there is a fundamental difference between
>>>>>> parallel NOR flash and things like NAND, SPI NOR etc. - the latter
>>>>>> are storage devices, which are usually handled as block device or
>>>>>> similar, i. e. you always need a driver to read data.  Parallel NOR
>>>>>> is not storage, it is _memory_, which is directly mapped int o
>>>>>> memory. You can execute code from it.
>>>>>
>>>>> That's only partially true. Yes, you can read from a parallel NORs
>>>>> like
>>>>> if it was memory because memory controllers embedded in SoCs provide
>>>>> your a direct mmio mapping. That's not true for write accesses,
>>>>
>>>> Right, but especially in the SPL read access is sufficient.
>>>
>>> 100% agreed, the SPL just needs read access. But we are talking about
>>> U-Boot itself here.
>>
>> So, new but related question.  Are we dropping the write path in the
>> case of SPL?  The only case I can think of where SPL might be doing an
>> MTD write would be bootcount stored in env, so we should be able to drop
>> those paths in the normal case.
>
> Based on my tests with Vignesh's series to port SF to MTD, I don't think
> we drop the write part in SPL. I also brought that up in that thread.
>
> However, my (preliminary) test results of his work showed that SPL size
> is actually reduced when using his new 'spi-nor-tiny' code. And that's
> without trying to reduce MTD code size.
>

To add, 'spi-nor-tiny' has only read path (write/erase returns
-ENOTSUPP). There is an option to either use full stack(read+write+erase
support) in SPL or use spi-nor-tiny. Boards with SPL size constraints
can use spi-nor-tiny to reduces overall code size.

--
Regards
Vignesh