[PATCH v5 0/9] Implement setup_interface() in the DaVinci NAND controller

Bastien Curutchet posted 9 patches 1 year ago
drivers/memory/ti-aemif.c           | 191 +++++++++++++++++-----------
drivers/mtd/nand/raw/Kconfig        |   4 +-
drivers/mtd/nand/raw/davinci_nand.c |  86 +++++++++++++
include/linux/memory/ti-aemif.h     |  32 +++++
4 files changed, 235 insertions(+), 78 deletions(-)
create mode 100644 include/linux/memory/ti-aemif.h
[PATCH v5 0/9] Implement setup_interface() in the DaVinci NAND controller
Posted by Bastien Curutchet 1 year ago
Hi all,

This patch series aims to implement the setup_interface() operation in
the DaVinci NAND controller to enable the use of all ONFI modes and
improve the NAND access speed.

PATCH 6 depends on PATCH 1-2-3-4-5
PATCH 9 depends on PATCH 6-8

This NAND controller is present in the DaVinci (OMAP L138) and Keystone2
SoCs and functions as a 'child' of the AEMIF controller. So its timings
are set by the AEMIF controller itself from device-tree properties.
Implementing the setup_interface() callback implies being able to update
dynamically these timings, so the first six patches of the series modify
the AEMIF driver to provide its 'children' a way to modify their chip
select timing configuration.

The remaining patches implement the setup_interface() operation.
The computation of the register's contents is directly based on
§20.3.2.3 of the OMAP-L138 TRM [1]

This has been tested on two platforms based upon the DaVinci SoC. One is
interfaced with a Macronix MX30UF4G18AC NAND, the other with a Toshiba
NAND.

[1] : https://www.ti.com/lit/ug/spruh77c/spruh77c.pdf

Change log:
 * v5:
   Rebase on v6.13-rc1
   PATCH 1:
     - Move the struct aemif_cs_data's comment modification to PATCH 3
   PATCH 3:
     - Fix commit log's typo
   PATCH 4:
     - Add '()' in comment to fit kernel doc format
     - Change aemif_calc_rate() return type to u32
     - Add details in commit log and fix typo
   PATCH 5:
     - Add '()' in comment to fit kernel doc format
   PATCH 6:
     - Use EXPORT_SYMBOL_GPL instead of EXPORT_SYMBOL
     - Use longer header guard
   PATCH 8 removed (already done on v6.13-rc1)
 * v4
   PATCH 1,2,3 [new]:
     - Create the struct aemif_cs_timings inside the already existing
       struct aemif_cs_data
 * v3
   PATCH 1 [new]:
     - Wrap the verification of CS timing configuration into a function
   PATCH 2:
     - Fix comments
   PATCH 3:
     - Replace the spin-lock with a mutex
   PATCH 7:
     - Add handling of the NAND_DATA_IFACE_CHECK_ONLY case
     - setup_interface() returns errno on failures

 * v2
   Cover letter :
     - Add dependency details
     - Remove the question about ti-aemif.h location
   PATCH 1 :
     - Fix aemif_cs_timings's description in the comments
   PATCH 2 :
     - Fix typo in the config_cs_lock's description in the comments
     - Move include/memory/ti-aemif.h to include/linux/memory/ti-aemif.h
   PATCH 3 [NEW] :
     - Fix dependency issue with aemif controller in Kconfig
   PATCH 5 :
     - Add details about the clock bindings in the commit log
     - Replace devm_clk_get() with devm_clk_get_enabled()
     - Use dev_err_probe() to return the devm_clk_get_enabled() error

[v1] : https://lore.kernel.org/all/20241030104717.88688-1-bastien.curutchet@bootlin.com/
[v2] : https://lore.kernel.org/all/20241106085507.76425-1-bastien.curutchet@bootlin.com/
[v3] : https://lore.kernel.org/all/20241113094938.44817-1-bastien.curutchet@bootlin.com/
[v4] : https://lore.kernel.org/all/20241115132631.264609-1-bastien.curutchet@bootlin.com/

Bastien Curutchet (9):
  memory: ti-aemif: Store timings parameter in number of cycles - 1
  memory: ti-aemif: Remove unnecessary local variables
  memory: ti-aemif: Wrap CS timings into a struct
  memory: ti-aemif: Create aemif_check_cs_timings()
  memory: ti-aemif: Create aemif_set_cs_timings()
  memory: ti-aemif: Export aemif_*_cs_timings()
  mtd: rawnand: davinci: Always depends on TI_AEMIF
  mtd: rawnand: davinci: Add clock resource
  mtd: rawnand: davinci: Implement setup_interface() operation

 drivers/memory/ti-aemif.c           | 191 +++++++++++++++++-----------
 drivers/mtd/nand/raw/Kconfig        |   4 +-
 drivers/mtd/nand/raw/davinci_nand.c |  86 +++++++++++++
 include/linux/memory/ti-aemif.h     |  32 +++++
 4 files changed, 235 insertions(+), 78 deletions(-)
 create mode 100644 include/linux/memory/ti-aemif.h

-- 
2.47.0

Re: (subset) [PATCH v5 0/9] Implement setup_interface() in the DaVinci NAND controller
Posted by Krzysztof Kozlowski 1 year ago
On Wed, 04 Dec 2024 10:43:10 +0100, Bastien Curutchet wrote:
> This patch series aims to implement the setup_interface() operation in
> the DaVinci NAND controller to enable the use of all ONFI modes and
> improve the NAND access speed.
> 
> PATCH 6 depends on PATCH 1-2-3-4-5
> PATCH 9 depends on PATCH 6-8
> 
> [...]

Applied, thanks!

[1/9] memory: ti-aemif: Store timings parameter in number of cycles - 1
      https://git.kernel.org/krzk/linux-mem-ctrl/c/1ec0fa90070c9468d22b3c3ea5f4bd6c27810907
[2/9] memory: ti-aemif: Remove unnecessary local variables
      https://git.kernel.org/krzk/linux-mem-ctrl/c/b3d57e179607106d5b08a635c49b338c409357d4
[3/9] memory: ti-aemif: Wrap CS timings into a struct
      https://git.kernel.org/krzk/linux-mem-ctrl/c/30b4da67655469bf8d4b8ba7c001096a1e10c7bf
[4/9] memory: ti-aemif: Create aemif_check_cs_timings()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/2c7b585d19cc1a7185a3a0b58cb643d28fd19cc1
[5/9] memory: ti-aemif: Create aemif_set_cs_timings()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/a6d60e3376065752137ec23d103f7d039c363e41
[6/9] memory: ti-aemif: Export aemif_*_cs_timings()
      https://git.kernel.org/krzk/linux-mem-ctrl/c/df8e78607d4795806b59564ba7a3e2e125d119fc


I'll wait till it hit next and got build reports and provide these as stable
tag/branch.


Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Re: (subset) [PATCH v5 0/9] Implement setup_interface() in the DaVinci NAND controller
Posted by Miquel Raynal 1 year ago
Hello,

> I'll wait till it hit next and got build reports and provide these as stable
> tag/branch.

Perfect.

Thanks,
Miquèl