From patchwork Wed Oct 25 05:29:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Edward Chow X-Patchwork-Id: 1854734 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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=w4UqMKA5; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=openmail.cc header.i=@openmail.cc header.a=rsa-sha256 header.s=2018 header.b=Cj0wJoiK; dkim-atps=neutral Authentication-Results: legolas.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=patchwork.ozlabs.org) 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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SFcw61cmpz23jh for ; Wed, 25 Oct 2023 16:30:44 +1100 (AEDT) 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:Message-ID:Date:Subject:Cc :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=GeE2ck1Z2OlYyVARMAHDJcv2sYaDHSVqjtyUkcNzRds=; b=w4UqMKA5DohUSR pFxX0sanoy7Ek8LHU2MhnCUJro2LcmwSxsE0A+By24kBMdAYLIK9rJOxlvPtUqsNjq0LseUza69iE idR8PM07lIsHJLAbh+L6W876d/hkeKhhdIrqYkbhxooefimKWjQT49hlDUZ8TASFxXHOYf4wJ3EtE o3ylyiSZua70jSZzkbOC++DMBmvd9/2pnvr03pbpEZjbJc9O7nytbrclH5II4CLqeotY8BDMbQ7xT Iz7YZTisP7FuPoCn1RVtGbKwyMynclEoDgUsjbinxJ9geq8lYYRz7iF5O3iHwr3U6lRVzvsTlxztt I89D9/pTBa99NDBI2ndg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qvWT0-00BPvn-0h; Wed, 25 Oct 2023 05:30:06 +0000 Received: from smtp161.vfemail.net ([146.59.185.161]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qvWSw-00BPub-2y for linux-mtd@lists.infradead.org; Wed, 25 Oct 2023 05:30:04 +0000 Received: (qmail 19221 invoked from network); 25 Oct 2023 05:29:55 +0000 Received: from localhost (HELO nl101-3.vfemail.net) () by smtpout.vfemail.net with ESMTPS (ECDHE-RSA-AES256-GCM-SHA384 encrypted); 25 Oct 2023 05:29:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=openmail.cc; h=from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; s=2018; bh=z3I7BxJWkJGWMcauhe7x+lldOe3CDXrLlKAqfautbjk=; b=Cj0w JoiKI2SfVe60Psj61dy+q52zcpnQMkdZP67tcjvidMl6y4aVKYAxOW9ExxIhthqS 15sVmRPwMBR84z2XcNUVvQqdEyyp9sFp+j0qboyt7AAZE+D8/KT0vEQxB9QjsgpH x40Gly4ZsBpym5DXJCFTEPOtAY8Q2S0TY5UftTo= Received: (qmail 25396 invoked from network); 25 Oct 2023 05:29:55 -0000 Received: by simscan 1.4.0 ppid: 25167, pid: 25355, t: 1.2316s scanners:none Received: from unknown (HELO bmwxMDEudmZlbWFpbC5uZXQ=) (ZXF1dUBvcGVubWFpbC5jYw==@MTkyLjE2OC4xLjE5Mg==) by nl101.vfemail.net with ESMTPA; 25 Oct 2023 05:29:54 -0000 From: Edward Chow To: Rob Herring , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Krzysztof Kozlowski Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Edward Chow Subject: [PATCH] dt-bindings: mtd-partitions: Export special values Date: Wed, 25 Oct 2023 13:29:37 +0800 Message-ID: <20231025052937.830813-1-equu@openmail.cc> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231024_223003_291339_A8D33C22 X-CRM114-Status: GOOD ( 17.14 ) 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: There are special "offset" and "size" values defined and documented in linux/mtd/partitions.h: // consume as much as possible, leaving size after the end of partition. // the partition will start at the next erase block. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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 [equu[at]openmail.cc] -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 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 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 There are special "offset" and "size" values defined and documented in linux/mtd/partitions.h: // consume as much as possible, leaving size after the end of partition. // the partition will start at the next erase block. // the partition will start where the previous one ended. (Though not explicitly, they are compared against variables in uint64_t in drivers/mtd/mtdpart.c, so they had better be considered as such.) // the partition will extend to the end of the master MTD device. These special values could be used to define partitions automatically fitting to the size of the master MTD device at runtime. However, these values used not to be exported to dt-bindings, thus seldom used before, since they might have been only used in numeric form, such as "(-1) (-3)" for MTDPART_OFS_RETAIN. Now, they are exported in dt-bindings/mtd/partitions.h as 32-bit cell values, so 2-cell addressed should be defined to use special offset values, such as "MTDPART_OFS_SPECIAL MTDPART_OFS_RETAIN" for MTDPART_OFS_RETAIN in linux/mtd/partitions.h. An example is added to fixed-partitions.yaml. Signed-off-by: Edward Chow --- .../mtd/partitions/fixed-partitions.yaml | 29 +++++++++++++++++++ MAINTAINERS | 2 ++ include/dt-bindings/mtd/partitions.h | 15 ++++++++++ 3 files changed, 46 insertions(+) create mode 100644 include/dt-bindings/mtd/partitions.h diff --git a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml index 331e564f29dc..a939fb52ef76 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml @@ -164,3 +164,32 @@ examples: read-only; }; }; + + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <2>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0 0x000000 0x020000>; + read-only; + }; + + firmware@1 { + label = "firmware"; + /* From the end of the last partition, occupying as mush + * as possible, retaining 0x010000 after it, + * "MTDPART_OFS_SPECIAL MTDPART_OFS_NXTBLK" similar to + * this, but always beginning at erase block boundary. */ + reg = ; + }; + + calibration@2 { + compatible = "fixed-partitions"; + label = "calibration"; + /* Appending to the last partition, occupying 0x010000 */ + reg = ; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 668d1e24452d..7d6beadc8b36 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -13771,9 +13771,11 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes T: git git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next F: Documentation/devicetree/bindings/mtd/ F: drivers/mtd/ +F: include/dt-bindings/mtd/ F: include/linux/mtd/ F: include/uapi/mtd/ + MEMSENSING MICROSYSTEMS MSA311 DRIVER M: Dmitry Rokosov L: linux-iio@vger.kernel.org diff --git a/include/dt-bindings/mtd/partitions.h b/include/dt-bindings/mtd/partitions.h new file mode 100644 index 000000000000..456a54a1259a --- /dev/null +++ b/include/dt-bindings/mtd/partitions.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Device Tree constants identical to those in include/linux/mtd/partitions.h + */ + +#ifndef _DT_BINDINGS_MTD_PARTITIONS_H +#define _DT_BINDINGS_MTD_PARTITIONS_H + +#define MTDPART_OFS_SPECIAL (-1) +#define MTDPART_OFS_RETAIN (-3) +#define MTDPART_OFS_NXTBLK (-2) +#define MTDPART_OFS_APPEND (-1) +#define MTDPART_SIZ_FULL (0) + +#endif