summaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch')
-rw-r--r--target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch19
1 files changed, 9 insertions, 10 deletions
diff --git a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch
index 163bafdb2e..2f83b23e80 100644
--- a/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch
+++ b/target/linux/ath79/patches-6.1/400-mtd-nor-support-mtd-name-from-device-tree.patch
@@ -10,18 +10,17 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
-@@ -3107,6 +3107,7 @@ int spi_nor_scan(struct spi_nor *nor, co
- struct device *dev = nor->dev;
+@@ -2941,12 +2941,19 @@ static void spi_nor_set_mtd_info(struct
+ {
struct mtd_info *mtd = &nor->mtd;
- struct device_node *np = spi_nor_get_flash_node(nor);
+ struct device *dev = nor->dev;
++ struct device_node *np = spi_nor_get_flash_node(nor);
+ const char __maybe_unused *of_mtd_name = NULL;
- int ret;
- int i;
-@@ -3161,7 +3162,12 @@ int spi_nor_scan(struct spi_nor *nor, co
- if (ret)
- return ret;
+ spi_nor_set_mtd_locking_ops(nor);
+ spi_nor_set_mtd_otp_ops(nor);
+ mtd->dev.parent = dev;
- if (!mtd->name)
+#ifdef CONFIG_MTD_OF_PARTS
+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
@@ -30,11 +29,11 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
+ mtd->name = of_mtd_name;
+ else if (!mtd->name)
mtd->name = dev_name(dev);
- mtd->priv = nor;
mtd->type = MTD_NORFLASH;
+ mtd->flags = MTD_CAP_NORFLASH;
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
-@@ -847,6 +847,17 @@ out_error:
+@@ -840,6 +840,17 @@ out_error:
*/
static void mtd_set_dev_defaults(struct mtd_info *mtd)
{