[PATCH] mtd: cfi_mtd: populate mtd->dev with flash_info->dev

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 ---
drivers/mtd/cfi_mtd.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/mtd/cfi_mtd.c b/drivers/mtd/cfi_mtd.c index 2295bb7220..1475461a59 100644 --- a/drivers/mtd/cfi_mtd.c +++ b/drivers/mtd/cfi_mtd.c @@ -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;

On 12/3/21 10:27, Patrice Chotard wrote:
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
Thanks, Stefan

On 12/3/21 10:27, Patrice Chotard wrote:
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
Applied to u-boot-cfi-flash/master
Thanks, Stefan
participants (2)
-
Patrice Chotard
-
Stefan Roese