aboutsummaryrefslogtreecommitdiff
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-19 10:40:00 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:41 -0700
commite2a7cfe9d5fce65789972a31ff50fb1d8d509848 (patch)
tree085b2ec36757a215d7f9ed647af5a5c6aa09f149 /include/linux/mtd
parenta53f6fad7ea20f6ccde21f68e3b44ab7fe8bf6cd (diff)
downloadu-boot-e2a7cfe9d5fce65789972a31ff50fb1d8d509848.zip
u-boot-e2a7cfe9d5fce65789972a31ff50fb1d8d509848.tar.gz
u-boot-e2a7cfe9d5fce65789972a31ff50fb1d8d509848.tar.bz2
spi: Tidy up get/set of device node
This code is a bit odd in that it only reads and updates the livetree version of the device ofnode. This means it won't work with flattree. Update the code to work as it was presumably intended. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/mtd.h9
-rw-r--r--include/linux/mtd/nand.h14
-rw-r--r--include/linux/mtd/spi-nor.h2
-rw-r--r--include/linux/mtd/spinand.h15
4 files changed, 35 insertions, 5 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 1b91517..54d03d0 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -332,15 +332,14 @@ struct mtd_info {
};
#if IS_ENABLED(CONFIG_DM)
-static inline void mtd_set_of_node(struct mtd_info *mtd,
- const struct device_node *np)
+static inline void mtd_set_ofnode(struct mtd_info *mtd, ofnode node)
{
- mtd->dev->node.np = np;
+ mtd->dev->node = node;
}
-static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
+static inline const ofnode mtd_get_ofnode(struct mtd_info *mtd)
{
- return mtd->dev->node.np;
+ return mtd->dev->node;
}
#else
struct device_node;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 13e8dd1..7774c17 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -389,6 +389,7 @@ static inline int nanddev_unregister(struct nand_device *nand)
return mtd_device_unregister(nand->mtd);
}
+#ifndef __UBOOT__
/**
* nanddev_set_of_node() - Attach a DT node to a NAND device
* @nand: NAND device
@@ -412,6 +413,19 @@ static inline const struct device_node *nanddev_get_of_node(struct nand_device *
{
return mtd_get_of_node(nand->mtd);
}
+#else
+/**
+ * nanddev_set_of_node() - Attach a DT node to a NAND device
+ * @nand: NAND device
+ * @node: ofnode
+ *
+ * Attach a DT node to a NAND device.
+ */
+static inline void nanddev_set_ofnode(struct nand_device *nand, ofnode node)
+{
+ mtd_set_ofnode(nand->mtd, node);
+}
+#endif /* __UBOOT__ */
/**
* nanddev_offs_to_pos() - Convert an absolute NAND offset into a NAND position
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 233fdc3..2642bf9 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -352,6 +352,7 @@ struct spi_nor {
u32 erase_size;
};
+#ifndef __UBOOT__
static inline void spi_nor_set_flash_node(struct spi_nor *nor,
const struct device_node *np)
{
@@ -363,6 +364,7 @@ device_node *spi_nor_get_flash_node(struct spi_nor *nor)
{
return mtd_get_of_node(&nor->mtd);
}
+#endif /* __UBOOT__ */
/**
* struct spi_nor_hwcaps - Structure for describing the hardware capabilies
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 88bacde..15bcd59 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -412,6 +412,7 @@ spinand_to_nand(struct spinand_device *spinand)
return &spinand->base;
}
+#ifndef __UBOOT__
/**
* spinand_set_of_node - Attach a DT node to a SPI NAND device
* @spinand: SPI NAND device
@@ -424,6 +425,20 @@ static inline void spinand_set_of_node(struct spinand_device *spinand,
{
nanddev_set_of_node(&spinand->base, np);
}
+#else
+/**
+ * spinand_set_of_node - Attach a DT node to a SPI NAND device
+ * @spinand: SPI NAND device
+ * @node: ofnode
+ *
+ * Attach a DT node to a SPI NAND device.
+ */
+static inline void spinand_set_ofnode(struct spinand_device *spinand,
+ ofnode node)
+{
+ nanddev_set_ofnode(&spinand->base, node);
+}
+#endif /* __UBOOT__ */
int spinand_match_and_init(struct spinand_device *dev,
const struct spinand_info *table,