From patchwork Mon Jun 6 15:14:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1639409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=DL2Ul0jB; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Erz1QKme; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LGxrr34wyz9sGP for ; Tue, 7 Jun 2022 01:15:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5D/BxL9uX2tZ/xS+ZiEg7lNjckWY79BjQxwThvA7RZk=; b=DL2Ul0jBeWJH7+ zX3ZIjChKjiDmbTi5GdqDEZGJpJ7bvprNGWApw9q1yzsdYG/zFgyph9g/lLgvezaITWCK2nAwHlbJ ZUhyT6g/yucI6pMzhcPU27sgEqJ0qPtk7/1R4rREAXLjwfhkxJDATL8Ld+9BhzqdYNjl0y8YDlN+O ISqqkruxgGuSSvqy6x5luKtsE8cevrkXZWAb2OsPpnnAfnBwi3HZqLiABR5TKk0LPjKOcZSNQWkee c3iA6k5V0UvUwg86EKqle77/06mp9Zbv+BqImf3P+0pQ0mVGOouqR1QuYhBYBZcwPZFhXMdZDDSrg a4+8j1hxosH6MyVttQhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERR-001jgi-1p; Mon, 06 Jun 2022 15:14:53 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERH-001jcI-Cv for linux-mtd@lists.infradead.org; Mon, 06 Jun 2022 15:14:45 +0000 Received: by mail-ej1-x632.google.com with SMTP id s12so22373633ejx.3 for ; Mon, 06 Jun 2022 08:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=wdA5SSs2A+GftYSjZhbZ3WXsisBDCmDB/JAxOYIkUdU=; b=Erz1QKme2uzu1CL53DykcnrB+qfgjJVnrpzSTvOrs+a/I69PggV9QsYYLXjzqxHebU atO+cXtLR7n5ZB6wEgQ6IdC7lYVVlOBMbGAAUyXlYZBNl1FZgYz6TyUWfIAqXNbSXL2T UG9Zo2iohTfIMSlrKX2DPboaZgVGBb57qjEyd0DhZMoYf7eWWUNrKmfleK2dDnVruHHs bK7wxDw/KOtX5hkmXJrnkVW4hhXZ9DQR3zktMyBdMGmPnvC6GGaeQLXbYSn1zNDASMZK hNDcpkbLwl71VmMIITEVDlEXBFz0CGCrQ9VkpyBbLzCgSGeilwXFVz9GQVUfu8L4dHTp 7DzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdA5SSs2A+GftYSjZhbZ3WXsisBDCmDB/JAxOYIkUdU=; b=jvptu+7NXXvHq1Q1xOWh7gz+spxPoy7id9hCQXXkspZrtoEt1JHqlR7ymPeRnAYFld m28UjHw91tEVVEePkRrU+HEeZzxYliThUJ0VEBbRbEBkJZfwG5XEFpyNoc0tRhFFJfSb TZQpiPZ0nzHAreFyhS68FWDK1cNnaV4QnbMlLONzV4mdvwq2UxeKInpw1qiDSYg3CTcv WPY63S0ytSON+aujdg3V93CKQ6ww2VadGT52g/SHRCfvWshF+z7MiEWFjQsaVGeHafvi 8it9GdosbY7aGzBvb1q5/r+GT+FNaOJcDK6LpYUNFK21QpK4K5APmxykl/mItlHKSRlc iuvg== X-Gm-Message-State: AOAM531rZbXq5liJiLdSFbuVXuSOdECImrGZnte56xp241V/8uX7WSgI 3P4qGJqIutsYY4ddL0twVBo= X-Google-Smtp-Source: ABdhPJyt2liP+1F1RvMMxu7z+WgrxpjuApud9EFnbwkjgtInQOBqMpdZdFYR9tePcSfc/J8YciKCbQ== X-Received: by 2002:a17:906:8301:b0:6e4:896d:59b1 with SMTP id j1-20020a170906830100b006e4896d59b1mr21131479ejx.396.1654528481019; Mon, 06 Jun 2022 08:14:41 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id be5-20020a0564021a2500b0042e09f44f81sm7494001edb.38.2022.06.06.08.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:14:40 -0700 (PDT) From: Ansuel Smith To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , Jens Axboe , Ansuel Smith , =?utf-8?b?77+9ZWNraQ==?= , Manivannan Sadhasivam , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/3] dt-bindings: mtd: partitions: Support label only partition Date: Mon, 6 Jun 2022 17:14:15 +0200 Message-Id: <20220606151417.19227-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606151417.19227-1-ansuelsmth@gmail.com> References: <20220606151417.19227-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_081443_508808_1C97335C X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Document new partition nodes that declare only the label instead of the reg used to provide an OF node for partition registred at runtime by parsers. This is required for nvmem system to declare and d [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:632 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Document new partition nodes that declare only the label instead of the reg used to provide an OF node for partition registred at runtime by parsers. This is required for nvmem system to declare and detect nvmem-cells. With these special partitions, the reg / offset is not required. The label binding is used to match the partition allocated by the parser at runtime and the parser will provide reg and offset of the mtd. NVMEM will use the data from the parser and provide the NVMEM cells declared in the DTS, "connecting" the dynamic partition with a static declaration of cells in them. Signed-off-by: Ansuel Smith --- .../bindings/mtd/partitions/partition.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml index e1ac08064425..bff6fb980e6b 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -11,6 +11,13 @@ description: | relative offset and size specified. Depending on partition function extra properties can be used. + A partition may be dynamically allocated by a specific parser at runtime. + In this specific case, the label is required instead of the reg. + This is used to assign an OF node to the dynamiccally allocated partition + so that subsystem like NVMEM can provide an OF node and declare NVMEM cells. + The OF node will be assigned only if the partition label declared match the + one assigned by the parser at runtime. + maintainers: - Rafał Miłecki @@ -22,6 +29,8 @@ properties: label: description: The label / name for this partition. If omitted, the label is taken from the node name (excluding the unit address). + With dynamically allocated partition the label is required and won't + fallback to the node name. read-only: description: This parameter, if present, is a hint that this partition @@ -41,7 +50,10 @@ properties: immune to paired-pages corruptions type: boolean -required: - - reg +if: + not: + required: [ reg ] +then: + required: [ label ] additionalProperties: true From patchwork Mon Jun 6 15:14:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1639410 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=naBLZvKf; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bi9r+qtN; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LGxrs3Cmsz9sGh for ; Tue, 7 Jun 2022 01:15:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UEz7+dHRb2jRDWolV3yORNGbLLtBt54kCDmSFfBPbpw=; b=naBLZvKf9HQAkp igEaUmHDuB5V7WH5HkaBw22Zluuyity2L9lbOhmx3grVY7BBl5OqpUXJwGryngXdqabPVBs/yQXsj RilWF8QH643o+HzvGKgJ4kDtqqc0cf7+ozDg8buA58LEtl/lYHl9jmuByhfWsEDootg2MtcFm/s67 GjnVMcVp2RmwzYosj9cvB6PH1K557rd6zeLvycUR4/Z5GYZSluzxsfLwOH1PIdpwxf9B6Wsi5QoHZ VAw7L4BPRrmzri8j/JWZPaQzW0Geqo1sYly1eSYO4KqkIN7xoNUBqGUnD+UA5UKVFQJY49O9QEKYL 9Q4QLfvKDqsdc6OAKnlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERU-001ji7-N7; Mon, 06 Jun 2022 15:14:56 +0000 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERK-001jch-4n for linux-mtd@lists.infradead.org; Mon, 06 Jun 2022 15:14:47 +0000 Received: by mail-ed1-x52c.google.com with SMTP id er5so19244591edb.12 for ; Mon, 06 Jun 2022 08:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=IvilBWGAnBlRQU+9jyrl5Is4xvOjLGN9x8U2mNdKUuA=; b=bi9r+qtN/YEFgZKvHG34WS3p/giaGxSArRaYglAT7nz4PQ/VsYlL8SUk7w1Io9htm/ muhxQTp2qWsVdZiCnQuwTWrkk7r5MnUooK67tZwH9DEJnwK27j9dgngYu6KF6db8+F31 AWLbtIXSy/7KMzNKc5Nu9j7RcfGILCbM/zwAcz1Oh9cJiGMjYUKdEZAY7N+ZRrQ7Czkm 2hjy8FFI+KoJs2mOuMWhq5h1Won/1Mhlj1cfD4W5Co5Zy4FqYglj8PPH9DdMP4KLiGn7 +zw4HLSP2WBActg5VfNCP8JfC6J3mntx3a0vTD/g2319ASx0z7a88G8Ab00tKRaHdLk4 G4Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IvilBWGAnBlRQU+9jyrl5Is4xvOjLGN9x8U2mNdKUuA=; b=NLbTaegWmK1EfL2MpmxZeFNGSou/gHIlKlg6xRXQ8hH2YdXTJG2PiwZBZ0lCKsN5lZ zg2bAz9HWYPuPgC8yNoxR667L/Hm8oNImfBpCt3cgMEVwPeUrUlIqUE6Ck+nYSIWUqP8 D9QkrPz9X2/HY8CIMIdj8nOpRgA0UdrKtFZGKW3hG7BI0CR1+60AniOf/xzYe/u9m1bd fIH7T8porsLxSNehe5Q3tqZhtql3IIpEe9kJq/HQpSWpyvxQ8xxch63nkQ0OyS3hJO9X fiJoRVhKQiMx24c81VqQC/AXQhsIGYw2gHbiN9ICraNIW/IeX2JUb8HxXQ8E4rnmGa1M dKRg== X-Gm-Message-State: AOAM532kojYFLvlpMiF5uTrwgQDjMWguj/mEj6K2PZX0TBp22soVAAg/ fw1HfYIJb378JFdTkpFfolQ= X-Google-Smtp-Source: ABdhPJyvopiVyT4O43UNksA7O6pjAK73X83wxSdwvAO1QFgjxLTOD7mUL678+d8kzQ3Qa2X+T1FOiA== X-Received: by 2002:a50:fc0d:0:b0:42d:c1ae:28bc with SMTP id i13-20020a50fc0d000000b0042dc1ae28bcmr28023125edr.24.1654528482474; Mon, 06 Jun 2022 08:14:42 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id be5-20020a0564021a2500b0042e09f44f81sm7494001edb.38.2022.06.06.08.14.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:14:41 -0700 (PDT) From: Ansuel Smith To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , Jens Axboe , Ansuel Smith , =?utf-8?b?77+9ZWNraQ==?= , Manivannan Sadhasivam , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/3] dt-bindings: mtd: partitions: add additional example for qcom,smem-part Date: Mon, 6 Jun 2022 17:14:16 +0200 Message-Id: <20220606151417.19227-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606151417.19227-1-ansuelsmth@gmail.com> References: <20220606151417.19227-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_081446_238160_815DAF36 X-CRM114-Status: GOOD ( 11.18 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Add additional example for qcom,smem-part to declare a dynamic partition to provide NVMEM cells for the commonly ART partition provided by this parser. Signed-off-by: Ansuel Smith --- .../mtd/partitions/qcom,smem-part.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add additional example for qcom,smem-part to declare a dynamic partition to provide NVMEM cells for the commonly ART partition provided by this parser. Signed-off-by: Ansuel Smith Reviewed-by: Rob Herring --- .../mtd/partitions/qcom,smem-part.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml index cf3f8c1e035d..dc07909af023 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/qcom,smem-part.yaml @@ -19,6 +19,10 @@ properties: compatible: const: qcom,smem-part +patternProperties: + "^partition-[0-9a-z]+$": + $ref: partition.yaml# + required: - compatible @@ -31,3 +35,26 @@ examples: compatible = "qcom,smem-part"; }; }; + + - | + /* Example declaring dynamic partition */ + flash { + partitions { + compatible = "qcom,smem-part"; + + partition-art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + label = "0:art"; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; + }; + }; + }; + }; From patchwork Mon Jun 6 15:14:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1639407 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=lMtp8FW8; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Sjpbo1f3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LGxrr60hVz9sGZ for ; Tue, 7 Jun 2022 01:15:56 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3/D0Sa/FbfcmRTHdK6a3lwRfSw60urhk3ydodxM++f8=; b=lMtp8FW8mAZJOX Y68p+3i4SKAeT/KtEyGdfFGKlDFbaeItAWoeeKFMTiP41tXMQvmIHICloKjrwBnNewm1I3pJ3hPjT ZfbilMjgCOORJwr6SIJmuRLaN+vj9nvn4t9VfLqRQkXwcEswkZvXfDSNasr0NXcIGJdGpMcVQ7OFJ kDRc4XWYb06CG+c+RQ2x1V7DjYa58stKzp78xVFd31Z649CfjdL62doO2Wmhfk3qceDfVsSo0pqod +3gJHIUD2iXw3xf6iHjTaeKAU7+4dOtUVDS2tlgR+4xqeUbaZLXMgrLSbA8XTmFXXsLNiR4EJw35o AjdjFpFp69msZiSb4XGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERX-001jjd-OP; Mon, 06 Jun 2022 15:14:59 +0000 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nyERL-001jdP-OM for linux-mtd@lists.infradead.org; Mon, 06 Jun 2022 15:14:49 +0000 Received: by mail-ej1-x62e.google.com with SMTP id bg6so9751747ejb.0 for ; Mon, 06 Jun 2022 08:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GYSZo6XHpAMyhvRqkjuy1lYBsylet9wRGEIDu+7oMAg=; b=Sjpbo1f3mz+MDObOhOImNTpeNo2ne+Ui6zvvn7v/z35jvASMQcDf/nUUd0HRF/t/Ea 4h8P2FFMK6drGKIuDe7GJdr4VJiUqql9Zkf5vd/qkcjzjYBEosbzEWuLOrLbtWtJTZSQ go1rdCHGLfc6Rtc6BxG+G5Motw9DHduYGE4PafmLUcSrSbFALoldaHcCiFu4vi+Mr2Sz dbKFzNplwkQu7TA9PrRtYSaK/hXBl8xLBphmb6NCeocwI6CMhlaBO8hk/x93chFTKKDY 8kzV7kkTNyDaEkCVvOKZY3q6zuxOX2mlyAq41FsA19gzg7LN43M2Vp0WkKAaaEY0ZPwO +UaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GYSZo6XHpAMyhvRqkjuy1lYBsylet9wRGEIDu+7oMAg=; b=h4s2uP1J9MwyfAKqSRlSNDSTnHnrSG5tDpWhZAbfSEZkAjpUV7IAfgHMixKawnAXVd aEMSrePYqd+X0yZ0dUlmNdv+zFabixYxKUmitLPuf5X9ElEjfCcGDVkdLPc/qfmmMSj9 Y2HceSF//axqLoRhqb5xbPCRfZSnBn2wKhoTChnvCvQcbPtvKywcXGUjSApUhKrt28b+ fgzK5PdTlaZmhOmA+CxGL3Hiq1WmStbAh5N0wH2HPkw9r3fzR5UmCyJG5KhFXFwEYj1v aWu6n5TExq/IBfqgES5/I9NwALsYFhfEg28775zGoIp3Z2eNhfvA77ZCIsEysKqU3o/t hWyw== X-Gm-Message-State: AOAM530NGCG8pxRNkox2lQgURudnAl4E4Bn8K6rUfMEmaIR+Y3SMlcbZ 38RWTGNw9iQuCsk8Z/ifp5Y= X-Google-Smtp-Source: ABdhPJyUO4QhLpj5hQB1ExfVx6GyV11SpB7T0Mr7aQNaOcyQYh/tJ5wxoOy0jfL291yecIhfv8GacA== X-Received: by 2002:a17:907:7811:b0:6ef:a896:b407 with SMTP id la17-20020a170907781100b006efa896b407mr21254860ejc.645.1654528484015; Mon, 06 Jun 2022 08:14:44 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id be5-20020a0564021a2500b0042e09f44f81sm7494001edb.38.2022.06.06.08.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:14:43 -0700 (PDT) From: Ansuel Smith To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , Greg Kroah-Hartman , Jens Axboe , Ansuel Smith , =?utf-8?b?77+9ZWNraQ==?= , Manivannan Sadhasivam , linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/3] mtd: core: introduce of support for dynamic partitions Date: Mon, 6 Jun 2022 17:14:17 +0200 Message-Id: <20220606151417.19227-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220606151417.19227-1-ansuelsmth@gmail.com> References: <20220606151417.19227-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220606_081447_849631_C5F709D9 X-CRM114-Status: GOOD ( 19.90 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We have many parser that register mtd partitions at runtime. One example is the cmdlinepart or the smem-part parser where the compatible is defined in the dts and the partitions gets detected and regi [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:62e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [ansuelsmth[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We have many parser that register mtd partitions at runtime. One example is the cmdlinepart or the smem-part parser where the compatible is defined in the dts and the partitions gets detected and registered by the parser. This is problematic for the NVMEM subsystem that requires an OF node to detect NVMEM cells. To fix this problem, introduce an additional logic that will try to assign an OF node to the MTD if declared. On MTD addition, it will be checked if the MTD has an OF node and if not declared will check if a partition with the same label is declared in DTS. If an exact match is found, the partition dynamically allocated by the parser will have a connected OF node. The NVMEM subsystem will detect the OF node and register any NVMEM cells declared statically in the DTS. Signed-off-by: Ansuel Smith Reported-by: kernel test robot --- drivers/mtd/mtdcore.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 7731796024e0..807194efb580 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -546,6 +546,54 @@ static int mtd_nvmem_add(struct mtd_info *mtd) return 0; } +static void mtd_check_of_node(struct mtd_info *mtd) +{ + struct device_node *partitions, *parent_dn, *mtd_dn = NULL; + struct mtd_info *parent; + const char *mtd_name; + bool found = false; + int plen; + + /* Check if MTD already has a device node */ + if (dev_of_node(&mtd->dev)) + return; + + /* Check if a partitions node exist */ + parent = mtd->parent; + parent_dn = dev_of_node(&parent->dev); + if (!parent_dn) + return; + + partitions = of_get_child_by_name(parent_dn, "partitions"); + if (!partitions) + goto exit_parent; + + /* Search if a partition is defined with the same name */ + for_each_child_of_node(partitions, mtd_dn) { + /* Skip partition with no label */ + mtd_name = of_get_property(mtd_dn, "label", &plen); + if (!mtd_name) + continue; + + if (!strncmp(mtd->name, mtd_name, plen)) { + found = true; + break; + } + } + + if (!found) + goto exit_partitions; + + /* Set of_node only for nvmem */ + if (of_device_is_compatible(mtd_dn, "nvmem-cells")) + mtd_set_of_node(mtd, mtd_dn); + +exit_partitions: + of_node_put(partitions); +exit_parent: + of_node_put(parent_dn); +} + /** * add_mtd_device - register an MTD device * @mtd: pointer to new MTD device info structure @@ -651,6 +699,7 @@ int add_mtd_device(struct mtd_info *mtd) mtd->dev.devt = MTD_DEVT(i); dev_set_name(&mtd->dev, "mtd%d", i); dev_set_drvdata(&mtd->dev, mtd); + mtd_check_of_node(mtd); of_node_get(mtd_get_of_node(mtd)); error = device_register(&mtd->dev); if (error)