]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mtd: cfi_mtd: populate mtd->dev with flash_info->dev
authorPatrice Chotard <patrice.chotard@foss.st.com>
Fri, 3 Dec 2021 09:27:44 +0000 (10:27 +0100)
committerStefan Roese <sr@denx.de>
Tue, 1 Feb 2022 09:56:25 +0000 (10:56 +0100)
Populate mtd->dev with flash_info->dev which allows to get
full mtd information using the "mtd list" command.
Before, "mtd list" command returns :

List of MTD devices:
* nor0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "nor0"

After this patch we get for example:

List of MTD devices:
* nor0
  - device: flash@0
  - parent: spi@40430000
  - driver: cfi_flash
  - path: /soc/spi@40430000/flash@0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "nor0"

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/mtd/cfi_mtd.c

index f998ffaf26f04eb5b40fd53b7fe63d49a82fbb81..bf4473ba9e8308e796f3b8f7f4d4cd3281c9ac10 100644 (file)
@@ -221,6 +221,9 @@ int cfi_mtd_init(void)
                        continue;
 
                sprintf(cfi_mtd_names[i], "nor%d", i);
+#ifdef CONFIG_CFI_FLASH
+               mtd->dev                = fi->dev;
+#endif
                mtd->name               = cfi_mtd_names[i];
                mtd->type               = MTD_NORFLASH;
                mtd->flags              = MTD_CAP_NORFLASH;