From patchwork Sat Oct 15 15:48:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 119980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 622E1B70C5 for ; Sun, 16 Oct 2011 03:07:30 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 252ED287F5; Sat, 15 Oct 2011 18:07:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SjLT1I3TQSbv; Sat, 15 Oct 2011 18:07:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F3578287FF; Sat, 15 Oct 2011 18:06:57 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EAC5F2867F for ; Sat, 15 Oct 2011 17:50:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UTjGCx4Js7CZ for ; Sat, 15 Oct 2011 17:50:18 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp-out.google.com (smtp-out.google.com [74.125.121.67]) by theia.denx.de (Postfix) with ESMTPS id 295E12866C for ; Sat, 15 Oct 2011 17:50:17 +0200 (CEST) Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id p9FFnxuu004101; Sat, 15 Oct 2011 08:49:59 -0700 Received: from sglass.mtv.corp.google.com (sglass.mtv.corp.google.com [172.22.72.144]) by hpaq14.eem.corp.google.com with ESMTP id p9FFnugE025389; Sat, 15 Oct 2011 08:49:57 -0700 Received: by sglass.mtv.corp.google.com (Postfix, from userid 121222) id 7485A140B2C; Sat, 15 Oct 2011 08:49:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 15 Oct 2011 08:48:23 -0700 Message-Id: <1318693706-3381-5-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1318693706-3381-1-git-send-email-sjg@chromium.org> References: <1318693706-3381-1-git-send-email-sjg@chromium.org> X-System-Of-Record: true X-Mailman-Approved-At: Sat, 15 Oct 2011 18:06:52 +0200 Cc: Kumar Gala , Grant Likely , Tom Warren , Aaron Williams Subject: [U-Boot] [PATCH v4 4/6] fdt: ARM: Implement and verify embedded and separate device tree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This locates the device tree either embedded within U-Boot or attached to the end as a separate binary. When CONFIG_OF_CONTROL is defined, U-Boot requires a valid fdt. A check is provided for this early in initialisation. Signed-off-by: Simon Glass --- arch/arm/lib/board.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index 1fe3751..b0f3162 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -197,6 +198,17 @@ static int arm_pci_init(void) } #endif /* CONFIG_CMD_PCI || CONFIG_PCI */ +#ifdef CONFIG_OF_CONTROL +static int check_fdt(void) +{ + /* We must have an fdt */ + if (fdt_check_header(gd->fdt_blob)) + panic("No valid fdt found - please append one to U-Boot\n" + "binary or define CONFIG_OF_EMBED\n"); + return 0; +} +#endif + /* * Breathe some life into the board... * @@ -239,6 +251,9 @@ init_fnc_t *init_sequence[] = { #if defined(CONFIG_BOARD_EARLY_INIT_F) board_early_init_f, #endif +#ifdef CONFIG_OF_CONTROL + check_fdt, +#endif timer_init, /* initialize timer */ #ifdef CONFIG_FSL_ESDHC get_clocks, @@ -276,6 +291,13 @@ void board_init_f(ulong bootflag) memset((void *)gd, 0, sizeof(gd_t)); gd->mon_len = _bss_end_ofs; +#ifdef CONFIG_OF_EMBED + /* Get a pointer to the FDT */ + gd->fdt_blob = _binary_dt_dtb_start; +#elif defined CONFIG_OF_SEPARATE + /* FDT is at end of image */ + gd->fdt_blob = (void *)(_end_ofs + _TEXT_BASE); +#endif for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) { if ((*init_fnc_ptr)() != 0) {