[U-Boot] [RFC PATCH v2 00/11] SF: Migrate to Linux SPI NOR framework

Vignesh R vigneshr at ti.com
Tue Dec 4 12:26:48 UTC 2018


U-Boot SPI NOR support (sf layer) is quite outdated as it does not
support 4 byte addressing opcodes, SFDP table parsing and different types of
quad mode enable sequences. Many newer flashes no longer support BANK
registers used 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 isn't 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 easier.

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. Complete series
with dependencies here[1]

For clean build on some platforms, depends on CONFIG_SPI_FLASH migration
to defconfigs [2]

[1] https://github.com/r-vignesh/u-boot.git  branch: spi-nor-mig-v2
[2] https://patchwork.ozlabs.org/patch/1007485/

Change log:
v2:
Add lightweight SPI flash stack for boards with SPL size constraints
Provide non DM version of spi-mem
Fix build issues on different platforms as reported by travis-ci on v1

v1: https://patchwork.ozlabs.org/cover/1004689/

Vignesh R (11):
  spi: spi-mem: Allow use of spi_mem_exec_op for all SPI modes
  spi-mem: Claim SPI bus before spi mem access
  spi: Add non DM version of SPI_MEM
  sh: bitops: add hweight*() macros
  mtd: spi: Port SPI NOR framework from Linux
  mtd spi: Switch to new SPI NOR framework
  mtd: spi: Remove unused files
  mtd: spi: Add lightweight SPI flash stack for SPL
  sf_mtd: Simply mtd operations
  taurus_defconfig: Enable simple malloc in SPL
  axm_defconfig: Enable simple malloc in SPL

 arch/sh/include/asm/bitops.h    |    4 +
 common/spl/Kconfig              |   16 +
 configs/axm_defconfig           |    1 +
 configs/taurus_defconfig        |    1 +
 drivers/mtd/spi/Kconfig         |    8 +
 drivers/mtd/spi/Makefile        |   10 +-
 drivers/mtd/spi/sandbox.c       |   36 +-
 drivers/mtd/spi/sf_dataflash.c  |   11 +-
 drivers/mtd/spi/sf_internal.h   |  230 +---
 drivers/mtd/spi/sf_mtd.c        |   39 +-
 drivers/mtd/spi/sf_probe.c      |   35 +-
 drivers/mtd/spi/spi-nor-ids.c   |  294 ++++
 drivers/mtd/spi/spi-nor-tiny.c  |  806 +++++++++++
 drivers/mtd/spi/spi-nor.c       | 2300 +++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c     | 1337 ------------------
 drivers/mtd/spi/spi_flash_ids.c |  211 ---
 drivers/spi/Kconfig             |    4 +-
 drivers/spi/Makefile            |    1 +
 drivers/spi/spi-mem-nodm.c      |   89 ++
 drivers/spi/spi-mem.c           |   15 +-
 drivers/spi/stm32_qspi.c        |    4 +-
 include/linux/mtd/cfi.h         |   32 +
 include/linux/mtd/spi-nor.h     |  421 ++++++
 include/spi_flash.h             |  105 +-
 24 files changed, 4116 insertions(+), 1894 deletions(-)
 create mode 100644 drivers/mtd/spi/spi-nor-ids.c
 create mode 100644 drivers/mtd/spi/spi-nor-tiny.c
 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 drivers/spi/spi-mem-nodm.c
 create mode 100644 include/linux/mtd/cfi.h
 create mode 100644 include/linux/mtd/spi-nor.h

-- 
2.19.2



More information about the U-Boot mailing list