forked from grobian/openwrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pistachio: Add mtd device name from dts
Parse the "linux,mtd-name" property also for SPI NAND flashes. Signed-off-by: Hauke Mehrtens <[email protected]>
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,23 @@ Signed-off-by: Abhimanyu Vishwakarma <[email protected]> | |
mtd->name = dev_name(dev); | ||
mtd->priv = nor; | ||
mtd->type = MTD_NORFLASH; | ||
--- a/drivers/mtd/mtdcore.c | ||
+++ b/drivers/mtd/mtdcore.c | ||
@@ -778,6 +778,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; |