summaryrefslogtreecommitdiff
path: root/common/board_f.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-09-18 20:42:37 -0400
committerTom Rini <trini@konsulko.com>2018-09-18 20:42:37 -0400
commit4e710ebb4463c8e031eb269c012fbadb2479608b (patch)
treef334518436bc0262b483308026fbba413a45493e /common/board_f.c
parentb57f1895b669e3fbdca486e7c40dfea00f22bb93 (diff)
parent75629a25087cd9897305375421abe2248bc40e72 (diff)
Merge git://git.denx.de/u-boot-dm
- MPC83xx device tree additions (CPU and RAM) - Fix sandbox build error - Sync bitrev with Linux - Various ofnode/DT improvements
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c58
1 files changed, 57 insertions, 1 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 88d770071c3..213d0440667 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -11,8 +11,9 @@
#include <common.h>
#include <console.h>
-#include <environment.h>
+#include <cpu.h>
#include <dm.h>
+#include <environment.h>
#include <fdtdec.h>
#include <fs.h>
#include <i2c.h>
@@ -24,6 +25,7 @@
#include <relocate.h>
#include <spi.h>
#include <status_led.h>
+#include <sysreset.h>
#include <timer.h>
#include <trace.h>
#include <video.h>
@@ -140,6 +142,57 @@ 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)
+{
+ struct udevice *dev;
+ char desc[512];
+ int ret;
+
+ ret = uclass_first_device_err(UCLASS_CPU, &dev);
+ if (ret) {
+ debug("%s: Could not get CPU device (err = %d)\n",
+ __func__, ret);
+ return ret;
+ }
+
+ ret = cpu_get_desc(dev, desc, sizeof(desc));
+ if (ret) {
+ debug("%s: Could not get CPU description (err = %d)\n",
+ dev->name, ret);
+ return ret;
+ }
+
+ printf("%s", desc);
+
+ return 0;
+}
+#endif
+
static int announce_dram_init(void)
{
puts("DRAM: ");
@@ -790,6 +843,9 @@ static const init_fnc_t init_sequence_f[] = {
#if defined(CONFIG_PPC) || defined(CONFIG_SH) || defined(CONFIG_X86)
checkcpu,
#endif
+#if defined(CONFIG_SYSRESET)
+ print_resetinfo,
+#endif
#if defined(CONFIG_DISPLAY_CPUINFO)
print_cpuinfo, /* display cpu info (and speed) */
#endif