[PATCH 2/2] mtd: m25p80: consider max_transfer_size when reading

Michal Suchanek hramrach at gmail.com
Tue Jun 7 01:10:47 PDT 2016


On 7 June 2016 at 08:03, Heiner Kallweit <hkallweit1 at gmail.com> wrote:
> Am 07.06.2016 um 01:07 schrieb Mark Brown:
>> On Mon, Jun 06, 2016 at 08:53:10PM +0200, Heiner Kallweit wrote:
>>> Am 06.06.2016 um 19:40 schrieb Mark Brown:

>>> Well, we could reduce the max_transfer_size exposed by the driver by
>>> the max length of a m25p80 read command in general.
>>
>> No!  Apart from anything else this would be a complete and total
>> abstraction failure.  This is a driver for a SPI controller, not a
>> driver for a flash controller, which means that it should not have flash
>> specific hacks in it.
>>
>>> Then we might be too strict for other SPI devices, but this may
>>> be acceptable as the current fsl-espi driver is usable with SPI NOR
>>> devices only anyway.
>>
>> What makes you say this?  I'm guessing that the driver is just broken
>> but it would be good to understand the specifics.
>>
> See fsl_espi_rw_trans():
> In case of transfers > SPCOM_TRANLEN_MAX it loops and reads in
> SPCOM_TRANLEN_MAX chunks whilst replacing bytes 2-4 of the
> message buffer with the new start address to read from.

That's obviously bogus. Just reject anything too large and let the
upper layer deal with it.

Given m25p80 and fbtft would handle this can you use DMA to gather
buffers from multiple transfers (ie command and data) or does the
buffer have to be copied together for the transfer?

Thanks

Michal



More information about the linux-mtd mailing list