Skip to content

spi: spi-mem: Convert Aspeed SMC driver to spi-mem

Cédric Le Goater linux-arm-kernel linux-aspeed linux-devicetree linux-mtd linux-spi lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest11 patches 7 repliesIn review
  2. v611 patches 4 repliesSuperseded
  3. v511 patches 3 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v411 patches21 repliesSuperseded

Changes in v7 from the cover letter

- Moved removal of the old binding desccription in the binding patch

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11ARM: dts: aspeed: Adjust "reg" property of FMC/SPI controllersarch/arm/boot/dts/aspeed-g4.dtsi arch/arm/boot/dts/aspeed-g5.dtsi arch/arm/boot/dts/aspeed-g6.dtsi+8 -160 replies
2/11dt-bindings: spi: Convert the Aspeed SMC controllers device tree bindingDocumentation/devicetree/bindings/mtd/aspeed-smc.txt Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml MAINTAINERS+91 -510 replies
3/11spi: spi-mem: Convert Aspeed SMC driver to spi-memMAINTAINERS drivers/mtd/spi-nor/controllers/Kconfig drivers/mtd/spi-nor/controllers/Makefile +4 more+730 -9320 replies
4/11spi: aspeed: Add support for direct mappingdrivers/spi/spi-aspeed-smc.c+68 -00 replies
5/11spi: aspeed: Adjust direct mapping to device sizedrivers/spi/spi-aspeed-smc.c+88 -00 replies
6/11spi: aspeed: Workaround AST2500 limitationsdrivers/spi/spi-aspeed-smc.c+12 -00 replies
7/11spi: aspeed: Add support for the AST2400 SPI controllerdrivers/spi/spi-aspeed-smc.c+32 -10 replies
8/11spi: aspeed: Calibrate read timingsdrivers/spi/spi-aspeed-smc.c+281 -00 replies
9/11ARM: dts: aspeed: Enable Dual SPI RX transfersarch/arm/boot/dts/aspeed-g4.dtsi arch/arm/boot/dts/aspeed-g5.dtsi arch/arm/boot/dts/aspeed-g6.dtsi+21 -00 replies
10/11ARM: dts: aspeed-g4: Set spi-max-frequency for all flashesarch/arm/boot/dts/aspeed-g4.dtsi+4 -00 replies
11/11mtd: spi-nor: aspeed: set the decoding size to at least 2MB for AST2600drivers/spi/spi-aspeed-smc.c+13 -00 replies

Reviews trailers per patch

8 of 11 patches have a Reviewed-by or Acked-by.

PatchJoel StanleyTao RenJae Hyun YooRob Herring
1/11T-b T-b T-b
2/11T-b R-b T-b T-b R-b
3/11R-b T-b T-b T-b
4/11R-b T-b T-b T-b
5/11R-b T-b T-b T-b
6/11R-b T-b T-b T-b
7/11R-b T-b T-b T-b
8/11R-b T-b T-b T-b
9/11R-b T-b T-b T-b
10/11T-b
11/11T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v7 thread

Cover letter [PATCH v7 00/11] spi: spi-mem: Convert Aspeed SMC driver to spi-mem

Hi,

This series adds a new SPI driver using the spi-mem interface for the Aspeed static memory controllers of the AST2600, AST2500 and AST2400 SoCs.

* AST2600 Firmware SPI Memory Controller (FMC)
* AST2600 SPI Flash Controller (SPI1 and SPI2)
* AST2500 Firmware SPI Memory Controller (FMC)
* AST2500 SPI Flash Controller (SPI1 and SPI2)
* AST2400 New Static Memory Controller (also referred as FMC)
* AST2400 SPI Flash Controller (SPI)

It is based on the current OpenBMC kernel driver [1], using directly the MTD SPI-NOR interface and on a patchset [2] previously proposed adding support for the AST2600 only. This driver takes a slightly different approach to cover all 6 controllers.

It does not make use of the controller register disabling Address and Data byte lanes because is not available on the AST2400 SoC. We could introduce a specific handler for new features available on recent SoCs if needed. As there is not much difference on performance, the driver chooses the common denominator: "User mode" which has been heavily tested in [1]. "User mode" is also used as a fall back method when flash device mapping window is too small.

Problems to address with spi-mem were the configuration of the mapping windows and the calibration of the read timings. The driver handles them in the direct mapping handler when some knowledge on the size of the flash device is know. It is not perfect but not incorrect either. The algorithm is one from [1] because it doesn't require the DMA registers which are not available on all controllers.

Direct mapping for writes is not supported (yet). I have seen some corruption with writes and I preferred to use the safer and proven method of the initial driver [1]. We can improve that later.

The driver supports Quad SPI RX transfers on the AST2600 SoC but it didn't have the expected results. Therefore it is not activated yet. There are some issues on the pinctrl to investigate first.

Tested on:

* OpenPOWER Palmetto (AST2400)
* Facebook Wedge 100 BMC (AST2400) by Tao Ren <[email protected]>
* Evaluation board (AST2500)
* Inspur FP5280G2 BMC (AST2500) by John Wang <[email protected]>
* Facebook Backpack CMM BMC (AST2500) by Tao Ren <[email protected]>
* OpenPOWER Witherspoon (AST2500)
* Evaluation board (AST2600 A0 and A3)
* Rainier board (AST2600)

[1] https://github.com/openbmc/linux/blob/dev-5.15/drivers/mtd/spi-nor/controllers/aspeed-smc.c
[2] https://patchwork.ozlabs.org/project/linux-aspeed/list/?series=212394

Thanks,

C.

Changes in v7:

- Moved removal of the old binding desccription in the binding patch

Changes in v6:

- Removed tabs for aspeed,ast2600-fmc.yaml

Changes in v5:

- Rebased on 5.18-rc5
- More AST2600 tests from Jae Hyun Yoo
- Cleanups of aspeed,ast2600-fmc.yaml
- Modified aspeed_spi_send_cmd_addr() routine to return an error
- Simplified conditions in exec_op() handler when computing the controller setting
- Dropped the use of memcpy_fromio for the SFDP address space

Changes in v4:

- Rebased on 5.18
- Removal of the SPI-NOR base driver (we had enough tests)
- Fix for small size flash devices on AST2600 (Potin)

Changes in v3:

- Fixed compile warning on aspeed_spi_dirmap_read() prototype reported by kernel test robot
- Removed unnecessary entry in ast2600-fmc.yaml
- New patch from Tao to set spi-max-frequency on all FMC devices

Changes in v2:

- Fixed dt_binding_check warnings (Rob)
- New entry in MAINTAINERS
- Addressed Lukas comments regarding the SPI controller registration and device removal. Checked with driver bind/unbind
- Introduced setup and cleanup handlers and removed routine looping on the DT children properties (Pratyush)
- Clarified in commit log requirements for training.
- Removed defconfig changes of patch 1 since they were reverted in the last patch (Joel)

C?dric Le Goater (9):
ARM: dts: aspeed: Adjust "reg" property of FMC/SPI controllers
dt-bindings: spi: Convert the Aspeed SMC controllers device tree
binding
spi: spi-mem: Convert Aspeed SMC driver to spi-mem
spi: aspeed: Add support for direct mapping
spi: aspeed: Adjust direct mapping to device size
spi: aspeed: Workaround AST2500 limitations
spi: aspeed: Add support for the AST2400 SPI controller
spi: aspeed: Calibrate read timings
ARM: dts: aspeed: Enable Dual SPI RX transfers

Potin Lai (1):
mtd: spi-nor: aspeed: set the decoding size to at least 2MB for

    AST2600

Tao Ren (1):
ARM: dts: aspeed-g4: Set spi-max-frequency for all flashes

 drivers/mtd/spi-nor/controllers/aspeed-smc.c  |  921 -------------
 drivers/spi/spi-aspeed-smc.c                  | 1210 +++++++++++++++++
 .../devicetree/bindings/mtd/aspeed-smc.txt    |   51 -
 .../bindings/spi/aspeed,ast2600-fmc.yaml      |   82 ++
 MAINTAINERS                                   |   10 +
 arch/arm/boot/dts/aspeed-g4.dtsi              |   16 +-
 arch/arm/boot/dts/aspeed-g5.dtsi              |   16 +-
 arch/arm/boot/dts/aspeed-g6.dtsi              |   17 +-
 drivers/mtd/spi-nor/controllers/Kconfig       |   10 -
 drivers/mtd/spi-nor/controllers/Makefile      |    1 -
 drivers/spi/Kconfig                           |   11 +
 drivers/spi/Makefile                          |    1 +
 12 files changed, 1347 insertions(+), 999 deletions(-)
 delete mode 100644 drivers/mtd/spi-nor/controllers/aspeed-smc.c
 create mode 100644 drivers/spi/spi-aspeed-smc.c
 delete mode 100644 Documentation/devicetree/bindings/mtd/aspeed-smc.txt
 create mode 100644 Documentation/devicetree/bindings/spi/aspeed,ast2600-fmc.yaml
Signature · 1 line
2.35.1