Skip to content

RFC SF: Migrate to Linux SPI NOR framework

Simon Goldschmidt u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 of 6 patches 0 repliesNew

2 of 6 patches are in this archive. The cover letter announces 6.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
4/6porter_defconfig: Enable tiny printf+0 -04 replies
4/6porter_defconfig: Enable tiny printf+0 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [RFC PATCH 0/6] SF: Migrate to Linux SPI NOR framework
Quoted 22 lines · Vignesh R

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.

Quoted 4 lines

[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

Quoted 32 lines

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