diff mbox

[04/21] platform: Call generic platform probe and init UART there

Message ID 1479089181-18410-4-git-send-email-benh@kernel.crashing.org
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Nov. 14, 2016, 2:06 a.m. UTC
At the moment the generic platform initializes the UART really late,
which make debugging harder than it needs to be. Most platforms set
it up in their probe() callback but the generic platform doesn't have
one.

This adds one and initializes the UART in it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 core/platform.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/core/platform.c b/core/platform.c
index 99f1d1c..5878164 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -101,11 +101,15 @@  static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag)
 }
 opal_call(OPAL_CEC_REBOOT2, opal_cec_reboot2, 2);
 
-static void generic_platform_init(void)
+static bool generic_platform_probe(void)
 {
-	/* Enable a UART if we find one in the device-tree */
 	uart_init();
 
+	return true;
+}
+
+static void generic_platform_init(void)
+{
 	if (uart_enabled())
 		uart_setup_opal_console();
 	else
@@ -130,6 +134,7 @@  static struct bmc_platform generic_bmc = {
 static struct platform generic_platform = {
 	.name		= "generic",
 	.bmc		= &generic_bmc,
+	.probe          = generic_platform_probe,
 	.init		= generic_platform_init,
 	.cec_power_down	= generic_cec_power_down,
 };
@@ -158,13 +163,17 @@  void probe_platform(void)
 		manufacturing_mode = true;
 	}
 
-	platform = generic_platform;
 	for (i = 0; &platforms[i] < &__platforms_end; i++) {
 		if (platforms[i].probe && platforms[i].probe()) {
 			platform = platforms[i];
 			break;
 		}
 	}
+	if (!platform.name) {
+		platform = generic_platform;
+		if (platform.probe)
+			platform.probe();
+	}
 
 	prlog(PR_NOTICE, "PLAT: Detected %s platform\n", platform.name);