Open rogeryou opened 2 years ago
I'm looking forward for this rework. Probably the key factor for success will be proper API interface between vendors low layer driver part and higher generic flash driver part.
@rogeryou since the flash subsystem maintainer, @nvlsianpu, seems to have no objections to the proposal as it stands, will you send a Pull Request to start work on this?
@rogeryou since the flash subsystem maintainer, @nvlsianpu, seems to have no objections to the proposal as it stands, will you send a Pull Request to start work on this?
Hi,@carlescufi I have submitted the source code,please review.
Sorry for going off-topic. What application do you use to create the diagram? @rogeryou they look great!
Sorry for going off-topic. What application do you use to create the diagram? @rogeryou they look great!
draw.io
@rogeryou do you plan to return to this?
Any updates on this? Am interested also in using NAND flash with Zephyr
+1
+1
+1
@MaureenHelm @carlescufi @nvlsianpu Hi, Because some developers are also interested in using NAND flash with Zephyr, we will submit a PR for NFTL. The PR is based on the SPI NAND driver #50690. Can we reopen that PR and discuss how to merge it?"
Because some developers are also interested in using NAND flash with Zephyr, we will submit a PR for NFTL. The PR is based on the SPI NAND driver #50690. Can we reopen that PR and discuss how to merge it?"
I see the PR is opened now, so let's continue the discussion in the PR.
As a Flash manufacturer, we hope to integrate various types of Flash drivers in Zephyr, such as SPI NOR Flash ,QSPI NOR Flash, Octal NOR Flash, SPI NAND Flash and ONFI NAND Flash.
We found that the framework of the existing Flash driver is shown in the following figure.
In the Flash folder there are various drivers, even for the same type of Flash, such as flash_stm32_qspi.c, nrf_qspi_nor.c. Each MCU manufacturer maintains a separate driver, which we think is inconvenient to maintain.
Therefore, we propose to modify the framework structure of the Flash driver. We divide the drivers of QSPI NOR Flash and OSPI NOR Flash into two layers, just like the drivers of SPI NOR Flash. The upper layer is a pure Flash driver. Each type of Flash has only one driver file. This layer has nothing to do with which MCU is used.
The lower layer is about the drivers of the Flash controllers of various MCU manufacturers. For example, the QSPI controller of ST corresponds to qspi_ll_stm32.c, the OSPI controller of ST corresponds to ospi_ll_stm32.c, and other manufacturers implement the corresponding ospi_xx. c. Each program in this layer needs to provide several APIs for the upper layer to call, such as ospi_read() and ospi_write() and so on.
We provide the following two solutions, as shown in the figure below:
We consider SPI NAND Flash and ONFI NAND Flash, and the expansion of the above picture is as follows:
We consider that there are already definitions for QSPI and OSPI modes in spi.h, and some drivers use these definitions, we provide solution 2:
At present, we have implemented the modification of the OSPI related program of solution 2, and passed the test on the STM32L562E-DK development board. A PR will be submitted later.