
On Fri, Apr 5, 2019 at 2:24 PM Rajat Srivastava rajat.srivastava@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@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:
- write_enable //issue write enable command
- execute_write_operation //write data to flash or register
- spi_nor_wait_till_ready //read status of flash
The current framework has two types of write operation:
- write to register (nor->write_reg)
- 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).