Skip to content
  • Patrick Delaunay's avatar
    mtd: spi: nor: force mtd name to "nor%d" · a4f2d834
    Patrick Delaunay authored and Tom Rini's avatar Tom Rini committed
    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 ...
    a4f2d834