u-boot/include/dm
Patrick Delaunay a4f2d83414 mtd: spi: nor: force mtd name to "nor%d"
Force the mtd name of spi-nor to "nor" + the driver sequence number:
"nor0", "nor1"... beginning after the existing nor devices.

This patch is coherent with existing "nand" and "spi-nand"
mtd device names.

When CFI MTD NOR device are supported, the spi-nor index is chosen after
the last CFI device defined by CONFIG_SYS_MAX_FLASH_BANKS.

When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated, this config
is replaced by to cfi_flash_num_flash_banks in the include file
mtd/cfi_flash.h.

This generic name "nor%d" can be use to identify the mtd spi-nor device
without knowing the real device name or the DT path of the device,
used with API get_mtd_device_nm() and is used in mtdparts command.

This patch also avoids issue when the same NOR device is present 2 times,
for example on STM32MP15F-EV1:

STM32MP> mtd list
SF: Detected mx66l51235l with page size 256 Bytes, erase size 64 KiB, \
total 64 MiB

List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x40000 bytes
  - min I/O: 0x1000 bytes
  - OOB size: 224 bytes
  - OOB available: 118 bytes
  - ECC strength: 8 bits
  - ECC step size: 512 bytes
  - bitflip threshold: 6 bits
  - 0x000000000000-0x000040000000 : "nand0"
* mx66l51235l
  - device: mx66l51235l@0
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@0
  - type: NOR flash
  - block size: 0x10000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "mx66l51235l"
* mx66l51235l
  - device: mx66l51235l@1
  - parent: spi@58003000
  - driver: jedec_spi_nor
  - path: /soc/spi@58003000/mx66l51235l@1
  - type: NOR flash
  - block size: 0x10000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "mx66l51235l"

The same mtd name "mx66l51235l" identify the 2 instances
mx66l51235l@0 and mx66l51235l@1.

This patch fixes a ST32CubeProgrammer / stm32prog command issue
with nor0 target on STM32MP157C-EV1 board introduced by
commit b7f060565e ("mtd: spi-nor: allow registering multiple MTDs when
DM is enabled").

Fixes: b7f060565e ("mtd: spi-nor: allow registering multiple MTDs when DM is enabled")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
[trini: Add <dm/device.h> to <mtd.h> for DM_MAX_SEQ_STR]
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-09-28 12:03:20 -04:00
..
platform_data dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
acpi.h common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
device-internal.h dm: core: Add warnings to private / platform setters 2021-03-26 17:03:09 +13:00
device.h mtd: spi: nor: force mtd name to "nor%d" 2021-09-28 12:03:20 -04:00
device_compat.h dm: Don't undefine dev_xxx macros 2020-10-16 09:44:27 -04:00
devres.h dm: core: Require users of devres to include the header 2020-02-05 19:33:46 -07:00
fdtaddr.h dm: core: Use const device for the devfdt...() interface 2020-02-05 19:33:45 -07:00
lists.h dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO() 2021-01-05 12:26:35 -07:00
of.h dm: Avoid using #ifdef for CONFIG_OF_LIVE 2020-10-29 14:42:17 -06:00
of_access.h dm: add cells_count parameter in *_count_phandle_with_args 2020-10-06 09:07:54 -06:00
of_addr.h dm: Introduce xxx_get_dma_range() 2021-02-18 11:56:25 +01:00
of_extra.h of: extra: Introduce ofnode_phy_is_fixed_link() API 2021-04-15 14:22:17 +05:30
ofnode.h dm: core: Add helper to compare node names 2021-07-27 10:56:53 +05:30
pci.h dm: treewide: Rename 'platdata' variables to just 'plat' 2020-12-13 16:51:08 -07:00
pinctrl.h cmd: pinmux: update result of do_status 2021-07-23 07:13:25 -04:00
platdata.h dm: core: Drop device_get_by_driver_info() 2021-03-26 17:03:08 +13:00
read.h dm: Introduce xxx_get_dma_range() 2021-02-18 11:56:25 +01:00
root.h dm: core: Adjust uclass setup with of-platdata 2021-03-22 19:23:28 +13:00
simple_bus.h dm: core: Correctly read <ranges> of simple-bus 2021-04-15 14:22:17 +05:30
test.h Prepare v2021.04-rc5 2021-03-29 18:00:21 -04:00
uclass-id.h dm: crypto: Define UCLASS API for ECDSA signature verification 2021-08-16 10:49:35 +02:00
uclass-internal.h dm: core: Add warnings to private / platform setters 2021-03-26 17:03:09 +13:00
uclass.h dm: core: Don't allow uclass use before ready 2021-08-08 11:27:27 -06:00
util.h dm: migrate the dm_warn to use the log macro 2021-08-08 11:27:27 -06:00