[U-Boot] [PATCH] mtd: spi: Improve data write functionality

Jagan Teki jagan at amarulasolutions.com
Fri Apr 12 06:52:29 UTC 2019


On Fri, Apr 5, 2019 at 2:24 PM Rajat Srivastava
<rajat.srivastava at nxp.com> wrote:
>
> Incorporate write enable and status check in the write data
> function itself.
>
> Formerly, Write data function used to break the data to be
> written into smaller chunks and used to send the smaller
> chunks without write enable or status check for every iteration.
>
> Signed-off-by: Rajat Srivastava <rajat.srivastava at nxp.com>
> ---
> While writing any data to a SPI flash every write transaction
> shall be preceded by a WRITE_ENABLE command and shall be
> followed by a READ_STATUS process (to check if the flash is
> not busy).
> This sequence can be roughly represented as:
> 1. write_enable  //issue write enable command
> 2. execute_write_operation  //write data to flash or register
> 3. spi_nor_wait_till_ready  //read status of flash
>
> The current framework has two types of write operation:
> 1. write to register (nor->write_reg)
> 2. write data to flash memory (nor->write)
>
> There seems to be an issue in writing data to flash memory for which
> the framework uses spi_nor_write_data() function.
> Before every call to spi_nor_write_data() function the framework
> sends a WRITE_ENABLE command and later checks if the flash is busy.
> However, the spi_nor_write_data() function which executes the data
> write to flash, breaks the data into smaller chunks. For all of
> these small transactions there is only a single WRITE_ENABLE
> command issued and a single check made for status, which breaks
> the write operation. Only the first chunk of the whole data is
> successfully written on to the flash.

Can you point me exactly as far as I know the framework is following
as expected, the spi-nor calls (from Linux sync) are preparing the
write by claiming the bus and indeed it will call the MTD operations.
The mtd ops where you can see write_enable, transfer and
wait_till_ready (mtd->_write).


More information about the U-Boot mailing list