Skip to content

Commit

Permalink
platform: Call generic platform probe and init UART there
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
ozbenh authored and stewartsmith committed Nov 15, 2016
1 parent bc25587 commit 74a8c1d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions core/platform.c
Expand Up @@ -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
Expand All @@ -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,
};
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 74a8c1d

Please sign in to comment.