1 From 3ed29e95facfd50427721f8e9093dc36c2304e42 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 22 Mar 2016 03:52:07 +0100
4 Subject: [PATCH 56/81] mtd: add get/set of_node/flash_node helpers
6 We are going to begin using the mtd->dev.of_node field for MTD device
7 nodes, so let's add helpers for it. Also, we'll be making some
8 conversions on spi_nor (and nand_chip eventually) too, so get that ready
9 with their own helpers.
11 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
12 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
14 include/linux/mtd/mtd.h | 11 +++++++++++
15 include/linux/mtd/nand.h | 11 +++++++++++
16 include/linux/mtd/spi-nor.h | 11 +++++++++++
17 3 files changed, 33 insertions(+)
19 --- a/include/linux/mtd/mtd.h
20 +++ b/include/linux/mtd/mtd.h
21 @@ -258,6 +258,17 @@ struct mtd_info {
25 +static inline void mtd_set_of_node(struct mtd_info *mtd,
26 + struct device_node *np)
28 + mtd->dev.of_node = np;
31 +static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
33 + return mtd->dev.of_node;
36 int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
37 int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
38 void **virt, resource_size_t *phys);
39 --- a/include/linux/mtd/nand.h
40 +++ b/include/linux/mtd/nand.h
41 @@ -741,6 +741,17 @@ static inline void nand_set_controller_d
45 +static inline void nand_set_flash_node(struct nand_chip *chip,
46 + struct device_node *np)
48 + chip->flash_node = np;
51 +static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
53 + return chip->flash_node;
57 * NAND Flash Manufacturer ID Codes
59 --- a/include/linux/mtd/spi-nor.h
60 +++ b/include/linux/mtd/spi-nor.h
61 @@ -184,6 +184,17 @@ struct spi_nor {
65 +static inline void spi_nor_set_flash_node(struct spi_nor *nor,
66 + struct device_node *np)
68 + nor->flash_node = np;
71 +static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
73 + return nor->flash_node;
77 * spi_nor_scan() - scan the SPI NOR
78 * @nor: the spi_nor structure