1 From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001
2 From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
3 Date: Sat, 25 Feb 2017 16:42:50 +0000
4 Subject: mtd: nor: support mtd name from device tree
6 Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
8 drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
9 1 file changed, 7 insertions(+), 1 deletion(-)
11 --- a/drivers/mtd/spi-nor/spi-nor.c
12 +++ b/drivers/mtd/spi-nor/spi-nor.c
13 @@ -2667,6 +2667,7 @@ int spi_nor_scan(struct spi_nor *nor, co
14 struct device *dev = nor->dev;
15 struct mtd_info *mtd = &nor->mtd;
16 struct device_node *np = spi_nor_get_flash_node(nor);
17 + const char __maybe_unused *of_mtd_name = NULL;
21 @@ -2742,7 +2743,12 @@ int spi_nor_scan(struct spi_nor *nor, co
22 spi_nor_wait_till_ready(nor);
26 +#ifdef CONFIG_MTD_OF_PARTS
27 + of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
30 + mtd->name = of_mtd_name;
31 + else if (!mtd->name)
32 mtd->name = dev_name(dev);
34 mtd->type = MTD_NORFLASH;