mbox series

[v4,0/5] spi: add support for Mediatek SPI-NAND controller

Message ID 20220407150652.21885-1-gch981213@gmail.com
Headers show
Series spi: add support for Mediatek SPI-NAND controller | expand

Message

Chuanhong Guo April 7, 2022, 3:06 p.m. UTC
Mediatek has an extended version of their NAND Flash Interface which
has a SPI-NAND mode. In this mode, the controller can perform 1-bit
spi-mem ops for up-to 0xa0 bytes and typical SPI-NAND single, dual
and quad IO page cache ops with 2-byte address. Additionally, the
page cache ops can be performed with ECC and auto data formatting
using the ECC engine of the controller.

This patchset implements support of this mode as a separated SPI-MEM
driver with piplined ECC engine.

Changes since v1:
 add a blank line between properties in dt binding doc
 rename ecc-engine to nand-ecc-engine for the generic properties
 fix warnings/errors from the CI

Changes since v2:
 use streamed DMA api to avoid an extra memory copy during read
 make ECC engine config a per-nand context
 take user-requested ECC strength into account

Change since v3:
 fix a missed ecc-engine rename in doc from v1

Chuanhong Guo (5):
  mtd: nand: make mtk_ecc.c a separated module
  spi: add driver for MTK SPI NAND Flash Interface
  mtd: nand: mtk-ecc: also parse nand-ecc-engine if available
  dt-bindings: spi: add binding doc for spi-mtk-snfi
  arm64: dts: mediatek: add mtk-snfi for mt7622

 .../bindings/spi/mediatek,spi-mtk-snfi.yaml   |   88 +
 arch/arm64/boot/dts/mediatek/mt7622.dtsi      |   12 +
 drivers/mtd/nand/Kconfig                      |    7 +
 drivers/mtd/nand/Makefile                     |    1 +
 drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} |    8 +-
 drivers/mtd/nand/raw/Kconfig                  |    1 +
 drivers/mtd/nand/raw/Makefile                 |    2 +-
 drivers/mtd/nand/raw/mtk_nand.c               |    2 +-
 drivers/spi/Kconfig                           |   10 +
 drivers/spi/Makefile                          |    1 +
 drivers/spi/spi-mtk-snfi.c                    | 1442 +++++++++++++++++
 .../linux/mtd/nand-ecc-mtk.h                  |    0
 12 files changed, 1569 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/mediatek,spi-mtk-snfi.yaml
 rename drivers/mtd/nand/{raw/mtk_ecc.c => ecc-mtk.c} (98%)
 create mode 100644 drivers/spi/spi-mtk-snfi.c
 rename drivers/mtd/nand/raw/mtk_ecc.h => include/linux/mtd/nand-ecc-mtk.h (100%)

Comments

Krzysztof Kozlowski April 7, 2022, 3:21 p.m. UTC | #1
On 07/04/2022 17:06, Chuanhong Guo wrote:
> Add device-tree binding documentation for Mediatek SPI-NAND Flash
> Interface.
> 
> Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
> ---
> 

Looks good. The subject should be rather "spi: dt-bindings:" (as
requirement for SPI subsystem).

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof
Miquel Raynal April 8, 2022, 6:32 a.m. UTC | #2
Hi Chuanhong,

gch981213@gmail.com wrote on Thu,  7 Apr 2022 23:06:48 +0800:

> this code will be used in mediatek snfi spi-mem controller with
> pipelined ECC engine.
> 
> Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
> ---
> 
> Change since v1:
>   actually make it a module instead of a part of nandcore.o
>     (ECC_MXIC probablly needs a similar fix.)

Please do not hesitate to propose something about it.

Otherwise on the MTD side the series looks good (besides the two
comments you already received).

I don't know if something changed regarding the comments style in the
spi subsystem, but using // everywhere looks strange, it's usually
reserved for the SPDX tag, but I'll let Mark comment on it.

Otherwise, MTD patches 1 and 3 look fine.

Thanks,
Miquèl
Mark Brown April 8, 2022, 12:27 p.m. UTC | #3
On Fri, Apr 08, 2022 at 08:32:14AM +0200, Miquel Raynal wrote:

> Otherwise on the MTD side the series looks good (besides the two
> comments you already received).

What's the plan for merging then?

> I don't know if something changed regarding the comments style in the
> spi subsystem, but using // everywhere looks strange, it's usually
> reserved for the SPDX tag, but I'll let Mark comment on it.

I generally request that, it looks messy if the comment block at the top
mixes styles.
Chuanhong Guo April 9, 2022, 11:08 a.m. UTC | #4
Hi Mark!

On Fri, Apr 8, 2022 at 8:28 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Fri, Apr 08, 2022 at 08:32:14AM +0200, Miquel Raynal wrote:
>
> > Otherwise on the MTD side the series looks good (besides the two
> > comments you already received).
>
> What's the plan for merging then?

I just tested this driver on a different chip and found out it's buggy
there. I'm still debugging.
Please wait for v5 of this series. Sorry.
Miquel Raynal April 11, 2022, 7:17 a.m. UTC | #5
Hi Mark,

gch981213@gmail.com wrote on Sat, 9 Apr 2022 19:08:57 +0800:

> Hi Mark!
> 
> On Fri, Apr 8, 2022 at 8:28 PM Mark Brown <broonie@kernel.org> wrote:
> >
> > On Fri, Apr 08, 2022 at 08:32:14AM +0200, Miquel Raynal wrote:
> >  
> > > Otherwise on the MTD side the series looks good (besides the two
> > > comments you already received).  
> >
> > What's the plan for merging then?  
> 
> I just tested this driver on a different chip and found out it's buggy
> there. I'm still debugging.
> Please wait for v5 of this series. Sorry.

We need to merge this series in an immutable branch. Perhaps as the big
"part" is the SPI controller driver, it should preferably go through
spi, but I'm fine either ways, let me know what you prefer.

Thanks,
Miquèl