summaryrefslogtreecommitdiff
path: root/test/dm/test-fdt.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-12-30 07:19:28 +0300
committerSimon Glass <sjg@chromium.org>2020-01-08 02:02:39 +0300
commit42a0ce576f33ad413662e7178f05db2f36de9896 (patch)
treeaf97557d5426841d06a5942688ed3621dfc2e514 /test/dm/test-fdt.c
parentaf68411dd1e9ef69ada074963333a5a5b8e278a4 (diff)
downloadu-boot-42a0ce576f33ad413662e7178f05db2f36de9896.tar.xz
dm: devres: Add a new OFDATA phase
Since the ofdata_to_platdata() method can allocate resources, add it as a new devres phase. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm/test-fdt.c')
-rw-r--r--test/dm/test-fdt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index bbac37761d..d59c449ce0 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -159,6 +159,7 @@ struct dm_testdevres_pdata {
struct dm_testdevres_priv {
void *ptr;
+ void *ptr_ofdata;
};
static int testdevres_drv_bind(struct udevice *dev)
@@ -170,6 +171,15 @@ static int testdevres_drv_bind(struct udevice *dev)
return 0;
}
+static int testdevres_drv_ofdata_to_platdata(struct udevice *dev)
+{
+ struct dm_testdevres_priv *priv = dev_get_priv(dev);
+
+ priv->ptr_ofdata = devm_kmalloc(dev, TEST_DEVRES_SIZE3, 0);
+
+ return 0;
+}
+
static int testdevres_drv_probe(struct udevice *dev)
{
struct dm_testdevres_priv *priv = dev_get_priv(dev);
@@ -189,6 +199,7 @@ U_BOOT_DRIVER(testdevres_drv) = {
.of_match = testdevres_ids,
.id = UCLASS_TEST_DEVRES,
.bind = testdevres_drv_bind,
+ .ofdata_to_platdata = testdevres_drv_ofdata_to_platdata,
.probe = testdevres_drv_probe,
.platdata_auto_alloc_size = sizeof(struct dm_testdevres_pdata),
.priv_auto_alloc_size = sizeof(struct dm_testdevres_priv),