Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2949778rwl; Mon, 27 Mar 2023 07:24:52 -0700 (PDT) X-Google-Smtp-Source: AKy350ZfJOqupx7f01TkSBZUAjA3SgeJPiYvVdGhN7dS4jTqvC/K1X6pctSAr512MsuJq++X6W2D X-Received: by 2002:a17:906:1c19:b0:92b:f118:ef32 with SMTP id k25-20020a1709061c1900b0092bf118ef32mr12380565ejg.48.1679927092743; Mon, 27 Mar 2023 07:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679927092; cv=none; d=google.com; s=arc-20160816; b=t05CR6b1V6dvKzGVG1VT1TARyS6lZJ7pdegyoyIgfGdfPXrWEyF7G7gyxg41ByjfO/ XpnUCLF9TWQujAYO6uxUlkzb31KRDe4earpqeNi8UaQVtnnZMxtRc4OGVtRR2D5VRLzA nMwQquFfe+MGGJkUezj24o8GPVc5/ywR1oqAn5ezp7HcmMvZbbiR+Ulx+kP8xMtI0MFH X+nuuRTdP3ZrPT7CYkanoTCFSESHIeVJXdEI1Mb2pEK5aJmkCQIXtcG45MRGf+xL6tNK KveFTrFQjDBjIToM/lGTP+NAAIAEUK9VtQ0Xer9VVxD8l1vkuOqe6xveQecdG4a4YoIf lzDQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QzCwekFGfxzs1CDNjeDV7r4j31xaEPMaYXmxUiOdDtk=; b=aHPy01iI2VlcjSB9SKg6mqtSQD7Wlo1DA7oxT/PEq9kBaAxfgW5MrBLeGjkJwmkJor Cax2J1nCNXUuZM7g52jgVv2EnVj4hSJYIloNu8eFNnz3WCWE2Cghm+v0cN9MAkD+nG/m NYRUlVke7meCrWA7EP07M4GTgP3zIFWhBn7hOm6sZgRpVhCI4ZE0m8rNsmkhoGRNLtEK 1iIoZWbeA30b92/u66UoZdP3nOycEsZ+Ad+11cYqYDuJCGtYUUgrtD4RudVho1ElBxHf pZgbnY9EsN2JqwITtBcl3lsBS9+AgxWqpMIUyYuxkMRSoDoXiVbeHMPjmnmE6/M5hhfj ggXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jkSlOjGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 10-20020a170906208a00b009395b8121cesi17022061ejq.178.2023.03.27.07.24.28; Mon, 27 Mar 2023 07:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jkSlOjGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232519AbjC0OS1 (ORCPT + 99 others); Mon, 27 Mar 2023 10:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232724AbjC0OSG (ORCPT ); Mon, 27 Mar 2023 10:18:06 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7A496A64; Mon, 27 Mar 2023 07:16:19 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id h11so4696055lfu.8; Mon, 27 Mar 2023 07:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QzCwekFGfxzs1CDNjeDV7r4j31xaEPMaYXmxUiOdDtk=; b=jkSlOjGPwovb56Z9OU+zzP1erojmRSVnXihJEmA/6boY4vkMTFK1XwgnXyvJi8JqHj /pjpPjtDhAyVMD5uJbJ1J3qeJ9tBx7vAFcFAFjgywDKPQ0L2dS0++bvVSsNbqIbWFGZH BnAAEbGlNIqKKZ93KwUIa7hvj0ySvlpvdq0xZo61R4NzbrZAB7P3BmiCJ+urmHXYqNtZ WFL6stshmFIY83e/+JV1BkX3hv/6ALDvocypKQzStSW47Vl4blGX6qPiFp+T8GfVuheP pdZ5t5OwV6U+ypBwDjCoVd9ii2ChkAZ6lresRuyC93P6H3/iLAw3V1+0Xrm+yiuB7eIP AmCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QzCwekFGfxzs1CDNjeDV7r4j31xaEPMaYXmxUiOdDtk=; b=NCIWc39iUr/GTaJKcDGQ6Ftt9CC6zU7oGSP0I9Z/ughGcyodxo2ZLKd7F0pJdOO7uJ ZBRihDi8hFWrHXGZcMfS0Wn1RbHdQK9lWCbxB4oQy4JgIm9C9pNAl9aA7lQenG5mgUc7 VegHIdFWSwI3T05ZQkUXjgHNIxQ0uyCp0aLwg8xHBY56PnZSSPCWBRxAQRE5BvcVt7qD onWfFts/QzUggoxgVfJhp3zXEjb1M4iaZr+qmdiVpx7Z1dTzFdOsNstlU8n0nXYHaPLu C4EWpYbnWGtnDe5WVPMeao26JotVU0lB8dNCLP74xUV72OMUjWK/5iIIRmJlpkXLZijb 9GEA== X-Gm-Message-State: AAQBX9cMSshd5jmt7EqOevy9YMLBYFgHB1QQYg77vkdbaDw3MUSjR6Ks AlvG4/HEws0+zrR1n+GWrC4= X-Received: by 2002:ac2:484a:0:b0:4dd:a73f:aede with SMTP id 10-20020ac2484a000000b004dda73faedemr3095133lfy.10.1679926577303; Mon, 27 Mar 2023 07:16:17 -0700 (PDT) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id w3-20020ac24423000000b004e977970721sm4444519lfl.219.2023.03.27.07.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:16:16 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Rob Herring , Krzysztof Kozlowski , Srinivas Kandagatla Cc: Greg Kroah-Hartman , Miquel Raynal , Michael Walle , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V6 1/3] dt-bindings: nvmem: layouts: add fixed-layout Date: Mon, 27 Mar 2023 16:16:09 +0200 Message-Id: <20230327141611.25131-2-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230327141611.25131-1-zajec5@gmail.com> References: <20230327141611.25131-1-zajec5@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafał Miłecki With the introduction of NVMEM layouts, new NVMEM content structures should be defined as such. We should also try to convert / migrate existing NVMEM content bindings to layouts. This commit handles fixed NVMEM cells. So far they had to be defined directly - as device subnodes. With this change it's allowed to put them in the DT node named "nvmem-layout". Having NVMEM cells in separated node is preferred as it draws a nice line between NVMEM device and its content. It results in cleaner bindings. FWIW a very similar situation has happened to MTD devices and their partitions: see commit 5d96ea42eb63 ("dt-bindings: mtd: Clarify all partition subnodes"). Signed-off-by: Rafał Miłecki --- V6: Add unevaluatedProperties: false --- .../bindings/nvmem/layouts/fixed-cell.yaml | 31 ++++++++++++ .../bindings/nvmem/layouts/fixed-layout.yaml | 50 +++++++++++++++++++ .../bindings/nvmem/layouts/nvmem-layout.yaml | 5 +- .../devicetree/bindings/nvmem/nvmem.yaml | 19 +------ 4 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml new file mode 100644 index 000000000000..e698098450e1 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml @@ -0,0 +1,31 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/layouts/fixed-cell.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Fixed offset & size NVMEM cell + +maintainers: + - Rafał Miłecki + - Srinivas Kandagatla + +properties: + reg: + maxItems: 1 + + bits: + $ref: /schemas/types.yaml#/definitions/uint32-array + items: + - minimum: 0 + maximum: 7 + description: + Offset in bit within the address range specified by reg. + - minimum: 1 + description: + Size in bit within the address range specified by reg. + +required: + - reg + +additionalProperties: true diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml new file mode 100644 index 000000000000..c271537d0714 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVMEM layout for fixed NVMEM cells + +description: + Many NVMEM devices have hardcoded cells layout (offset and size of defined + NVMEM content doesn't change). + + This binding allows defining such NVMEM layout with its cells. It can be used + on top of any NVMEM device. + +maintainers: + - Rafał Miłecki + +properties: + compatible: + const: fixed-layout + + "#address-cells": + const: 1 + + "#size-cells": + const: 1 + +patternProperties: + "@[a-f0-9]+$": + type: object + $ref: fixed-cell.yaml + unevaluatedProperties: false + +required: + - compatible + +additionalProperties: false + +examples: + - | + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + calibration@4000 { + reg = <0x4000 0x100>; + }; + }; diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml index 8512ee538c4c..3b40f7880774 100644 --- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml @@ -18,16 +18,13 @@ description: | perform their parsing. The nvmem-layout container is here to describe these. oneOf: + - $ref: fixed-layout.yaml - $ref: kontron,sl28-vpd.yaml - $ref: onie,tlv-layout.yaml properties: compatible: true - '#address-cells': false - - '#size-cells': false - required: - compatible diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index 75bb93dda9df..b79f1bb795fb 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -49,23 +49,8 @@ properties: patternProperties: "@[0-9a-f]+(,[0-7])?$": type: object - - properties: - reg: - maxItems: 1 - description: - Offset and size in bytes within the storage device. - - bits: - $ref: /schemas/types.yaml#/definitions/uint32-array - items: - - minimum: 0 - maximum: 7 - description: - Offset in bit within the address range specified by reg. - - minimum: 1 - description: - Size in bit within the address range specified by reg. + $ref: layouts/fixed-cell.yaml + deprecated: true additionalProperties: true -- 2.34.1