From patchwork Tue Oct 22 14:39:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181418 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="Ax1tS072"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGSp0HDyz9sPk for ; Wed, 23 Oct 2019 01:42:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C14FEC21DB5; Tue, 22 Oct 2019 14:42:10 +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=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 BFA3BC21DED; Tue, 22 Oct 2019 14:42:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 539D8C21D72; Tue, 22 Oct 2019 14:40:09 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 64198C21E3E for ; Tue, 22 Oct 2019 14:40:06 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdwgg048804; Tue, 22 Oct 2019 09:39:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755198; bh=a9Ut4KT4pCZPtxhs33IHaT20JzKr/Ops/ctL2QSomM4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Ax1tS072pEfppqdY/3nkKn+tfCJP5lS2GBRTmnfABS+bxoeaCrY9OdM1IWNo5iD/z M1yGuFQsdZI6FMybadnW/jCoBg/cg/7n4HWj6fz1uZyShavXUqMSXCE/kEX2/P/9Yi Xf6E2AZ0gYBGPw1PXACzaSoTx/HXbd24Q5IURFyM= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdS4Q069492 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:28 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:17 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:18 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdQ9Y096770; Tue, 22 Oct 2019 09:39:27 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:10 +0200 Message-ID: <20191022143922.10205-2-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 01/13] spl: fit: don't load the firmware twice 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When u-boot.img is a FIT image generated automatically by mkimage, the configuration node has the following structure: conf-1 { description = "k3-am654-base-board"; firmware = "firmware-1"; loadables = "firmware-1"; fdt = "fdt-1"; }; The firmware is referenced twice. Once by the 'firmware' property and once by the 'loadables' property. Currently this result in the firmware being loaded twice. This is not a big problem but has an impact on the boot time. Fixing it by not loading a loadable image if it is also the firmware image. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass Tested-by: Andreas Dannenberg --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None common/spl/spl_fit.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index cbc00a4e7c..346f9edaa5 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -373,6 +373,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, int images, ret; int base_offset, hsize, align_len = ARCH_DMA_MINALIGN - 1; int index = 0; + int firmware_node; /* * For FIT with external data, figure out where the external images @@ -502,6 +503,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, spl_fit_append_fdt(spl_image, info, sector, fit, images, base_offset); + firmware_node = node; /* Now check if there are more images for us to load */ for (; ; index++) { uint8_t os_type = IH_OS_INVALID; @@ -510,6 +512,14 @@ int spl_load_simple_fit(struct spl_image_info *spl_image, if (node < 0) break; + /* + * if the firmware is also a loadable, skip it because + * it already has been loaded. This is typically the case with + * u-boot.img generated by mkimage. + */ + if (firmware_node == node) + continue; + ret = spl_load_fit_image(info, sector, fit, base_offset, node, &image_info); if (ret < 0) From patchwork Tue Oct 22 14:39:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181425 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="KpvnnGTN"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGWt3730z9sPh for ; Wed, 23 Oct 2019 01:45:30 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 297D3C21EA1; Tue, 22 Oct 2019 14:41:55 +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=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 0DF07C21E26; Tue, 22 Oct 2019 14:41:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DCD40C21DB5; Tue, 22 Oct 2019 14:40:02 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 836B1C21E1D for ; Tue, 22 Oct 2019 14:39:59 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdj98048618; Tue, 22 Oct 2019 09:39:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755185; bh=rRMr8TtrpAPhNsLlEOTU7jVONJSpEh1mubVuec2dseA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KpvnnGTNHtunMrkfsrT5YBViR5UsyK27wJBmaibvwILT0labr2+NxMbeDuOa0g/3a fFC2D8QC0ahsEZ1if8clET+U1r/gg1HACsHPyRiRzrOltNhlv7pWCOZXNL/JyKbp6R o1gTAhfvX7LKtawjFD6gmBtRIB4VO2uoe3HlTkOg= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdjAu070263 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:45 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:44 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:35 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdS01026364; Tue, 22 Oct 2019 09:39:29 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:11 +0200 Message-ID: <20191022143922.10205-3-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Marek Vasut , Stefan Roese , u-boot@lists.denx.de, Chris Packham Subject: [U-Boot] [PATCH PATCH v6 02/13] spl: fit: Add support for applying DT overlay 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Michal Simek doc/uImage.FIT/overlay-fdt-boot.txt is describing how to create FIT image with DT overlays in it. Add support for this feature to SPL. Here is the ZynqMP fragment where dtb points to full DT and dtbo is overlay which should be applied on the top of dtb. config { description = "ATF with full u-boot overlay"; firmware = "atf"; loadables = "uboot"; fdt = "dtb", "dtbo"; }; The whole feature depends on OF_LIBFDT_OVERLAY which is adding +4kB code and 0 for platforms which are not enabling this feature. Signed-off-by: Michal Simek Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: - use CONFIG_IS_ENABLED() instead of #idef Changes in v3: - Add a new config option: SPL_LOAD_FIT_APPLY_OVERLAY. By default, it is not selected. Changes in v2: None Kconfig | 9 +++++++++ common/spl/spl_fit.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Kconfig b/Kconfig index 66b059f749..518ce7e0d6 100644 --- a/Kconfig +++ b/Kconfig @@ -429,6 +429,15 @@ config SPL_LOAD_FIT particular it can handle selecting from multiple device tree and passing the correct one to U-Boot. +config SPL_LOAD_FIT_APPLY_OVERLAY + bool "Enable SPL applying DT overlays from FIT" + depends on SPL_LOAD_FIT + select OF_LIBFDT_OVERLAY + help + The device tree is loaded from the FIT image. Allow the SPL is to + also load device-tree overlays from the FIT image an apply them + over the device tree. + config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT (full fitImage features)" select SPL_FIT diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 346f9edaa5..39e406b237 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -281,7 +281,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, void *fit, int images, ulong base_offset) { struct spl_image_info image_info; - int node, ret = 0; + int node, ret = 0, index = 0; /* * Use the address following the image as target address for the @@ -290,7 +290,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, image_info.load_addr = spl_image->load_addr + spl_image->size; /* Figure out which device tree the board wants to use */ - node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, 0); + node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); if (node < 0) { debug("%s: cannot find FDT node\n", __func__); @@ -315,8 +315,32 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); + if (ret < 0) + return ret; #endif - + if (CONFIG_IS_ENABLED(LOAD_FIT_APPLY_OVERLAY)) { + for (; ; index++) { + node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, + index); + if (node < 0) { + debug("%s: No additional FDT node\n", __func__); + return 0; + } + + ret = spl_load_fit_image(info, sector, fit, base_offset, + node, &image_info); + if (ret < 0) + return ret; + + ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, + (void *)image_info.load_addr); + if (ret) + return ret; + + debug("%s: DT overlay %s applied\n", __func__, + fit_get_name(fit, node, NULL)); + } + } return ret; } From patchwork Tue Oct 22 14:39:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181414 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="Eomj9l2P"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGQg5Gkgz9sPh for ; Wed, 23 Oct 2019 01:40:59 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 662A8C21D74; Tue, 22 Oct 2019 14:40:01 +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=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 8EAFBC21DD4; Tue, 22 Oct 2019 14:39:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9E096C21E12; Tue, 22 Oct 2019 14:39:50 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id B5219C21DB5 for ; Tue, 22 Oct 2019 14:39:47 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdW7Z048475; Tue, 22 Oct 2019 09:39:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755172; bh=aK2g8T02HDqVGuNOG1/A3814VuS0X3XxOvqIEBshOF0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Eomj9l2PIXyEYf6iNEcJBgbOEKCNjCSkNxFnXzTUdN/C818zcW5EO0ZrjQdwk/XeL O0jb5+NU7juPrDYQhFpd4gygK5h9EqUn7D3ikPCARe22TpOwlUW8JSiDLSs4MalNbV DJ5R0Sfd89iARL1dE2fWnM0fyMFk9buLITlkEBX0= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdWvJ004139 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:32 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:21 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:21 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdU9V096924; Tue, 22 Oct 2019 09:39:30 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:12 +0200 Message-ID: <20191022143922.10205-4-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 03/13] spl: fit: Make room in the FDT before applying overlays 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Make room in the FDT before applying the overlay, otherwise it may fail if the overlay is big. As the exact added size is not known in advance, just add the size of the overlay. Move after the end of the application of the overlays, the resize of the FDT for the injection of the details on the loadables. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None common/spl/spl_fit.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 39e406b237..65dd835ecc 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -313,11 +313,6 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, /* Make the load-address of the FDT available for the SPL framework */ spl_image->fdt_addr = (void *)image_info.load_addr; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) - /* Try to make space, so we can inject details on the loadables */ - ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); - if (ret < 0) - return ret; -#endif if (CONFIG_IS_ENABLED(LOAD_FIT_APPLY_OVERLAY)) { for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, @@ -332,6 +327,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, if (ret < 0) return ret; + /* Make room in FDT for changes from the overlay */ + ret = fdt_increase_size(spl_image->fdt_addr, + image_info.size); + if (ret < 0) + return ret; + ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, (void *)image_info.load_addr); if (ret) @@ -341,6 +342,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, fit_get_name(fit, node, NULL)); } } + /* Try to make space, so we can inject details on the loadables */ + ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); + if (ret < 0) + return ret; +#endif + return ret; } From patchwork Tue Oct 22 14:39:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181421 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="qkYhoQLg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGV007tNz9sPh for ; Wed, 23 Oct 2019 01:43:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AB03EC21E79; Tue, 22 Oct 2019 14:42:25 +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=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 B2904C21DF8; Tue, 22 Oct 2019 14:42:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 26AA6C21D4A; Tue, 22 Oct 2019 14:40:19 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 2E184C21D8A for ; Tue, 22 Oct 2019 14:40:16 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEe4hw048876; Tue, 22 Oct 2019 09:40:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755204; bh=SlycVT1gNgos/Z/Uk9ocHBIOASbde4oxnteSjhKlfrw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=qkYhoQLg7ibMCPtnBq8h+A8EteLfnzZqyCvYcdJQapdzhyiHpXL68SvPuHF2bgWce 3+CsMIFZ16Kbhaxibn091slO6WU3uDFLTVjzy2v4ce67M9T26VOwZ5UCEbMmoh5j5B mkb0AE9gveZsFHoaHsJbrgsv+s2VWEeUFnVudN3c= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEe3AO005538 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:40:03 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:40:03 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:53 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdWIY026521; Tue, 22 Oct 2019 09:39:32 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:13 +0200 Message-ID: <20191022143922.10205-5-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Marek Vasut , u-boot@lists.denx.de, Stefan Roese , Chris Packham Subject: [U-Boot] [PATCH PATCH v6 04/13] spl: fit: allocate a temporary buffer to load the overlays 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If the node describing an overlay does not specify a load address, it will be loaded at the address previously used. Fixing it by allocating a temporary buffer that will be used as a default load address. By default, the size of the buffer is 64kB which should be plenty for most use cases. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: - Do not allocate the buffer if not needed (no overlay). - Add a Kconfig option for the buffer size Changes in v4: - make sure that the temp buffer is freed in all cases Changes in v3: None Changes in v2: None Kconfig | 9 +++++++++ common/spl/spl_fit.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Kconfig b/Kconfig index 518ce7e0d6..417799a700 100644 --- a/Kconfig +++ b/Kconfig @@ -438,6 +438,15 @@ config SPL_LOAD_FIT_APPLY_OVERLAY also load device-tree overlays from the FIT image an apply them over the device tree. +config SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ + depends on SPL_LOAD_FIT_APPLY_OVERLAY + default 0x10000 + hex "size of temporary buffer used to load the overlays" + help + The size of the area where the overlays will be loaded and + uncompress. Must be at least as large as biggest overlay + (uncompressed) + config SPL_LOAD_FIT_FULL bool "Enable SPL loading U-Boot as a FIT (full fitImage features)" select SPL_FIT diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 65dd835ecc..e6935c16b7 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -9,11 +9,16 @@ #include #include #include -#include +#include #include +#include DECLARE_GLOBAL_DATA_PTR; +#ifndef CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ +#define CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ (64 * 1024) +#endif + #ifndef CONFIG_SYS_BOOTM_LEN #define CONFIG_SYS_BOOTM_LEN (64 << 20) #endif @@ -314,33 +319,52 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, spl_image->fdt_addr = (void *)image_info.load_addr; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) if (CONFIG_IS_ENABLED(LOAD_FIT_APPLY_OVERLAY)) { + void *tmpbuffer = NULL; + for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); if (node < 0) { debug("%s: No additional FDT node\n", __func__); - return 0; + break; } + if (!tmpbuffer) { + /* + * allocate memory to store the DT overlay + * before it is applied. It may not be used + * depending on how the overlay is stored, so + * don't fail yet if the allocation failed. + */ + tmpbuffer = malloc(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ); + if (!tmpbuffer) + debug("%s: unable to allocate space for overlays\n", + __func__); + } + image_info.load_addr = (ulong)tmpbuffer; ret = spl_load_fit_image(info, sector, fit, base_offset, node, &image_info); if (ret < 0) - return ret; + break; /* Make room in FDT for changes from the overlay */ ret = fdt_increase_size(spl_image->fdt_addr, image_info.size); if (ret < 0) - return ret; + break; ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, (void *)image_info.load_addr); if (ret) - return ret; + break; debug("%s: DT overlay %s applied\n", __func__, fit_get_name(fit, node, NULL)); } + if (tmpbuffer) + free(tmpbuffer); + if (ret) + return ret; } /* Try to make space, so we can inject details on the loadables */ ret = fdt_shrink_to_minimum(spl_image->fdt_addr, 8192); From patchwork Tue Oct 22 14:39:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181412 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="nuEWgfrR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGPX2xQWz9sPf for ; Wed, 23 Oct 2019 01:39:59 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 93CB0C21E0D; Tue, 22 Oct 2019 14:39:48 +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=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 09DD9C21D4A; Tue, 22 Oct 2019 14:39:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7BE05C21D4A; Tue, 22 Oct 2019 14:39:46 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id 02887C21C51 for ; Tue, 22 Oct 2019 14:39:45 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdZJK130625; Tue, 22 Oct 2019 09:39:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755175; bh=ib1qmgpBF1MSOEPe5D/LPn23ZwyMeFQAjiJ3otbEE/4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nuEWgfrRH0UKCMmL1TW1AGZDDBfzZ++5RCGwzaS8aRKRzWd52zBsYY1MT9Fsxrm57 thL04dasaMRoEK79cZyj4INMxo/UA1qsW4uV1+y6b6mmsb49kRm6IEO1Ws+WGDd0E0 rHBehQ4cM1FTEpN/hp+cXBWBm/O7TE8RprghETN0= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdZ5T004348 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:35 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:25 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:25 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdX80097163; Tue, 22 Oct 2019 09:39:34 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:14 +0200 Message-ID: <20191022143922.10205-6-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 05/13] spl: fit: Do not fail immediately if an overlay is not available 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If one overlay that must be applied cannot be found in the FIT, the current implementation stops applying the overlays. Let's make it skip only the failing overlay instead. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None common/spl/spl_fit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index e6935c16b7..0245dcadb4 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -324,9 +324,13 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, for (; ; index++) { node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index); - if (node < 0) { + if (node == -E2BIG) { debug("%s: No additional FDT node\n", __func__); break; + } else if (node < 0) { + debug("%s: unable to find FDT node %d\n", + __func__, index); + continue; } if (!tmpbuffer) { From patchwork Tue Oct 22 14:39:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181422 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="SMlrPWkg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGV10gfyz9sPk for ; Wed, 23 Oct 2019 01:43:53 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CBC84C21DB6; Tue, 22 Oct 2019 14:41:15 +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=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 C0BC6C21D72; Tue, 22 Oct 2019 14:41:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8E442C21E36; Tue, 22 Oct 2019 14:40:03 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id CACA1C21E12 for ; Tue, 22 Oct 2019 14:39:59 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdqBa048666; Tue, 22 Oct 2019 09:39:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755192; bh=XaNgkkPsArM2+VXyFwAotEF2V3MGBVL8xN7Gdv9erns=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SMlrPWkgOANwEJuKj1JCcuW/1zTOchv0jqlRUAWVhpwW+GR3sBjaV+fLUQZDP0B6R szoHr300WcnuATxHwUIqETuzUZvZBceNzZM68SNbp7w04KFyZYuqdbIq+ysGpN3Zzc r1ZCG4N8SSiWGOgMHkzWcXmotpw4O3Da+4o8QWhk= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdaKG004401 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:37 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:27 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:36 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdZfI097244; Tue, 22 Oct 2019 09:39:36 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:15 +0200 Message-ID: <20191022143922.10205-7-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 06/13] spl: fit: be more verbose when an error occurs when applying the overlays 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There are many ways the overlay application can fail. 2 of them are probably the most common: - the application itself failed. Usually this is comes from an unresolved reference - DTBO not available in FIT (could be because of a typo) In both case it is good to be more explicit about the error and at least show which overlay is failing. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 0245dcadb4..5aeb9528fe 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -113,7 +113,7 @@ static int spl_fit_get_image_node(const void *fit, int images, node = fdt_subnode_offset(fit, images, str); if (node < 0) { - debug("cannot find image node '%s': %d\n", str, node); + pr_err("cannot find image node '%s': %d\n", str, node); return -EINVAL; } @@ -359,8 +359,11 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, ret = fdt_overlay_apply_verbose(spl_image->fdt_addr, (void *)image_info.load_addr); - if (ret) + if (ret) { + pr_err("failed to apply DT overlay %s\n", + fit_get_name(fit, node, NULL)); break; + } debug("%s: DT overlay %s applied\n", __func__, fit_get_name(fit, node, NULL)); From patchwork Tue Oct 22 14:39:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181420 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="OWwB48PZ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGTj0tNTz9sPh for ; Wed, 23 Oct 2019 01:43:37 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CFE65C21E56; Tue, 22 Oct 2019 14:40:41 +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=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 36689C21E02; Tue, 22 Oct 2019 14:40:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 09C67C21D8A; Tue, 22 Oct 2019 14:39:59 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id B7867C21DD4 for ; Tue, 22 Oct 2019 14:39:58 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEddEf130648; Tue, 22 Oct 2019 09:39:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755179; bh=TRR0fNeqVbIcaZuUE9EU4/4wxl5XD2ZwdXvDFVrTfDo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OWwB48PZ+qKANmSNYavuNTuWftPbwsPllXms4tQ8RVQAaMk9qvMU5na3B3kR5/HIr SjUK4qfnEdosa42rnYOBio2/yLQCYOsn9uH1/JZF5mTqns2bBFnlJwjK/VCxQ1fxBZ u/EOgkb0OlXJGo90NUwMbwLhtSPF9lm7MBGBs7Yo= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdcsl069973 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:38 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:28 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:38 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdbbk026827; Tue, 22 Oct 2019 09:39:37 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:16 +0200 Message-ID: <20191022143922.10205-8-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Stephen Warren , u-boot@lists.denx.de, Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH PATCH v6 07/13] Makefile.lib: include /__symbols__ in dtb if SPL_LOAD_FIT_APPLY_OVERLAY is enabled 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In order to apply an overlay to a DTB. The DTB must have been generated with the option '-@'. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None scripts/Makefile.lib | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ef116e0e0a..6946da6aa4 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -292,6 +292,10 @@ cmd_dt_S_dtb= \ $(obj)/%.dtb.S: $(obj)/%.dtb $(call cmd,dt_S_dtb) +ifeq ($(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY),y) +DTC_FLAGS += -@ +endif + quiet_cmd_dtc = DTC $@ # Modified for U-Boot # Bring in any U-Boot-specific include at the end of the file From patchwork Tue Oct 22 14:39:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181416 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="c3dyFxjm"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGRK3BgGz9sPh for ; Wed, 23 Oct 2019 01:41:33 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 00175C21D72; Tue, 22 Oct 2019 14:40:14 +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=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 3EF90C21E1D; Tue, 22 Oct 2019 14:40:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6F2E1C21E0D; Tue, 22 Oct 2019 14:39:51 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id DE79AC21DF3 for ; Tue, 22 Oct 2019 14:39:48 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdehQ130657; Tue, 22 Oct 2019 09:39:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755180; bh=1/6BxHavTsI2Zr41bHodshDdT98tQajvJEFEOHMdWIg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=c3dyFxjm7Hz/ruCNyIAuh8MJfPo4kXPW1RERm3Sxtf8tMwCLViWyTyLoGBZHA1fRZ sjPZFghyGK8pr78H6X+2v4yQinUWtYZz8HhEDr8h8OOUSxZ/57S5uSs9/EkM/QOQqg 7tjRCbGYaFdDIl+9Pvr91YFORt07e6PTqDUV92fU= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEde7F004548 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:40 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:30 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:30 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEddqp026928; Tue, 22 Oct 2019 09:39:39 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:17 +0200 Message-ID: <20191022143922.10205-9-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 08/13] spl: fit: constify the output parameter of spl_fit_get_image_name() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" There is no need for it to be non-constant. Making it constant, allows to return constant string without warning. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None common/spl/spl_fit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 5aeb9528fe..9001731303 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -46,7 +46,7 @@ __weak ulong board_spl_fit_size_align(ulong size) */ static int spl_fit_get_image_name(const void *fit, int images, const char *type, int index, - char **outname) + const char **outname) { const char *name, *str; __maybe_unused int node; @@ -101,7 +101,7 @@ static int spl_fit_get_image_name(const void *fit, int images, static int spl_fit_get_image_node(const void *fit, int images, const char *type, int index) { - char *str; + const char *str; int err; int node; @@ -387,7 +387,7 @@ static int spl_fit_record_loadable(const void *fit, int images, int index, { int ret = 0; #if !CONFIG_IS_ENABLED(FIT_IMAGE_TINY) - char *name; + const char *name; int node; ret = spl_fit_get_image_name(fit, images, "loadables", From patchwork Tue Oct 22 14:39:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181427 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="jWV8YqVj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGXq3VScz9sPh for ; Wed, 23 Oct 2019 01:46:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2EA2BC21E89; Tue, 22 Oct 2019 14:41:28 +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=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 84BC0C21E36; Tue, 22 Oct 2019 14:41:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BE119C21E08; Tue, 22 Oct 2019 14:40:09 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 9FCD1C21E1D for ; Tue, 22 Oct 2019 14:40:05 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdvoY048783; Tue, 22 Oct 2019 09:39:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755197; bh=s5C1b5nJbCnN3YNYe8IUHZFHM3iaJ2kekCq8af8+rGg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jWV8YqVjRepEvC8JuZ2qu2YXi/yILZmh1Vr9G8t4fSeSZW2CUIfSKE6Go/BPVju4E GpjHcqDV+dxbv4Wu4I1gMDRdyj0uh7WHLPTdkHIS01FMvs80GSpXL++R3aiMk7pBIr vrJfX1/RVA/bOVvg/JyjuqI/aGmQ+tNSUfP6vs9g= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdgYB004616 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:42 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:32 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:32 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEded1026998; Tue, 22 Oct 2019 09:39:41 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:18 +0200 Message-ID: <20191022143922.10205-10-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Ramon Fried , u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 09/13] drivers: board: Make the board drivers available in SPL 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Make the board driver available in the SPL too. The board driver is a way to provide useful information about the board and that can be useful in the SPL too. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - depend on SPL_DM - update the commit log drivers/Makefile | 2 +- drivers/board/Kconfig | 3 +++ drivers/board/Makefile | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/Makefile b/drivers/Makefile index a4bb5e4975..6dd43d4949 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)VIRTIO) += virtio/ obj-$(CONFIG_$(SPL_)DM_MAILBOX) += mailbox/ obj-$(CONFIG_$(SPL_)REMOTEPROC) += remoteproc/ obj-$(CONFIG_$(SPL_TPL_)TPM) += tpm/ +obj-$(CONFIG_$(SPL_)BOARD) += board/ ifndef CONFIG_TPL_BUILD ifdef CONFIG_SPL_BUILD @@ -77,7 +78,6 @@ obj-y += ata/ obj-$(CONFIG_DM_DEMO) += demo/ obj-$(CONFIG_BIOSEMU) += bios_emulator/ obj-y += block/ -obj-y += board/ obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/ obj-y += cache/ obj-$(CONFIG_CPU) += cpu/ diff --git a/drivers/board/Kconfig b/drivers/board/Kconfig index 2a3fc9c049..254f657049 100644 --- a/drivers/board/Kconfig +++ b/drivers/board/Kconfig @@ -8,6 +8,9 @@ menuconfig BOARD if BOARD +config SPL_BOARD + depends on SPL_DM + bool "Enable board driver support in SPL" config BOARD_GAZERBEAM bool "Enable board driver for the Gazerbeam board" diff --git a/drivers/board/Makefile b/drivers/board/Makefile index c8dab4fa0b..cc16361755 100644 --- a/drivers/board/Makefile +++ b/drivers/board/Makefile @@ -2,6 +2,6 @@ # # (C) Copyright 2017 # Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc -obj-$(CONFIG_BOARD) += board-uclass.o +obj-y += board-uclass.o obj-$(CONFIG_BOARD_GAZERBEAM) += gazerbeam.o obj-$(CONFIG_BOARD_SANDBOX) += sandbox.o From patchwork Tue Oct 22 14:39:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181419 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="ApTYyZBe"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGTY5C2qz9sPh for ; Wed, 23 Oct 2019 01:43:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 69C13C21E1B; Tue, 22 Oct 2019 14:41:02 +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=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 21F01C21E36; Tue, 22 Oct 2019 14:41:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D968EC21E42; Tue, 22 Oct 2019 14:40:07 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 352ACC21E12 for ; Tue, 22 Oct 2019 14:40:03 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdxHg048809; Tue, 22 Oct 2019 09:39:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755199; bh=b5G++ViHuWujHdw3DDW/HcjpldbYiHkcXSEuBvMiM8A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ApTYyZBeriEMVK7qE7nQeN3seOn0tLg9CGLWHHi/PaIBvZZWNpcJCGmVOD8UtzQm4 MGosyJknXFmTUgSkL3m1/1QheOKqXgOvUyL3ceHRRZQ9XFqAIEBFyFw+bjvEfr1Mxr T1iKalFR1FlYYeQ/NWFrAL20Fil9NADzRPcBocj0= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdifE004669 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:44 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:33 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:43 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdgQp027085; Tue, 22 Oct 2019 09:39:43 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:19 +0200 Message-ID: <20191022143922.10205-11-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 10/13] drivers: board: Add get_fit_loadable() 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function will be used by the SPL to get the names of images to load from the FIT. This allows to load different images based on runtime HW detection. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: - board_get_fit_loadable() returns an error code instead of a NULL string in case of failure Changes in v4: None Changes in v3: None Changes in v2: None drivers/board/board-uclass.c | 11 +++++++++++ include/board.h | 37 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/board/board-uclass.c b/drivers/board/board-uclass.c index a516ba4962..b5485e9895 100644 --- a/drivers/board/board-uclass.c +++ b/drivers/board/board-uclass.c @@ -23,6 +23,17 @@ int board_detect(struct udevice *dev) return ops->detect(dev); } +int board_get_fit_loadable(struct udevice *dev, int index, + const char *type, const char **strp) +{ + struct board_ops *ops = board_get_ops(dev); + + if (!ops->get_fit_loadable) + return -ENOSYS; + + return ops->get_fit_loadable(dev, index, type, strp); +} + int board_get_bool(struct udevice *dev, int id, bool *val) { struct board_ops *ops = board_get_ops(dev); diff --git a/include/board.h b/include/board.h index 9dc78684f8..fd6a486702 100644 --- a/include/board.h +++ b/include/board.h @@ -79,6 +79,24 @@ struct board_ops { * Return: 0 if OK, -ve on error. */ int (*get_str)(struct udevice *dev, int id, size_t size, char *val); + + /** + * get_fit_loadable - Get the name of an image to load from FIT + * This function can be used to provide the image names based on runtime + * detection. A classic use-case would when DTBOs are used to describe + * additionnal daughter cards. + * + * @dev: The board instance to gather the data. + * @index: Index of the image. Starts at 0 and gets incremented + * after each call to this function. + * @type: The type of image. For example, "fdt" for DTBs + * @strp: A pointer to string. Untouched if the function fails + * + * Return: 0 if OK, -ENOENT if no loadable is available else -ve on + * error. + */ + int (*get_fit_loadable)(struct udevice *dev, int index, + const char *type, const char **strp); }; #define board_get_ops(dev) ((struct board_ops *)(dev)->driver->ops) @@ -137,3 +155,22 @@ int board_get_str(struct udevice *dev, int id, size_t size, char *val); * Return: 0 if OK, -ve on error. */ int board_get(struct udevice **devp); + +/** + * board_get_fit_loadable - Get the name of an image to load from FIT + * This function can be used to provide the image names based on runtime + * detection. A classic use-case would when DTBOs are used to describe + * additionnal daughter cards. + * + * @dev: The board instance to gather the data. + * @index: Index of the image. Starts at 0 and gets incremented + * after each call to this function. + * @type: The type of image. For example, "fdt" for DTBs + * @strp: A pointer to string. Untouched if the function fails + * + * + * Return: 0 if OK, -ENOENT if no loadable is available else -ve on + * error. + */ +int board_get_fit_loadable(struct udevice *dev, int index, + const char *type, const char **strp); From patchwork Tue Oct 22 14:39:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181415 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="HQGaajLh"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGQj1cykz9sPf for ; Wed, 23 Oct 2019 01:41:01 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C54A5C21E30; Tue, 22 Oct 2019 14:40:28 +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=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 1E955C21DA1; Tue, 22 Oct 2019 14:40:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B719AC21E08; Tue, 22 Oct 2019 14:39:53 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id 48546C21E02 for ; Tue, 22 Oct 2019 14:39:50 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdkj6130690; Tue, 22 Oct 2019 09:39:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755186; bh=MTdxi30SVTBza7lMNgcWLkuGkooTZhItBm2Lg5GZxUs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HQGaajLhpVjKZsxTUxDoahGVKLDqO2+7texTXjIjYiOClpnwr7wgc5iVMZWiZjNo4 J3OqF16WVgqQ5K1VsHNFE0WsNOc5Pk+Ra4Mf+C2OVnGrjBEVc+gRT1wGnZ1VTAI9UM F1RLYQPaAITPUmkQC6Al/r3kEQ6wjFqBdclg91Pg= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdjPn070312 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:46 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:45 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:35 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdiAp027158; Tue, 22 Oct 2019 09:39:45 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:20 +0200 Message-ID: <20191022143922.10205-12-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 11/13] include: board: provide empty stubs when the BOARD option is not selected 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Useful to avoid #ifdef throughout the code that uses the board driver API. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None include/board.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/include/board.h b/include/board.h index fd6a486702..678b652b0a 100644 --- a/include/board.h +++ b/include/board.h @@ -31,6 +31,7 @@ * to read the serial number. */ +#if CONFIG_IS_ENABLED(BOARD) struct board_ops { /** * detect() - Run the hardware info detection procedure for this @@ -174,3 +175,39 @@ int board_get(struct udevice **devp); */ int board_get_fit_loadable(struct udevice *dev, int index, const char *type, const char **strp); + +#else + +static inline int board_detect(struct udevice *dev) +{ + return -ENOSYS; +} + +static inline int board_get_bool(struct udevice *dev, int id, bool *val) +{ + return -ENOSYS; +} + +static inline int board_get_int(struct udevice *dev, int id, int *val) +{ + return -ENOSYS; +} + +static inline int board_get_str(struct udevice *dev, int id, size_t size, + char *val) +{ + return -ENOSYS; +} + +static inline int board_get(struct udevice **devp) +{ + return -ENOSYS; +} + +static inline int board_get_fit_loadable(struct udevice *dev, int index, + const char *type, const char **strp) +{ + return -ENOSYS; +} + +#endif From patchwork Tue Oct 22 14:39:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181424 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="g2tq43EM"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGWd5MHYz9sPh for ; Wed, 23 Oct 2019 01:45:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 69D69C21E45; Tue, 22 Oct 2019 14:44:12 +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=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 1FCA2C21E0D; Tue, 22 Oct 2019 14:44:09 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E1966C21DA1; Tue, 22 Oct 2019 14:40:48 +0000 (UTC) Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lists.denx.de (Postfix) with ESMTPS id 3A594C21DEC for ; Tue, 22 Oct 2019 14:40:45 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEeWq3049226; Tue, 22 Oct 2019 09:40:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755232; bh=+XlVV//nU2P7kXkUkcWL4FQvP5kzjvitytyc2Un3hZA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=g2tq43EMCrD9Q6PJpFiABSKIsKfcc54ib7b2AeN8/Ifwxg+dCDQR4tARbMktMm4RN xv9llq0z4y6TVPAVXHX3wpO7pExx3ck56qcTcr8Xd74hTESohPfD0HY0OT933Dyp05 6aFUQtChcZjFZ7K78po+QH6NOb+wSi58KtS6atgw= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEeHMd071938 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:40:17 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:40:17 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:40:07 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdkOt097777; Tue, 22 Oct 2019 09:39:46 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:21 +0200 Message-ID: <20191022143922.10205-13-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Stefan Roese , Heinrich Schuchardt , u-boot@lists.denx.de, Chris Packham , Marek Vasut Subject: [U-Boot] [PATCH PATCH v6 12/13] dts: Add support for adding DT overlays in u-boot.img 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If u-boot.img is a FIT image, CONFIG_OF_OVERLAY_LIST can be used to add DT overlays to u-boot.img. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None Makefile | 3 ++- dts/Kconfig | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6fda3268e7..46c5bd4753 100644 --- a/Makefile +++ b/Makefile @@ -1262,7 +1262,8 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -p $(CONFIG_FIT_EXTERNAL_OFFSET) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \ - $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) + $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \ + $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ diff --git a/dts/Kconfig b/dts/Kconfig index c9ab66cccc..c150a9b2af 100644 --- a/dts/Kconfig +++ b/dts/Kconfig @@ -130,6 +130,14 @@ config OF_LIST device tree files (without the directory or .dtb suffix) separated by . +config OF_OVERLAY_LIST + string "List of device tree overlays to include for DT control" + depends on SPL_LOAD_FIT_APPLY_OVERLAY + help + This option specifies a list of device tree overlaysto use for DT + control. This option can then be used a FIT generator to include + the overlays in the FIT image + choice prompt "SPL OF LIST compression" depends on MULTI_DTB_FIT From patchwork Tue Oct 22 14:39:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 1181423 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 (no SPF record) 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; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="rZbUi6FD"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46yGVL1mdlz9sPh for ; Wed, 23 Oct 2019 01:44:10 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DBF4CC21E52; Tue, 22 Oct 2019 14:41:41 +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=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 65879C21E30; Tue, 22 Oct 2019 14:41:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63D6FC21E31; Tue, 22 Oct 2019 14:40:14 +0000 (UTC) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lists.denx.de (Postfix) with ESMTPS id E56BCC21DEC for ; Tue, 22 Oct 2019 14:40:10 +0000 (UTC) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x9MEe4rG130869; Tue, 22 Oct 2019 09:40:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1571755204; bh=xwUVoqG9u9zgJWh4+zMsqGYtrz5mbEfZJG3mN0uDTz0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rZbUi6FDdHuF9P/OdCef0UNQpcrQQjjObANCa2zg1C1mMTKK1Oc2DwiK12t5rPVJl ZJxet0qInP4my0Wg0qsopg2pDJ0iCBhTPb8A6iKjOgn3zQGTLwAVpo4UNqe+uAKttx Cbz1/XVUhPH7E++sCalt8ezEiwM+vpge66kbOSvQ= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x9MEdmfY070464 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 22 Oct 2019 09:39:49 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 22 Oct 2019 09:39:48 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 22 Oct 2019 09:39:39 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x9MEdlHm097895; Tue, 22 Oct 2019 09:39:48 -0500 From: Jean-Jacques Hiblot To: , , Date: Tue, 22 Oct 2019 16:39:22 +0200 Message-ID: <20191022143922.10205-14-jjhiblot@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191022143922.10205-1-jjhiblot@ti.com> References: <20191022143922.10205-1-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH PATCH v6 13/13] spl: fit: Allow the board to tell if more images must be loaded from FIT 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" spl_fit_get_image_name() is used to get the names of the images that the SPL must load from the FIT. It relies on the content of a property present in the FIT. The list of images is thus statically defined in the FIT. With this scheme, it quickly becomes hard to manage combinations of more than a handful of images. To address this problem, give the board driver code the opportunity to add to the list of images. The images from the FIT property are loaded first, and then the board_get_fit_loadable() is called to get more image names. Signed-off-by: Jean-Jacques Hiblot Reviewed-by: Simon Glass --- Changes in v6: - Instead of matching a overlay by the name of it's node. Try to match it first with the description, and then with the node's name. This allows to use makeimg to add the overlays to u-boot.img and not use a custom SPL_FIT_GENERATOR script Changes in v5: -reword commit log Changes in v4: - Use the board driver infrastructure to get the image names from the board code. - Remove a patch that passed the board name to the FIT generator. If needed the generator can get it from elsewhere - Add a fix to not load the firmware twice (once as a firmware and once as a loadable) Changes in v3: - removed the RFC prefix. This work will be needed soon by TI's AM65x platform. and can probably benefit other modular platforms - removed the last patch that provided an example of how to use this with on a DRA76. - removed the patch that made u-boot.img a symlink to u-boot.itb because it breaks the build of many platforms (because files required to build the ITB are missing) - removed the patch to reduce the footprint of the am335x SPL. (already merged) - Made the boot flow more permissive (don't fail immediately if an overlay is not present) and more verbose when an error occures - handle the dependencies of the FIT generation in a more generic way - use a dedicated kconfig option to enable the application of the overlays by the SPL. Changes in v2: - reworked board_fit_get_additionnal_images() and how it used in spl_fit.c - removed dtbo generation from dtso files and use .dts extension for the overlays - add dynamic allocation usage in a separate patch - defconfig change for the am335x_evm common/spl/spl_fit.c | 65 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 9001731303..ac69d8312e 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,29 @@ __weak ulong board_spl_fit_size_align(ulong size) return size; } +static int find_node_from_desc(const void *fit, int node, const char *str) +{ + int child; + + if (node < 0) + return -EINVAL; + + /* iterate the FIT nodes and find a matching description */ + for (child = fdt_first_subnode(fit, node); child >= 0; + child = fdt_next_subnode(fit, child)) { + int len; + const char *desc = fdt_getprop(fit, child, "description", &len); + + if (!desc) + continue; + + if (!strcmp(desc, str)) + return child; + } + + return -ENOENT; +} + /** * spl_fit_get_image_name(): By using the matching configuration subnode, * retrieve the name of an image, specified by a property name and an index @@ -48,10 +72,12 @@ static int spl_fit_get_image_name(const void *fit, int images, const char *type, int index, const char **outname) { + struct udevice *board; const char *name, *str; __maybe_unused int node; int conf_node; int len, i; + bool found = true; conf_node = fit_find_config_node(fit); if (conf_node < 0) { @@ -77,12 +103,45 @@ static int spl_fit_get_image_name(const void *fit, int images, for (i = 0; i < index; i++) { str = strchr(str, '\0') + 1; if (!str || (str - name >= len)) { - debug("no string for index %d\n", index); - return -E2BIG; + found = false; + break; + } + } + + if (!found && !board_get(&board)) { + int rc; + /* + * no string in the property for this index. Check if the board + * level code can supply one. + */ + rc = board_get_fit_loadable(board, index - i - 1, type, &str); + if (rc && rc != -ENOENT) + return rc; + + if (!rc) { + /* + * The board provided a name for a loadable. + * Try to match it against the description properties + * first. If no matching node is found, use it as a + * node name. + */ + int node; + int images = fdt_path_offset(fit, FIT_IMAGES_PATH); + + node = find_node_from_desc(fit, images, str); + if (node > 0) + str = fdt_get_name(fit, node, NULL); + + found = true; } } - *outname = (char *)str; + if (!found) { + debug("no string for index %d\n", index); + return -E2BIG; + } + + *outname = str; return 0; }