|
@@ -21,6 +21,9 @@
|
|
|
#include <mtd/mtd-abi.h>
|
|
|
#include <linux/errno.h>
|
|
|
#include <div64.h>
|
|
|
+#if IS_ENABLED(CONFIG_DM)
|
|
|
+#include <dm/device.h>
|
|
|
+#endif
|
|
|
|
|
|
#define MAX_MTD_DEVICES 32
|
|
|
#endif
|
|
@@ -306,6 +309,31 @@ struct mtd_info {
|
|
|
int usecount;
|
|
|
};
|
|
|
|
|
|
+#if IS_ENABLED(CONFIG_DM)
|
|
|
+static inline void mtd_set_of_node(struct mtd_info *mtd,
|
|
|
+ const struct device_node *np)
|
|
|
+{
|
|
|
+ mtd->dev->node.np = np;
|
|
|
+}
|
|
|
+
|
|
|
+static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
|
|
|
+{
|
|
|
+ return mtd->dev->node.np;
|
|
|
+}
|
|
|
+#else
|
|
|
+struct device_node;
|
|
|
+
|
|
|
+static inline void mtd_set_of_node(struct mtd_info *mtd,
|
|
|
+ const struct device_node *np)
|
|
|
+{
|
|
|
+}
|
|
|
+
|
|
|
+static inline const struct device_node *mtd_get_of_node(struct mtd_info *mtd)
|
|
|
+{
|
|
|
+ return NULL;
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
|
struct mtd_oob_region *oobecc);
|
|
|
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,
|