
Compared to previous patch series this series adds spi-nor core with spi-nor controller drivers are of "mtd uclass"
Why this framework:
Some of the SPI device drivers at drivers/spi not a real spi controllers, Unlike normal/generic SPI controllers they operates only with SPI-NOR flash devices. these were technically termed as SPI-NOR controllers, Ex: drivers/spi/fsl_qspi.c
The problem with these were resides at drivers/spi is entire SPI layer becomes SPI-NOR flash oriented which is absolutely a wrong indication where SPI layer getting effected more with flash operations - So this SPI-NOR core will resolve this issue by separating all SPI-NOR flash operations from spi layer and creats a generic layer called SPI-NOR core which can be used to interact SPI-NOR to SPI driver interface layer and the SPI-NOR controller driver. The idea is taken from Linux spi-nor framework.
Before SPI-NOR:
----------------------- cmd/sf.c ----------------------- spi_flash.c ----------------------- sf_probe.c ----------------------- spi-uclass ----------------------- spi drivers ----------------------- SPI NOR chip -----------------------
After SPI-NOR:
------------------------------ cmd/sf.c ------------------------------ spi-nor.c ------------------------------- m25p80.c spi nor drivers ------------------------------- spi-uclass SPI NOR chip ------------------------------- spi drivers ------------------------------- SPI NOR chip -------------------------------
SPI-NOR with MTD:
------------------------------ cmd/sf.c ------------------------------ MTD core ------------------------------ spi-nor.c ------------------------------- m25p80.c spi nor drivers ------------------------------- spi-uclass SPI NOR chip ------------------------------- spi drivers ------------------------------- SPI NOR chip -------------------------------
drivers/mtd/spi-nor/spi-nor.c: spi-nor core drivers/mtd/spi-nor/m25p80.c: mtd uclass driver which is an interface layer b/w spi-nor core drivers/spi drivers/mtd/spi-nor/fsl_qspi.c: spi-nor controller driver(mtd uclass)
Changes for v5: - newly designed changes
Testing: $ git clone git://git.denx.de/u-boot-spi.git $ cd u-boot-spi $ git checkout -b spi-nor origin/spi-nor
Jagan Teki (32): mtd: Add m25p80 driver mtd: Add Kconfig entry for MTD_M25P80 mtd: Add SPI-NOR core support doc: device-tree-bindings: jedec,spi-nor mtd: spi-nor: Add Kconfig entry for MTD_SPI_NOR mtd: spi-nor: Add kconfig for MTD_SPI_NOR_USE_4K_SECTORS mtd: spi-nor: Add MTD support mtd: spi-nor: Add spi_nor support in m25p80 mtd: spi-nor: Add dm spi-nor probing mtd: spi-nor: Add spi_flash_probe for mtd-dm-spi-nor cmd: sf: Add mtd_info for mtd-dm-spi-nor code mtd: spi-nor: m25p80: Add spi_nor support for non-dm spi_flash: Use mtd_info operation for non-dm mtd: spi-nor: Move spi_read_then_write to spi layer spi: Rename spi_read_then_write to spi_write_then_read spi: Drop mode_rx spi: Drop SPI_RX_FAST mtd: spi-nor: Rename SPI_FLASH_BAR to SPI_NOR_BAR mtd: spi-nor: Add Kconfig entry for SPI_NOR_BAR mtd: spi-nor: Copy spl files from drivers/mtd/spi mtd: spi-nor: spl: Follow ascending order of include headers mtd: spi-nor: fsl_espi_spl: Use mtd_info mtd: spi-nor: spi_spl_load: Use mtd_info mtd: spi-nor: Add flash vendor Kconfig entries arm: zynq: Kconfig: Select MTD uclass arm: zynq: Kconfig: Drop DM_SPI_FLASH defconfigs: zynq_microzed: Drop CONFIG_SPI_FLASH defconfig: zynq_microzed: Enable CONFIG_MTD_M25P80 defconfig: zynq_microzed: Enable CONFIG_MTD_SPI_NOR spl: Add CONFIG_SPL_SPI_NOR_SUPPORT configs: zynq: Use CONFIG_SPL_SPI_NOR_SUPPORT configs: zynq: Use CONFIG_SPL_MTD_SUPPORT
Makefile | 1 + arch/arm/Kconfig | 2 +- cmd/sf.c | 38 +- configs/zynq_microzed_defconfig | 3 +- doc/device-tree-bindings/mtd/jedec,spi-nor.txt | 78 ++ drivers/Makefile | 1 + drivers/mtd/Kconfig | 2 + drivers/mtd/spi-nor/Kconfig | 99 ++ drivers/mtd/spi-nor/Makefile | 18 + drivers/mtd/spi-nor/fsl_espi_spl.c | 90 ++ drivers/mtd/spi-nor/m25p80.c | 332 +++++++ drivers/mtd/spi-nor/spi-nor-ids.c | 276 ++++++ drivers/mtd/spi-nor/spi-nor-probe.c | 45 + drivers/mtd/spi-nor/spi-nor.c | 1141 ++++++++++++++++++++++++ drivers/mtd/spi-nor/spi_spl_load.c | 89 ++ drivers/spi/ich.c | 6 +- drivers/spi/spi-uclass.c | 35 +- drivers/spi/spi.c | 24 + drivers/spi/ti_qspi.c | 6 +- include/configs/zynq-common.h | 3 +- include/linux/err.h | 5 + include/linux/mtd/spi-nor.h | 251 ++++++ include/spi.h | 33 +- include/spi_flash.h | 79 +- 24 files changed, 2581 insertions(+), 76 deletions(-) create mode 100644 doc/device-tree-bindings/mtd/jedec,spi-nor.txt create mode 100644 drivers/mtd/spi-nor/Kconfig create mode 100644 drivers/mtd/spi-nor/Makefile create mode 100644 drivers/mtd/spi-nor/fsl_espi_spl.c create mode 100644 drivers/mtd/spi-nor/m25p80.c create mode 100644 drivers/mtd/spi-nor/spi-nor-ids.c create mode 100644 drivers/mtd/spi-nor/spi-nor-probe.c create mode 100644 drivers/mtd/spi-nor/spi-nor.c create mode 100644 drivers/mtd/spi-nor/spi_spl_load.c create mode 100644 include/linux/mtd/spi-nor.h