| #
1f383ee4 |
| 12-Oct-2022 |
Michal Suchanek <msuchanek@suse.de> |
UPSTREAM: dm: core: Do not stop uclass iteration on error
When probing a device fails NULL pointer is returned, and following devices in uclass list cannot be iterated. Skip to next device on error
UPSTREAM: dm: core: Do not stop uclass iteration on error
When probing a device fails NULL pointer is returned, and following devices in uclass list cannot be iterated. Skip to next device on error instead.
With that the only condition under which these simple iteration functions return error is when the dm is not initialized at uclass_get time. This is not all that interesting, change return type to void.
Fixes: 6494d708bf ("dm: Add base driver model support") Change-Id: Ie327dc21db7ee80f9fc32e7913be2af71bb074a7 Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit f21954750aa8ed445ab83998bb099e366136c428) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
d1cab63e |
| 12-Oct-2022 |
Michal Suchanek <msuchanek@suse.de> |
UPSTREAM: dm: core: Switch uclass_*_device_err to use uclass_*_device_check
The _err variant iterators use the simple iterators without suffix as basis.
However, there is no user that uclass_next_d
UPSTREAM: dm: core: Switch uclass_*_device_err to use uclass_*_device_check
The _err variant iterators use the simple iterators without suffix as basis.
However, there is no user that uclass_next_device_err for iteration, many users of uclass_first_device_err use it to get the first and (assumed) only device of an uclass, and a couple that use uclass_next_device_err to get the device following a known device in the uclass list.
While there are some truly singleton device classes in which more than one device cannot exist these are quite rare, and most classes can have multiple devices even if it is not the case on the SoC's EVB.
In a later patch the simple iterators will be updated to not stop on error and return next device instead. With this in many cases the code that expects the first device or an error if it fails to probe may get the next device instead. Use the _check iterators as the basis of _err iterators to preserve the old behavior.
Change-Id: Ia4a249c906a12db0cda69d44097a4fd3682d2ed9 Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit e44d7e73fe0d649693d8d0a110cd7632bc919273) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
771aadba |
| 06-Feb-2020 |
Simon Glass <sjg@chromium.org> |
UPSTREAM: dm: core: Add a function to find a device by drvdata
It is sometimes useful to find a device in a uclass using only its driver data. The driver data often indicates the 'subtype' of the de
UPSTREAM: dm: core: Add a function to find a device by drvdata
It is sometimes useful to find a device in a uclass using only its driver data. The driver data often indicates the 'subtype' of the device, e,g, via its compatible string.
Add a function to handle this.
Change-Id: I6668a2a29c29346f57d3d975838459c0ac90fdea Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> (cherry picked from commit 50162348f0d3b915004733131acd81805e202c76) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
2c3c84fc |
| 06-Feb-2020 |
Simon Glass <sjg@chromium.org> |
UPSTREAM: dm: core: Allow iterating devices without uclass_get()
At present we have uclass_foreach_dev() which requires that uclass_get() be called beforehand to find the uclass. This is good if we
UPSTREAM: dm: core: Allow iterating devices without uclass_get()
At present we have uclass_foreach_dev() which requires that uclass_get() be called beforehand to find the uclass. This is good if we suspect that that function might fail, but often we know that the uclass is available.
Add a new helper which does this uclass_get() automatically, so that only the uclass ID is needed.
Change-Id: I3106b199653bf8a32d2d1a0025b77261881716fc Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> (cherry picked from commit 3cf0fba4ff862d833545f82fb2209ff3c79d17b5) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
563bfcf9 |
| 24-Oct-2018 |
Patrice Chotard <patrice.chotard@st.com> |
UPSTREAM: dm: uclass: Add uclass_foreach_dev_probe
Add uclass_foreach_dev_probe() which iterates through devices of a given uclass. Devices are probed if necessary and are ready to use.
Change-Id:
UPSTREAM: dm: uclass: Add uclass_foreach_dev_probe
Add uclass_foreach_dev_probe() which iterates through devices of a given uclass. Devices are probed if necessary and are ready to use.
Change-Id: Ia4561d234d8d4e8e55c3b1b318f411b8abce7627 Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit 37b596ac5c5f7ac405602af2577405b1f7d38cce) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
d07fa43e |
| 24-Oct-2018 |
Patrice Chotard <patrice.chotard@st.com> |
UPSTREAM: dm: uclass: Add uclass_next_device_err() to return a valid device
Similarly to uclass_first_device_err(), add uclass_next_device_err() which returns an error if there are no next devices i
UPSTREAM: dm: uclass: Add uclass_next_device_err() to return a valid device
Similarly to uclass_first_device_err(), add uclass_next_device_err() which returns an error if there are no next devices in that uclass.
Change-Id: I44e34260045b15db3b19eeb0bbea725d80a956d2 Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit f6abd5389ceab5fce185126c2364a324465fafbe) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
739ce16a |
| 03-Aug-2018 |
Bin Meng <bmeng.cn@gmail.com> |
UPSTREAM: dm: Correct typos in uclass_first/next_device_check()
Correct typos in the comment block of uclass_first/next_device_check().
Change-Id: Id7091715ca2077d2dededcd578d891b3b8668fdb Signed-o
UPSTREAM: dm: Correct typos in uclass_first/next_device_check()
Correct typos in the comment block of uclass_first/next_device_check().
Change-Id: Id7091715ca2077d2dededcd578d891b3b8668fdb Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> (cherry picked from commit d494131bc6a709a0fc0b12bf6a975af3de27a6e8) Signed-off-by: Cody Xie <cody.xie@rock-chips.com>
show more ...
|
| #
d9da4b44 |
| 08-Oct-2021 |
Joseph Chen <chenjh@rock-chips.com> |
dm: core: add kernel dtb version 2 mechanism support
The V2 mechanism: - both of U-Boot and kernel's *ALL* devices are exist in dm tree. - put the necessary U-Boot devices in the head of device
dm: core: add kernel dtb version 2 mechanism support
The V2 mechanism: - both of U-Boot and kernel's *ALL* devices are exist in dm tree. - put the necessary U-Boot devices in the head of device uclass list. - the both existence policy don't require phandle fixup any more. - it is for the next generation(rk3588 ...) or necessary platforms. - traverse u-boot fdt phandle if not found in kernel fdt, because the U-Boot framework gets phandle by of_root(from fdt) but not dm_root(from dm). The V1 mechanism(legacy): - U-Boot: only some necessary U-Boot devices(storage, crypto...) in dm tree. - kernel: all the devices(except the U-Boot only) in dm tree.
The commit (bd3ad955a3 scripts/dtc: phandle index start from 0x1000000) is necessary for this v2 mechanism.
Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I0964f176a17725f9bb7c4e491373c278ed2bfcc5
show more ...
|
| #
7862d7bf |
| 14-Jan-2021 |
Jianqun Xu <jay.xu@rock-chips.com> |
UPSTREAM: core: uclass: fix to u32 for phandle of fdt
The function has a little fix during upstream review, do fix to sync with upstream.
Change-Id: I9e1c43a660b2f83395d1639aa962988ca04494e5 Signed
UPSTREAM: core: uclass: fix to u32 for phandle of fdt
The function has a little fix during upstream review, do fix to sync with upstream.
Change-Id: I9e1c43a660b2f83395d1639aa962988ca04494e5 Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
show more ...
|
| #
440e24d7 |
| 28-Dec-2017 |
Simon Glass <sjg@chromium.org> |
UPSTREAM: dm: core: Add a function to look up a uclass by name
Each uclass has a driver name which we can use to look up the uclass. This is useful for logging, where the uclass ID is used as the ca
UPSTREAM: dm: core: Add a function to look up a uclass by name
Each uclass has a driver name which we can use to look up the uclass. This is useful for logging, where the uclass ID is used as the category.
Add a function to handle this, as well as a test.
Change-Id: Id221809d6f9f818b52a5bf88f4e12d409a070f05 Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Kever Yang <kever.yang@rock-chips.com> (cherry picked from commit 6e43d1b19982b1756b7c607569d1778e556d6577)
show more ...
|
| #
1d5894f2 |
| 08-Feb-2018 |
Kever Yang <kever.yang@rock-chips.com> |
core: add uclass_get_device_by_phandle_id() api
Add to api for who can not get phandle from a device property.
Change-Id: I8395f02d1731a4bbb00af1e4fa9d151830fc54b0 Signed-off-by: Kever Yang <kever.
core: add uclass_get_device_by_phandle_id() api
Add to api for who can not get phandle from a device property.
Change-Id: I8395f02d1731a4bbb00af1e4fa9d151830fc54b0 Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
show more ...
|
| #
8d3a2568 |
| 12-Jul-2017 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-dm
|
| #
95ce385a |
| 24-Apr-2017 |
Simon Glass <sjg@chromium.org> |
dm: core: Add uclass_first/next_device_check()
Sometimes it is useful to iterate through all devices in a uclass and skip over those which do not work correctly (e.g fail to probe). Add two new func
dm: core: Add uclass_first/next_device_check()
Sometimes it is useful to iterate through all devices in a uclass and skip over those which do not work correctly (e.g fail to probe). Add two new functions to provide this feature.
The caller must check the return value each time to make sure that the device is valid. But the device pointer is always returned.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
30a570a9 |
| 24-Apr-2017 |
Simon Glass <sjg@chromium.org> |
dm: core: Clarify uclass_first/next_device() comments
These are not as clear as they could be. Tidy them up a bit. Also fix a tiny code-style nit.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
| #
40bb637d |
| 19-May-2017 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a way to find a device by ofnode
Add a function which looks up a device by its node (either in live tree or flat tree).
Signed-off-by: Simon Glass <sjg@chromium.org>
|
| #
5ebd27d8 |
| 12-Oct-2016 |
Tom Rini <trini@konsulko.com> |
Merge branch 'master' of git://git.denx.de/u-boot-x86
|
| #
0a5f6f86 |
| 06-Oct-2016 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a function to get a uclass name
It is useful in debug() statements to display the name of the uclass for a device. Add a simple function to provide this.
Signed-off-by: Simon Glass <s
dm: core: Add a function to get a uclass name
It is useful in debug() statements to display the name of the uclass for a device. Add a simple function to provide this.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
show more ...
|
| #
c57f806b |
| 17-Jul-2016 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a way to find a device by its driver
Some SoCs have a single clock device. Provide a way to find it given its driver name. This is handled by the linker so will fail if the name is not
dm: core: Add a way to find a device by its driver
Some SoCs have a single clock device. Provide a way to find it given its driver name. This is handled by the linker so will fail if the name is not found, avoiding strange errors when names change and do not match. It is also faster than a string comparison.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
88033d73 |
| 14-Mar-2016 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-dm
|
| #
b0675050 |
| 11-Feb-2016 |
Simon Glass <sjg@chromium.org> |
dm: core: Add uclass_first_device_err() to return a valid device
A common pattern is to call uclass_first_device() and then check if it actually returns a device. Add a new function which does this,
dm: core: Add uclass_first_device_err() to return a valid device
A common pattern is to call uclass_first_device() and then check if it actually returns a device. Add a new function which does this, returning an error if there are no devices in that uclass.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
7aeac5bc |
| 09-Nov-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add safe device iteration macros
Add iteration macros which support unbinding a device within the loop.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
| #
80cd58b9 |
| 31-Aug-2015 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-dm
|
| #
71f1e3f1 |
| 10-Aug-2015 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
dm: simplify uclass_foreach_dev() implementation
This can be simply written with list_for_each_entry(), maybe this macro was not necessary in the first place.
Signed-off-by: Masahiro Yamada <yamada
dm: simplify uclass_foreach_dev() implementation
This can be simply written with list_for_each_entry(), maybe this macro was not necessary in the first place.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
ae27120c |
| 06-Aug-2015 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-dm
|
| #
74356d7f |
| 30-Jul-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Fix a typo in the uclass_get_device_by_name() comment
This function comment has a typo. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
|