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

Marek Behún marek.behun at nic.cz
Sat Sep 25 02:12:00 CEST 2021


On Fri, 24 Sep 2021 22:09:15 +0200
Marek Vasut <marex at denx.de> wrote:

> I have a feeling the discussion is again banking toward "mtdparts" and 
> "DT", which really is a solved problem, or at least we agreed upon the 
> solution.

I was trying to explain to Patrick how he can convert the ST board so
that the mtd partitions will be defined in DT and board code won't need
mtdids if he also converts to distro boot correctly.

> The patch is trying to fix MTDIDS and their look up in 
> get_mtd_device_nm(). This is all U-Boot stuff, it has nothing to do with 
> passing mtd partitions to Linux at all.

The solution here is to get rid of MTDIDS also. But I guess this will
take some time, so it does make sense for get_mtd_device_nm() to
return the same device as previously when given argument "norN".

The reason why I put SPI NOR name into mtd->name was because otherwise
the `mtd list` command did not print that name anywhere (since it
doesn't know how, because that SPI-NOR data are private for the
jedec_spi_nor driver).

Since
- every mtd device has mtd->type, for NOR flash this is MTD_NORFLASH
- we can iterate mtd devices in order they were registered
  (mtd_for_each_device does this)
we can easily implement a function
  get_mtd_device_by_type_and_id()
that, when given string "norN" will find the N-th mtd device of type
MTD_NORFLASH.

This function could than be called from get_mtd_device_nm() if
everything failed, or in some other way.

Tom, Marek, Patrick, what do you think?

Marek


More information about the U-Boot mailing list