diff --git a/Documentation/devicetree/bindings/barebox/barebox,environment.rst b/Documentation/devicetree/bindings/barebox/barebox,environment.rst index d472f66..d5e52ea 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,environment.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,environment.rst @@ -8,8 +8,9 @@ * ``compatible``: should be ``barebox,environment`` * ``device-path``: path to the environment -The device-path is a multistring property. The first string should be a -nodepath to the node containing the physical device of the environment. +The device-path is a multistring property. The first string should contain +a nodepath to the node containing the physical device of the environment or +a nodepath to a partition described by the OF partition binding. The subsequent strings are of the form : to further describe the path to the environment. Supported values for : diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index 2dc7848..992972c 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -117,7 +117,8 @@ * @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available * * paths in the devicetree have the form of a multistring property. The first - * string contains the full path to the physical device containing the path. + * string contains the full path to the physical device containing the path or + * a full path to a partition described by the OF partition binding. * The remaining strings have the form ":". Currently supported * for are: * @@ -129,6 +130,7 @@ * * device-path = &mmc0, "partname:0"; * device-path = &norflash, "partname:barebox-environment"; + * device-path = &environment_nor; */ int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags) { @@ -147,13 +149,15 @@ return -ENODEV; op.dev = of_find_device_by_node_path(rnode->full_name); - if (!op.dev) - return -ENODEV; + if (!op.dev) { + op.dev = of_find_device_by_node_path(rnode->parent->full_name); + if (!op.dev) + return -ENODEV; + } device_detect(op.dev); - if (list_is_singular(&op.dev->cdevs)) - op.cdev = list_first_entry(&op.dev->cdevs, struct cdev, devices_list); + op.cdev = cdev_by_device_node(rnode); i = 1;