
On Thu, 16 Sep 2021 16:01:18 +0200 Patrick Delaunay patrick.delaunay@foss.st.com wrote:
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:
This is an unfortunate hack :( This is another reason why the whole mtd subsystem should be refactored.