mbox series

[U-Boot,v2,00/20] Bring NAND support to Nintendo NES Classic

Message ID 20180222133350.8033-1-miquel.raynal@bootlin.com
Headers show
Series Bring NAND support to Nintendo NES Classic | expand

Message

Miquel Raynal Feb. 22, 2018, 1:33 p.m. UTC
Hello,

This series first adds fixes and enhancements to sunxi NAND drivers (SPL
and U-Boot). Once this is done, the SPL NAND driver is converted to use
PIO instead of DMA with the goal to support all SoCs with this IP
without the need for DMA-related code. Finally, NAND support is added to
Nintendo NES Classic through Kconfig and DT additions.

Thanks,
Miquèl


Changes since v1:
=================

All:
----
  - Enhance all commit messages.
  - Rebased on top of master branch (I should have done that earlier but
    I forgot I was on an old revision).

Fix binman_sym output check
---------------------------
  - SPL seems to be broken for a few weeks when using raw NAND, fix it
    by changing the error condition.

Fix strength
------------
  - Add comment explaining the added line and moved the line for
    clarification on why it is needed.
  - Add forgotten Boris' Suggested-by tag.

Fix second case of modulo by zero  error
----------------------------------------
  - Added a reference to the first occurence of this issue.

Allow SPL to be compiled for sun8i platforms
--------------------------------------------
  - This commit is not about compiling the SPL, but the NAND support in
    the SPL, as corrected by Maxime.

Enhancements and cleaning
-------------------------
  - Patch split into several logical chunks, as requested.
  - Removed useless udelay(1), that was added for debugging purpose.
  - Introduced the nand_exec_cmd() helper to mutualize code one step
    further.
  - Add an udelay(1) after changing the column to respect the minimum
    tCCS delay (Change Column Setup time).
  - Canceled moving to global scope the ecc_strength array.

Use PIO instead of DMA
----------------------
  - Change commit message/title.
  - Cancel removing NFC related definitions: they can be useful as the
    this IP is quite under-documented.
  - Merge nand_reset_column and nand_change_column (in another patch).
  - Moved the copy of the data after the check of the ECC status.
  - ECC chunks are read manually, return if the first chunk is empty
    only (needed for configuration research), otherwise it should not be
    treated as an error.

Add NAND node to sun8i
----------------------
  - U-Boot master branch already has this node, remove the patch.

Enable NAND on NES classic
--------------------------
  - Change the DT cells size from 2 to 1.

Add NAND support for NES classic
--------------------------------
  - Split in several patches, moving SPL_NAND_SUPPORT and NAND_SUNXI out
    of the defconfig files (NES and CHIP pro) to be automatically
    selected depending on NAND_SUNXI and ARCH_SUNXI.
  - Moved the NAND parameters to Kconfig (only for SUNXI because the
    tool did not work as expected, maybe due to some definitions that
    are not "numbers" but multiplications and sometimes use other
    definitions (NAND page size, 2K_SZ, etc).


Miquel Raynal (20):
  spl: fix binman_sym output check
  mtd: nand: sunxi: fix ECC strength choice
  spl: nand: sunxi: fix second case of modulo by zero error
  spl: nand: sunxi: fix typo on register name
  spl: nand: sunxi: introduce the nand_wait_int() helper
  spl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper
  spl: nand: sunxi: add missing status clear
  spl: nand: sunxi: create an helper to handle command execution
  spl: nand: sunxi: ensure enough time has passed after changing the
    column
  spl: nand: sunxi: make the reset column helper more generic
  sunxi: spl: deassert the NAND controller reset line
  spl: nand: sunxi: declare the ecc_bytes array globally
  spl: nand: sunxi: use PIO instead of DMA
  sunxi: spl: remove DMA related settings of the NAND controller
  sunxi: allow NAND support in SPL to be compiled for sun8i platforms
  sunxi: dts: enable NAND on NES classic
  sunxi: automatically select SPL_NAND_SUPPORT in Kconfig
  sunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig
  sunxi: move the NAND parameters to Kconfig
  configs: add NAND support for NES Classic

 arch/arm/dts/sun8i-a23-a33.dtsi                    |  18 ++
 .../dts/sun8i-r16-nintendo-nes-classic-edition.dts |  14 ++
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h      |   6 +
 board/sunxi/board.c                                |   6 +-
 common/spl/spl.c                                   |  10 +-
 configs/CHIP_pro_defconfig                         |   6 +-
 configs/Nintendo_NES_Classic_Edition_defconfig     |   4 +
 drivers/mtd/nand/Kconfig                           |  26 ++-
 drivers/mtd/nand/sunxi_nand.c                      |   8 +-
 drivers/mtd/nand/sunxi_nand_spl.c                  | 242 ++++++++++-----------
 10 files changed, 206 insertions(+), 134 deletions(-)

Comments

Boris Brezillon Feb. 22, 2018, 2:06 p.m. UTC | #1
On Thu, 22 Feb 2018 14:33:30 +0100
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hello,
> 
> This series first adds fixes and enhancements to sunxi NAND drivers (SPL
> and U-Boot). Once this is done, the SPL NAND driver is converted to use
> PIO instead of DMA with the goal to support all SoCs with this IP
> without the need for DMA-related code. Finally, NAND support is added to
> Nintendo NES Classic through Kconfig and DT additions.
> 
> Thanks,
> Miquèl
> 
> 
> Changes since v1:
> =================
> 
> All:
> ----
>   - Enhance all commit messages.
>   - Rebased on top of master branch (I should have done that earlier but
>     I forgot I was on an old revision).
> 
> Fix binman_sym output check
> ---------------------------
>   - SPL seems to be broken for a few weeks when using raw NAND, fix it
>     by changing the error condition.
> 
> Fix strength
> ------------
>   - Add comment explaining the added line and moved the line for
>     clarification on why it is needed.
>   - Add forgotten Boris' Suggested-by tag.
> 
> Fix second case of modulo by zero  error
> ----------------------------------------
>   - Added a reference to the first occurence of this issue.
> 
> Allow SPL to be compiled for sun8i platforms
> --------------------------------------------
>   - This commit is not about compiling the SPL, but the NAND support in
>     the SPL, as corrected by Maxime.
> 
> Enhancements and cleaning
> -------------------------
>   - Patch split into several logical chunks, as requested.
>   - Removed useless udelay(1), that was added for debugging purpose.
>   - Introduced the nand_exec_cmd() helper to mutualize code one step
>     further.
>   - Add an udelay(1) after changing the column to respect the minimum
>     tCCS delay (Change Column Setup time).
>   - Canceled moving to global scope the ecc_strength array.
> 
> Use PIO instead of DMA
> ----------------------
>   - Change commit message/title.
>   - Cancel removing NFC related definitions: they can be useful as the
>     this IP is quite under-documented.
>   - Merge nand_reset_column and nand_change_column (in another patch).
>   - Moved the copy of the data after the check of the ECC status.
>   - ECC chunks are read manually, return if the first chunk is empty
>     only (needed for configuration research), otherwise it should not be
>     treated as an error.
> 
> Add NAND node to sun8i
> ----------------------
>   - U-Boot master branch already has this node, remove the patch.
> 
> Enable NAND on NES classic
> --------------------------
>   - Change the DT cells size from 2 to 1.
> 
> Add NAND support for NES classic
> --------------------------------
>   - Split in several patches, moving SPL_NAND_SUPPORT and NAND_SUNXI out
>     of the defconfig files (NES and CHIP pro) to be automatically
>     selected depending on NAND_SUNXI and ARCH_SUNXI.
>   - Moved the NAND parameters to Kconfig (only for SUNXI because the
>     tool did not work as expected, maybe due to some definitions that
>     are not "numbers" but multiplications and sometimes use other
>     definitions (NAND page size, 2K_SZ, etc).
> 
> 
> Miquel Raynal (20):
>   spl: fix binman_sym output check
>   mtd: nand: sunxi: fix ECC strength choice
>   spl: nand: sunxi: fix second case of modulo by zero error
>   spl: nand: sunxi: fix typo on register name
>   spl: nand: sunxi: introduce the nand_wait_int() helper
>   spl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper
>   spl: nand: sunxi: add missing status clear
>   spl: nand: sunxi: create an helper to handle command execution
>   spl: nand: sunxi: ensure enough time has passed after changing the
>     column
>   spl: nand: sunxi: make the reset column helper more generic
>   sunxi: spl: deassert the NAND controller reset line
>   spl: nand: sunxi: declare the ecc_bytes array globally
>   spl: nand: sunxi: use PIO instead of DMA
>   sunxi: spl: remove DMA related settings of the NAND controller
>   sunxi: allow NAND support in SPL to be compiled for sun8i platforms
>   sunxi: dts: enable NAND on NES classic
>   sunxi: automatically select SPL_NAND_SUPPORT in Kconfig
>   sunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig
>   sunxi: move the NAND parameters to Kconfig
>   configs: add NAND support for NES Classic

Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>

on all NAND related patches.

> 
>  arch/arm/dts/sun8i-a23-a33.dtsi                    |  18 ++
>  .../dts/sun8i-r16-nintendo-nes-classic-edition.dts |  14 ++
>  arch/arm/include/asm/arch-sunxi/clock_sun6i.h      |   6 +
>  board/sunxi/board.c                                |   6 +-
>  common/spl/spl.c                                   |  10 +-
>  configs/CHIP_pro_defconfig                         |   6 +-
>  configs/Nintendo_NES_Classic_Edition_defconfig     |   4 +
>  drivers/mtd/nand/Kconfig                           |  26 ++-
>  drivers/mtd/nand/sunxi_nand.c                      |   8 +-
>  drivers/mtd/nand/sunxi_nand_spl.c                  | 242 ++++++++++-----------
>  10 files changed, 206 insertions(+), 134 deletions(-)
>
Boris Brezillon Feb. 22, 2018, 2:21 p.m. UTC | #2
On Thu, 22 Feb 2018 15:06:19 +0100
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> On Thu, 22 Feb 2018 14:33:30 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > Hello,
> > 
> > This series first adds fixes and enhancements to sunxi NAND drivers (SPL
> > and U-Boot). Once this is done, the SPL NAND driver is converted to use
> > PIO instead of DMA with the goal to support all SoCs with this IP
> > without the need for DMA-related code. Finally, NAND support is added to
> > Nintendo NES Classic through Kconfig and DT additions.
> > 
> > Thanks,
> > Miquèl
> > 
> > 
> > Changes since v1:
> > =================
> > 
> > All:
> > ----
> >   - Enhance all commit messages.
> >   - Rebased on top of master branch (I should have done that earlier but
> >     I forgot I was on an old revision).
> > 
> > Fix binman_sym output check
> > ---------------------------
> >   - SPL seems to be broken for a few weeks when using raw NAND, fix it
> >     by changing the error condition.
> > 
> > Fix strength
> > ------------
> >   - Add comment explaining the added line and moved the line for
> >     clarification on why it is needed.
> >   - Add forgotten Boris' Suggested-by tag.
> > 
> > Fix second case of modulo by zero  error
> > ----------------------------------------
> >   - Added a reference to the first occurence of this issue.
> > 
> > Allow SPL to be compiled for sun8i platforms
> > --------------------------------------------
> >   - This commit is not about compiling the SPL, but the NAND support in
> >     the SPL, as corrected by Maxime.
> > 
> > Enhancements and cleaning
> > -------------------------
> >   - Patch split into several logical chunks, as requested.
> >   - Removed useless udelay(1), that was added for debugging purpose.
> >   - Introduced the nand_exec_cmd() helper to mutualize code one step
> >     further.
> >   - Add an udelay(1) after changing the column to respect the minimum
> >     tCCS delay (Change Column Setup time).
> >   - Canceled moving to global scope the ecc_strength array.
> > 
> > Use PIO instead of DMA
> > ----------------------
> >   - Change commit message/title.
> >   - Cancel removing NFC related definitions: they can be useful as the
> >     this IP is quite under-documented.
> >   - Merge nand_reset_column and nand_change_column (in another patch).
> >   - Moved the copy of the data after the check of the ECC status.
> >   - ECC chunks are read manually, return if the first chunk is empty
> >     only (needed for configuration research), otherwise it should not be
> >     treated as an error.
> > 
> > Add NAND node to sun8i
> > ----------------------
> >   - U-Boot master branch already has this node, remove the patch.
> > 
> > Enable NAND on NES classic
> > --------------------------
> >   - Change the DT cells size from 2 to 1.
> > 
> > Add NAND support for NES classic
> > --------------------------------
> >   - Split in several patches, moving SPL_NAND_SUPPORT and NAND_SUNXI out
> >     of the defconfig files (NES and CHIP pro) to be automatically
> >     selected depending on NAND_SUNXI and ARCH_SUNXI.
> >   - Moved the NAND parameters to Kconfig (only for SUNXI because the
> >     tool did not work as expected, maybe due to some definitions that
> >     are not "numbers" but multiplications and sometimes use other
> >     definitions (NAND page size, 2K_SZ, etc).
> > 
> > 
> > Miquel Raynal (20):
> >   spl: fix binman_sym output check
> >   mtd: nand: sunxi: fix ECC strength choice
> >   spl: nand: sunxi: fix second case of modulo by zero error
> >   spl: nand: sunxi: fix typo on register name
> >   spl: nand: sunxi: introduce the nand_wait_int() helper
> >   spl: nand: sunxi: introduce the nand_wait_cmd_fifo_empty() helper
> >   spl: nand: sunxi: add missing status clear
> >   spl: nand: sunxi: create an helper to handle command execution
> >   spl: nand: sunxi: ensure enough time has passed after changing the
> >     column
> >   spl: nand: sunxi: make the reset column helper more generic
> >   sunxi: spl: deassert the NAND controller reset line
> >   spl: nand: sunxi: declare the ecc_bytes array globally
> >   spl: nand: sunxi: use PIO instead of DMA
> >   sunxi: spl: remove DMA related settings of the NAND controller
> >   sunxi: allow NAND support in SPL to be compiled for sun8i platforms
> >   sunxi: dts: enable NAND on NES classic
> >   sunxi: automatically select SPL_NAND_SUPPORT in Kconfig
> >   sunxi: make NAND_SUNXI use ARCH_SUNXI as default in Kconfig
> >   sunxi: move the NAND parameters to Kconfig
> >   configs: add NAND support for NES Classic  
> 
> Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
> 
> on all NAND related patches.

I've been told that my statement was a bit ambiguous since all patches
in this series are related to supporting NAND on sun8i, so I'll clarify
a bit. My ack applies to all patches containing 'nand' in their
subject :P.

> 
> > 
> >  arch/arm/dts/sun8i-a23-a33.dtsi                    |  18 ++
> >  .../dts/sun8i-r16-nintendo-nes-classic-edition.dts |  14 ++
> >  arch/arm/include/asm/arch-sunxi/clock_sun6i.h      |   6 +
> >  board/sunxi/board.c                                |   6 +-
> >  common/spl/spl.c                                   |  10 +-
> >  configs/CHIP_pro_defconfig                         |   6 +-
> >  configs/Nintendo_NES_Classic_Edition_defconfig     |   4 +
> >  drivers/mtd/nand/Kconfig                           |  26 ++-
> >  drivers/mtd/nand/sunxi_nand.c                      |   8 +-
> >  drivers/mtd/nand/sunxi_nand_spl.c                  | 242 ++++++++++-----------
> >  10 files changed, 206 insertions(+), 134 deletions(-)
> >   
> 
> 
>