Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2324389rda; Tue, 24 Oct 2023 21:58:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEogOQCxI0Je27sEOhxAFAhgAAOSBMq8y2/3oPnn9oedAQwXwYkkv0FqcC2i0lb5NudZsC5 X-Received: by 2002:a0d:d54d:0:b0:583:b186:d817 with SMTP id x74-20020a0dd54d000000b00583b186d817mr15598410ywd.27.1698209899332; Tue, 24 Oct 2023 21:58:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698209899; cv=none; d=google.com; s=arc-20160816; b=kCfben0msbG4n0D38Bo/Z9LRuDgFyZaVAPdLrqjggXVSraZMEjBChp/bqx++RNIrov rf4hQiufdh8ajKo4uDnk5jY856yUDV2y81U+W8QVeaL2BzNTl/FCwBxESgnyh28neRbr 3ZkoAqnkjuB53fxnw3DpAdBE7I2H2b5ocegIsOyh9DkUPRyFJbdil2bROcyjxa9IuxR5 Kl+jGSyQVuGYdqPt5Q5US/HfcTDyYiVPyX4CpRoxUeYrZ2T3+R6cVlJ21M5DxWJj5ui6 QPwE9ExHb6kkXKWNJKI7s1c7BUFNv/VGqcJBCylsynpPfu3arSwSKPIchV1JpArTu6Ni seyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=A+J55LQm/ehzwlxpHcKUirPQzq5SR9QqjtUmOs0xD2A=; fh=u75K1eXRqX9Ot54CwK241PLNztrttlquxUL22xQjEPA=; b=Fkc1LyxxoMkc5c4Hq9mU6b3QGzJkSQbAYgjFgzRfEhHW38nTHHIP5i0v4hCK1Xt+UD mZiXLVsVHARqZWzHYIkO2VlQtlm3MLRBCfGniwbWVV1Ar8sqGkqsySf0nx5X5WC/vNs4 un4exw8aR5mnvDd+JuAwvxQxnSb2sPdRuQNprn+Tycq/Rc9ppHyzhIwIXWsgOpl/iYPf teCAV21RyEaHuzMZzUCyKa8tbCWTttL5RLhzxgIrcZFdOmRBGelX3h9lUkC0BQKQlVXA 4u0A/bPqehEA8bzDnmgMRJ6e2XXnmg3u8gRorRbt+igIubiS569QrokSAWE2lvzqdLO2 efMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@openmail.cc header.s=2018 header.b=JKscZA1f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id r18-20020a81c312000000b005a210c45124si9623300ywk.530.2023.10.24.21.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 21:58:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=fail header.i=@openmail.cc header.s=2018 header.b=JKscZA1f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 8FBBF8021708; Tue, 24 Oct 2023 21:58:16 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbjJYE6F (ORCPT + 99 others); Wed, 25 Oct 2023 00:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjJYE6E (ORCPT ); Wed, 25 Oct 2023 00:58:04 -0400 X-Greylist: delayed 401 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 24 Oct 2023 21:58:02 PDT Received: from smtp161.vfemail.net (smtp161.vfemail.net [146.59.185.161]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 300E5128 for ; Tue, 24 Oct 2023 21:58:01 -0700 (PDT) Received: (qmail 18737 invoked from network); 25 Oct 2023 04:51:19 +0000 Received: from localhost (HELO nl101-3.vfemail.net) () by smtpout.vfemail.net with ESMTPS (ECDHE-RSA-AES256-GCM-SHA384 encrypted); 25 Oct 2023 04:51:19 +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=JKsc ZA1fcTejIgxVxwE99gtg3mw34yQTjcVa8RC4teaG6ZfTDisPJTcXsKrmpjHFQ8G+ cSc8mTxgzsEiK2w8hBLAmKlLEOR1LT58CGC72gxYKa+RgYX8+f8HyndQSbL2QyPj 4Tvi2cTwrNsxT9rG4ZHe5LiQ7SEqK48PUHjxpes= Received: (qmail 80579 invoked from network); 25 Oct 2023 04:51:18 -0000 Received: by simscan 1.4.0 ppid: 80549, pid: 80569, t: 1.8100s scanners:none Received: from unknown (HELO bmwxMDEudmZlbWFpbC5uZXQ=) (ZXF1dUBvcGVubWFpbC5jYw==@MTkyLjE2OC4xLjE5Mg==) by nl101.vfemail.net with ESMTPA; 25 Oct 2023 04:51:16 -0000 From: Edward Chow To: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Edward Chow Subject: [PATCH] dt-bindings: mtd-partitions: Export special values Date: Wed, 25 Oct 2023 12:50:58 +0800 Message-ID: <20231025045101.825236-1-equu@openmail.cc> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.3 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 24 Oct 2023 21:58:16 -0700 (PDT) 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 -- 2.42.0