From patchwork Fri May 1 14:55:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 244750 List-Id: U-Boot discussion From: rasmus.villemoes at prevas.dk (Rasmus Villemoes) Date: Fri, 1 May 2020 16:55:16 +0200 Subject: [PATCH 5/5] sysreset: move print_resetinfo() to sysreset-uclass.c In-Reply-To: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> References: <20200501145516.18168-1-rasmus.villemoes@prevas.dk> Message-ID: <20200501145516.18168-6-rasmus.villemoes@prevas.dk> Moving this out of board_f.c allows board-specific SPL code to call this rather than duplicating its implementation. Signed-off-by: Rasmus Villemoes Reviewed-by: Simon Glass --- common/board_f.c | 24 ------------------------ drivers/sysreset/sysreset-uclass.c | 22 ++++++++++++++++++++++ include/sysreset.h | 5 +++++ 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 82a164752a..252ad1c520 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -152,30 +152,6 @@ static int display_text_info(void) return 0; } -#ifdef CONFIG_SYSRESET -static int print_resetinfo(void) -{ - struct udevice *dev; - char status[256]; - 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; - } - - if (!sysreset_get_status(dev, status, sizeof(status))) - printf("%s", status); - - return 0; -} -#endif - #if defined(CONFIG_DISPLAY_CPUINFO) && CONFIG_IS_ENABLED(CPU) static int print_cpuinfo(void) { diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c index 51fdb1055e..739e4526ff 100644 --- a/drivers/sysreset/sysreset-uclass.c +++ b/drivers/sysreset/sysreset-uclass.c @@ -18,6 +18,28 @@ #include #include +int print_resetinfo(void) +{ + struct udevice *dev; + char status[256]; + 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; + } + + if (!sysreset_get_status(dev, status, sizeof(status))) + printf("%s", status); + + return 0; +} + int sysreset_request(struct udevice *dev, enum sysreset_t type) { struct sysreset_ops *ops = sysreset_get_ops(dev); diff --git a/include/sysreset.h b/include/sysreset.h index 61295e3fcb..5f402b9d04 100644 --- a/include/sysreset.h +++ b/include/sysreset.h @@ -116,4 +116,9 @@ void sysreset_walk_halt(enum sysreset_t type); */ void reset_cpu(ulong addr); +/** + * print_resetinfo() - print reset information to console + */ +int print_resetinfo(void); + #endif