
On 28.11.2018 18:26, Vignesh R wrote:
U-Boot SPI NOR support (sf layer) is quite outdated as it does not support 4 byte addressing opcodes, SFDP table and different types of quad mode enable sequences. Many newer flashes no longer support BANK registers use by sf layer to a access >16MB space. Also, many SPI controllers have special MMIO interfaces which provide accelerated read/write access but require knowledge of flash parameters to make use of it. Recent spi-mem layer provides a way to support such flashes but sf layer isnt using that. This patch series syncs SPI NOR framework from Linux v4.19. It also adds spi-mem support on top. So, we gain 4byte addressing support and SFDP support. This makes migrating to U-Boot MTD framework very easy.
Tested with few Spansion, micron and macronix flashes with TI's dra7xx, k2g, am43xx EVMs. I dont have access to flashes from other vendors. So, I would greatly appreciate testing on other platforms.
This is a RFC, if this approach if fine with the community and get an early feedback. Based on the response, I plan to post official series with better splitting of patches, removing all dead code and fixing up any checkpatch errors.
[1] https://github.com/r-vignesh/u-boot.git branch: spi-nor-mig
Vignesh R (6): mtd: spi: Port SPI NOR framework from Linux
Patch 1/6 seems to be missing for me and in patchwork...
Regards, Simon
mtd spi: Switch to new SPI NOR framework spi: spi-mem: Enable all SPI modes porter_defconfig: Enable tiny printf da8250_am18xxevm_defconfig: Enable TINY PRINTF mtd: spi: Remove unused files
arch/sh/include/asm/bitops.h | 4 + common/spl/Kconfig | 7 + configs/da850_am18xxevm_defconfig | 1 + configs/porter_defconfig | 1 + drivers/mtd/spi/Kconfig | 8 + drivers/mtd/spi/Makefile | 4 +- drivers/mtd/spi/sandbox.c | 36 +- drivers/mtd/spi/sf_dataflash.c | 11 +- drivers/mtd/spi/sf_internal.h | 227 +-- drivers/mtd/spi/sf_probe.c | 33 +- drivers/mtd/spi/spi-nor.c | 2859 +++++++++++++++++++++++++++++ drivers/mtd/spi/spi_flash.c | 1337 -------------- drivers/mtd/spi/spi_flash_ids.c | 211 --- drivers/spi/spi-mem.c | 15 +- drivers/spi/stm32_qspi.c | 4 +- include/linux/mtd/cfi.h | 385 ++++ include/linux/mtd/mtd.h | 2 +- include/linux/mtd/spi-nor.h | 421 +++++ include/spi_flash.h | 105 +- 19 files changed, 3805 insertions(+), 1866 deletions(-) create mode 100644 drivers/mtd/spi/spi-nor.c delete mode 100644 drivers/mtd/spi/spi_flash.c delete mode 100644 drivers/mtd/spi/spi_flash_ids.c create mode 100644 include/linux/mtd/cfi.h create mode 100644 include/linux/mtd/spi-nor.h