From patchwork Thu Feb 11 16:20:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1439568 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.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=AaoQWdor; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=d7CSuiss; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dc2262bX1z9sB4 for ; Fri, 12 Feb 2021 03:21:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=TmrI/qgx11Dqg/nK8Ocwv602lFWakK/5oSKweTbosFI=; b=AaoQWdordPjpizYAJ9MWhF/ghh 9vvW7lkzXpxccPD1AfYUxmh8qVi0jKPWiOYIvXLrydYe9rohosnzo1Y74RRnc7SKUkzON2Mfl58RZ YoSWj00HF9kAqQYDaIiJOyEbPeWD1iRHXhkWU/K7F3dLG6UzOJMymBebEhYKSm+i3PF9NUvMj6GQD m9Qo8ML5cX29zat3k9VyQ8EWiX7jdERmJWRXAc2U4N9ydnYE5d3N90J7O1fRYUXWLLNYznMm/D3fO iWylWD2uhLYJcLmcNCI+EF/gQWScraswbYCRWajy0vrUDJTtYGm8z0ZVdECRToUtEyYRXnIjZD1LM CM6HtmdQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhg-0006ad-RG; Thu, 11 Feb 2021 16:20:28 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhd-0006aH-0N for linux-mtd@lists.infradead.org; Thu, 11 Feb 2021 16:20:26 +0000 Received: by mail-lf1-x12e.google.com with SMTP id j19so8850047lfr.12 for ; Thu, 11 Feb 2021 08:20:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Klq+8tOZRYNtsr93x0bkE0OFCVkNgyAVAYrNdy6LlIA=; b=d7CSuissF1kLdNUvxsyMgjp5L79P0utUtQBK4o6sghIjh+anGrVTlyRDjO+3yLY0B8 358tEQA5wtuE6d6DK7Pf7JJImbZRLmrMp5KLM8Wcry3sxOpEajJjHAZTnldJptxmuKy5 gY+vzvpH2qkrZJra0KPAd4/OcxnSULKOKkTt9pastaCUspvfeQdkRl9SYKc8Liygo7Zn s/d1lIVUjUoPv78GfoPII1mXUJU/neI6JA/KVWVj7Qj6HYPj6qtNQB6KFGBYd1zGYe0d BTIKaf0D5CPMiM4aZJu9MA7wcAAmSxz9NfyhE1ofKmirZosXbNg6olULlD62OKi0+rop E26g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Klq+8tOZRYNtsr93x0bkE0OFCVkNgyAVAYrNdy6LlIA=; b=S8en6S5b47nakmLRPSdcXQDRPIdFHrydQhIVSydX1G1Ou8fsipHdR2MefQ549fFsSP qUNQo6wrd7wNCT2tUtVg0SbiaS47aPDmcwqU4WlnBTFAnvR6g8tncZT7iLkj4Plr7TG+ EyHIDQYc+Lylx6Ce2l0UfxnzojsNCjJqPhWkgssPwkyOMAsl1PK4CRpfP+cht6JCqIsM KY4vUZOXuDLma5R2gAnJ/T1Ml19Lan+9kXL+NvDM+yG5h4tU3ypyF9QYw3I7IzJphi7l HF9phWrsh7/MhQP8CRFX23Q7W/tCpKX98avqCWO18UCIjz+ah9VVRdqfUXDmi2LyWfXa 8jSw== X-Gm-Message-State: AOAM532u6ZCmpG7gO8JqQTgkFbe3T4kwti9c1DL4yALQh/nWseD4SkKi D2aljmRpr8miYBOrfOOErbk= X-Google-Smtp-Source: ABdhPJzAho/xEpXrHRwCUYs5X/XOO5iSDUdCi+OiIBXlAlW8Hmvg9Hr9HuhT0buIhy58eiuXoCZ2Ww== X-Received: by 2002:a19:6d0a:: with SMTP id i10mr4612142lfc.367.1613060421764; Thu, 11 Feb 2021 08:20:21 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id b5sm685941lfi.3.2021.02.11.08.20.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 08:20:21 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring Subject: [PATCH V2 mtd/next 1/3] dt-bindings: mtd: move partition binding to its own file Date: Thu, 11 Feb 2021 17:20:10 +0100 Message-Id: <20210211162012.27417-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_112025_310013_8578DC4A X-CRM114-Status: GOOD ( 17.33 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) 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:12e listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [zajec5[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [zajec5[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Rob Herring , Boris Brezillon , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki Single partition binding is quite common and may be: 1. Used by multiple parsers 2. Extended for more specific cases Move it to separated file to avoid code duplication. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../mtd/partitions/fixed-partitions.yaml | 33 +------------ .../bindings/mtd/partitions/partition.yaml | 47 +++++++++++++++++++ 2 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/partition.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml index 6d4a3450e064..ea4cace6a955 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml @@ -27,38 +27,7 @@ properties: patternProperties: "@[0-9a-f]+$": - description: node describing a single flash partition - type: object - - properties: - reg: - description: partition's offset and size within the flash - maxItems: 1 - - label: - description: The label / name for this partition. If omitted, the label - is taken from the node name (excluding the unit address). - - read-only: - description: This parameter, if present, is a hint that this partition - should only be mounted read-only. This is usually used for flash - partitions containing early-boot firmware images or data which should - not be clobbered. - type: boolean - - lock: - description: Do not unlock the partition at initialization time (not - supported on all devices) - type: boolean - - slc-mode: - description: This parameter, if present, allows one to emulate SLC mode - on a partition attached to an MLC NAND thus making this partition - immune to paired-pages corruptions - type: boolean - - required: - - reg + $ref: "partition.yaml#" required: - "#address-cells" diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml new file mode 100644 index 000000000000..e1ac08064425 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/partition.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Partition + +description: | + This binding describes a single flash partition. Each partition must have its + relative offset and size specified. Depending on partition function extra + properties can be used. + +maintainers: + - Rafał Miłecki + +properties: + reg: + description: partition's offset and size within the flash + maxItems: 1 + + label: + description: The label / name for this partition. If omitted, the label + is taken from the node name (excluding the unit address). + + read-only: + description: This parameter, if present, is a hint that this partition + should only be mounted read-only. This is usually used for flash + partitions containing early-boot firmware images or data which should + not be clobbered. + type: boolean + + lock: + description: Do not unlock the partition at initialization time (not + supported on all devices) + type: boolean + + slc-mode: + description: This parameter, if present, allows one to emulate SLC mode + on a partition attached to an MLC NAND thus making this partition + immune to paired-pages corruptions + type: boolean + +required: + - reg + +additionalProperties: true From patchwork Thu Feb 11 16:20:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1439569 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.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=imn1J/42; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=eByUlelt; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dc22B3wjYz9sB4 for ; Fri, 12 Feb 2021 03:21:38 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5triL3WMvhd22685u0xjc5pAOqu5TAdmEJwBVoAVENY=; b=imn1J/42+bZiZWqoYUat1xjfB 0jGI2324BOuXfqhxYuQi+m5OMWJvN1XuD2qCamChroPzD/q+zDuMq+Hzhw7HG5kCna80AEoB0lKgH BS7+zxK/+w7gimxGptK2szJtX/sFCGZHDG/BZXiGpIKZduWDLXLq2qNKlJf+MJZ+yGZybb4fbUt8J CSXs9z9z0VcLMcrAU+/psaqdhdEIHI4RyJrTVZgVCcvX/YqQQpHWs72axo3/7QaTKpyWxiP8AEeEX u7W9+RAXhPD4lvOaCZFgqYReTcD9rXoHWqexd5Wyx+DBLGz1yATZpo2psac/KNCkevOjbLy6A4Nps 0htYzl5pg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhk-0006bq-RA; Thu, 11 Feb 2021 16:20:32 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhh-0006ae-Hf for linux-mtd@lists.infradead.org; Thu, 11 Feb 2021 16:20:30 +0000 Received: by mail-lf1-x12c.google.com with SMTP id d24so8897467lfs.8 for ; Thu, 11 Feb 2021 08:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3WpoZRJbhDf8nOoFeDPqKJ512Il9p1PZRrO8Rys09/E=; b=eByUleltSsDabJSARAXb5WFg5+LXtrKg7AY6TIk0O9ksaNguT5kRzw6PmUzTAosxis iNShdt9aBkOXFdRyoaDfxL5nBj5AyVaDaLCfi4GIRXdNbQCvj3FNHy4xyQk4XsiRZz3n WimIRpS8aRhTESVPYaI7d3fcs5MrWy0iYjIVbU849oSNuGy0kI4QsmPVMH0N8+7FbCr6 VMHYqmHNH6Avq4XMeHQZrPxgDeWjWaTCKOD5koVK42fjkij0RN/Lp7nIMKNNsrZPWQ20 QBUV/l3peoDFe/mbmqRF9muDf+EFFPXOTlcnO7HRwksZJmK6nV6PVXwDWamiaor/e+Xw En9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3WpoZRJbhDf8nOoFeDPqKJ512Il9p1PZRrO8Rys09/E=; b=fpLyGhgpcp0I0UnwCUrmNp+O+8+NICaEilXe/sAwRB2d5Kv6q0Vm2ZdF57pJxfEqxC 65xeEWqa9F7aSXo3o973kSw5JXlqp3++GL1ubwt8Fqs6x2eScZUmSC87A9FOQ7/kvceB r2h/Ni3mWumTzttA7+vmpb/rgf/cb6kU26cKb+zY5FQ3BsiBJBDxR/Yf/35mmSxlk9jq vamZFt7fvBNY3pqB0BaMsW3hGDidPxsgwz6+MiGPGpI7SuXaZWyquqzzA2P/DDMMVTFv zFd89MRy/BtAxf/8IPFgdV43N2ebGtRCoybn0uzDyuVoDwIgJ0Jtkn2DF3YYnHp6I7X5 6Mqw== X-Gm-Message-State: AOAM532oShhS8d+TDZQXhOT+Dynq/Ualk05ht5zn+RWXjo3PT+5hMod6 3/KLOrFaVWT6NGtDE7Uu6fM= X-Google-Smtp-Source: ABdhPJzja81XJ6PEVGOSRsOZMSj5zqLEbPhy1Lu7xHQa/hCANZF3lbGArnTjoNKjzSxwFJoZt/TpXg== X-Received: by 2002:ac2:4ade:: with SMTP id m30mr5152152lfp.231.1613060426406; Thu, 11 Feb 2021 08:20:26 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id b5sm685941lfi.3.2021.02.11.08.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 08:20:25 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring Subject: [PATCH V2 mtd/next 2/3] dt-bindings: mtd: add binding for BCM4908 partitions Date: Thu, 11 Feb 2021 17:20:11 +0100 Message-Id: <20210211162012.27417-2-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210211162012.27417-1-zajec5@gmail.com> References: <20210211162012.27417-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_112029_690889_BD1627C1 X-CRM114-Status: GOOD ( 15.19 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) 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:12c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [zajec5[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [zajec5[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , devicetree@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Boris Brezillon Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki BCM4908 uses fixed partitions layout but function of some partitions may vary. Some devices use multiple firmware partitions and those partitions should be marked to let system discover their purpose. Signed-off-by: Rafał Miłecki --- V2: Use enum: [ 1, 2 ] for address & size Use ^partition@[0-9a-f]+$ pattern ("partition" was added) Drop unneeded allOf Add unevaluatedProperties --- .../partitions/brcm,bcm4908-partitions.yaml | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml new file mode 100644 index 000000000000..7b113e5e3421 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml @@ -0,0 +1,70 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/brcm,bcm4908-partitions.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom BCM4908 partitioning + +description: | + Broadcom BCM4908 CFE bootloader supports two firmware partitions. One is used + for regular booting, the other is treated as fallback. + + This binding allows defining all fixed partitions and marking those containing + firmware. System can use that information e.g. for booting or flashing + purposes. + +maintainers: + - Rafał Miłecki + +properties: + compatible: + const: brcm,bcm4908-partitions + + "#address-cells": + enum: [ 1, 2 ] + + "#size-cells": + enum: [ 1, 2 ] + +patternProperties: + "^partition@[0-9a-f]+$": + $ref: "partition.yaml#" + properties: + compatible: + const: brcm,bcm4908-firmware + unevaluatedProperties: false + +required: + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + - | + partitions { + compatible = "brcm,bcm4908-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "cferom"; + reg = <0x0 0x100000>; + }; + + partition@100000 { + compatible = "brcm,bcm4908-firmware"; + reg = <0x100000 0xf00000>; + }; + + partition@1000000 { + compatible = "brcm,bcm4908-firmware"; + reg = <0x1000000 0xf00000>; + }; + + partition@1f00000 { + label = "calibration"; + reg = <0x1f00000 0x100000>; + }; + }; From patchwork Thu Feb 11 16:20:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 1439567 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.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=h06HiHyl; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=QZMSbH+t; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dc21r43Q6z9sBy for ; Fri, 12 Feb 2021 03:21:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc: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:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Yk0Fy6INUF2SHhK5offXEngcHtiHzEI1tCSB4Qx0Xbc=; b=h06HiHylJTHl+wrr/+/owHKNz ocK7zCHy9lVv49Lr4VlUatSGwSLoJyV9uQCuPBIp1IhmN6sogPsMX2W+sr6V6gdvm8kZ4dT1MwOJb WiY0dHJvfkwNavkRSV+ieD41xRPESRMTS2s2SidSG6h7+dQ9isBBynBJYkaQTlYG9ImulcE/JZhr3 Wa7edoYDAsUJcb01kZ4OeHr1jcbdtRjeMj0o7+u02R9yJgjx5m48/ANxAUhPPOfeJKjjGTUKrFRX6 8fo4V/DwDls8pjPsr2SekQEqKrsj8W64m/sTViNxAFNbP2CEE6PJYiO+G+DFb7bSuoAjJnXHVNe9Y Nqawpy+bw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhm-0006c5-VI; Thu, 11 Feb 2021 16:20:34 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAEhj-0006b0-9w for linux-mtd@lists.infradead.org; Thu, 11 Feb 2021 16:20:32 +0000 Received: by mail-lj1-x22a.google.com with SMTP id r23so8087723ljh.1 for ; Thu, 11 Feb 2021 08:20:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9ypo3wj7J3pF2Yz8E+y5ps2m5DtA6PNEJkEl7d6YQRY=; b=QZMSbH+ttQB5qa33fjxlBu+2fHDGXvxwCtufn6iodc5U5ZxyD9UMwdYLmpxcOd/DOz aOAd5/0fq2q9j91/njYxzrbdx0G6XQgmHL2kMh8HwxgscVcZfDt+6BJ811FDBlGMR9U3 h3yhoMcw6AHeCdezr4qm85Uxq9634J0JWrJykUljT+XEn/F7NprQN9BkrE1yzy7QZH17 qwGZPSsuxXa0dTOeg7X9l6I7Un6YSkz94j6q3ZWigAESZ9qAEYIb8rr3UKlyJaM82ONI CRrXUqpOJ1nXD0JRa85LeeCWmWr1v51wf3GDfOG2eIIpL4EBRxYixDWan7/4smnsqxa8 SeEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9ypo3wj7J3pF2Yz8E+y5ps2m5DtA6PNEJkEl7d6YQRY=; b=kylvkGMiuuBlZPdVNngUGbMFw8gSu7V2+33dXxPgyuBK/tmuQGDXIFWfPoikhVcC8k 1IcTB7mc3zIvQ6JVMCnljoZnl7qzwR1eAxSOa6CFAJ9sbq4gkKugcsRbqZFTsx+vZxLf WV7H5F/JpbCCGY6nTfw2gn64OHy9HSVEcEDCo6STvQyazhKbKrH3GSw+HnvYElF3FBAo hi96Ddeh6tzMhvhlMJeRI7pBXpkNvKK0sOF5zbhzswYkr08skxeNWtQJDw1/LfoETV8W D8JWNCRdFrr+rbUxWN1Y1uM/SVfaSbfF5Cvo8lj/O3f/zFIh/E4Fh7/yLz1DbHBAqAYL HPYg== X-Gm-Message-State: AOAM532xu8btx9MDwfdYhgBV8gptNjGd1SYAKNt0DEsN1s3AEZhxxCQ5 MqxkEQTlsaW9/n74mmZOUdk= X-Google-Smtp-Source: ABdhPJxlyl1pYqoM9NleY1jv+/fLEqPbr1QDZyb4le0/nwxxulN5aU9vYoTiUFC74g4SqpsCp6CeCQ== X-Received: by 2002:a2e:7815:: with SMTP id t21mr5604805ljc.94.1613060429413; Thu, 11 Feb 2021 08:20:29 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id b5sm685941lfi.3.2021.02.11.08.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 08:20:29 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring Subject: [PATCH V2 mtd/next 3/3] mtd: parsers: ofpart: support BCM4908 fixed partitions Date: Thu, 11 Feb 2021 17:20:12 +0100 Message-Id: <20210211162012.27417-3-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210211162012.27417-1-zajec5@gmail.com> References: <20210211162012.27417-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210211_112031_399436_70801DEA X-CRM114-Status: GOOD ( 28.85 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) 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:22a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [zajec5[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [zajec5[at]gmail.com] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , devicetree@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Boris Brezillon Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki BCM4908 partitioning is based on fixed layout but allows specifying multiple firmware partitions. It requires detecting which firmware partition was used for booting current kernel. To support such cases without duplicating a lot of code (without copying most of the ofpart.c code) support for post-parsing callback was added. BCM4908 callback simply reads offset of currently used firmware partition from the DT. Bootloader specifies it using the "brcm_blparms" property. Signed-off-by: Rafał Miłecki Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/mtd/parsers/Makefile | 1 + drivers/mtd/parsers/bcm4908-partitions.c | 62 ++++++++++++++++++++++++ drivers/mtd/parsers/bcm4908-partitions.h | 7 +++ drivers/mtd/parsers/ofpart.c | 28 ++++++++++- 4 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 drivers/mtd/parsers/bcm4908-partitions.c create mode 100644 drivers/mtd/parsers/bcm4908-partitions.h diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile index 50eb0b0a2210..01972a5edc5c 100644 --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +obj-$(CONFIG_MTD_OF_PARTS) += bcm4908-partitions.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o diff --git a/drivers/mtd/parsers/bcm4908-partitions.c b/drivers/mtd/parsers/bcm4908-partitions.c new file mode 100644 index 000000000000..032a4b1b8a5f --- /dev/null +++ b/drivers/mtd/parsers/bcm4908-partitions.c @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2021 Rafał Miłecki + */ + +#include +#include +#include +#include +#include +#include + +#define BLPARAMS_FW_OFFSET "NAND_RFS_OFS" + +static long long bcm4908_partitions_fw_offset(void) +{ + struct device_node *root; + struct property *prop; + const char *s; + + root = of_find_node_by_path("/"); + if (!root) + return -ENOENT; + + of_property_for_each_string(root, "brcm_blparms", prop, s) { + size_t len = strlen(BLPARAMS_FW_OFFSET); + unsigned long offset; + int err; + + if (strncmp(s, BLPARAMS_FW_OFFSET, len) || s[len] != '=') + continue; + + err = kstrtoul(s + len + 1, 0, &offset); + if (err) { + pr_err("failed to parse %s\n", s + len + 1); + return err; + } + + return offset << 10; + } + + return -ENOENT; +} + +int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts) +{ + long long fw_offset; + int i; + + fw_offset = bcm4908_partitions_fw_offset(); + + for (i = 0; i < nr_parts; i++) { + if (of_device_is_compatible(parts[i].of_node, "brcm,bcm4908-firmware")) { + if (fw_offset < 0 || parts[i].offset == fw_offset) + parts[i].name = "firmware"; + else + parts[i].name = "backup"; + } + } + + return 0; +} diff --git a/drivers/mtd/parsers/bcm4908-partitions.h b/drivers/mtd/parsers/bcm4908-partitions.h new file mode 100644 index 000000000000..df25f0487d0a --- /dev/null +++ b/drivers/mtd/parsers/bcm4908-partitions.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __BCM4908_PARTITIONS_H +#define __BCM4908_PARTITIONS_H + +int bcm4908_partitions_post_parse(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); + +#endif diff --git a/drivers/mtd/parsers/ofpart.c b/drivers/mtd/parsers/ofpart.c index daf507c123e6..6b221df8401c 100644 --- a/drivers/mtd/parsers/ofpart.c +++ b/drivers/mtd/parsers/ofpart.c @@ -16,6 +16,18 @@ #include #include +#include "bcm4908-partitions.h" + +struct fixed_partitions_quirks { + int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); +}; + +struct fixed_partitions_quirks bcm4908_partitions_quirks = { + .post_parse = bcm4908_partitions_post_parse, +}; + +static const struct of_device_id parse_ofpart_match_table[]; + static bool node_has_compatible(struct device_node *pp) { return of_get_property(pp, "compatible", NULL); @@ -25,6 +37,8 @@ static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) { + const struct fixed_partitions_quirks *quirks; + const struct of_device_id *of_id; struct mtd_partition *parts; struct device_node *mtd_node; struct device_node *ofpart_node; @@ -33,7 +47,6 @@ static int parse_fixed_partitions(struct mtd_info *master, int nr_parts, i, ret = 0; bool dedicated = true; - /* Pull of_node from the master device node */ mtd_node = mtd_get_of_node(master); if (!mtd_node) @@ -50,11 +63,16 @@ static int parse_fixed_partitions(struct mtd_info *master, master->name, mtd_node); ofpart_node = mtd_node; dedicated = false; - } else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) { + } + + of_id = of_match_node(parse_ofpart_match_table, ofpart_node); + if (dedicated && !of_id) { /* The 'partitions' subnode might be used by another parser */ return 0; } + quirks = of_id ? of_id->data : NULL; + /* First count the subnodes */ nr_parts = 0; for_each_child_of_node(ofpart_node, pp) { @@ -126,6 +144,9 @@ static int parse_fixed_partitions(struct mtd_info *master, if (!nr_parts) goto ofpart_none; + if (quirks && quirks->post_parse) + quirks->post_parse(master, parts, nr_parts); + *pparts = parts; return nr_parts; @@ -140,7 +161,10 @@ static int parse_fixed_partitions(struct mtd_info *master, } static const struct of_device_id parse_ofpart_match_table[] = { + /* Generic */ { .compatible = "fixed-partitions" }, + /* Customized */ + { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, {}, }; MODULE_DEVICE_TABLE(of, parse_ofpart_match_table);