From patchwork Fri Jan 5 10:29:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 123496 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp639433qgn; Fri, 5 Jan 2018 02:38:26 -0800 (PST) X-Google-Smtp-Source: ACJfBov1eL51GaZ7F9HJ9MRVHJ4XqvbMi43rF0DD3GfwfgEqFTyMP+5+RMxvp79auZtpTzcOVSof X-Received: by 10.80.217.76 with SMTP id u12mr3494991edj.171.1515148706401; Fri, 05 Jan 2018 02:38:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515148706; cv=none; d=google.com; s=arc-20160816; b=gYr8FKWAOJTaR038GACH5D7GjnRvtkLo/5OoCGX+5Ra6Y+ofdPpDlvl8DjaRd/GOVH cx3lkTDRXmbplJb56lSlQ8zP5X9aCvLRxlxbtQeoo3wpM6y4dkw28fzjeDacW+EX8JPA bXeC08OJpFhP68mn282Ix4c6CGLy7Mnm3No1yfmW02qQTU+tTiJTvvATnaRxNlrAnFrm wd7lqmxm43+pAPPJzBNM/yck0Ulh4CGWdQLi41lMVLqsOBlpEk3dwjXyyrLcnSKoyQ0Y HRYWFH8CDeLgebOoxMu4/AN7WZRWRmfCP6M8NzGQdbEGjxvsSNjpwd8miQpwAKeEBAiO B7Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=6o5DxjGEyMWCwPBz++uswl2hlaVvqiafwJQMe78MdRg=; b=mZx9E8llPLkWO3Gubkc0ZReWuqEVJrWfWFM/8DTg68oW/DprrjMq5o9mXa9VzVNm7r KG33id51gdDzWCRRhG0/pIE0BPKr67W6yQNRZ3pbQn+LnAndiFjyZH1Rxk5kjea8Kebb nmXdEqIcJH23xmZjBnljQY0460n2xLnd+tC39wxuWcdh1b4gbN84hHoSwGChX9qb4/Rm 6M8K2Pol3Ay2swhmVTFxeaZjs8ER0jz3ekHpKylIDKwPe5H7UJGhyTqw6TOSlLcBMpY+ /UsKfbdSF5XXG7mPTBHpfuVIpAE/v1e1OHbPRBCbySoR4FCPzImrZvNvIZS9pnbc8yhr KbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SYPo3ruS; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id b15si968797edf.329.2018.01.05.02.38.26; Fri, 05 Jan 2018 02:38:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SYPo3ruS; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 05A1FC21DFA; Fri, 5 Jan 2018 10:36:45 +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_H2, 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 98A56C21E9B; Fri, 5 Jan 2018 10:31:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CB58CC21E4C; Fri, 5 Jan 2018 10:31:35 +0000 (UTC) Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by lists.denx.de (Postfix) with ESMTPS id 50CEBC21E13 for ; Fri, 5 Jan 2018 10:30:06 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id w107so3955360wrb.9 for ; Fri, 05 Jan 2018 02:30:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=zAuMPiQsqtCOBU1vbUwCdf0jvKNVylQBt2xrTCp6vS8=; b=SYPo3ruSFHYTXe84Bf8GM4fV31XhVrASpVn8hKN/h9ARbpvelfUUhI5cO16dZMCnkL vgpSdYORhRe1P86uHPnWcaIrLzQLNRm0dtPw+pIZo/FyKdon15ShjhOq6vRVdXSYTECp JsFoHOeN8J9t9AHCgCnMnhVhKY9wVwqJ79k7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zAuMPiQsqtCOBU1vbUwCdf0jvKNVylQBt2xrTCp6vS8=; b=BnBfdQC7VTO7W4mujm1zc/pom01dB1/BU1ONv7LpyC6bB+yYWfvsagU1M4W/v3V2gk J1VXkeidkVvDD+EgTSOHck1On4yagCnuQT/Ow2NZ8x9fmuSLvW3i0ydpXs+bMLwXb9fE ZwIsLgpELyCWuOwNk4ydEjo9SmpJ9lzRLQgVUHw6EVPGLPCcnqG4KdSbvrOzxpYey1Iv vAFIJMWydjJ0mCXKqCb1BN3e/rVeeliVM0HaBJeO5z4i+qWEYSLW8SXK7JH33nj8R/L2 jdv2BPexRrAs8Htmkjkrn4aCUPeiL6MhMK8gBaO202qq/+CTpBG8VGVAyNOEaatAjFnM 0zjg== X-Gm-Message-State: AKGB3mKWyHx/vN2ev8AR13WF0jzqGCI/g4e0Ou1cADyyCPMWxoof9Vop EQibxPWO0bk2T5TsjB/TkcSToQ== X-Received: by 10.223.178.242 with SMTP id g105mr1376008wrd.213.1515148205916; Fri, 05 Jan 2018 02:30:05 -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 w40sm3719020wrc.79.2018.01.05.02.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 02:30:05 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Fri, 5 Jan 2018 11:29:54 +0100 Message-Id: <1515148197-30234-4-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515148197-30234-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1515148197-30234-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH 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)