aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2022-10-10 20:29:40 +0200
committerTom Rini <trini@konsulko.com>2022-10-21 16:06:14 -0400
commit9259bd1735990ca07473ceb03ca667d7d0caddfc (patch)
tree12fd930b83ea5c2cf0590895ab78a3ecb85ecfd5 /common
parent5b2f49c033d6b6d48fff203d6f154acc8153320a (diff)
downloadu-boot-9259bd1735990ca07473ceb03ca667d7d0caddfc.zip
u-boot-9259bd1735990ca07473ceb03ca667d7d0caddfc.tar.gz
u-boot-9259bd1735990ca07473ceb03ca667d7d0caddfc.tar.bz2
common: board_f: Print information for all sysresets
Boards can have multiple sysresets, iterate all when printing sysreset info. Fixes: 23471aed5c ("board_f: Add reset status printing") Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/board_f.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 5f17111..4355d1c 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -146,20 +146,27 @@ static int print_resetinfo(void)
{
struct udevice *dev;
char status[256];
+ bool status_printed = false;
int ret;
- ret = uclass_first_device_err(UCLASS_SYSRESET, &dev);
- if (ret) {
- debug("%s: No sysreset device found (error: %d)\n",
- __func__, ret);
- /* Not all boards have sysreset drivers available during early
- * boot, so don't fail if one can't be found.
- */
- return 0;
- }
+ /* Not all boards have sysreset drivers available during early
+ * boot, so don't fail if one can't be found.
+ */
+ for (ret = uclass_first_device_check(UCLASS_SYSRESET, &dev); dev;
+ ret = uclass_next_device_check(&dev)) {
+ if (ret) {
+ debug("%s: %s sysreset device (error: %d)\n",
+ __func__, dev->name, ret);
+ continue;
+ }
- if (!sysreset_get_status(dev, status, sizeof(status)))
- printf("%s", status);
+ if (!sysreset_get_status(dev, status, sizeof(status))) {
+ printf("%s%s", status_printed ? " " : "", status);
+ status_printed = true;
+ }
+ }
+ if (status_printed)
+ printf("\n");
return 0;
}