diff options
| author | Tom Rini <[email protected]> | 2023-04-28 19:00:01 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-04-28 19:00:01 -0400 |
| commit | 076f13308c6f06e2c4feb8b408e997bc732586e1 (patch) | |
| tree | 412d95d550e2e03214f48c89db608c57886e0995 /drivers/core | |
| parent | c9c2c95d4cd27fe0cd41fe13a863899d268f973c (diff) | |
| parent | f43fc16812487289e98389f0f643d20c444f9c9c (diff) | |
Merge tag 'dm-pull-28apr23' of https://source.denx.de/u-boot/custodians/u-boot-dm
sandbox and fdt bug fixes / tweaks
various other minor fixes
Diffstat (limited to 'drivers/core')
| -rw-r--r-- | drivers/core/fdtaddr.c | 6 | ||||
| -rw-r--r-- | drivers/core/of_access.c | 2 | ||||
| -rw-r--r-- | drivers/core/uclass.c | 50 |
3 files changed, 31 insertions, 27 deletions
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 91bcd1a2c21..b9b0c28852f 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -12,6 +12,7 @@ #include <dm.h> #include <fdt_support.h> #include <log.h> +#include <mapmem.h> #include <asm/global_data.h> #include <asm/io.h> #include <dm/device-internal.h> @@ -97,7 +98,10 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index) { fdt_addr_t addr = devfdt_get_addr_index(dev, index); - return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr; + if (addr == FDT_ADDR_T_NONE) + return NULL; + + return map_sysmem(addr, 0); } fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 85f7da5a499..81a307992c0 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -33,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR; /* list of struct alias_prop aliases */ -LIST_HEAD(aliases_lookup); +static LIST_HEAD(aliases_lookup); /* "/aliaes" node */ static struct device_node *of_aliases; diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 1762a0796db..e46d5717aa6 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -411,18 +411,14 @@ done: } #if CONFIG_IS_ENABLED(OF_REAL) -int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, - const char *name, struct udevice **devp) +static int uclass_find_device_by_phandle_id(enum uclass_id id, + uint find_phandle, + struct udevice **devp) { struct udevice *dev; struct uclass *uc; - int find_phandle; int ret; - *devp = NULL; - find_phandle = dev_read_u32_default(parent, name, -1); - if (find_phandle <= 0) - return -ENOENT; ret = uclass_get(id, &uc); if (ret) return ret; @@ -440,6 +436,19 @@ int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, return -ENODEV; } + +int uclass_find_device_by_phandle(enum uclass_id id, struct udevice *parent, + const char *name, struct udevice **devp) +{ + int find_phandle; + + *devp = NULL; + find_phandle = dev_read_u32_default(parent, name, -1); + if (find_phandle <= 0) + return -ENOENT; + + return uclass_find_device_by_phandle_id(id, find_phandle, devp); +} #endif int uclass_get_device_by_driver(enum uclass_id id, @@ -535,31 +544,22 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, return uclass_get_device_tail(dev, ret, devp); } -#if CONFIG_IS_ENABLED(OF_CONTROL) +#if CONFIG_IS_ENABLED(OF_REAL) +int uclass_get_device_by_of_path(enum uclass_id id, const char *path, + struct udevice **devp) +{ + return uclass_get_device_by_ofnode(id, ofnode_path(path), devp); +} + int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id, struct udevice **devp) { struct udevice *dev; - struct uclass *uc; int ret; *devp = NULL; - ret = uclass_get(id, &uc); - if (ret) - return ret; - - uclass_foreach_dev(dev, uc) { - uint phandle; - - phandle = dev_read_phandle(dev); - - if (phandle == phandle_id) { - *devp = dev; - return uclass_get_device_tail(dev, ret, devp); - } - } - - return -ENODEV; + ret = uclass_find_device_by_phandle_id(id, phandle_id, &dev); + return uclass_get_device_tail(dev, ret, devp); } int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent, |
