Skip to content

dm: Generic MTD Subsystem/SPI-NOR

Jagan Teki u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v9 Latest21 patches 0 repliesNew

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21dm: mtd: Add dm mtd core opsdrivers/mtd/mtd-uclass.c include/mtd.h+126 -01 reply
2/21mtd: Add SPI-NOR core supportMakefile drivers/mtd/spi-nor/Makefile drivers/mtd/spi-nor/spi-nor-ids.c +3 more+1046 -01 reply
3/21mtd: spi-nor: Kconfig: Add MTD_SPI_NOR entrydrivers/mtd/Kconfig drivers/mtd/spi-nor/Kconfig+16 -01 reply
4/21mtd: spi-nor: Kconfig: Add MTD_SPI_NOR_USE_4K_SECTORSdrivers/mtd/spi-nor/Kconfig+18 -01 reply
5/21mtd: spi-nor: Kconfig: Add SPI_NOR_MISC entrydrivers/mtd/spi-nor/Kconfig+6 -01 reply
6/21mtd: spi-nor: Kconfig: Add SPI_NOR_MACRONIX entrydrivers/mtd/spi-nor/Kconfig+5 -01 reply
7/21mtd: spi-nor: Kconfig: Add SPI_NOR_SPANSION entrydrivers/mtd/spi-nor/Kconfig+5 -01 reply
8/21mtd: spi-nor: Kconfig: Add SPI_NOR_STMICRO entrydrivers/mtd/spi-nor/Kconfig+5 -01 reply
9/21mtd: spi-nor: Kconfig: Add SPI_NOR_SST entrydrivers/mtd/spi-nor/Kconfig+5 -01 reply
10/21mtd: spi-nor: Kconfig: Add SPI_NOR_WINBOND entrydrivers/mtd/spi-nor/Kconfig+5 -01 reply
11/21spi: Add spi_write_then_readdrivers/spi/spi-uclass.c include/spi.h+44 -01 reply
12/21mtd: spi-nor: Add m25p80 driverdrivers/mtd/spi-nor/Makefile drivers/mtd/spi-nor/m25p80.c+220 -01 reply
13/21mtd: spi-nor: Kconfig: Add MTD_M25P80 entrydrivers/mtd/spi-nor/Kconfig+17 -01 reply
14/21mtd: spi-nor: Add zynq qspinor driverdrivers/mtd/spi-nor/Makefile drivers/mtd/spi-nor/zynq_qspinor.c+644 -00 replies
15/21mtd: spi-nor: zynq_qspi: Kconfig: Add MTD_ZYNQdrivers/mtd/spi-nor/Kconfig+9 -00 replies
16/21mtd: spi-nor: Add 4-byte addresswidth supportdrivers/mtd/spi-nor/m25p80.c drivers/mtd/spi-nor/spi-nor.c include/linux/mtd/spi-nor.h+42 -10 replies
17/21dm: mtd: Add uclass_driver.flagsdrivers/mtd/mtd-uclass.c+1 -01 reply
18/21dm: mtd: Add post_binddrivers/mtd/mtd-uclass.c+3 -01 reply
19/21cmd: Add mtd command supportcmd/Kconfig cmd/Makefile cmd/mtd.c +3 more+319 -11 reply
20/21arm: dts: zynq: Add zynq-qspinor nodearch/arm/dts/zynq-7000.dtsi+12 -00 replies
21/21dm: zynq: microzed: Enable MTD/SPI-NORarch/arm/dts/zynq-microzed.dts configs/zynq_microzed_defconfig+15 -50 replies

Reviews trailers per patch

14 of 21 patches have a Reviewed-by or Acked-by.

PatchSimon Glass
1/21R-b
2/21
3/21R-b
4/21R-b
5/21R-b
6/21R-b
7/21R-b
8/21R-b
9/21R-b
10/21R-b
11/21R-b
12/21
13/21R-b
14/21
15/21
16/21
17/21R-b
18/21R-b
19/21R-b
20/21
21/21

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

Read the v9 thread

Cover letter [U-Boot] [PATCH v9 00/21] dm: Generic MTD Subsystem/SPI-NOR

The previous series [1] [2] are added SPI-NOR on top of mtd/spi where it bypassing DM_SPI_FLASH and use the existing mtd core (which is non-dm), I feel this is moving in a reverse direction where adding new feature with the help of non-dm mtd core support and also few of the spi drivers are not fully dm-driven.

Previous design series[3]: keep the mtd/spi as it is and start adding spi-nor features separately. The idea here is to add the dm features to MTD first and then add UCLASS_MTD spi-nor drivers so-that the commands are interfacing to spi-nor through dm-driven MTD core to spi-nor.

This series adding a new command 'mtd.c' which is common for all MTD devices SPI-NOR, SPI-NOR(master) and Parallel NOR with dm-driven.

SPI-NOR and Parallel NOR:
------------------------

------------------------------------
mtd.c
------------------------------------
mtd-uclass
------------------------------------
SPI-NOR Core CFI FLASH
------------------------------------
m25p80.c zynq_qspi
-----------------------------------
spi-uclass SPI NOR chip
-----------------------------------
spi drivers
-----------------------------------
SPI NOR chip
-----------------------------------

drivers/mtd/spi-nor/

- Add dm mtd operations
- spi-nor.c: Add basic SPI-NOR core like erase/read/write ops and lock's will add later
- m25p80.c: spi-nor to spi divers interface layer drivers/spi-nor
- zynq_qspi.c: zynq qspi spi-nor controller driver.

Current Status:
--------------
- SPI-NOR Controller design flow working, see Log

TODO:
----
- SPI-NOR with SPI bus
- Parallel NOR.

Log:
----
Zynq> mtd
mtd - MTD Sub-system

Usage:

mtd list                        - show list of MTD devices
mtd info                        - show current MTD device info
mtd probe devnum                - probe the 'devnum' MTD device
mtd erase offset len            - erase 'len' bytes from 'offset'
mtd write addr to len           - write 'len' bytes to 'to' from 'addr'
mtd read addr from len          - read 'len' bytes from 'from' to 'addr'

Zynq> mtd list
MTD 1: spi-nor at e000d000
Zynq>
MTD 1: spi-nor at e000d000
Zynq> mtd list
MTD 1: spi-nor at e000d000
Zynq> mtd probe 0
failing to set MTD device 0
Zynq> mtd probe 1
SPI-NOR: detected s25fl128s_64k with page size 256 Bytes, erase size 64 KiB, total 16 MiB Zynq> mtd info
MTD Device 1: s25fl128s_64k

 Page size:     256 B
 Erase size:    64 KiB
 Size:          16 MiB

Zynq> mtd list
MTD 1: spi-nor at e000d000 (active 1)
Zynq> mtd erase 0xE00000 0x100000
MTD: 1048576 bytes @ 0xe00000 Erased: OK
Zynq> mw.b 0x100 0xaa 0x100000
Zynq> mtd write 0x100 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
MTD: 1048576 bytes @ 0xe00000 Written: OK
Zynq> mtd read 0x3000000 0xE00000 0x100000
device 0 offset 0xe00000, size 0x100000
MTD: 1048576 bytes @ 0xe00000 Read: OK
Zynq> cmp.b 0x3000000 0x100 0x100000
Total of 1048576 byte(s) were the same

Testing:
-------

$ git clone git://git.denx.de/u-boot-spi.git
$ cd u-boot-spi
$ git checkout -b mtd origin/mtd-working

[1] http://lists.denx.de/pipermail/u-boot/2016-March/249286.html
[2] http://lists.denx.de/pipermail/u-boot/2016-February/245418.html
[3] [PATCH RFC v8 00/16] SPI-NOR/MTD addition

Jagan Teki (21):
dm: mtd: Add dm mtd core ops
mtd: Add SPI-NOR core support
mtd: spi-nor: Kconfig: Add MTD_SPI_NOR entry
mtd: spi-nor: Kconfig: Add MTD_SPI_NOR_USE_4K_SECTORS
mtd: spi-nor: Kconfig: Add SPI_NOR_MISC entry
mtd: spi-nor: Kconfig: Add SPI_NOR_MACRONIX entry
mtd: spi-nor: Kconfig: Add SPI_NOR_SPANSION entry
mtd: spi-nor: Kconfig: Add SPI_NOR_STMICRO entry
mtd: spi-nor: Kconfig: Add SPI_NOR_SST entry
mtd: spi-nor: Kconfig: Add SPI_NOR_WINBOND entry
spi: Add spi_write_then_read
mtd: spi-nor: Add m25p80 driver
mtd: spi-nor: Kconfig: Add MTD_M25P80 entry
mtd: spi-nor: Add zynq qspinor driver
mtd: spi-nor: zynq_qspi: Kconfig: Add MTD_ZYNQ
mtd: spi-nor: Add 4-byte addresswidth support
dm: mtd: Add uclass_driver.flags
dm: mtd: Add post_bind
cmd: Add mtd command support
arm: dts: zynq: Add zynq-qspinor node
dm: zynq: microzed: Enable MTD/SPI-NOR

 Makefile                           |   1 +
 arch/arm/dts/zynq-7000.dtsi        |  12 +
 arch/arm/dts/zynq-microzed.dts     |   6 +
 cmd/Kconfig                        |   6 +
 cmd/Makefile                       |   1 +
 cmd/mtd.c                          | 285 ++++++++++++++++
 configs/zynq_microzed_defconfig    |  14 +-
 drivers/mtd/Kconfig                |   2 +
 drivers/mtd/Makefile               |   2 +-
 drivers/mtd/mtd-uclass.c           |  93 +++++
 drivers/mtd/spi-nor/Kconfig        |  89 +++++
 drivers/mtd/spi-nor/Makefile       |  15 +
 drivers/mtd/spi-nor/m25p80.c       | 218 ++++++++++++
 drivers/mtd/spi-nor/spi-nor-ids.c  | 176 ++++++++++
 drivers/mtd/spi-nor/spi-nor.c      | 684 +++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi-nor/zynq_qspinor.c | 641 ++++++++++++++++++++++++++++++++++
 drivers/spi/spi-uclass.c           |  24 ++
 include/linux/err.h                |   5 +
 include/linux/mtd/spi-nor.h        | 211 ++++++++++++
 include/mtd.h                      |  63 ++++
 include/spi.h                      |  20 ++
 21 files changed, 2562 insertions(+), 6 deletions(-)
 create mode 100644 cmd/mtd.c
 create mode 100644 drivers/mtd/spi-nor/Kconfig
 create mode 100644 drivers/mtd/spi-nor/Makefile
 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.c
 create mode 100644 drivers/mtd/spi-nor/zynq_qspinor.c
 create mode 100644 include/linux/mtd/spi-nor.h
Signature · 1 line
2.7.4