Skip to contentSkip to conversation

Add a "label" property to the mtd device

PATCH Applied Cédric Le Goater 4 participants 5 messages Feb 9, 2017 – Feb 10, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v3 cover Add a "label" property to the mtd device

Hello,

Herer are a couple of patches adding a "label" property to the mtd device, which can be used to identify a specific chip on a system with multiple chips. This is common on the OpenPower boards, there can be four chips holding the firmware for the BMC and the firmware for the host, plus chips with golden images for recovery.

Thanks,

C.

Changes since v2:

- only assign device name from label if mtd->name is undefined

Changes since v1:

- moved the use of the "label" property from mtd_set_dev_defaults() to mtd_set_of_node() to let drivers keep control on how mtd->name is set and allocated.

Cédric Le Goater (2):
mtd: name the mtd device with an optional label property
dt-bindings: mtd: add a common label property to all mtd devices

 Documentation/devicetree/bindings/mtd/common.txt | 15 +++++++++++++++
 include/linux/mtd/mtd.h                          |  3 +++
 2 files changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/common.txt
Signature · 6 lines
2.7.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

A message that is not in the archive (sent off-list or not yet received): 1486632068-14894-1-git-send-email-clg-Bxea+6Xhats@public.gmane.org

#2 lore raw

PATCH v3 1/2 mtd: name the mtd device with an optional label property

This can be used to easily identify a specific chip on a system with multiple chips.

---

Changes since v2:

- only assign device name from label if mtd->name is undefined

Changes since v1:

- moved the use of the "label" property from mtd_set_dev_defaults() to mtd_set_of_node() to let drivers keep control on how mtd->name is set and allocated.

 include/linux/mtd/mtd.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/mtd/mtd.h +3 -0
index 13f8052b9ff9..5a08ddff4f51 100644
@@ -24,6 +24,7 @@
 #include <linux/uio.h>
 #include <linux/notifier.h>
 #include <linux/device.h>
+#include <linux/of.h>
 
 #include <mtd/mtd-abi.h>
 
@@ -385,6 +386,8 @@ static inline void mtd_set_of_node(struct mtd_info *mtd,
 				   struct device_node *np)
 {
 	mtd->dev.of_node = np;
+	if (!mtd->name)
+		of_property_read_string(np, "label", &mtd->name);
 }
 
 static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH v3 2/2 dt-bindings: mtd: add a common label property to all mtd devices

In reply to Cédric Le Goater

This can be used to easily identify a specific chip on a system with multiple chips.

---
 Documentation/devicetree/bindings/mtd/common.txt | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/common.txt
Documentation/devicetree/bindings/mtd/common.txt new file +15 -0
new file mode 100644
index 000000000000..fc068b923d7a
@@ -0,0 +1,15 @@
+* Common properties of all MTD devices
+
+Optional properties:
+- label: user-defined MTD device name. Can be used to assign user
+  friendly names to MTD devices (instead of the flash model or flash
+  controller based name) in order to ease flash device identification
+  and/or describe what they are used for.
+
+Example:
+
+	flash@0 {
+		label = "System-firmware";
+
+		/* flash type specific properties */
+	};
Signature · 6 lines
2.7.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on the v3 series
#4 lore raw
In reply to Cédric Le Goater
Quoted 7 lines · Cédric Le Goater

Hello,

Herer are a couple of patches adding a "label" property to the mtd device, which can be used to identify a specific chip on a system with multiple chips. This is common on the OpenPower boards, there can be four chips holding the firmware for the BMC and the firmware for the host, plus chips with golden images for recovery.

Series is

Quoted 23 lines

Thanks,

C.

Changes since v2:

- only assign device name from label if mtd->name is undefined

Changes since v1:

- moved the use of the "label" property from mtd_set_dev_defaults() to mtd_set_of_node() to let drivers keep control on how mtd->name is set and allocated.

Cédric Le Goater (2):
mtd: name the mtd device with an optional label property
dt-bindings: mtd: add a common label property to all mtd devices

 Documentation/devicetree/bindings/mtd/common.txt | 15 +++++++++++++++
 include/linux/mtd/mtd.h                          |  3 +++
 2 files changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/common.txt
Signature · 6 lines
Best regards,
Marek Vasut

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Applied
#5 lore raw
Quoted 11 lines · Marek Vasut
Quoted 7 lines · Cédric Le Goater

Hello,

Herer are a couple of patches adding a "label" property to the mtd device, which can be used to identify a specific chip on a system with multiple chips. This is common on the OpenPower boards, there can be four chips holding the firmware for the BMC and the firmware for the host, plus chips with golden images for recovery.

Series is

Applied to l2-mtd.git.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/