summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/board
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox/board')
-rw-r--r--arch/sandbox/board/hostfile.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index 745f078d1a..e5a7580d07 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -84,15 +84,16 @@ static int hf_probe(struct device_d *dev)
if (!dev->device_node)
return -ENODEV;
- err = of_property_read_u32(dev->device_node, "barebox,fd", &priv->fd);
- if (err)
- return err;
+ of_property_read_u32(dev->device_node, "barebox,fd", &priv->fd);
err = of_property_read_string(dev->device_node, "barebox,filename",
&priv->filename);
if (err)
return err;
+ if (!priv->fd)
+ priv->fd = linux_open(priv->filename, true);
+
priv->cdev.name = dev->device_node->name;
priv->cdev.dev = dev;
priv->cdev.ops = &hf_fops;
@@ -101,7 +102,14 @@ static int hf_probe(struct device_d *dev)
dev->info = hf_info;
dev->priv = priv;
- return devfs_create(&priv->cdev);
+ err = devfs_create(&priv->cdev);
+ if (err)
+ return err;
+
+ of_parse_partitions(&priv->cdev, dev->device_node);
+ of_partitions_register_fixup(&priv->cdev);
+
+ return 0;
}
static __maybe_unused struct of_device_id hostfile_dt_ids[] = {