[PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"

Marek Behún marek.behun at nic.cz
Wed Sep 22 19:29:25 CEST 2021


(Adding also Tom.)

Hi Patrick, Marek,

I find this either not complete or not needed:

- either you need mtd names to be of this format so that old MTDPARTS
  config definitions do not need to be changed, i.e. something like
    CONFIG_MTDPARTS_DEFAULT="nor0:1M(u-boot),0x1000 at 0xfff000(env)"
  does not work currently, and you want to make it work.

  I find your solution here incomplete because MTDPARTS can also be
  used to be passed to Linux as mtdparts parameter, but there is no
  guarantee that the "norN" numbering you are creating in U-Boot will
  be the same as the one in kernel.

- or it is not needed, because you can remove MTDPARTS definition from
  the board config entirely and move the information into device tree. 
  In fact this was the main idea behind making the series
    Support SPI NORs and OF partitions in `mtd list`
  The SPI-NOR MTDs after this series can have conflicting names,
  because you can still choose between them via OF path with the `mtd`
  command.

  Tom and I were of the opinion that MTDPARTS should be deprecated and
  removed in favor of OF. Marek Vasut says that this is not possible
  for every board, and so needs to stay.

BTW, I find it a little weird for Marek to defend old API which should
be converted to DT, when in discussion about DM USB / Nokia N900
USB TTY console [1] he was defending the opinion that we should be
heading to DT in U-Boot.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/20210618145724.2558-1-pali@kernel.org/

On Wed, 22 Sep 2021 18:29:06 +0200
Patrick Delaunay <patrick.delaunay at foss.st.com> wrote:

> This serie is a V4 for [1].
> 
> Now the SPI nor are named "norN" with N after the CFI nor device:
> "nor0" to "norM" => N= M+1.
> 
> See also an other proposal from Marek (not working after test)
> "mtd: spi-nor: Fix SF MTDIDS when registering multiple MTDs with
> DM enabled"
> 
> http://patchwork.ozlabs.org/project/uboot/list/?series=262362
> 
> The first patch of the serie fixed the compilation issues around
> 'cfi_flash_num_flash_banks' found in CI:
> 
> https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138
> 
> [1] Series: mtd: spi: nor: force mtd name to "nor%d"
> http://patchwork.ozlabs.org/project/uboot/list/?series=262632&state=*
> http://patchwork.ozlabs.org/project/uboot/list/?series=262017&state=*
> http://patchwork.ozlabs.org/project/uboot/list/?series=262013&state=*
> 
> Patrick
> 
> 
> Changes in v4:
> - introduce macro MTD_NAME_SIZE for mtd_name size and use MTD_DEV_TYPE
>   to retrieved the "nor" string.
> 
> Changes in v3:
> - NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used
> - start index after the last CFI device, use CONFIG_SYS_MAX_FLASH_BANKS
> 
> Changes in v2:
> - correct commit message
> 
> Patrick Delaunay (2):
>   mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported
>   mtd: spi: nor: force mtd name to "nor%d"
> 
>  drivers/mtd/spi/spi-nor-core.c | 17 ++++++++++++++---
>  include/dm/device.h            |  3 ++-
>  include/linux/mtd/spi-nor.h    |  2 ++
>  include/mtd.h                  |  4 ++++
>  include/mtd/cfi_flash.h        |  8 +++++++-
>  5 files changed, 29 insertions(+), 5 deletions(-)
> 



More information about the U-Boot mailing list