From patchwork Wed Jan 10 10:34:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Gmail" X-Patchwork-Id: 858212 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="X0/WFXOL"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zGlxn3Cxmz9ryk for ; Wed, 10 Jan 2018 21:44:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0AD0BC2217A; Wed, 10 Jan 2018 10:42:36 +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=FREEMAIL_FROM, 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 EE979C2214A; Wed, 10 Jan 2018 10:36:58 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A6C94C22168; Wed, 10 Jan 2018 10:34:59 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 13A2EC2209F for ; Wed, 10 Jan 2018 10:34:53 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id f206so26027144wmf.5 for ; Wed, 10 Jan 2018 02:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=zAuMPiQsqtCOBU1vbUwCdf0jvKNVylQBt2xrTCp6vS8=; b=X0/WFXOL9i4YUtPT82JtD7iKyxs0vBLf7NT7BKlexTt45ltY4mQAGRGVC7ntqWkmfe qPPN+2Uweiqxj5L3rwxGOv1s/W3i3dtsq4WdwoBhVSUGLcQYh2F/5Tk8jTsp1dihRNug 23bExEKh7EoYOA2WRBJuQ8/8h0VMM0HmGWKGoZoq9ORxjVA3SKqNuA2B9rikgUr2dNEQ +0PApscACKv6AiltX427/uydZBeBbcd6z5A/Pr89i0y8pbZwoy/Nx8IWNHgkcHmYVJWw 38o3BfH/VLGR6Yt3l4v2mTrQtXv7ZKLGRfukqNHaeG3eFEZ6AaxF2phSRibJQLcaoZIc 2q/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=zAuMPiQsqtCOBU1vbUwCdf0jvKNVylQBt2xrTCp6vS8=; b=WhJcwRuvjtYxv4P18v3sv5xZAAArYR1XjDG36RhScFc3A7s3DsNLmc6sqYRwr+z2G9 97uW5w7h7eNZ3ZKXBYDhnry16SOPoy/EnocdJxRDqz0vsG+u2MCUBE1lXLBnRwO/QFP0 /QdYwiAR97pBmH3dkjrO44N6KxLiY5SaBR/7TFCbQSCKvkx4CD2G/ASqZrOs2MlmSK/x YOTIM4JgaupDpaVZFAkU6OZcS/dBTr01X4NaShqwsCnqCAX+RObzxEshERnSGT8hhH4o IvBT0XrLQmmag7CY9aHMCJFozzxGeFQp3H5YD9B74kaY/rZDXUbm+tzhpWTopJ0MYviH qleA== X-Gm-Message-State: AKwxytdWoB2pjBd7fNmU87++C4VrVqAl1KsyAa5dNih1U2HLp97HAa54 foDU43qh9QyDdClHpMUvsIBrgg== X-Google-Smtp-Source: ACJfBotzUgFvlwfpc8fyBd9TM805uh/T/in5gBCfxoA1RB3Ycbl91u5rsmPukXyXAtJN1jwK8tY4Og== X-Received: by 10.28.165.213 with SMTP id o204mr1430803wme.82.1515580492560; Wed, 10 Jan 2018 02:34:52 -0800 (PST) Received: from igloo.80.58.61.254 (141.pool85-51-114.dynamic.orange.es. [85.51.114.141]) by smtp.gmail.com with ESMTPSA id i33sm21484737wri.90.2018.01.10.02.34.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jan 2018 02:34:51 -0800 (PST) From: Jorge Ramirez-Ortiz To: u-boot@lists.denx.de Date: Wed, 10 Jan 2018 11:34:37 +0100 Message-Id: <1515580480-26075-4-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515580480-26075-1-git-send-email-jorge.ramirez.ortiz@gmail.com> References: <1515580480-26075-1-git-send-email-jorge.ramirez.ortiz@gmail.com> Subject: [U-Boot] [PATCH v1 04/07] fdtdec: allow board to provide fdt for CONFIG_OF_SEPARATE 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" From: Rob Clark Similar to CONFIG_OF_BOARD, but in this case the fdt is still built by u-boot build. This allows the board to patch the fdt, etc. In the specific case of dragonboard 410c, we pass the u-boot generated fdt to the previous stage of bootloader (by embedding it in the u-boot.img that is loaded by lk/aboot), which patches the fdt and passes it back to u-boot. Signed-off-by: Rob Clark --- include/fdtdec.h | 3 ++- lib/fdtdec.c | 35 +++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/fdtdec.h b/include/fdtdec.h index 0fb3e07..4afb9ac 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -990,7 +990,8 @@ int fdtdec_setup(void); /** * Board-specific FDT initialization. Returns the address to a device tree blob. - * Called when CONFIG_OF_BOARD is defined. + * Called when CONFIG_OF_BOARD is defined, or if CONFIG_OF_SEPARATE is defined + * and the board implements it. */ void *board_fdt_blob_setup(void); diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 30ec6b9..cc3dfd6 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1272,6 +1272,28 @@ static int uncompress_blob(const void *src, ulong sz_src, void **dstp) # endif #endif +#if CONFIG_IS_ENABLED(OF_SEPARATE) +/* + * For CONFIG_OF_SEPARATE, the board may optionally implement this to + * provide and/or fixup the fdt. + */ +__weak void *board_fdt_blob_setup(void) +{ + void *fdt_blob = NULL; +#ifdef CONFIG_SPL_BUILD + /* FDT is at end of BSS unless it is in a different memory region */ + if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) + fdt_blob = (ulong *)&_image_binary_end; + else + fdt_blob = (ulong *)&__bss_end; +#else + /* FDT is at end of image */ + fdt_blob = (ulong *)&_end; +#endif + return fdt_blob; +} +#endif + int fdtdec_setup(void) { #if CONFIG_IS_ENABLED(OF_CONTROL) @@ -1285,18 +1307,7 @@ int fdtdec_setup(void) # else gd->fdt_blob = __dtb_dt_begin; # endif -# elif defined CONFIG_OF_SEPARATE -# ifdef CONFIG_SPL_BUILD - /* FDT is at end of BSS unless it is in a different memory region */ - if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) - gd->fdt_blob = (ulong *)&_image_binary_end; - else - gd->fdt_blob = (ulong *)&__bss_end; -# else - /* FDT is at end of image */ - gd->fdt_blob = (ulong *)&_end; -# endif -# elif defined(CONFIG_OF_BOARD) +# elif defined(CONFIG_OF_BOARD) || defined (CONFIG_OF_SEPARATE) /* Allow the board to override the fdt address. */ gd->fdt_blob = board_fdt_blob_setup(); # elif defined(CONFIG_OF_HOSTFILE)