arm: Add bootblock_mainboard_early_init() for pre-console initialization

On most platforms, enabling the console and exception handlers are
amongst the very first things you want to do, as they help you see
what's going on and debug errors in other early init code. However, most
ARM boards require some small amount of board-specific initialization
(pinmuxing, maybe clocks) to get the UART running, which is why
bootblock_mainboard_init() (and with it almost all of the actual
bootblock code) always had to run before console initialization for now.

This patch introduces an explicit bootblock_mainboard_early_init() hook
for only that part of initialization that absolutely needs to run before
console output. The other two hooks for SoC and mainboard are moved
below console_init(). This model has already proven its worth before in
the tegra124 and tegra132 custom bootblocks.

BRANCH=None
BUG=chrome-os-partner:32123
TEST=Booted on Pinky. Compiled for Daisy, Storm and Ryu.

Change-Id: I510c58189faf0c08c740bcc3b5a654f81f892464
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: f58e84a2fc1c9951e9c4c65cdec1dbeb6a20d597
Original-Change-Id: I4257b5a8807595140e8c973ca04e68ea8630bf9a
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/231941
Reviewed-on: http://review.coreboot.org/9603
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Julius Werner 2014-11-25 13:22:20 -08:00 committed by Patrick Georgi
parent a512e117b0
commit f1e321001d
7 changed files with 13 additions and 39 deletions

View File

@ -26,18 +26,21 @@
#include <console/console.h> #include <console/console.h>
#include <program_loading.h> #include <program_loading.h>
__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ } __attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ } __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
void main(void) void main(void)
{ {
bootblock_soc_init(); bootblock_mainboard_early_init();
bootblock_mainboard_init();
if (CONFIG_BOOTBLOCK_CONSOLE) { if (CONFIG_BOOTBLOCK_CONSOLE) {
console_init(); console_init();
exception_init(); exception_init();
} }
bootblock_soc_init();
bootblock_mainboard_init();
run_romstage(); run_romstage();
} }

View File

@ -27,18 +27,21 @@
#include <program_loading.h> #include <program_loading.h>
#include <smp/node.h> #include <smp/node.h>
__attribute__((weak)) void bootblock_mainboard_early_init(void) { /* no-op */ }
__attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ } __attribute__((weak)) void bootblock_soc_init(void) { /* do nothing */ }
__attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ } __attribute__((weak)) void bootblock_mainboard_init(void) { /* do nothing */ }
void main(void) void main(void)
{ {
bootblock_soc_init(); bootblock_mainboard_early_init();
bootblock_mainboard_init();
#if CONFIG_BOOTBLOCK_CONSOLE #if CONFIG_BOOTBLOCK_CONSOLE
console_init(); console_init();
exception_init(); exception_init();
#endif #endif
bootblock_soc_init();
bootblock_mainboard_init();
run_romstage(); run_romstage();
} }

View File

@ -21,6 +21,7 @@
#define __ARCH_BOOTBLOCK_COMMON_H #define __ARCH_BOOTBLOCK_COMMON_H
/* These are defined as weak no-ops that can be overridden by mainboard/SoC. */ /* These are defined as weak no-ops that can be overridden by mainboard/SoC. */
void bootblock_mainboard_early_init(void);
void bootblock_mainboard_init(void); void bootblock_mainboard_init(void);
void bootblock_soc_init(void); void bootblock_soc_init(void);

View File

@ -18,11 +18,11 @@
*/ */
#include <arch/io.h> #include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h> #include <console/console.h>
#include <device/i2c.h> #include <device/i2c.h>
#include <soc/addressmap.h> #include <soc/addressmap.h>
#include <soc/clk_rst.h> #include <soc/clk_rst.h>
#include <soc/bootblock.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/funitcfg.h> #include <soc/funitcfg.h>
#include <soc/nvidia/tegra/i2c.h> #include <soc/nvidia/tegra/i2c.h>

View File

@ -18,10 +18,10 @@
*/ */
#include <arch/io.h> #include <arch/io.h>
#include <bootblock_common.h>
#include <console/console.h> #include <console/console.h>
#include <device/i2c.h> #include <device/i2c.h>
#include <soc/addressmap.h> #include <soc/addressmap.h>
#include <soc/bootblock.h>
#include <soc/clk_rst.h> #include <soc/clk_rst.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/funitcfg.h> #include <soc/funitcfg.h>

View File

@ -23,7 +23,6 @@
#include <console/console.h> #include <console/console.h>
#include <program_loading.h> #include <program_loading.h>
#include <soc/addressmap.h> #include <soc/addressmap.h>
#include <soc/bootblock.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/nvidia/tegra/apbmisc.h> #include <soc/nvidia/tegra/apbmisc.h>
#include <soc/power.h> #include <soc/power.h>

View File

@ -1,32 +0,0 @@
/*
* This file is part of the coreboot project.
*
* Copyright 2014 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __SOC_NVIDIA_TEGRA132_SOC_BOOTBLOCK_H__
#define __SOC_NVIDIA_TEGRA132_SOC_BOOTBLOCK_H__
#include <bootblock_common.h>
/*
* Perform any necessary mainboard-specific work early in bootblock. This is
* ran before consoles are brought up so any pad configuration could be done
* in this routine to enable console hardware.
*/
void bootblock_mainboard_early_init(void);
#endif /* __SOC_NVIDIA_TEGRA132_SOC_BOOTBLOCK_H__ */