layerscape: add 64b/32b target for ls1012ardb device
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 1077-mtd-add-get-set-of_node-flash_node-helpers.patch
1 From a2f87e7df641b482e217f5b0efbaf41f6b8a0cf6 Mon Sep 17 00:00:00 2001
2 From: Brian Norris <computersforpeace@gmail.com>
3 Date: Fri, 30 Oct 2015 20:33:20 -0700
4 Subject: [PATCH 077/113] mtd: add get/set of_node/flash_node helpers
5
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.
10
11 commit:28b8b26b308e656edfa9467867d5f79212da2ec3
12 delete the include/linux/mtd/nand.h
13 just upgrade the code about spi.
14
15 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
16 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
17 Signed-off-by: Yuan Yao <yao.yuan@nxp.com>
18 ---
19 include/linux/mtd/mtd.h | 11 +++++++++++
20 include/linux/mtd/spi-nor.h | 11 +++++++++++
21 2 files changed, 22 insertions(+)
22
23 --- a/include/linux/mtd/mtd.h
24 +++ b/include/linux/mtd/mtd.h
25 @@ -258,6 +258,17 @@ struct mtd_info {
26 int usecount;
27 };
28
29 +static inline void mtd_set_of_node(struct mtd_info *mtd,
30 + struct device_node *np)
31 +{
32 + mtd->dev.of_node = np;
33 +}
34 +
35 +static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
36 +{
37 + return mtd->dev.of_node;
38 +}
39 +
40 int mtd_erase(struct mtd_info *mtd, struct erase_info *instr);
41 int mtd_point(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen,
42 void **virt, resource_size_t *phys);
43 --- a/include/linux/mtd/spi-nor.h
44 +++ b/include/linux/mtd/spi-nor.h
45 @@ -184,6 +184,17 @@ struct spi_nor {
46 void *priv;
47 };
48
49 +static inline void spi_nor_set_flash_node(struct spi_nor *nor,
50 + struct device_node *np)
51 +{
52 + nor->flash_node = np;
53 +}
54 +
55 +static inline struct device_node *spi_nor_get_flash_node(struct spi_nor *nor)
56 +{
57 + return nor->flash_node;
58 +}
59 +
60 /**
61 * spi_nor_scan() - scan the SPI NOR
62 * @nor: the spi_nor structure