mbox series

[U-Boot,v6,00/27] SPI-NAND support

Message ID 20180801081848.19398-1-miquel.raynal@bootlin.com
Headers show
Series SPI-NAND support | expand

Message

Miquel Raynal Aug. 1, 2018, 8:18 a.m. UTC
During the last months, Boris Brezillon shared his work to support
serial flashes within Linux. First, he delivered (and merged) a new
layer called spi-mem. He also initiated in Linux MTD subsystem the move
of all 'raw' NAND related code to a raw/ subdirectory, adding at the
same time a NAND core that would be shared with all NAND devices. Then,
he contributed a generic SPI-NAND driver, making use of this NAND core,
as well as some vendor code to drive a few chips.

On top of this work, I added an 'mtd' U-Boot command to handle all sort
of MTD devices. This should become the default command instead of having
one per flash flavor ('sf', 'nand', 'spi-nand' ?).

The series has been tested on an Ocelot board PCB123 (VSC7514),
featuring a Macronix SPI NAND chip.

TL;DR: the series contains:
- A few patches from Linux to resynchronize some areas of the MTD layer.
- Various fixes and re-organization of the MTD subsystem.
- The introduction of the SPI-mem interface.
- The addition of the generic SPI-NAND driver (and its bindings).
- Several SPI NAND chip drivers (Macronix, Micron, Winbond).
- A new 'mtd' command.
- Support for spi-nand devices in mtdparts.

To test your SPI-NAND device with U-Boot simply follow these lines:

> setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> setenv mtdids spi-nand0=spi-nand0
> mtdparts             # show the spi-nand device partitions
> ubi part bar         # create a static UBI volume in the bar partition

Thanks,
Miquèl

Changes since v5:
-----------------
* Included Boris fixup about the build issues.
* Added Rb/Ab tags from Jagan on patchs 20/21.

Changes since v4:
-----------------
* Added Jagan's Acked-by tags to every patch related to the
  SPI-mem/SPI-NAND addition.
* Rebased on top of master.

Changes since v3:
-----------------
* Fixed the debug messages in spi-mem to print either Rx or Tx data.
* Fixed a Kconfig error that prevented to build mtdparts with plain
  defconfig.
* Fixed a compilation error due to the above error that prevented one
  file to be compiled.
* Adapted the mtd command to probe MTD partitions also.
* Declared mtd_probe_devices() in a header so mtdparts or UBI could
  use it too (to probe all devices and MTD partitions in a clean way).
* As I worked on mtdparts, I found annoying and completely useless the
  fact that we need to prefix the environment variable with
  "mtdparts=". Canceled this obligation.
* Added one patch to allow spi-nand devices to be recognized by mtdparts
  (this is purely useless but needed to be done in order to use this
  command).
* Removed useless definitions of MTD device types in UBI code.
* Wrote a generic mtdparts environment variable parser, used by the mtd
  command.
* Used the mtd_probe_devices() function from get_mtd_info() in
  cmd/mtdparts.c to be sure the desired partition really does not exist
  (otherwise it will be probed and then found).

Changes since v2:
-----------------
* Rebased on u-boot master branch.
* Removed extra-parenthesis in
  "mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing"
* s/fiels/files/ in "mtd: move NAND fiels into a raw/ subdirectory"
* Do not describe generic SPI device properties in SPI NAND bindings.
* Changes in the mtd command:
  * Printing more information in 'mtd list' (device type, device
    characteristics)
  * Switch to do_div() instead of '(u32)value64b % value32b' which only
    worked because value32b was a power of 2.
  * Removed erase.chip option.
  * By default, erase/read/write happen on the full MTD device while a
    dump will only work on a single page.

Changes since v1:
-----------------
* Fixed the nand_memorg structure of the MX35LF2GE4AB chip.
* Added Reviewed-by tags from Jagan.
* Backported and squashed two patches fixing things in the SPI NAND core
  received on the Linux ML.
* Backported more changes in mtdcore.c from Linux.
* Added a patch to add a fallback on mtd->_read/_write() in mtdcore.c
  when mtd->_read/write_oob() is not supported.
* Removed the DT changes, useless as the DTs are not available in
  mainline yet.
* Addressed Boris/Stefan comments on the 'mtd' command.
* Added support for multi-pages OOB read/write.


Boris Brezillon (7):
  mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
  mtd: Add sanity checks in mtd_write/read_oob()
  mtd: nand: Add core infrastructure to deal with NAND devices
  mtd: nand: Pass mode information to nand_page_io_req
  spi: Extend the core to ease integration of SPI memory controllers
  mtd: spinand: Add initial support for the MX35LF1GE4AB chip
  dt-bindings: Add bindings for SPI NAND devices

Brian Norris (1):
  mtd: add get/set of_node/flash_node helpers

Ezequiel Garcia (1):
  mtd: Uninline mtd_write_oob and move it to mtdcore.c

Frieder Schrempf (1):
  mtd: spinand: Add initial support for Winbond W25M02GV

Miquel Raynal (15):
  mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing
  mtd: fix build issue with includes
  mtd: move definitions to enlarge their range
  mtd: move all flash categories inside MTD submenu
  mtd: move NAND files into a raw/ subdirectory
  mtd: rename nand into rawnand in Kconfig prompt
  mtd: spinand: Add initial support for the MX35LF2GE4AB chip
  mtd: declare MTD_PARTITIONS symbol in Kconfig
  cmd: ubi: delete useless and misleading definitions
  cmd: mtdparts: accept spi-nand devices
  cmd: mtdparts: add a generic 'mtdparts' parser
  cmd: mtdparts: remove useless 'mtdparts=' prefix
  mtd: uclass: add probe function
  cmd: mtd: add 'mtd' command
  cmd: mtdparts: try to probe the MTD devices as a fallback

Peter Pan (2):
  mtd: nand: Add core infrastructure to support SPI NANDs
  mtd: spinand: Add initial support for Micron MT29F2G01ABAGD

 MAINTAINERS                                   |    6 +-
 Makefile                                      |    2 +-
 README                                        |    6 +-
 arch/arm/mach-uniphier/board_late_init.c      |    2 +-
 cmd/Kconfig                                   |    7 +
 cmd/Makefile                                  |    1 +
 cmd/mtd.c                                     |  392 ++++++++
 cmd/mtdparts.c                                |  113 ++-
 cmd/ubi.c                                     |    5 -
 common/spl/Kconfig                            |    2 +-
 common/spl/spl_spi.c                          |    2 +-
 doc/README.SPL                                |    4 +-
 doc/README.arm-relocation                     |    2 +-
 doc/README.nand                               |    6 +-
 doc/README.zynq                               |    2 +-
 doc/device-tree-bindings/mtd/spi-nand.txt     |    5 +
 drivers/Makefile                              |    2 +-
 drivers/mtd/Kconfig                           |    7 +-
 drivers/mtd/Makefile                          |    4 +-
 drivers/mtd/mtd-uclass.c                      |    9 +
 drivers/mtd/mtdcore.c                         |  106 ++-
 drivers/mtd/mtdcore.h                         |    6 -
 drivers/mtd/mtdpart.c                         |    6 +-
 drivers/mtd/nand/Kconfig                      |  299 +-----
 drivers/mtd/nand/Makefile                     |   78 +-
 drivers/mtd/nand/bbt.c                        |  132 +++
 drivers/mtd/nand/core.c                       |  243 +++++
 drivers/mtd/nand/raw/Kconfig                  |  297 ++++++
 drivers/mtd/nand/raw/Makefile                 |   77 ++
 drivers/mtd/nand/{ => raw}/am335x_spl_bch.c   |    0
 drivers/mtd/nand/{ => raw}/arasan_nfc.c       |    0
 drivers/mtd/nand/{ => raw}/atmel_nand.c       |    0
 drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h   |    0
 drivers/mtd/nand/{ => raw}/davinci_nand.c     |    2 +-
 drivers/mtd/nand/{ => raw}/denali.c           |    0
 drivers/mtd/nand/{ => raw}/denali.h           |    0
 drivers/mtd/nand/{ => raw}/denali_dt.c        |    0
 drivers/mtd/nand/{ => raw}/denali_spl.c       |    0
 drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c    |    0
 drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c     |    0
 drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c     |    0
 drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c      |    0
 drivers/mtd/nand/{ => raw}/fsl_upm.c          |    0
 drivers/mtd/nand/{ => raw}/fsmc_nand.c        |    0
 drivers/mtd/nand/{ => raw}/kb9202_nand.c      |    0
 drivers/mtd/nand/{ => raw}/kirkwood_nand.c    |    0
 drivers/mtd/nand/{ => raw}/kmeter1_nand.c     |    0
 drivers/mtd/nand/{ => raw}/lpc32xx_nand_mlc.c |    0
 drivers/mtd/nand/{ => raw}/lpc32xx_nand_slc.c |    0
 drivers/mtd/nand/{ => raw}/mxc_nand.c         |    0
 drivers/mtd/nand/{ => raw}/mxc_nand.h         |    0
 drivers/mtd/nand/{ => raw}/mxc_nand_spl.c     |    0
 drivers/mtd/nand/{ => raw}/mxs_nand.c         |    0
 drivers/mtd/nand/{ => raw}/mxs_nand.h         |    0
 drivers/mtd/nand/{ => raw}/mxs_nand_dt.c      |    0
 drivers/mtd/nand/{ => raw}/mxs_nand_spl.c     |    0
 drivers/mtd/nand/{ => raw}/nand.c             |    0
 drivers/mtd/nand/{ => raw}/nand_base.c        |   56 --
 drivers/mtd/nand/{ => raw}/nand_bbt.c         |    0
 drivers/mtd/nand/{ => raw}/nand_bch.c         |    0
 drivers/mtd/nand/{ => raw}/nand_ecc.c         |    2 +-
 drivers/mtd/nand/{ => raw}/nand_ids.c         |    0
 drivers/mtd/nand/{ => raw}/nand_plat.c        |    0
 drivers/mtd/nand/{ => raw}/nand_spl_load.c    |    0
 drivers/mtd/nand/{ => raw}/nand_spl_loaders.c |    0
 drivers/mtd/nand/{ => raw}/nand_spl_simple.c  |    0
 drivers/mtd/nand/{ => raw}/nand_timings.c     |    0
 drivers/mtd/nand/{ => raw}/nand_util.c        |    2 +-
 drivers/mtd/nand/{ => raw}/omap_elm.c         |    0
 drivers/mtd/nand/{ => raw}/omap_gpmc.c        |    0
 drivers/mtd/nand/{ => raw}/pxa3xx_nand.c      |    2 +-
 drivers/mtd/nand/{ => raw}/pxa3xx_nand.h      |    0
 drivers/mtd/nand/{ => raw}/sunxi_nand.c       |    0
 drivers/mtd/nand/{ => raw}/sunxi_nand_spl.c   |    0
 drivers/mtd/nand/{ => raw}/tegra_nand.c       |    0
 drivers/mtd/nand/{ => raw}/tegra_nand.h       |    0
 drivers/mtd/nand/{ => raw}/vf610_nfc.c        |    0
 drivers/mtd/nand/{ => raw}/zynq_nand.c        |    0
 drivers/mtd/nand/spi/Kconfig                  |    7 +
 drivers/mtd/nand/spi/Makefile                 |    4 +
 drivers/mtd/nand/spi/core.c                   | 1254 +++++++++++++++++++++++++
 drivers/mtd/nand/spi/macronix.c               |  146 +++
 drivers/mtd/nand/spi/micron.c                 |  135 +++
 drivers/mtd/nand/spi/winbond.c                |  143 +++
 drivers/mtd/onenand/onenand_base.c            |   60 --
 drivers/spi/Kconfig                           |    7 +
 drivers/spi/Makefile                          |    1 +
 drivers/spi/spi-mem.c                         |  500 ++++++++++
 include/configs/MPC8313ERDB.h                 |    2 +-
 include/jffs2/load_kernel.h                   |    7 +-
 include/linux/mtd/mtd.h                       |   34 +-
 include/linux/mtd/nand.h                      |  734 +++++++++++++++
 include/linux/mtd/partitions.h                |    3 +
 include/linux/mtd/spinand.h                   |  432 +++++++++
 include/spi-mem.h                             |  258 +++++
 include/spi.h                                 |   11 +
 96 files changed, 5064 insertions(+), 561 deletions(-)
 create mode 100644 cmd/mtd.c
 create mode 100644 doc/device-tree-bindings/mtd/spi-nand.txt
 create mode 100644 drivers/mtd/nand/bbt.c
 create mode 100644 drivers/mtd/nand/core.c
 create mode 100644 drivers/mtd/nand/raw/Kconfig
 create mode 100644 drivers/mtd/nand/raw/Makefile
 rename drivers/mtd/nand/{ => raw}/am335x_spl_bch.c (100%)
 rename drivers/mtd/nand/{ => raw}/arasan_nfc.c (100%)
 rename drivers/mtd/nand/{ => raw}/atmel_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h (100%)
 rename drivers/mtd/nand/{ => raw}/davinci_nand.c (99%)
 rename drivers/mtd/nand/{ => raw}/denali.c (100%)
 rename drivers/mtd/nand/{ => raw}/denali.h (100%)
 rename drivers/mtd/nand/{ => raw}/denali_dt.c (100%)
 rename drivers/mtd/nand/{ => raw}/denali_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsl_upm.c (100%)
 rename drivers/mtd/nand/{ => raw}/fsmc_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/kb9202_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/kirkwood_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/kmeter1_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/lpc32xx_nand_mlc.c (100%)
 rename drivers/mtd/nand/{ => raw}/lpc32xx_nand_slc.c (100%)
 rename drivers/mtd/nand/{ => raw}/mxc_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/mxc_nand.h (100%)
 rename drivers/mtd/nand/{ => raw}/mxc_nand_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/mxs_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/mxs_nand.h (100%)
 rename drivers/mtd/nand/{ => raw}/mxs_nand_dt.c (100%)
 rename drivers/mtd/nand/{ => raw}/mxs_nand_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_base.c (98%)
 rename drivers/mtd/nand/{ => raw}/nand_bbt.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_bch.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_ecc.c (99%)
 rename drivers/mtd/nand/{ => raw}/nand_ids.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_plat.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_spl_load.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_spl_loaders.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_spl_simple.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_timings.c (100%)
 rename drivers/mtd/nand/{ => raw}/nand_util.c (99%)
 rename drivers/mtd/nand/{ => raw}/omap_elm.c (100%)
 rename drivers/mtd/nand/{ => raw}/omap_gpmc.c (100%)
 rename drivers/mtd/nand/{ => raw}/pxa3xx_nand.c (99%)
 rename drivers/mtd/nand/{ => raw}/pxa3xx_nand.h (100%)
 rename drivers/mtd/nand/{ => raw}/sunxi_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/sunxi_nand_spl.c (100%)
 rename drivers/mtd/nand/{ => raw}/tegra_nand.c (100%)
 rename drivers/mtd/nand/{ => raw}/tegra_nand.h (100%)
 rename drivers/mtd/nand/{ => raw}/vf610_nfc.c (100%)
 rename drivers/mtd/nand/{ => raw}/zynq_nand.c (100%)
 create mode 100644 drivers/mtd/nand/spi/Kconfig
 create mode 100644 drivers/mtd/nand/spi/Makefile
 create mode 100644 drivers/mtd/nand/spi/core.c
 create mode 100644 drivers/mtd/nand/spi/macronix.c
 create mode 100644 drivers/mtd/nand/spi/micron.c
 create mode 100644 drivers/mtd/nand/spi/winbond.c
 create mode 100644 drivers/spi/spi-mem.c
 create mode 100644 include/linux/mtd/nand.h
 create mode 100644 include/linux/mtd/spinand.h
 create mode 100644 include/spi-mem.h

Comments

Miquel Raynal Aug. 3, 2018, 8:27 a.m. UTC | #1
Hi Jagan, Tom,

Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
10:18:21 +0200:

> During the last months, Boris Brezillon shared his work to support
> serial flashes within Linux. First, he delivered (and merged) a new
> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> same time a NAND core that would be shared with all NAND devices. Then,
> he contributed a generic SPI-NAND driver, making use of this NAND core,
> as well as some vendor code to drive a few chips.
> 
> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> of MTD devices. This should become the default command instead of having
> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> 
> The series has been tested on an Ocelot board PCB123 (VSC7514),
> featuring a Macronix SPI NAND chip.
> 
> TL;DR: the series contains:
> - A few patches from Linux to resynchronize some areas of the MTD layer.
> - Various fixes and re-organization of the MTD subsystem.
> - The introduction of the SPI-mem interface.
> - The addition of the generic SPI-NAND driver (and its bindings).
> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> - A new 'mtd' command.
> - Support for spi-nand devices in mtdparts.
> 
> To test your SPI-NAND device with U-Boot simply follow these lines:
> 
> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> > setenv mtdids spi-nand0=spi-nand0
> > mtdparts             # show the spi-nand device partitions
> > ubi part bar         # create a static UBI volume in the bar partition  
> 
> Thanks,
> Miquèl
> 
> Changes since v5:
> -----------------
> * Included Boris fixup about the build issues.
> * Added Rb/Ab tags from Jagan on patchs 20/21.

I can't see a pull request flow on U-Boot ML, I suppose you use a
different mean for that purpose.

Jagan, is this version OK? Is it part of your PR?

Thanks,
Miquèl
Jagan Teki Aug. 3, 2018, 9:50 a.m. UTC | #2
On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> Hi Jagan, Tom,
>
> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
> 10:18:21 +0200:
>
>> During the last months, Boris Brezillon shared his work to support
>> serial flashes within Linux. First, he delivered (and merged) a new
>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
>> same time a NAND core that would be shared with all NAND devices. Then,
>> he contributed a generic SPI-NAND driver, making use of this NAND core,
>> as well as some vendor code to drive a few chips.
>>
>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
>> of MTD devices. This should become the default command instead of having
>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
>>
>> The series has been tested on an Ocelot board PCB123 (VSC7514),
>> featuring a Macronix SPI NAND chip.
>>
>> TL;DR: the series contains:
>> - A few patches from Linux to resynchronize some areas of the MTD layer.
>> - Various fixes and re-organization of the MTD subsystem.
>> - The introduction of the SPI-mem interface.
>> - The addition of the generic SPI-NAND driver (and its bindings).
>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
>> - A new 'mtd' command.
>> - Support for spi-nand devices in mtdparts.
>>
>> To test your SPI-NAND device with U-Boot simply follow these lines:
>>
>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
>> > setenv mtdids spi-nand0=spi-nand0
>> > mtdparts             # show the spi-nand device partitions
>> > ubi part bar         # create a static UBI volume in the bar partition
>>
>> Thanks,
>> Miquèl
>>
>> Changes since v5:
>> -----------------
>> * Included Boris fixup about the build issues.
>> * Added Rb/Ab tags from Jagan on patchs 20/21.
>
> I can't see a pull request flow on U-Boot ML, I suppose you use a
> different mean for that purpose.
>
> Jagan, is this version OK? Is it part of your PR?

Travis is going on [1], will send PR once all fine.

[1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788
Jagan Teki Aug. 3, 2018, 12:08 p.m. UTC | #3
On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:
> On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> Hi Jagan, Tom,
>>
>> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
>> 10:18:21 +0200:
>>
>>> During the last months, Boris Brezillon shared his work to support
>>> serial flashes within Linux. First, he delivered (and merged) a new
>>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
>>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
>>> same time a NAND core that would be shared with all NAND devices. Then,
>>> he contributed a generic SPI-NAND driver, making use of this NAND core,
>>> as well as some vendor code to drive a few chips.
>>>
>>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
>>> of MTD devices. This should become the default command instead of having
>>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
>>>
>>> The series has been tested on an Ocelot board PCB123 (VSC7514),
>>> featuring a Macronix SPI NAND chip.
>>>
>>> TL;DR: the series contains:
>>> - A few patches from Linux to resynchronize some areas of the MTD layer.
>>> - Various fixes and re-organization of the MTD subsystem.
>>> - The introduction of the SPI-mem interface.
>>> - The addition of the generic SPI-NAND driver (and its bindings).
>>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
>>> - A new 'mtd' command.
>>> - Support for spi-nand devices in mtdparts.
>>>
>>> To test your SPI-NAND device with U-Boot simply follow these lines:
>>>
>>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
>>> > setenv mtdids spi-nand0=spi-nand0
>>> > mtdparts             # show the spi-nand device partitions
>>> > ubi part bar         # create a static UBI volume in the bar partition
>>>
>>> Thanks,
>>> Miquèl
>>>
>>> Changes since v5:
>>> -----------------
>>> * Included Boris fixup about the build issues.
>>> * Added Rb/Ab tags from Jagan on patchs 20/21.
>>
>> I can't see a pull request flow on U-Boot ML, I suppose you use a
>> different mean for that purpose.
>>
>> Jagan, is this version OK? Is it part of your PR?
>
> Travis is going on [1], will send PR once all fine.
>
> [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788

There are some build issues, not quite sure whether it relates. please
look into it.

[2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
[3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815
Miquel Raynal Aug. 4, 2018, 7:23 a.m. UTC | #4
Hi Jagan,

Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
17:38:33 +0530:

> On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:
> > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:  
> >> Hi Jagan, Tom,
> >>
> >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
> >> 10:18:21 +0200:
> >>  
> >>> During the last months, Boris Brezillon shared his work to support
> >>> serial flashes within Linux. First, he delivered (and merged) a new
> >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> >>> same time a NAND core that would be shared with all NAND devices. Then,
> >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
> >>> as well as some vendor code to drive a few chips.
> >>>
> >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> >>> of MTD devices. This should become the default command instead of having
> >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> >>>
> >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
> >>> featuring a Macronix SPI NAND chip.
> >>>
> >>> TL;DR: the series contains:
> >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
> >>> - Various fixes and re-organization of the MTD subsystem.
> >>> - The introduction of the SPI-mem interface.
> >>> - The addition of the generic SPI-NAND driver (and its bindings).
> >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> >>> - A new 'mtd' command.
> >>> - Support for spi-nand devices in mtdparts.
> >>>
> >>> To test your SPI-NAND device with U-Boot simply follow these lines:
> >>>  
> >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> >>> > setenv mtdids spi-nand0=spi-nand0
> >>> > mtdparts             # show the spi-nand device partitions
> >>> > ubi part bar         # create a static UBI volume in the bar partition  
> >>>
> >>> Thanks,
> >>> Miquèl
> >>>
> >>> Changes since v5:
> >>> -----------------
> >>> * Included Boris fixup about the build issues.
> >>> * Added Rb/Ab tags from Jagan on patchs 20/21.  
> >>
> >> I can't see a pull request flow on U-Boot ML, I suppose you use a
> >> different mean for that purpose.
> >>
> >> Jagan, is this version OK? Is it part of your PR?  
> >
> > Travis is going on [1], will send PR once all fine.
> >
> > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788  
> 
> There are some build issues, not quite sure whether it relates. please
> look into it.

Thanks for the reports.

> 
> [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
> [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815

Boris supposedly fixed all the build issues related to my changes (I
don't think the "missing interrupt parent" in a DTS file is related),
please pull his branch [1].

The fixes are under the form of fixups if you wanna check them.
Otherwise you can just 'rebase -i --autosquash' to automatically squash
them with the commit introducing the regression.

[1] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814


Thanks,
Miquèl
Boris Brezillon Aug. 4, 2018, 8:34 a.m. UTC | #5
On Sat, 4 Aug 2018 09:23:05 +0200
Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Hi Jagan,
> 
> Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
> 17:38:33 +0530:
> 
> > On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:  
> > > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:    
> > >> Hi Jagan, Tom,
> > >>
> > >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
> > >> 10:18:21 +0200:
> > >>    
> > >>> During the last months, Boris Brezillon shared his work to support
> > >>> serial flashes within Linux. First, he delivered (and merged) a new
> > >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > >>> same time a NAND core that would be shared with all NAND devices. Then,
> > >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
> > >>> as well as some vendor code to drive a few chips.
> > >>>
> > >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> > >>> of MTD devices. This should become the default command instead of having
> > >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> > >>>
> > >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
> > >>> featuring a Macronix SPI NAND chip.
> > >>>
> > >>> TL;DR: the series contains:
> > >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
> > >>> - Various fixes and re-organization of the MTD subsystem.
> > >>> - The introduction of the SPI-mem interface.
> > >>> - The addition of the generic SPI-NAND driver (and its bindings).
> > >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> > >>> - A new 'mtd' command.
> > >>> - Support for spi-nand devices in mtdparts.
> > >>>
> > >>> To test your SPI-NAND device with U-Boot simply follow these lines:
> > >>>    
> > >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> > >>> > setenv mtdids spi-nand0=spi-nand0
> > >>> > mtdparts             # show the spi-nand device partitions
> > >>> > ubi part bar         # create a static UBI volume in the bar partition    
> > >>>
> > >>> Thanks,
> > >>> Miquèl
> > >>>
> > >>> Changes since v5:
> > >>> -----------------
> > >>> * Included Boris fixup about the build issues.
> > >>> * Added Rb/Ab tags from Jagan on patchs 20/21.    
> > >>
> > >> I can't see a pull request flow on U-Boot ML, I suppose you use a
> > >> different mean for that purpose.
> > >>
> > >> Jagan, is this version OK? Is it part of your PR?    
> > >
> > > Travis is going on [1], will send PR once all fine.
> > >
> > > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788    
> > 
> > There are some build issues, not quite sure whether it relates. please
> > look into it.  
> 
> Thanks for the reports.
> 
> > 
> > [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
> > [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815  
> 
> Boris supposedly fixed all the build issues related to my changes (I
> don't think the "missing interrupt parent" in a DTS file is related),
> please pull his branch [1].
> 
> The fixes are under the form of fixups if you wanna check them.
> Otherwise you can just 'rebase -i --autosquash' to automatically squash
> them with the commit introducing the regression.

One more thing, if you want to make things bisectable patch 6 ("mtd: fix
build issue with includes") and it's fixup should be squashed in patch 5
("mtd: add get/set of_node/flash_node helpers"), because the build
failure you're fixing in patch 6 is introduced by patch 5.

> 
> [1] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814

You mean

[1]https://github.com/bbrezillon/u-boot/commits/wip-spi
Miquel Raynal Aug. 4, 2018, 9:59 a.m. UTC | #6
Hi Boris,

Boris Brezillon <boris.brezillon@bootlin.com> wrote on Sat, 4 Aug 2018
10:34:55 +0200:

> On Sat, 4 Aug 2018 09:23:05 +0200
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> 
> > Hi Jagan,
> > 
> > Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
> > 17:38:33 +0530:
> >   
> > > On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:    
> > > > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:      
> > > >> Hi Jagan, Tom,
> > > >>
> > > >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
> > > >> 10:18:21 +0200:
> > > >>      
> > > >>> During the last months, Boris Brezillon shared his work to support
> > > >>> serial flashes within Linux. First, he delivered (and merged) a new
> > > >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> > > >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> > > >>> same time a NAND core that would be shared with all NAND devices. Then,
> > > >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
> > > >>> as well as some vendor code to drive a few chips.
> > > >>>
> > > >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> > > >>> of MTD devices. This should become the default command instead of having
> > > >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> > > >>>
> > > >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
> > > >>> featuring a Macronix SPI NAND chip.
> > > >>>
> > > >>> TL;DR: the series contains:
> > > >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
> > > >>> - Various fixes and re-organization of the MTD subsystem.
> > > >>> - The introduction of the SPI-mem interface.
> > > >>> - The addition of the generic SPI-NAND driver (and its bindings).
> > > >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> > > >>> - A new 'mtd' command.
> > > >>> - Support for spi-nand devices in mtdparts.
> > > >>>
> > > >>> To test your SPI-NAND device with U-Boot simply follow these lines:
> > > >>>      
> > > >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> > > >>> > setenv mtdids spi-nand0=spi-nand0
> > > >>> > mtdparts             # show the spi-nand device partitions
> > > >>> > ubi part bar         # create a static UBI volume in the bar partition      
> > > >>>
> > > >>> Thanks,
> > > >>> Miquèl
> > > >>>
> > > >>> Changes since v5:
> > > >>> -----------------
> > > >>> * Included Boris fixup about the build issues.
> > > >>> * Added Rb/Ab tags from Jagan on patchs 20/21.      
> > > >>
> > > >> I can't see a pull request flow on U-Boot ML, I suppose you use a
> > > >> different mean for that purpose.
> > > >>
> > > >> Jagan, is this version OK? Is it part of your PR?      
> > > >
> > > > Travis is going on [1], will send PR once all fine.
> > > >
> > > > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788      
> > > 
> > > There are some build issues, not quite sure whether it relates. please
> > > look into it.    
> > 
> > Thanks for the reports.
> >   
> > > 
> > > [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
> > > [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815    
> > 
> > Boris supposedly fixed all the build issues related to my changes (I
> > don't think the "missing interrupt parent" in a DTS file is related),
> > please pull his branch [1].
> > 
> > The fixes are under the form of fixups if you wanna check them.
> > Otherwise you can just 'rebase -i --autosquash' to automatically squash
> > them with the commit introducing the regression.  
> 
> One more thing, if you want to make things bisectable patch 6 ("mtd: fix
> build issue with includes") and it's fixup should be squashed in patch 5
> ("mtd: add get/set of_node/flash_node helpers"), because the build
> failure you're fixing in patch 6 is introduced by patch 5.
> 
> > 
> > [1] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814  
> 
> You mean
> 
> [1]https://github.com/bbrezillon/u-boot/commits/wip-spi


Oops!

Thanks,
Miquèl
Stefan Roese Aug. 6, 2018, 5:45 p.m. UTC | #7
Hi Miquel,

I just noticed that when using this patchset version, I'm
getting oopses / crashes while trying to attach an MTD
partition to UBI using "ubi part". This did not happen
with earlier versions.

I digged a bit into it and noticed that for example mtd_read()
in mtdcore.c has some differences which are not mentioned in
the commit history. Perhaps this is some mistake, or I did
something wrong - I wanted to mention it.

Tomorrow I can dig into it a bit more if necessary.

Thanks,
Stefan

On 01.08.2018 10:18, Miquel Raynal wrote:
> During the last months, Boris Brezillon shared his work to support
> serial flashes within Linux. First, he delivered (and merged) a new
> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> same time a NAND core that would be shared with all NAND devices. Then,
> he contributed a generic SPI-NAND driver, making use of this NAND core,
> as well as some vendor code to drive a few chips.
> 
> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> of MTD devices. This should become the default command instead of having
> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> 
> The series has been tested on an Ocelot board PCB123 (VSC7514),
> featuring a Macronix SPI NAND chip.
> 
> TL;DR: the series contains:
> - A few patches from Linux to resynchronize some areas of the MTD layer.
> - Various fixes and re-organization of the MTD subsystem.
> - The introduction of the SPI-mem interface.
> - The addition of the generic SPI-NAND driver (and its bindings).
> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> - A new 'mtd' command.
> - Support for spi-nand devices in mtdparts.
> 
> To test your SPI-NAND device with U-Boot simply follow these lines:
> 
>> setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
>> setenv mtdids spi-nand0=spi-nand0
>> mtdparts             # show the spi-nand device partitions
>> ubi part bar         # create a static UBI volume in the bar partition
> 
> Thanks,
> Miquèl
> 
> Changes since v5:
> -----------------
> * Included Boris fixup about the build issues.
> * Added Rb/Ab tags from Jagan on patchs 20/21.
> 
> Changes since v4:
> -----------------
> * Added Jagan's Acked-by tags to every patch related to the
>    SPI-mem/SPI-NAND addition.
> * Rebased on top of master.
> 
> Changes since v3:
> -----------------
> * Fixed the debug messages in spi-mem to print either Rx or Tx data.
> * Fixed a Kconfig error that prevented to build mtdparts with plain
>    defconfig.
> * Fixed a compilation error due to the above error that prevented one
>    file to be compiled.
> * Adapted the mtd command to probe MTD partitions also.
> * Declared mtd_probe_devices() in a header so mtdparts or UBI could
>    use it too (to probe all devices and MTD partitions in a clean way).
> * As I worked on mtdparts, I found annoying and completely useless the
>    fact that we need to prefix the environment variable with
>    "mtdparts=". Canceled this obligation.
> * Added one patch to allow spi-nand devices to be recognized by mtdparts
>    (this is purely useless but needed to be done in order to use this
>    command).
> * Removed useless definitions of MTD device types in UBI code.
> * Wrote a generic mtdparts environment variable parser, used by the mtd
>    command.
> * Used the mtd_probe_devices() function from get_mtd_info() in
>    cmd/mtdparts.c to be sure the desired partition really does not exist
>    (otherwise it will be probed and then found).
> 
> Changes since v2:
> -----------------
> * Rebased on u-boot master branch.
> * Removed extra-parenthesis in
>    "mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing"
> * s/fiels/files/ in "mtd: move NAND fiels into a raw/ subdirectory"
> * Do not describe generic SPI device properties in SPI NAND bindings.
> * Changes in the mtd command:
>    * Printing more information in 'mtd list' (device type, device
>      characteristics)
>    * Switch to do_div() instead of '(u32)value64b % value32b' which only
>      worked because value32b was a power of 2.
>    * Removed erase.chip option.
>    * By default, erase/read/write happen on the full MTD device while a
>      dump will only work on a single page.
> 
> Changes since v1:
> -----------------
> * Fixed the nand_memorg structure of the MX35LF2GE4AB chip.
> * Added Reviewed-by tags from Jagan.
> * Backported and squashed two patches fixing things in the SPI NAND core
>    received on the Linux ML.
> * Backported more changes in mtdcore.c from Linux.
> * Added a patch to add a fallback on mtd->_read/_write() in mtdcore.c
>    when mtd->_read/write_oob() is not supported.
> * Removed the DT changes, useless as the DTs are not available in
>    mainline yet.
> * Addressed Boris/Stefan comments on the 'mtd' command.
> * Added support for multi-pages OOB read/write.
> 
> 
> Boris Brezillon (7):
>    mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing
>    mtd: Add sanity checks in mtd_write/read_oob()
>    mtd: nand: Add core infrastructure to deal with NAND devices
>    mtd: nand: Pass mode information to nand_page_io_req
>    spi: Extend the core to ease integration of SPI memory controllers
>    mtd: spinand: Add initial support for the MX35LF1GE4AB chip
>    dt-bindings: Add bindings for SPI NAND devices
> 
> Brian Norris (1):
>    mtd: add get/set of_node/flash_node helpers
> 
> Ezequiel Garcia (1):
>    mtd: Uninline mtd_write_oob and move it to mtdcore.c
> 
> Frieder Schrempf (1):
>    mtd: spinand: Add initial support for Winbond W25M02GV
> 
> Miquel Raynal (15):
>    mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing
>    mtd: fix build issue with includes
>    mtd: move definitions to enlarge their range
>    mtd: move all flash categories inside MTD submenu
>    mtd: move NAND files into a raw/ subdirectory
>    mtd: rename nand into rawnand in Kconfig prompt
>    mtd: spinand: Add initial support for the MX35LF2GE4AB chip
>    mtd: declare MTD_PARTITIONS symbol in Kconfig
>    cmd: ubi: delete useless and misleading definitions
>    cmd: mtdparts: accept spi-nand devices
>    cmd: mtdparts: add a generic 'mtdparts' parser
>    cmd: mtdparts: remove useless 'mtdparts=' prefix
>    mtd: uclass: add probe function
>    cmd: mtd: add 'mtd' command
>    cmd: mtdparts: try to probe the MTD devices as a fallback
> 
> Peter Pan (2):
>    mtd: nand: Add core infrastructure to support SPI NANDs
>    mtd: spinand: Add initial support for Micron MT29F2G01ABAGD
> 
>   MAINTAINERS                                   |    6 +-
>   Makefile                                      |    2 +-
>   README                                        |    6 +-
>   arch/arm/mach-uniphier/board_late_init.c      |    2 +-
>   cmd/Kconfig                                   |    7 +
>   cmd/Makefile                                  |    1 +
>   cmd/mtd.c                                     |  392 ++++++++
>   cmd/mtdparts.c                                |  113 ++-
>   cmd/ubi.c                                     |    5 -
>   common/spl/Kconfig                            |    2 +-
>   common/spl/spl_spi.c                          |    2 +-
>   doc/README.SPL                                |    4 +-
>   doc/README.arm-relocation                     |    2 +-
>   doc/README.nand                               |    6 +-
>   doc/README.zynq                               |    2 +-
>   doc/device-tree-bindings/mtd/spi-nand.txt     |    5 +
>   drivers/Makefile                              |    2 +-
>   drivers/mtd/Kconfig                           |    7 +-
>   drivers/mtd/Makefile                          |    4 +-
>   drivers/mtd/mtd-uclass.c                      |    9 +
>   drivers/mtd/mtdcore.c                         |  106 ++-
>   drivers/mtd/mtdcore.h                         |    6 -
>   drivers/mtd/mtdpart.c                         |    6 +-
>   drivers/mtd/nand/Kconfig                      |  299 +-----
>   drivers/mtd/nand/Makefile                     |   78 +-
>   drivers/mtd/nand/bbt.c                        |  132 +++
>   drivers/mtd/nand/core.c                       |  243 +++++
>   drivers/mtd/nand/raw/Kconfig                  |  297 ++++++
>   drivers/mtd/nand/raw/Makefile                 |   77 ++
>   drivers/mtd/nand/{ => raw}/am335x_spl_bch.c   |    0
>   drivers/mtd/nand/{ => raw}/arasan_nfc.c       |    0
>   drivers/mtd/nand/{ => raw}/atmel_nand.c       |    0
>   drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h   |    0
>   drivers/mtd/nand/{ => raw}/davinci_nand.c     |    2 +-
>   drivers/mtd/nand/{ => raw}/denali.c           |    0
>   drivers/mtd/nand/{ => raw}/denali.h           |    0
>   drivers/mtd/nand/{ => raw}/denali_dt.c        |    0
>   drivers/mtd/nand/{ => raw}/denali_spl.c       |    0
>   drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c    |    0
>   drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c     |    0
>   drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c     |    0
>   drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c      |    0
>   drivers/mtd/nand/{ => raw}/fsl_upm.c          |    0
>   drivers/mtd/nand/{ => raw}/fsmc_nand.c        |    0
>   drivers/mtd/nand/{ => raw}/kb9202_nand.c      |    0
>   drivers/mtd/nand/{ => raw}/kirkwood_nand.c    |    0
>   drivers/mtd/nand/{ => raw}/kmeter1_nand.c     |    0
>   drivers/mtd/nand/{ => raw}/lpc32xx_nand_mlc.c |    0
>   drivers/mtd/nand/{ => raw}/lpc32xx_nand_slc.c |    0
>   drivers/mtd/nand/{ => raw}/mxc_nand.c         |    0
>   drivers/mtd/nand/{ => raw}/mxc_nand.h         |    0
>   drivers/mtd/nand/{ => raw}/mxc_nand_spl.c     |    0
>   drivers/mtd/nand/{ => raw}/mxs_nand.c         |    0
>   drivers/mtd/nand/{ => raw}/mxs_nand.h         |    0
>   drivers/mtd/nand/{ => raw}/mxs_nand_dt.c      |    0
>   drivers/mtd/nand/{ => raw}/mxs_nand_spl.c     |    0
>   drivers/mtd/nand/{ => raw}/nand.c             |    0
>   drivers/mtd/nand/{ => raw}/nand_base.c        |   56 --
>   drivers/mtd/nand/{ => raw}/nand_bbt.c         |    0
>   drivers/mtd/nand/{ => raw}/nand_bch.c         |    0
>   drivers/mtd/nand/{ => raw}/nand_ecc.c         |    2 +-
>   drivers/mtd/nand/{ => raw}/nand_ids.c         |    0
>   drivers/mtd/nand/{ => raw}/nand_plat.c        |    0
>   drivers/mtd/nand/{ => raw}/nand_spl_load.c    |    0
>   drivers/mtd/nand/{ => raw}/nand_spl_loaders.c |    0
>   drivers/mtd/nand/{ => raw}/nand_spl_simple.c  |    0
>   drivers/mtd/nand/{ => raw}/nand_timings.c     |    0
>   drivers/mtd/nand/{ => raw}/nand_util.c        |    2 +-
>   drivers/mtd/nand/{ => raw}/omap_elm.c         |    0
>   drivers/mtd/nand/{ => raw}/omap_gpmc.c        |    0
>   drivers/mtd/nand/{ => raw}/pxa3xx_nand.c      |    2 +-
>   drivers/mtd/nand/{ => raw}/pxa3xx_nand.h      |    0
>   drivers/mtd/nand/{ => raw}/sunxi_nand.c       |    0
>   drivers/mtd/nand/{ => raw}/sunxi_nand_spl.c   |    0
>   drivers/mtd/nand/{ => raw}/tegra_nand.c       |    0
>   drivers/mtd/nand/{ => raw}/tegra_nand.h       |    0
>   drivers/mtd/nand/{ => raw}/vf610_nfc.c        |    0
>   drivers/mtd/nand/{ => raw}/zynq_nand.c        |    0
>   drivers/mtd/nand/spi/Kconfig                  |    7 +
>   drivers/mtd/nand/spi/Makefile                 |    4 +
>   drivers/mtd/nand/spi/core.c                   | 1254 +++++++++++++++++++++++++
>   drivers/mtd/nand/spi/macronix.c               |  146 +++
>   drivers/mtd/nand/spi/micron.c                 |  135 +++
>   drivers/mtd/nand/spi/winbond.c                |  143 +++
>   drivers/mtd/onenand/onenand_base.c            |   60 --
>   drivers/spi/Kconfig                           |    7 +
>   drivers/spi/Makefile                          |    1 +
>   drivers/spi/spi-mem.c                         |  500 ++++++++++
>   include/configs/MPC8313ERDB.h                 |    2 +-
>   include/jffs2/load_kernel.h                   |    7 +-
>   include/linux/mtd/mtd.h                       |   34 +-
>   include/linux/mtd/nand.h                      |  734 +++++++++++++++
>   include/linux/mtd/partitions.h                |    3 +
>   include/linux/mtd/spinand.h                   |  432 +++++++++
>   include/spi-mem.h                             |  258 +++++
>   include/spi.h                                 |   11 +
>   96 files changed, 5064 insertions(+), 561 deletions(-)
>   create mode 100644 cmd/mtd.c
>   create mode 100644 doc/device-tree-bindings/mtd/spi-nand.txt
>   create mode 100644 drivers/mtd/nand/bbt.c
>   create mode 100644 drivers/mtd/nand/core.c
>   create mode 100644 drivers/mtd/nand/raw/Kconfig
>   create mode 100644 drivers/mtd/nand/raw/Makefile
>   rename drivers/mtd/nand/{ => raw}/am335x_spl_bch.c (100%)
>   rename drivers/mtd/nand/{ => raw}/arasan_nfc.c (100%)
>   rename drivers/mtd/nand/{ => raw}/atmel_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/atmel_nand_ecc.h (100%)
>   rename drivers/mtd/nand/{ => raw}/davinci_nand.c (99%)
>   rename drivers/mtd/nand/{ => raw}/denali.c (100%)
>   rename drivers/mtd/nand/{ => raw}/denali.h (100%)
>   rename drivers/mtd/nand/{ => raw}/denali_dt.c (100%)
>   rename drivers/mtd/nand/{ => raw}/denali_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsl_elbc_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsl_elbc_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsl_ifc_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsl_ifc_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsl_upm.c (100%)
>   rename drivers/mtd/nand/{ => raw}/fsmc_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/kb9202_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/kirkwood_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/kmeter1_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/lpc32xx_nand_mlc.c (100%)
>   rename drivers/mtd/nand/{ => raw}/lpc32xx_nand_slc.c (100%)
>   rename drivers/mtd/nand/{ => raw}/mxc_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/mxc_nand.h (100%)
>   rename drivers/mtd/nand/{ => raw}/mxc_nand_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/mxs_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/mxs_nand.h (100%)
>   rename drivers/mtd/nand/{ => raw}/mxs_nand_dt.c (100%)
>   rename drivers/mtd/nand/{ => raw}/mxs_nand_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_base.c (98%)
>   rename drivers/mtd/nand/{ => raw}/nand_bbt.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_bch.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_ecc.c (99%)
>   rename drivers/mtd/nand/{ => raw}/nand_ids.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_plat.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_spl_load.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_spl_loaders.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_spl_simple.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_timings.c (100%)
>   rename drivers/mtd/nand/{ => raw}/nand_util.c (99%)
>   rename drivers/mtd/nand/{ => raw}/omap_elm.c (100%)
>   rename drivers/mtd/nand/{ => raw}/omap_gpmc.c (100%)
>   rename drivers/mtd/nand/{ => raw}/pxa3xx_nand.c (99%)
>   rename drivers/mtd/nand/{ => raw}/pxa3xx_nand.h (100%)
>   rename drivers/mtd/nand/{ => raw}/sunxi_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/sunxi_nand_spl.c (100%)
>   rename drivers/mtd/nand/{ => raw}/tegra_nand.c (100%)
>   rename drivers/mtd/nand/{ => raw}/tegra_nand.h (100%)
>   rename drivers/mtd/nand/{ => raw}/vf610_nfc.c (100%)
>   rename drivers/mtd/nand/{ => raw}/zynq_nand.c (100%)
>   create mode 100644 drivers/mtd/nand/spi/Kconfig
>   create mode 100644 drivers/mtd/nand/spi/Makefile
>   create mode 100644 drivers/mtd/nand/spi/core.c
>   create mode 100644 drivers/mtd/nand/spi/macronix.c
>   create mode 100644 drivers/mtd/nand/spi/micron.c
>   create mode 100644 drivers/mtd/nand/spi/winbond.c
>   create mode 100644 drivers/spi/spi-mem.c
>   create mode 100644 include/linux/mtd/nand.h
>   create mode 100644 include/linux/mtd/spinand.h
>   create mode 100644 include/spi-mem.h
> 

Viele Grüße,
Stefan
Jagan Teki Aug. 6, 2018, 5:50 p.m. UTC | #8
Are you planning to send the next version?

On Sat, Aug 4, 2018 at 3:29 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> Hi Boris,
>
> Boris Brezillon <boris.brezillon@bootlin.com> wrote on Sat, 4 Aug 2018
> 10:34:55 +0200:
>
>> On Sat, 4 Aug 2018 09:23:05 +0200
>> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>>
>> > Hi Jagan,
>> >
>> > Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
>> > 17:38:33 +0530:
>> >
>> > > On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:
>> > > > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> > > >> Hi Jagan, Tom,
>> > > >>
>> > > >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
>> > > >> 10:18:21 +0200:
>> > > >>
>> > > >>> During the last months, Boris Brezillon shared his work to support
>> > > >>> serial flashes within Linux. First, he delivered (and merged) a new
>> > > >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
>> > > >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
>> > > >>> same time a NAND core that would be shared with all NAND devices. Then,
>> > > >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
>> > > >>> as well as some vendor code to drive a few chips.
>> > > >>>
>> > > >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
>> > > >>> of MTD devices. This should become the default command instead of having
>> > > >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
>> > > >>>
>> > > >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
>> > > >>> featuring a Macronix SPI NAND chip.
>> > > >>>
>> > > >>> TL;DR: the series contains:
>> > > >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
>> > > >>> - Various fixes and re-organization of the MTD subsystem.
>> > > >>> - The introduction of the SPI-mem interface.
>> > > >>> - The addition of the generic SPI-NAND driver (and its bindings).
>> > > >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
>> > > >>> - A new 'mtd' command.
>> > > >>> - Support for spi-nand devices in mtdparts.
>> > > >>>
>> > > >>> To test your SPI-NAND device with U-Boot simply follow these lines:
>> > > >>>
>> > > >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
>> > > >>> > setenv mtdids spi-nand0=spi-nand0
>> > > >>> > mtdparts             # show the spi-nand device partitions
>> > > >>> > ubi part bar         # create a static UBI volume in the bar partition
>> > > >>>
>> > > >>> Thanks,
>> > > >>> Miquèl
>> > > >>>
>> > > >>> Changes since v5:
>> > > >>> -----------------
>> > > >>> * Included Boris fixup about the build issues.
>> > > >>> * Added Rb/Ab tags from Jagan on patchs 20/21.
>> > > >>
>> > > >> I can't see a pull request flow on U-Boot ML, I suppose you use a
>> > > >> different mean for that purpose.
>> > > >>
>> > > >> Jagan, is this version OK? Is it part of your PR?
>> > > >
>> > > > Travis is going on [1], will send PR once all fine.
>> > > >
>> > > > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788
>> > >
>> > > There are some build issues, not quite sure whether it relates. please
>> > > look into it.
>> >
>> > Thanks for the reports.
>> >
>> > >
>> > > [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
>> > > [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815
>> >
>> > Boris supposedly fixed all the build issues related to my changes (I
>> > don't think the "missing interrupt parent" in a DTS file is related),
>> > please pull his branch [1].
>> >
>> > The fixes are under the form of fixups if you wanna check them.
>> > Otherwise you can just 'rebase -i --autosquash' to automatically squash
>> > them with the commit introducing the regression.
>>
>> One more thing, if you want to make things bisectable patch 6 ("mtd: fix
>> build issue with includes") and it's fixup should be squashed in patch 5
>> ("mtd: add get/set of_node/flash_node helpers"), because the build
>> failure you're fixing in patch 6 is introduced by patch 5.
>>
>> >
>> > [1] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
>>
>> You mean
>>
>> [1]https://github.com/bbrezillon/u-boot/commits/wip-spi
>
>
> Oops!
>
> Thanks,
> Miquèl
Boris Brezillon Aug. 6, 2018, 8:43 p.m. UTC | #9
On Mon, 6 Aug 2018 19:45:24 +0200
Stefan Roese <sr@denx.de> wrote:

> Hi Miquel,
> 
> I just noticed that when using this patchset version, I'm
> getting oopses / crashes while trying to attach an MTD
> partition to UBI using "ubi part". This did not happen
> with earlier versions.
> 
> I digged a bit into it and noticed that for example mtd_read()
> in mtdcore.c has some differences which are not mentioned in
> the commit history. Perhaps this is some mistake, or I did
> something wrong - I wanted to mention it.

I have a branch containing this patchset there [1], just in case you
want to make sure this is not a mistake you made when applying patches.

[1]https://github.com/bbrezillon/u-boot/tree/wip-spi
Stefan Roese Aug. 7, 2018, 4:59 a.m. UTC | #10
Hi Boris,

On 06.08.2018 22:43, Boris Brezillon wrote:
> On Mon, 6 Aug 2018 19:45:24 +0200
> Stefan Roese <sr@denx.de> wrote:
> 
>> Hi Miquel,
>>
>> I just noticed that when using this patchset version, I'm
>> getting oopses / crashes while trying to attach an MTD
>> partition to UBI using "ubi part". This did not happen
>> with earlier versions.
>>
>> I digged a bit into it and noticed that for example mtd_read()
>> in mtdcore.c has some differences which are not mentioned in
>> the commit history. Perhaps this is some mistake, or I did
>> something wrong - I wanted to mention it.
> 
> I have a branch containing this patchset there [1], just in case you
> want to make sure this is not a mistake you made when applying patches.
> 
> [1]https://github.com/bbrezillon/u-boot/tree/wip-spi

Seems that I fat-fingered here something. Applying v6 of this patchset
again, all seems fine so far. So:

Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Daniel Schwierzeck Aug. 7, 2018, 2:39 p.m. UTC | #11
2018-08-04 9:23 GMT+02:00 Miquel Raynal <miquel.raynal@bootlin.com>:
> Hi Jagan,
>
> Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
> 17:38:33 +0530:
>
>> On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:
>> > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>> >> Hi Jagan, Tom,
>> >>
>> >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
>> >> 10:18:21 +0200:
>> >>
>> >>> During the last months, Boris Brezillon shared his work to support
>> >>> serial flashes within Linux. First, he delivered (and merged) a new
>> >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
>> >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
>> >>> same time a NAND core that would be shared with all NAND devices. Then,
>> >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
>> >>> as well as some vendor code to drive a few chips.
>> >>>
>> >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
>> >>> of MTD devices. This should become the default command instead of having
>> >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
>> >>>
>> >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
>> >>> featuring a Macronix SPI NAND chip.
>> >>>
>> >>> TL;DR: the series contains:
>> >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
>> >>> - Various fixes and re-organization of the MTD subsystem.
>> >>> - The introduction of the SPI-mem interface.
>> >>> - The addition of the generic SPI-NAND driver (and its bindings).
>> >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
>> >>> - A new 'mtd' command.
>> >>> - Support for spi-nand devices in mtdparts.
>> >>>
>> >>> To test your SPI-NAND device with U-Boot simply follow these lines:
>> >>>
>> >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
>> >>> > setenv mtdids spi-nand0=spi-nand0
>> >>> > mtdparts             # show the spi-nand device partitions
>> >>> > ubi part bar         # create a static UBI volume in the bar partition
>> >>>
>> >>> Thanks,
>> >>> Miquèl
>> >>>
>> >>> Changes since v5:
>> >>> -----------------
>> >>> * Included Boris fixup about the build issues.
>> >>> * Added Rb/Ab tags from Jagan on patchs 20/21.
>> >>
>> >> I can't see a pull request flow on U-Boot ML, I suppose you use a
>> >> different mean for that purpose.
>> >>
>> >> Jagan, is this version OK? Is it part of your PR?
>> >
>> > Travis is going on [1], will send PR once all fine.
>> >
>> > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788
>>
>> There are some build issues, not quite sure whether it relates. please
>> look into it.
>
> Thanks for the reports.
>
>>
>> [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
>> [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815
>
> Boris supposedly fixed all the build issues related to my changes (I
> don't think the "missing interrupt parent" in a DTS file is related),
> please pull his branch [1].

the DTS warnings are unrelated and can be ignored. Only the onenand_*
stuff seems
to be a regression.I wonder if VCT is the only board remaining with
OneNAND support?

>
> The fixes are under the form of fixups if you wanna check them.
> Otherwise you can just 'rebase -i --autosquash' to automatically squash
> them with the commit introducing the regression.
>
> [1] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
>
>
> Thanks,
> Miquèl
>
> --
> Miquel Raynal, Bootlin (formerly Free Electrons)
> Embedded Linux and Kernel engineering
> https://bootlin.com
Miquel Raynal Aug. 8, 2018, 9:17 a.m. UTC | #12
Hi Daniel,

Daniel Schwierzeck <daniel.schwierzeck@gmail.com> wrote on Tue, 7 Aug
2018 16:39:34 +0200:

> 2018-08-04 9:23 GMT+02:00 Miquel Raynal <miquel.raynal@bootlin.com>:
> > Hi Jagan,
> >
> > Jagan Teki <jagan@amarulasolutions.com> wrote on Fri, 3 Aug 2018
> > 17:38:33 +0530:
> >  
> >> On Fri, Aug 3, 2018 at 3:20 PM, Jagan Teki <jagan@amarulasolutions.com> wrote:  
> >> > On Fri, Aug 3, 2018 at 1:57 PM, Miquel Raynal <miquel.raynal@bootlin.com> wrote:  
> >> >> Hi Jagan, Tom,
> >> >>
> >> >> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Wed,  1 Aug 2018
> >> >> 10:18:21 +0200:
> >> >>  
> >> >>> During the last months, Boris Brezillon shared his work to support
> >> >>> serial flashes within Linux. First, he delivered (and merged) a new
> >> >>> layer called spi-mem. He also initiated in Linux MTD subsystem the move
> >> >>> of all 'raw' NAND related code to a raw/ subdirectory, adding at the
> >> >>> same time a NAND core that would be shared with all NAND devices. Then,
> >> >>> he contributed a generic SPI-NAND driver, making use of this NAND core,
> >> >>> as well as some vendor code to drive a few chips.
> >> >>>
> >> >>> On top of this work, I added an 'mtd' U-Boot command to handle all sort
> >> >>> of MTD devices. This should become the default command instead of having
> >> >>> one per flash flavor ('sf', 'nand', 'spi-nand' ?).
> >> >>>
> >> >>> The series has been tested on an Ocelot board PCB123 (VSC7514),
> >> >>> featuring a Macronix SPI NAND chip.
> >> >>>
> >> >>> TL;DR: the series contains:
> >> >>> - A few patches from Linux to resynchronize some areas of the MTD layer.
> >> >>> - Various fixes and re-organization of the MTD subsystem.
> >> >>> - The introduction of the SPI-mem interface.
> >> >>> - The addition of the generic SPI-NAND driver (and its bindings).
> >> >>> - Several SPI NAND chip drivers (Macronix, Micron, Winbond).
> >> >>> - A new 'mtd' command.
> >> >>> - Support for spi-nand devices in mtdparts.
> >> >>>
> >> >>> To test your SPI-NAND device with U-Boot simply follow these lines:
> >> >>>  
> >> >>> > setenv mtdparts mtdparts=spi-nand0:1m(foo),-(bar)
> >> >>> > setenv mtdids spi-nand0=spi-nand0
> >> >>> > mtdparts             # show the spi-nand device partitions
> >> >>> > ubi part bar         # create a static UBI volume in the bar partition  
> >> >>>
> >> >>> Thanks,
> >> >>> Miquèl
> >> >>>
> >> >>> Changes since v5:
> >> >>> -----------------
> >> >>> * Included Boris fixup about the build issues.
> >> >>> * Added Rb/Ab tags from Jagan on patchs 20/21.  
> >> >>
> >> >> I can't see a pull request flow on U-Boot ML, I suppose you use a
> >> >> different mean for that purpose.
> >> >>
> >> >> Jagan, is this version OK? Is it part of your PR?  
> >> >
> >> > Travis is going on [1], will send PR once all fine.
> >> >
> >> > [1] https://travis-ci.org/openedev/u-boot-amarula/builds/411596788  
> >>
> >> There are some build issues, not quite sure whether it relates. please
> >> look into it.  
> >
> > Thanks for the reports.
> >  
> >>
> >> [2] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596814
> >> [3] https://travis-ci.org/openedev/u-boot-amarula/jobs/411596815  
> >
> > Boris supposedly fixed all the build issues related to my changes (I
> > don't think the "missing interrupt parent" in a DTS file is related),
> > please pull his branch [1].  
> 
> the DTS warnings are unrelated and can be ignored. Only the onenand_*
> stuff seems
> to be a regression.

OneNAND warnings should be gone with Boris fixups.

Thanks,
Miquèl
Miquel Raynal Aug. 8, 2018, 10:08 a.m. UTC | #13
Hi Jagan,

Jagan Teki <jagan@amarulasolutions.com> wrote on Mon, 6 Aug 2018
23:20:19 +0530:

> Are you planning to send the next version?

I was not as we gave you a branch to pull patches from and test with
Travis if the warnings were gone [1].

Of course I can send the patches if you want them here also.

If Stefan sends a new iteration of his series I could fold the changes.

[1] https://github.com/bbrezillon/u-boot/commits/wip-spi


Thanks,
Miquèl