mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-21 04:00:25 +09:00
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> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
This commit is contained in:
parent
ca040d8512
commit
9bfc3fde9c
@ -21,6 +21,9 @@
|
|||||||
#include <mtd/mtd-abi.h>
|
#include <mtd/mtd-abi.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <div64.h>
|
#include <div64.h>
|
||||||
|
#if IS_ENABLED(CONFIG_DM)
|
||||||
|
#include <dm/device.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_MTD_DEVICES 32
|
#define MAX_MTD_DEVICES 32
|
||||||
#endif
|
#endif
|
||||||
@ -306,6 +309,31 @@ struct mtd_info {
|
|||||||
int usecount;
|
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,
|
int mtd_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||||
struct mtd_oob_region *oobecc);
|
struct mtd_oob_region *oobecc);
|
||||||
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,
|
int mtd_ooblayout_find_eccregion(struct mtd_info *mtd, int eccbyte,
|
||||||
|
Loading…
Reference in New Issue
Block a user