From patchwork Sun Mar 19 18:59:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 740738 X-Patchwork-Delegate: bmeng.cn@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3vmT8j3cx9z9s3l for ; Mon, 20 Mar 2017 06:07:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="pMZV8Kvk"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 36BF9C21C4E; Sun, 19 Mar 2017 19:02:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5CD47C21C75; Sun, 19 Mar 2017 19:00:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AF035C21C7A; Sun, 19 Mar 2017 19:00:05 +0000 (UTC) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) by lists.denx.de (Postfix) with ESMTPS id DF430C21C75 for ; Sun, 19 Mar 2017 19:00:00 +0000 (UTC) Received: by mail-oi0-f45.google.com with SMTP id q19so14097983oic.0 for ; Sun, 19 Mar 2017 12:00:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=d2ssaecXTvi7ZLFCjbTSveBOm8FvTiKGU2xeEZvGslo=; b=pMZV8KvkEtLT5aJkSbAoWx9SMlAH2lPU0nFNKmp30BWxlg/MCFA+ajkXcxSj8ZcbKS sdt9sVz0AG/OZfuxlZI5FVLurVDvk89t33caXB8vRtimQxLK6joMmPnjZpCTZjIcDcUb 16Vrumx7TNE/d5UePXT8xLo4V0f1QmDNWfz1i574RnLWbTso1RTnwqQWQOwdyizqjkLM o8pZq+fcsLa1nejC7lngJ615I01obZIjYw4ah5kqFoOpYAIotaWT8y7F0/8vSQcn35jl E4g6ru2nq1qPlCe/yJUWn5hFP+76bgZOEjiqUDxc4AzR0k7PrBks/Fkvd8L2BgaGTU8N KWVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=d2ssaecXTvi7ZLFCjbTSveBOm8FvTiKGU2xeEZvGslo=; b=aSsAf2+WztkYnLChwgY6iXi6XBJHVuOOE6SjqDDK66RTY1bcWlwWCHdnKWD9Nn3Pxe edARRVbAcin55GHWMmF7vQ9gd3x5Gz6AWWriCI2hcQVPgjt2ZxXW2Wr1/p69kZ/DCEnU QOc93euU7FMo82TVotrKVrGqaM1Z4N45mhYJtqpcTp8vhTDL9ijzE17JqR7ilm0b0TgJ 60oadbQc5MFIkZkTsYNbz9Nezh3+/8Ggzh4NqCtph9vOIZ6wyKu+yPMPTosnTJzCVhBb knEBkxIH2Xy5I/hHLcyrYwWAFCsHtfyO1gULfb4ICNl3P/mb8zk+ZTbMKPbAvqcp46MT fBgw== X-Gm-Message-State: AFeK/H3Jdkt3giaOwDGl5sZgvFeX/8esVLhrlrGFYieEfp95n2la2/kqXWzMf83R43t8J8ud X-Received: by 10.202.84.150 with SMTP id i144mr4689441oib.53.1489949999629; Sun, 19 Mar 2017 11:59:59 -0700 (PDT) Received: from kaki.bld.corp.google.com ([100.100.184.105]) by smtp.gmail.com with ESMTPSA id j128sm6600373oif.32.2017.03.19.11.59.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Mar 2017 11:59:59 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 839D140083; Sun, 19 Mar 2017 12:59:58 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 19 Mar 2017 12:59:25 -0600 Message-Id: <20170319185935.20950-7-sjg@chromium.org> X-Mailer: git-send-email 2.12.0.367.g23dc2f6d3c-goog In-Reply-To: <20170319185935.20950-1-sjg@chromium.org> References: <20170319185935.20950-1-sjg@chromium.org> Cc: Tom Rini , Chris Zankel , Vladimir Zapolskiy Subject: [U-Boot] [PATCH 06/16] dm: board: Adjust pre-relocation init hooks X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When CONFIG_BOARD_ENABLED is enabled, replace the existing ad-hoc hooks with ones based on driver model. These call devices to handle each phase of init. Signed-off-by: Simon Glass --- common/board_f.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 7d1ede0404..df9a64a20f 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -11,7 +11,8 @@ */ #include -#include +#include +#include #include #include #include @@ -819,6 +820,40 @@ static int initf_dm(void) return 0; } +#ifdef CONFIG_BOARD_ENABLE + +int arch_cpu_init_dm(void) +{ + return board_walk_opt_phase(BOARD_F_ARCH_CPU_INIT_DM); +} + +int board_early_init_f(void) +{ + return board_walk_opt_phase(BOARD_F_EARLY_INIT_F); +} + +int checkcpu(void) +{ + return board_walk_opt_phase(BOARD_F_CHECKCPU); +} + +int misc_init_f(void) +{ + return board_walk_opt_phase(BOARD_F_MISC_INIT_F); +} + +int dram_init(void) +{ + return board_walk_phase(BOARD_F_DRAM_INIT); +} + +int reserve_arch(void) +{ + return board_walk_opt_phase(BOARD_F_RESERVE_ARCH); +} + +#else + /* Architecture-specific memory reservation */ __weak int reserve_arch(void) { @@ -829,6 +864,7 @@ __weak int arch_cpu_init_dm(void) { return 0; } +#endif /* !CONFIG_BOARD_ENABLE_ENABLED */ static const init_fnc_t init_sequence_f[] = { #ifdef CONFIG_SANDBOX @@ -851,7 +887,7 @@ static const init_fnc_t init_sequence_f[] = { initf_dm, arch_cpu_init_dm, mark_bootstage, /* need timer, go after init dm */ -#if defined(CONFIG_BOARD_EARLY_INIT_F) +#if defined(CONFIG_BOARD_EARLY_INIT_F) || defined(CONFIG_BOARD_ENABLE) board_early_init_f, #endif /* TODO: can any of this go into arch_cpu_init()? */ @@ -898,7 +934,8 @@ static const init_fnc_t init_sequence_f[] = { #if defined(CONFIG_MPC83xx) prt_83xx_rsr, #endif -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SH) || \ + defined(CONFIG_BOARD_ENABLE) checkcpu, #endif #if defined(CONFIG_DISPLAY_CPUINFO) @@ -908,7 +945,7 @@ static const init_fnc_t init_sequence_f[] = { show_board_info, #endif INIT_FUNC_WATCHDOG_INIT -#if defined(CONFIG_MISC_INIT_F) +#if defined(CONFIG_MISC_INIT_F) || defined(CONFIG_BOARD_ENABLE) misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET @@ -922,7 +959,7 @@ static const init_fnc_t init_sequence_f[] = { /* TODO: unify all these dram functions? */ #if defined(CONFIG_ARM) || defined(CONFIG_X86) || defined(CONFIG_NDS32) || \ defined(CONFIG_MICROBLAZE) || defined(CONFIG_AVR32) || \ - defined(CONFIG_SH) + defined(CONFIG_SH) || defined(CONFIG_SANDBOX) dram_init, /* configure available RAM banks */ #endif #if defined(CONFIG_MIPS) || defined(CONFIG_PPC) || defined(CONFIG_M68K)