diff mbox series

[U-Boot,01/18] mtd: add get/set of_node/flash_node helpers

Message ID 1552659287-11246-2-git-send-email-philippe.reynes@softathome.com
State Accepted
Delegated to: Tom Rini
Headers show
Series Initial support of driver brcmnand (from kernel 4.18) | expand

Commit Message

Philippe REYNES March 15, 2019, 2:14 p.m. UTC
From: Brian Norris <computersforpeace@gmail.com>

Linux commit 28b8b26b308 ("mtd: add get/set of_node/flash_node helpers")

We are going to begin using the mtd->dev.of_node field for MTD device
nodes, so let's add helpers for it. Also, we'll be making some
conversions on spi_nor (and nand_chip eventually) too, so get that ready
with their own helpers.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[Philippe Reynes: only add function nand_set_flash_node and
nand_get_flash_node because others were already backported]

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 include/linux/mtd/rawnand.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Tom Rini April 24, 2019, 1:23 p.m. UTC | #1
On Fri, Mar 15, 2019 at 03:14:30PM +0100, Philippe Reynes wrote:

> From: Brian Norris <computersforpeace@gmail.com>
> 
> Linux commit 28b8b26b308 ("mtd: add get/set of_node/flash_node helpers")
> 
> We are going to begin using the mtd->dev.of_node field for MTD device
> nodes, so let's add helpers for it. Also, we'll be making some
> conversions on spi_nor (and nand_chip eventually) too, so get that ready
> with their own helpers.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> [Philippe Reynes: only add function nand_set_flash_node and
> nand_get_flash_node because others were already backported]
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 9f5dc81..e2bd598 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -15,6 +15,7 @@ 
 
 #include <config.h>
 
+#include <dm/device.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/flashchip.h>
@@ -961,6 +962,17 @@  struct nand_chip {
 	void *priv;
 };
 
+static inline void nand_set_flash_node(struct nand_chip *chip,
+				       ofnode node)
+{
+	chip->flash_node = ofnode_to_offset(node);
+}
+
+static inline ofnode nand_get_flash_node(struct nand_chip *chip)
+{
+	return offset_to_ofnode(chip->flash_node);
+}
+
 static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
 {
 	return container_of(mtd, struct nand_chip, mtd);