{"id":814224,"url":"http://patchwork.ozlabs.org/api/patches/814224/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1505473053-32520-5-git-send-email-jjhiblot@ti.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505473053-32520-5-git-send-email-jjhiblot@ti.com>","list_archive_url":null,"date":"2017-09-15T10:57:27","name":"[U-Boot,v6,04/10] fit: If no matching config is found in fit_find_config_node(), use the default one","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"20ed7d5f2436b09ea1935e5d4222cc952fc4a170","submitter":{"id":70508,"url":"http://patchwork.ozlabs.org/api/people/70508/?format=json","name":"Jean-Jacques Hiblot","email":"jjhiblot@ti.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1505473053-32520-5-git-send-email-jjhiblot@ti.com/mbox/","series":[{"id":3280,"url":"http://patchwork.ozlabs.org/api/series/3280/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=3280","date":"2017-09-15T10:57:23","name":"spl: dm: Make it possible for the SPL to pick its own DTB from a FIT","version":6,"mbox":"http://patchwork.ozlabs.org/series/3280/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814224/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814224/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"bSZ6Eey7\";\n\tdkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xtsss04nwz9t2V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 21:01:52 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid C54ACC21C93; Fri, 15 Sep 2017 11:01:07 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 72770C21FC5;\n\tFri, 15 Sep 2017 11:01:05 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid B42B4C21FBC; Fri, 15 Sep 2017 10:58:38 +0000 (UTC)","from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16])\n\tby lists.denx.de (Postfix) with ESMTPS id CE905C21FFB\n\tfor <u-boot@lists.denx.de>; Fri, 15 Sep 2017 10:58:32 +0000 (UTC)","from dlelxv90.itg.ti.com ([172.17.2.17])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8FAvto3010328; \n\tFri, 15 Sep 2017 05:57:55 -0500","from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26])\n\tby dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8FAvn5k026339; \n\tFri, 15 Sep 2017 05:57:49 -0500","from DFLE102.ent.ti.com (10.64.6.23) by DFLE105.ent.ti.com\n\t(10.64.6.26) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tFri, 15 Sep 2017 05:57:49 -0500","from dflp33.itg.ti.com (10.64.6.16) by DFLE102.ent.ti.com\n\t(10.64.6.23) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Fri, 15 Sep 2017 05:57:49 -0500","from localhost (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8FAvmAp020803;\n\tFri, 15 Sep 2017 05:57:49 -0500"],"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_DNSWL_NONE,\n\tT_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1505473075;\n\tbh=36VV4UrPu1xeniWNUGJae1GlD0krSSPMDTB/RR28678=;\n\th=From:To:CC:Subject:Date:In-Reply-To:References;\n\tb=bSZ6Eey7G4JBcDAQXTdXxZ9LwHeajfu8ETQ6nCKz+3omD8k/Es58IpNU6L2GcVIKp\n\tYjJhFw4V8N/09cHPc/DPB3vcD7vZELbWX3IvEg2Mwqf/pVaw2AskcAnS5rW/u4eHCK\n\tRDPPRrK2s1oIr0aYicRhirAv/GbtscowG9fe5jWM=","From":"Jean-Jacques Hiblot <jjhiblot@ti.com>","To":"<trini@konsulko.com>, <lokeshvutla@ti.com>, <sjg@chromium.org>,\n\t<fcooper@ti.com>","Date":"Fri, 15 Sep 2017 12:57:27 +0200","Message-ID":"<1505473053-32520-5-git-send-email-jjhiblot@ti.com>","X-Mailer":"git-send-email 1.9.1","In-Reply-To":"<1505473053-32520-1-git-send-email-jjhiblot@ti.com>","References":"<1505473053-32520-1-git-send-email-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 v6 04/10] fit: If no matching config is found in\n\tfit_find_config_node(), use the default one","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"If board_fit_config_name_match() doesn't match any configuration node,\nthen use the default one (if provided).\n\nSigned-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>\nReviewed-by: Tom Rini <trini@konsulko.com>\nReviewed-by: Simon Glass <sjg@chromium.org>\n---\n common/common_fit.c | 20 ++++++++++++++++++++\n include/image.h     | 13 +++++++++++++\n 2 files changed, 33 insertions(+)","diff":"diff --git a/common/common_fit.c b/common/common_fit.c\nindex 5f5f3f9..85b33d8 100644\n--- a/common/common_fit.c\n+++ b/common/common_fit.c\n@@ -32,6 +32,9 @@ int fit_find_config_node(const void *fdt)\n {\n \tconst char *name;\n \tint conf, node, len;\n+\tconst char *dflt_conf_name;\n+\tconst char *dflt_conf_desc = NULL;\n+\tint dflt_conf_node = -ENOENT;\n \n \tconf = fdt_path_offset(fdt, FIT_CONFS_PATH);\n \tif (conf < 0) {\n@@ -39,6 +42,9 @@ int fit_find_config_node(const void *fdt)\n \t\t      conf);\n \t\treturn -EINVAL;\n \t}\n+\n+\tdflt_conf_name = fdt_getprop(fdt, conf, \"default\", &len);\n+\n \tfor (node = fdt_first_subnode(fdt, conf);\n \t     node >= 0;\n \t     node = fdt_next_subnode(fdt, node)) {\n@@ -50,6 +56,15 @@ int fit_find_config_node(const void *fdt)\n #endif\n \t\t\treturn -EINVAL;\n \t\t}\n+\n+\t\tif (dflt_conf_name) {\n+\t\t\tconst char *node_name = fdt_get_name(fdt, node, NULL);\n+\t\t\tif (strcmp(dflt_conf_name, node_name) == 0) {\n+\t\t\t\tdflt_conf_node = node;\n+\t\t\t\tdflt_conf_desc = name;\n+\t\t\t}\n+\t\t}\n+\n \t\tif (board_fit_config_name_match(name))\n \t\t\tcontinue;\n \n@@ -58,5 +73,10 @@ int fit_find_config_node(const void *fdt)\n \t\treturn node;\n \t}\n \n+\tif (dflt_conf_node != -ENOENT) {\n+\t\tdebug(\"Selecting default config '%s'\", dflt_conf_desc);\n+\t\treturn dflt_conf_node;\n+\t}\n+\n \treturn -ENOENT;\n }\ndiff --git a/include/image.h b/include/image.h\nindex 339f79c..820f010 100644\n--- a/include/image.h\n+++ b/include/image.h\n@@ -1274,6 +1274,19 @@ void board_fit_image_post_process(void **p_image, size_t *p_size);\n #define FDT_ERROR\t((ulong)(-1))\n \n ulong fdt_getprop_u32(const void *fdt, int node, const char *prop);\n+\n+/**\n+ * fit_find_config_node() - Find the node for the best DTB in a FIT image\n+ *\n+ * A FIT image contains one or more DTBs. This function parses the\n+ * configurations described in the FIT images and returns the node of\n+ * the first matching DTB. To check if a DTB matches a board, this function\n+ * calls board_fit_config_name_match(). If no matching DTB is found, it returns\n+ * the node described by the default configuration if it exists.\n+ *\n+ * @fdt: pointer to flat device tree\n+ * @return the node if found, -ve otherwise\n+ */\n int fit_find_config_node(const void *fdt);\n \n /**\n","prefixes":["U-Boot","v6","04/10"]}