From patchwork Thu Mar 9 11:39:36 2023 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: 66822 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp248579wrd; Thu, 9 Mar 2023 04:04:15 -0800 (PST) X-Google-Smtp-Source: AK7set9JqHuywYbis6iMw9LSznbhabIjV0uGQ4u/cbTi5Zr9FqXLYhL93U60T6bm935s9JRk/e6H X-Received: by 2002:a17:902:ee45:b0:19e:6c7a:481 with SMTP id 5-20020a170902ee4500b0019e6c7a0481mr18154111plo.68.1678363454962; Thu, 09 Mar 2023 04:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678363454; cv=none; d=google.com; s=arc-20160816; b=Zq3IeD1/ewXGZghauzCt6u943vte8kH/dHiVgjZYRIxZVEhvO57h10jQIwwzRedeEc jMWIvu52vd1lydw3ot1FEXuaM4jNXNlbsFt8YhQSJUyyYmd1bDAINanxK23KBgfXAfSy xNdZmmDCByHCOBaO4jRIPPjzduV9gCbA+XDZu1bmdpAe1DgLGrf9+8Y/iU8MH3aU7393 mZSoRnMG5HvqS8cGmPtm0Nuz+SaRCbdDGw94yG5ZvwTaqmSz+iW25Szg4iX4m7MXhUbE IeXmrG4/XGSsk46o5aB4a6nCOboHRbHv0Sspd1/30uAqZBa8Ylz4C9Rf4mJxL6GHY9qb Crww== 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=5/fm4EqRCQX8P0V8IgQoUdGEPJ3+a5JFn9mYMwtSO3Q=; b=ItzLwk8gr8/YbpyWaV6l8278HsyViocHsWdQxssRRqd/r4ciLsfAOxcStIEsVBrbme hpn6HcmTp+yXiPw7rklfNaFJ5e+TWgua/MVSNV/VNM7/7/h8Nj8llbDPCloTORiBTADZ IXQzCNI/8RqjBvHa1wkPd3WslLpXgp+uHyEzDCrwlvEvcr5Rc2DQFMYGuuwTBHOmB8Ie vSbm+Nekqx5nzz8Fx0wO6+HkKJ55d9S9vuumOuuG7pL9gDLz+RKNRqWns8xKSaSYFmBd ws2pr1jkgMiAFx46keInAA/SaSp9AWcCfuYEK/HTu7mQwuXIG2t4c90hethgKXF8XZ/0 vzrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=jz8hJhES; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kz5-20020a170902f9c500b0019953bfaad4si16078985plb.470.2023.03.09.04.03.57; Thu, 09 Mar 2023 04:04:14 -0800 (PST) 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=jz8hJhES; 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 S231337AbjCILj4 (ORCPT + 99 others); Thu, 9 Mar 2023 06:39:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbjCILjs (ORCPT ); Thu, 9 Mar 2023 06:39:48 -0500 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E705DC0BE; Thu, 9 Mar 2023 03:39:47 -0800 (PST) Received: by mail-lj1-x231.google.com with SMTP id b10so1528991ljr.0; Thu, 09 Mar 2023 03:39:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678361985; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5/fm4EqRCQX8P0V8IgQoUdGEPJ3+a5JFn9mYMwtSO3Q=; b=jz8hJhESfDuPQgyoO4TMijhXSSWQRZKlV81/ZaLE1L19/bVehhsCxPiTATZqsogeuP Lm3C+nd6zUQfQOtHYmgIQ1N7emCuJszYTIwguedZttJi05Z23HC5g6HjeBQYH++q++Il kx4dChfSsKnGmc96ExgaWdu9F5O7qyzK+/hlfh76osrzvCofmzlRyELaeXYoNrKQcRfV YSHnkWH5QtT7Nmnqh7UaEPHV1ijH7qgq2tOg2L/I4jclKK5JTrt6X7SGLWwx9QomW999 7S8JEJRdCvnraQz2ErxcFWSQXHaWifE0WrDLK2yErSOFGy/V0nmLbef6e9xIJx3ORAwk K+Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678361985; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5/fm4EqRCQX8P0V8IgQoUdGEPJ3+a5JFn9mYMwtSO3Q=; b=wGFk4PoB14gY6K/p9TXXHKkkTjalNG2OUar0xhriunz5c9MgQN+KtfHdA9VkfRbTCR DvtxpH6NueyIZ9qUULtH06gtI+9JvCINd4XBw9DcQF4+iblBJmYydYgJieQmSJ0mlXJ3 CqkeXJFpXNNlC3DQYA4+s26OlZXCL6P9HzCICumxIePueeSb8h8GegWp8h8t3j8bCciW I38qiRyhLYyjE0kQczojZ2B0mvC4Vqgfa3esEZpeIrRnb1rvDAHFCG748DCZmQTObXMd Wvbjj/gwiMsk6li7MWWF+hKlKkx2xn/RC0ZOQqTYNMkQKnv/kJC95HpgGi4WUbij8Na6 BKFQ== X-Gm-Message-State: AO0yUKWA/5kN7hE+PyKLFCt96mUQ56TbTsUkp3GSoq3moTZ+Bnp96bAb 3xG4zztDxZ0el9d4296yxYI= X-Received: by 2002:a2e:8812:0:b0:298:7061:1172 with SMTP id x18-20020a2e8812000000b0029870611172mr1434269ljh.42.1678361985413; Thu, 09 Mar 2023 03:39:45 -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 y13-20020a2e9d4d000000b00295965f7495sm2922373ljj.0.2023.03.09.03.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 03:39:44 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Rob Herring , Krzysztof Kozlowski Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Miquel Raynal , Michael Walle , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= Subject: [PATCH V2] dt-bindings: nvmem: layouts: add fixed-layout Date: Thu, 9 Mar 2023 12:39:36 +0100 Message-Id: <20230309113936.20162-1-zajec5@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,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=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759891637749689896?= X-GMAIL-MSGID: =?utf-8?q?1759891637749689896?= From: Rafał Miłecki With the introduction of NVMEM layouts we should prefer and support describing all NVMEM devices content in the "nvmem-layout" node. That inludes using it for fixed NVMEM cells (those with hardcoded offset & size). This seems to be cleaner design and more explicit. Introduce a binding allowing fixed NVMEM cells as a type of layout. To avoid code duplication put shared part in the fixed-cell.yaml. Signed-off-by: Rafał Miłecki --- V2: Use fixed-cell.yaml --- .../bindings/nvmem/layouts/fixed-cell.yaml | 30 ++++++++++++ .../bindings/nvmem/layouts/fixed-layout.yaml | 49 +++++++++++++++++++ .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + .../devicetree/bindings/nvmem/nvmem.yaml | 18 +------ 4 files changed, 81 insertions(+), 17 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..2c77d02052d9 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml @@ -0,0 +1,30 @@ +# 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 + +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: false 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..4c4a968bb302 --- /dev/null +++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml @@ -0,0 +1,49 @@ +# 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 specific + NVMEM content doesn't change). + + This binding allows defining such cells using NVMEM layout. 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 + +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..03da7848c713 100644 --- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml +++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml @@ -18,6 +18,7 @@ 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 diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index 75bb93dda9df..732162e9d13e 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -49,23 +49,7 @@ 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 additionalProperties: true