of_path: Allow pointing directly to the partition
We could only point to partitions in the device tree by using &norflash, "partname:barebox-environment". Allow to point to the partition directly without having to parse the partition labels. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
3f68a7698d
commit
35eb06510b
2 changed files with 12 additions and 7 deletions
|
@ -8,8 +8,9 @@ Required properties:
|
||||||
* ``compatible``: should be ``barebox,environment``
|
* ``compatible``: should be ``barebox,environment``
|
||||||
* ``device-path``: path to the environment
|
* ``device-path``: path to the environment
|
||||||
|
|
||||||
The device-path is a multistring property. The first string should be a
|
The device-path is a multistring property. The first string should contain
|
||||||
nodepath to the node containing the physical device of the environment.
|
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 <type>:<options> to further describe
|
The subsequent strings are of the form <type>:<options> to further describe
|
||||||
the path to the environment. Supported values for <type>:
|
the path to the environment. Supported values for <type>:
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,8 @@ out:
|
||||||
* @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available
|
* @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
|
* 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 "<type>:<options>". Currently supported
|
* The remaining strings have the form "<type>:<options>". Currently supported
|
||||||
* for <type> are:
|
* for <type> are:
|
||||||
*
|
*
|
||||||
|
@ -129,6 +130,7 @@ out:
|
||||||
*
|
*
|
||||||
* device-path = &mmc0, "partname:0";
|
* device-path = &mmc0, "partname:0";
|
||||||
* device-path = &norflash, "partname:barebox-environment";
|
* 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)
|
int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags)
|
||||||
{
|
{
|
||||||
|
@ -147,13 +149,15 @@ int of_find_path(struct device_node *node, const char *propname, char **outpath,
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
op.dev = of_find_device_by_node_path(rnode->full_name);
|
op.dev = of_find_device_by_node_path(rnode->full_name);
|
||||||
|
if (!op.dev) {
|
||||||
|
op.dev = of_find_device_by_node_path(rnode->parent->full_name);
|
||||||
if (!op.dev)
|
if (!op.dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
device_detect(op.dev);
|
device_detect(op.dev);
|
||||||
|
|
||||||
if (list_is_singular(&op.dev->cdevs))
|
op.cdev = cdev_by_device_node(rnode);
|
||||||
op.cdev = list_first_entry(&op.dev->cdevs, struct cdev, devices_list);
|
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue