From patchwork Fri Jul 17 01:46:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 235664 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1291106ilg; Thu, 16 Jul 2020 18:47:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcXLikZK9dUCCHOcFzJkys0vNbwAWvrE3noXMl0SMZAZjYbQEVYlz7thQmici5AgcJPXwc X-Received: by 2002:a05:6402:94f:: with SMTP id h15mr7232008edz.313.1594950422271; Thu, 16 Jul 2020 18:47:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594950422; cv=none; d=google.com; s=arc-20160816; b=sE9VFzEY98KxXLB3KesKaMDFb0ymef4RWWlR5azXGYJnJKvKAQdGQPu1S8jDzGXZEg VVDey6eSvS2BnIpAHVqRPN/ELmI/u9nNMYdRTmMZXYE/uhlwy9Z3qU2XmBQfIEdVPPVd HbXVqNxciqRTrZt+vl/sJmHdMCYGl2+p3yjWsOrxDduNNiVKsmGE1M4YukFmXqzgxdF+ 1ynMK3bt0oHC60VFYcHm53XY07pGDGUmii9TRSLYayR7UgR7fkr8/Kmzq07JqHYC+0RH Vca9hYZ9FYwGgvrHMljtgqJ7mGqam+eoTf3lV7IqgXm7qjWpXNNUopKmaHx1k3KaH5ZR dYTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=gmTxS135nRLvOhBXkQeqGgS6HxmjDIz+lp/EDeUIYpA=; b=BUnIcwjNLWrqnYAe4Um0WTAhN3nYlv2fZU38+7WCdYQZAiVXXTQTht4pF8OJQ+TayJ mnLMGpjuhOTOQCgXWNbOFc7jBNru8rDrZX8jObWFkF+rcGx72Jol7sN8Mw+mFEsJq6AF CjcaEfpsx/eAexQdh3+c1qNaJqb2zg/Jfhf81s9BZOUq+yGfJHC5Ovc0He63S8Ghelm3 u2L23GOkUlWzVFcnk8GTdofUY5dEFu+tLIcfFXZvRM+QTHq/ktjBKt1Zm6XAdouNyhg8 9vzRZnmZnV0lL0BbGkiSkZDSHv3Ul71L9cLrwn6U3eAJOBwaMlKeAl8OLXLKjXPCm4HH gvDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HVSSdA9r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id k20si4137808ejq.621.2020.07.16.18.47.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 18:47:02 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HVSSdA9r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0259D81BF7; Fri, 17 Jul 2020 03:47:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="HVSSdA9r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AE73A81BFF; Fri, 17 Jul 2020 03:46:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 80B8781B6E for ; Fri, 17 Jul 2020 03:46:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=yamada.masahiro@socionext.com Received: from oscar.flets-west.jp (softbank126025067101.bbtec.net [126.25.67.101]) (authenticated) by conuserg-08.nifty.com with ESMTP id 06H1kPAn008623; Fri, 17 Jul 2020 10:46:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 06H1kPAn008623 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1594950386; bh=gmTxS135nRLvOhBXkQeqGgS6HxmjDIz+lp/EDeUIYpA=; h=From:To:Cc:Subject:Date:From; b=HVSSdA9rgPYxfVqsTthJN94kdI6QMNo6VUVJcA1AfcHEP0yLMT0/umUhQrHa7tzAY iNifkNxTBM9sJF0WTjlXYV5FrdQ3not2Ts4vKGpAxC5e3Zd2F+la7C+9hiEEygzw10 IOJG+YuZSxrAD1h1m01VByiJrTau2qIBqhmhVXGmubpltXPItkaX9lSw7wHlO7z63+ 1It6YoQLQmHwgXjp2i527HihkI+i/byx1iDG+5sjs8mSjgh53uZm46oVe/hfPawpN/ mOmxBrBoS6KVQRwAd26j7VngjpnGe0/DZOhzNjqdJ+NIzJTT4et4Ghc9V0HImcqyJM TgBlk5KZfCIEA== X-Nifty-SrcIP: [126.25.67.101] From: Masahiro Yamada To: u-boot@lists.denx.de Cc: Masahiro Yamada , Simon Glass Subject: [PATCH v2 1/2] fdt_support: call mtdparts_init() after finding MTD node to fix up Date: Fri, 17 Jul 2020 10:46:18 +0900 Message-Id: <20200717014619.756044-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Platform code can call fdt_fixup_mtdparts() in order to hand U-Boot's MTD partitions over to the Linux device tree. Currently, fdt_fixup_mtdparts() calls mtdparts_init() in its entry. If no target MTD device is found, an error message like follows is displayed: Device nand0 not found! This occurs when the same code (e.g. arch/arm/mach-uniphier/fdt-fixup.c) is shared among several boards, but not all of them support an MTD device. Parse the DT first, then call mtdparts_init() only when the target MTD node is found. Yet, you still need to call mtdparts_init() before device_find(). Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- Changes in v2: - rename 'initialized' to 'inited' common/fdt_support.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/common/fdt_support.c b/common/fdt_support.c index 3778de5368..cf09c3c5fb 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -951,9 +951,7 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, struct mtd_device *dev; int i, idx; int noff; - - if (mtdparts_init() != 0) - return; + bool inited = false; for (i = 0; i < node_info_size; i++) { idx = 0; @@ -963,6 +961,13 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, debug("%s: %s, mtd dev type %d\n", fdt_get_name(blob, noff, 0), node_info[i].compat, node_info[i].type); + + if (!inited) { + if (mtdparts_init() != 0) + return; + inited = true; + } + dev = device_find(node_info[i].type, idx++); if (dev) { if (fdt_node_set_part_info(blob, noff, dev)) From patchwork Fri Jul 17 01:46:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 235665 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1291193ilg; Thu, 16 Jul 2020 18:47:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMG4dglJW5dLdtoAISOH4WPEuDkgOeDbPxNgvJAHSmx1UfbHUTEnrv++MXAppw13vWYBtX X-Received: by 2002:a17:906:fa92:: with SMTP id lt18mr6371665ejb.534.1594950433365; Thu, 16 Jul 2020 18:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594950433; cv=none; d=google.com; s=arc-20160816; b=ts1ANYbokC8uI3eVqPBSHr085wIE0ezU19QcMCZmg+EFTjvWtf+L3gouUWUTUA+9fl dx1vuEeDMVeu9whYc9GVV+XmZPEXm0vxd2R6mq8FB7NkXEdgMvjKSQ3kqsPje1VYQEJn QlrbFhQ5BuEZyZquQtc7ERuBmuDA0bPaFT16AD8tX9kBTPggtCVJ72XJ+svhaK+H7l0T GGqcKCcQlEn5KHwppEyeJhW3n42r9aDkh5vie1IvIn/7FIa9SivG/Wo5f09XiptVNbgz RXeH/EZ3IGmks2+lyiT3oN0JSIj8hbG3gXHJGJbABx++d2b9QHMTXlfrFEXL7mi0KuJc Za5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=NpnNNlgJSpr2aW/KEhyy9Y7WVbdTXFKkHy02TOlqaI4=; b=fRMhx+hkp0JsSh1xUozClaCByN3y1xDKDbxL3/bjVXGSvRk147lzlDoAiochyYkXDk eExIWHnFcTT4gVahg0ILB9EzblIdkP+K+N9rlPg0hPfa++zXpohuodhqMxFPCyc2sNt3 1Vsz8vzUu80rsf73b5s5Fg3brRZ3WnEkSSKl1SPJjzeFhyOVPxTnvuq+qqVfKGmb5ANt mTcR77qb4N0ShRstY6QGskPdPVQTiLmDJel7mDCsAfhizerzItOWJnqMr9TF4FxD7tGw 9pjIBbVOmoTVQ2795DtCsjDuC0Ay4a55NbbiR9p6b3iXt+YJlbKS/D3uKWJzwsgDSis9 5OYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=joa0p7hK; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id j31si4249910edc.371.2020.07.16.18.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 18:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=joa0p7hK; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 13C9081C02; Fri, 17 Jul 2020 03:47:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="joa0p7hK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D9FAA81BF9; Fri, 17 Jul 2020 03:46:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8959681BF7 for ; Fri, 17 Jul 2020 03:46:54 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=yamada.masahiro@socionext.com Received: from oscar.flets-west.jp (softbank126025067101.bbtec.net [126.25.67.101]) (authenticated) by conuserg-08.nifty.com with ESMTP id 06H1kPAo008623; Fri, 17 Jul 2020 10:46:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 06H1kPAo008623 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1594950386; bh=NpnNNlgJSpr2aW/KEhyy9Y7WVbdTXFKkHy02TOlqaI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joa0p7hKSP5Nyx4Aymx2oaRoPBS6xUzNiHxxKcvfeeF+LWNX7sbjwpmXz+95NhSb0 AtP1g9fhSDdoOuZTdUQ6ZEXrmA8UomAAVZDwzAmCvy0inQ+poB5gGIhFQPcQZCRciJ vZUuyOc5mgBShYH5tESQzTk1Z7W0ZW0U7yMnyDeWgDAzgrClxdY9OqvMnEKh/BLKwm APSNSZaRqOkfYPv2599XqubpCnMGKImHJpBgIoBX+qyKuw+IervjKMmKMxs1nHUopy vaDgs/NUpO8ibVnmYX75nGfyJNKW35DCCX1/wjOCbNDIdp12YIAMcqWjTS7MTm6ibz prXHAWjO4H7dw== X-Nifty-SrcIP: [126.25.67.101] From: Masahiro Yamada To: u-boot@lists.denx.de Cc: Masahiro Yamada , Simon Glass Subject: [PATCH v2 2/2] fdt_support: skip MTD node with "disabled" in fdt_fixup_mtdparts() Date: Fri, 17 Jul 2020 10:46:19 +0900 Message-Id: <20200717014619.756044-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200717014619.756044-1-yamada.masahiro@socionext.com> References: <20200717014619.756044-1-yamada.masahiro@socionext.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Currently, fdt_fixup_mtdparts() only checks the compatible property. It is pointless to fix up the disabled node. Skip the node if it has the property: status = "disabled" Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- (no changes since v1) common/fdt_support.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/common/fdt_support.c b/common/fdt_support.c index cf09c3c5fb..1ddcc53556 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -955,9 +955,16 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, for (i = 0; i < node_info_size; i++) { idx = 0; - noff = fdt_node_offset_by_compatible(blob, -1, - node_info[i].compat); - while (noff != -FDT_ERR_NOTFOUND) { + noff = -1; + + while ((noff = fdt_node_offset_by_compatible(blob, noff, + node_info[i].compat)) >= 0) { + const char *prop; + + prop = fdt_getprop(blob, noff, "status", NULL); + if (prop && !strcmp(prop, "disabled")) + continue; + debug("%s: %s, mtd dev type %d\n", fdt_get_name(blob, noff, 0), node_info[i].compat, node_info[i].type); @@ -973,10 +980,6 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info, if (fdt_node_set_part_info(blob, noff, dev)) return; /* return on error */ } - - /* Jump to next flash node */ - noff = fdt_node_offset_by_compatible(blob, noff, - node_info[i].compat); } } }