Skip to content

SF: Migrate to Linux SPI NOR framework

Vignesh R u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest16 patches 0 repliesNew

Since RFC v2 from the cover letter

Fix issues reported by Simon Goldschmidt wrt 4 use of byte addressing opcode Fix issues in compiling SFDP code
Re organize file names and Makefile to simply spi-nor-tiny inclusion Remove SPI_FLASH_BAR and SF_DUAL_FLASH as these are no longer used RFC v2: https://patchwork.ozlabs.org/cover/1007589/

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/16spi: spi-mem: Allow use of spi_mem_exec_op for all SPI modesdrivers/spi/spi-mem.c+0 -90 replies
2/16spi-mem: Claim SPI bus before spi mem accessdrivers/spi/spi-mem.c+6 -00 replies
3/16spi: Add non DM version of SPI_MEMdrivers/spi/Kconfig drivers/spi/Makefile drivers/spi/spi-mem-nodm.c+92 -212 replies
3/16spi: Add non DM version of SPI_MEM+0 -01 reply
3/16spi: Add non DM version of SPI_MEM+0 -01 reply
3/16spi: Add non DM version of SPI_MEM+0 -01 reply
3/16spi: Add non DM version of SPI_MEM+0 -00 replies
4/16sh: bitops: add hweight*() macrosarch/sh/include/asm/bitops.h+4 -00 replies
5/16mtd: spi: Port SPI NOR framework from Linuxdrivers/mtd/spi/spi-nor-core.c include/linux/mtd/cfi.h include/linux/mtd/spi-nor.h+3100 -05 replies
5/16mtd: spi: Port SPI NOR framework from Linux+0 -00 replies
6/16mtd: spi: Switch to new SPI NOR frameworkcommon/spl/Kconfig drivers/mtd/spi/Kconfig drivers/mtd/spi/Makefile +7 more+137 -3700 replies
7/16mtd: spi: Remove unused filesdrivers/mtd/spi/spi_flash.c drivers/mtd/spi/spi_flash_ids.c+0 -15481 reply
7/16mtd: spi: Remove unused files+0 -00 replies
8/16mtd: spi: Add lightweight SPI flash stack for SPLcommon/spl/Kconfig drivers/mtd/spi/Makefile drivers/mtd/spi/sf_internal.h +3 more+1128 -2630 replies
9/16sf_mtd: Simply mtd operationsdrivers/mtd/spi/sf_internal.h drivers/mtd/spi/sf_mtd.c drivers/mtd/spi/sf_probe.c+24 -353 replies
9/16sf_mtd: Simply mtd operations+0 -01 reply
10/16configs: Get rid of SPI_FLASH_BARarch/arm/mach-omap2/am33xx/Kconfig configs/alt_defconfig configs/am57xx_evm_defconfig +88 more+0 -973 replies
10/16configs: Get rid of SPI_FLASH_BAR+0 -00 replies
11/16configs: Remove SF_DUAL_FLASHconfigs/topic_miamilite_defconfig configs/topic_miamiplus_defconfig configs/xilinx_zynqmp_mini_qspi_defconfig +10 more+0 -1091 reply
12/16axm_defconfig: Enable simple malloc in SPLconfigs/axm_defconfig+1 -00 replies
13/16taurus_defconfig: Enable simple malloc in SPLconfigs/taurus_defconfig+1 -00 replies
14/16da850_am18xxevm: Enable tiny printfconfigs/da850_am18xxevm_defconfig+1 -00 replies
15/16turris_omnia_defconfig: Enable tiny printfconfigs/turris_omnia_defconfig+1 -10 replies
16/16MAINTAINERS: Add an entry for SPI NORMAINTAINERS+8 -01 reply
16/16MAINTAINERS: Add an entry for SPI NOR+0 -00 replies

Reviews trailers per patch

None of the 25 patches has a Reviewed-by or Acked-by.

PatchStefan Roese
1/16
2/16
3/16
3/16
3/16
3/16
3/16
4/16
5/16
5/16
6/16
7/16
7/16
8/16
9/16T-b
9/16T-b
10/16
10/16
11/16
12/16
13/16
14/16
15/16
16/16
16/16

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [U-Boot] [PATCH 00/16] SF: Migrate to Linux SPI NOR framework

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-patch-v1
[2] https://patchwork.ozlabs.org/patch/1007485/

Patch 12-15 are compile tested.

Change log:
Since RFC v2:
Fix issues reported by Simon Goldschmidt wrt 4 use of byte addressing opcode Fix issues in compiling SFDP code
Re organize file names and Makefile to simply spi-nor-tiny inclusion Remove SPI_FLASH_BAR and SF_DUAL_FLASH as these are no longer used RFC v2: https://patchwork.ozlabs.org/cover/1007589/

Since RFC v1:
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

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

Vignesh R (16):
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
configs: Get rid of SPI_FLASH_BAR
configs: Remove SF_DUAL_FLASH
axm_defconfig: Enable simple malloc in SPL
taurus_defconfig: Enable simple malloc in SPL
da850_am18xxevm: Enable tiny printf
turris_omnia_defconfig: Enable tiny printf
MAINTAINERS: Add an entry for SPI NOR

 MAINTAINERS                                   |    8 +
 arch/arm/mach-omap2/am33xx/Kconfig            |    1 -
 arch/sh/include/asm/bitops.h                  |    4 +
 common/spl/Kconfig                            |   21 +-
 configs/alt_defconfig                         |    1 -
 configs/am57xx_evm_defconfig                  |    1 -
 configs/am57xx_hs_evm_defconfig               |    1 -
 configs/ap121_defconfig                       |    1 -
 configs/ap143_defconfig                       |    1 -
 configs/avnet_ultra96_rev1_defconfig          |    1 -
 configs/axm_defconfig                         |    1 +
 configs/axs101_defconfig                      |    1 -
 configs/axs103_defconfig                      |    1 -
 configs/bg0900_defconfig                      |    1 -
 configs/blanche_defconfig                     |    1 -
 configs/cl-som-am57x_defconfig                |    1 -
 configs/clearfog_defconfig                    |    1 -
 configs/cm_t43_defconfig                      |    1 -
 configs/da850_am18xxevm_defconfig             |    1 +
 configs/db-88f6820-amc_defconfig              |    1 -
 configs/display5_defconfig                    |    1 -
 configs/display5_factory_defconfig            |    1 -
 configs/dra7xx_evm_defconfig                  |    1 -
 configs/dra7xx_hs_evm_defconfig               |    1 -
 configs/ds109_defconfig                       |    1 -
 configs/ds414_defconfig                       |    1 -
 configs/evb-rv1108_defconfig                  |    1 -
 configs/gose_defconfig                        |    1 -
 configs/helios4_defconfig                     |    1 -
 configs/k2g_evm_defconfig                     |    1 -
 configs/k2g_hs_evm_defconfig                  |    1 -
 configs/koelsch_defconfig                     |    1 -
 configs/lager_defconfig                       |    1 -
 configs/maxbcm_defconfig                      |    1 -
 configs/mt7629_rfb_defconfig                  |    1 -
 configs/mx6sxsabreauto_defconfig              |    1 -
 configs/mx6sxsabresd_defconfig                |    1 -
 configs/mx6ul_14x14_evk_defconfig             |    1 -
 configs/mx6ul_9x9_evk_defconfig               |    1 -
 configs/mx6ull_14x14_evk_defconfig            |    1 -
 configs/mx6ull_14x14_evk_plugin_defconfig     |    1 -
 configs/mx7dsabresd_qspi_defconfig            |    1 -
 configs/porter_defconfig                      |    1 -
 configs/r8a77970_eagle_defconfig              |    1 -
 configs/silk_defconfig                        |    1 -
 configs/socfpga_arria5_defconfig              |    1 -
 configs/socfpga_cyclone5_defconfig            |    1 -
 configs/socfpga_is1_defconfig                 |    1 -
 configs/socfpga_sockit_defconfig              |    1 -
 configs/socfpga_socrates_defconfig            |    1 -
 configs/socfpga_sr1500_defconfig              |    1 -
 configs/socfpga_stratix10_defconfig           |    1 -
 configs/stout_defconfig                       |    1 -
 configs/taurus_defconfig                      |    1 +
 configs/topic_miami_defconfig                 |    1 -
 configs/topic_miamilite_defconfig             |    2 -
 configs/topic_miamiplus_defconfig             |    2 -
 configs/turris_omnia_defconfig                |    2 +-
 configs/xilinx_versal_virt_defconfig          |    1 -
 configs/xilinx_zynqmp_mini_qspi_defconfig     |    2 -
 configs/xilinx_zynqmp_zc1232_revA_defconfig   |    2 -
 configs/xilinx_zynqmp_zc1254_revA_defconfig   |    2 -
 configs/xilinx_zynqmp_zc1275_revA_defconfig   |    2 -
 configs/xilinx_zynqmp_zc1275_revB_defconfig   |    2 -
 .../xilinx_zynqmp_zc1751_xm015_dc1_defconfig  |    1 -
 .../xilinx_zynqmp_zc1751_xm016_dc2_defconfig  |    1 -
 .../xilinx_zynqmp_zc1751_xm018_dc4_defconfig  |    1 -
 configs/xilinx_zynqmp_zcu100_revC_defconfig   |    1 -
 configs/xilinx_zynqmp_zcu102_rev1_0_defconfig |    1 -
 configs/xilinx_zynqmp_zcu102_revA_defconfig   |    1 -
 configs/xilinx_zynqmp_zcu102_revB_defconfig   |    1 -
 configs/xilinx_zynqmp_zcu104_revA_defconfig   |    2 -
 configs/xilinx_zynqmp_zcu104_revC_defconfig   |    2 -
 configs/xilinx_zynqmp_zcu106_revA_defconfig   |    2 -
 configs/xilinx_zynqmp_zcu111_revA_defconfig   |    1 -
 configs/zynq_cc108_defconfig                  |    1 -
 configs/zynq_cse_qspi_defconfig               |    1 -
 configs/zynq_dlc20_rev1_0_defconfig           |    1 -
 configs/zynq_microzed_defconfig               |    1 -
 configs/zynq_minized_defconfig                |    1 -
 configs/zynq_z_turn_defconfig                 |    1 -
 configs/zynq_zc702_defconfig                  |    1 -
 configs/zynq_zc706_defconfig                  |    1 -
 configs/zynq_zc770_xm010_defconfig            |    1 -
 configs/zynq_zc770_xm013_defconfig            |    1 -
 configs/zynq_zed_defconfig                    |    1 -
 configs/zynq_zybo_defconfig                   |    1 -
 configs/zynq_zybo_z7_defconfig                |    1 -
 doc/SPI/README.dual-flash                     |   92 -
 doc/SPI/README.ti_qspi_dra_test               |    1 -
 drivers/mtd/spi/Kconfig                       |   22 +-
 drivers/mtd/spi/Makefile                      |   12 +-
 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                      |   52 +-
 drivers/mtd/spi/sf_probe.c                    |   38 +-
 drivers/mtd/spi/spi-nor-core.c                | 2334 +++++++++++++++++
 drivers/mtd/spi/spi-nor-ids.c                 |  294 +++
 drivers/mtd/spi/spi-nor-tiny.c                |  810 ++++++
 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/configs/T102xQDS.h                    |    1 -
 include/configs/T102xRDB.h                    |    1 -
 include/configs/T104xRDB.h                    |    1 -
 include/configs/T208xQDS.h                    |    1 -
 include/configs/T208xRDB.h                    |    1 -
 include/configs/gw_ventana.h                  |    1 -
 include/configs/km/kmp204x-common.h           |    1 -
 include/configs/ls1021aiot.h                  |    1 -
 include/configs/socfpga_stratix10_socdk.h     |    1 -
 include/linux/mtd/cfi.h                       |   32 +
 include/linux/mtd/spi-nor.h                   |  421 +++
 include/spi_flash.h                           |  105 +-
 119 files changed, 4179 insertions(+), 2110 deletions(-)
 delete mode 100644 doc/SPI/README.dual-flash
 create mode 100644 drivers/mtd/spi/spi-nor-core.c
 create mode 100644 drivers/mtd/spi/spi-nor-ids.c
 create mode 100644 drivers/mtd/spi/spi-nor-tiny.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
Signature · 1 line
2.19.2