kernel: bump 5.4 to 5.4.156
[openwrt/staging/wigyori.git] / target / linux / pistachio / patches-5.4 / 401-mtd-nor-support-mtd-name-from-device-tree.patch
index 065a0b77bcd931766a53c76dffcf2621304c47d7..cdf0e49b21cfe520fa2662cf53f2b7f32506fa32 100644 (file)
@@ -10,17 +10,17 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
 
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -2671,6 +2671,7 @@ int spi_nor_scan(struct spi_nor *nor, co
-       struct device *dev = nor->dev;
+@@ -4939,6 +4939,7 @@ int spi_nor_scan(struct spi_nor *nor, co
        struct mtd_info *mtd = &nor->mtd;
        struct device_node *np = spi_nor_get_flash_node(nor);
+       struct spi_nor_flash_parameter *params = &nor->params;
 +      const char __maybe_unused *of_mtd_name = NULL;
        int ret;
        int i;
  
-@@ -2746,7 +2747,12 @@ int spi_nor_scan(struct spi_nor *nor, co
-               spi_nor_wait_till_ready(nor);
-       }
+@@ -5001,7 +5002,12 @@ int spi_nor_scan(struct spi_nor *nor, co
+       /* Init flash parameters based on flash_info struct and SFDP */
+       spi_nor_init_params(nor);
  
 -      if (!mtd->name)
 +#ifdef CONFIG_MTD_OF_PARTS
@@ -32,3 +32,23 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
                mtd->name = dev_name(dev);
        mtd->priv = nor;
        mtd->type = MTD_NORFLASH;
+--- a/drivers/mtd/mtdcore.c
++++ b/drivers/mtd/mtdcore.c
+@@ -779,6 +779,17 @@ out_error:
+  */
+ static void mtd_set_dev_defaults(struct mtd_info *mtd)
+ {
++#ifdef CONFIG_MTD_OF_PARTS
++      const char __maybe_unused *of_mtd_name = NULL;
++      struct device_node *np;
++
++      np = mtd_get_of_node(mtd);
++      if (np && !mtd->name) {
++              of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
++              if (of_mtd_name)
++                      mtd->name = of_mtd_name;
++      } else
++#endif
+       if (mtd->dev.parent) {
+               if (!mtd->owner && mtd->dev.parent->driver)
+                       mtd->owner = mtd->dev.parent->driver->owner;