From patchwork Mon Mar 27 14:16:09 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: 1761751 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=jkSlOjGP; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4PlZfk70C6z1yXq for ; Tue, 28 Mar 2023 01:18:22 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232489AbjC0OSU (ORCPT ); Mon, 27 Mar 2023 10:18:20 -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-Google-Smtp-Source: AKy350ainV6iC5gic5XaaKtVh+/1mcO1aPMsD/jqNOYyxIjzmWLxbVX6CY5FfN6Dv8HILjcVxB2pkA== 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?b?UmFmYcWCIE1pxYJlY2tp?= 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?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= 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 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: devicetree@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 Reviewed-by: Rob Herring --- 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 From patchwork Mon Mar 27 14:16:10 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: 1761749 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=YvZ7Iw91; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4PlZfj6lHhz1yXq for ; Tue, 28 Mar 2023 01:18:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232467AbjC0OSS (ORCPT ); Mon, 27 Mar 2023 10:18:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbjC0OSG (ORCPT ); Mon, 27 Mar 2023 10:18:06 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B48C74EF4; Mon, 27 Mar 2023 07:16:21 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id j11so11629398lfg.13; Mon, 27 Mar 2023 07:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679926579; 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=xUI/boJJyBwexqi5pzYq09R7cmCZZDfn8166TkbccPA=; b=YvZ7Iw91yPR370hSqcrya7kzWkDlx0GxaLLswqfgY2kDoRjodyH8c5ht4TRfTnzGh8 rxXhBWE2D0R9rD55nyu6bPYVX+mf+UmYShlnvKzEm801re+x4thblmGWKsPK8ToE8ZhY uCvdWAN9YpWSI303VYcaZZlSQYEQjEkHFhxRIxCZQdjKf1hg4ouvncPeDDgDX/W+Mx6T Sm7/UciIprOe/XJMgwsXpkyBzhz/R0k0SsxXWWKHAOdVa992jSwh+rfFzOAiOMCl3aH4 KCbW34r+pZoZcQ6wHUTz1pXh42NpZ7hHX3xBetpJ/JCOP7ub3IF8Ap30//LnjxKBdupf 42zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679926579; 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=xUI/boJJyBwexqi5pzYq09R7cmCZZDfn8166TkbccPA=; b=JaK2m9wYG4ItQAOl8iL0PR3JJdq97jAddFIbnIi0I+I1p1Ezz964WehLQmyuPWSFfX 52qs557mX8Xs5M6AFcIC+ZYYE5i4ptffdnnQpfcUIAIjBXtBJ6UogGQ+UzUleX+xh4oA Osow07hXXd/3+MzPU4wYSPZ4tnckZCg3oDxhhGwKALnpNeQwNE1/awrEyjY6KhUZIbEl wEYxYNGBRyI1P6vI2NmHrDMbpRjPhVX3/QG0jY4lO0K3q8ONGWwS6SY/JMsLdM4YAHKJ VKNz3iBHkN42v3nIISYqYZNqDU1tkF9hwmrqcR+ERu6n2Q0jkUJmlDImalhmlMwSD0rb VU6g== X-Gm-Message-State: AAQBX9fqgjXpiOeSRGwsBfczI8DzpQPaoHTWBJ+Qqvq9QsNh9yUzxkwH qKkjwnyVPGv5qIY2DaYww/A= X-Google-Smtp-Source: AKy350boc4Hh/2cICnB+086LKmzzAAQjIgE+Fd/KSb+swqqx82dlqsj8bj2XzWr/jrizAWajbTmAow== X-Received: by 2002:a19:c202:0:b0:4db:2cdf:4c11 with SMTP id l2-20020a19c202000000b004db2cdf4c11mr3312945lfc.62.1679926579210; Mon, 27 Mar 2023 07:16:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 07:16:18 -0700 (PDT) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= 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?b?UmFm?= =?utf-8?b?YcWCIE1pxYJlY2tp?= , Rob Herring Subject: [PATCH V6 2/3] dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout Date: Mon, 27 Mar 2023 16:16:10 +0200 Message-Id: <20230327141611.25131-3-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 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: devicetree@vger.kernel.org From: Rafał Miłecki With support for the "fixed-layout" binding it's possible and preferred now to define fixed NVMEM cells in the layout node. Do that for the example binding. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../devicetree/bindings/nvmem/nvmem.yaml | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index b79f1bb795fb..980244100690 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -68,24 +68,30 @@ examples: /* ... */ - /* Data cells */ - tsens_calibration: calib@404 { - reg = <0x404 0x10>; - }; - - tsens_calibration_bckp: calib_bckp@504 { - reg = <0x504 0x11>; - bits = <6 128>; - }; - - pvs_version: pvs-version@6 { - reg = <0x6 0x2>; - bits = <7 2>; - }; - - speed_bin: speed-bin@c{ - reg = <0xc 0x1>; - bits = <2 3>; + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + /* Data cells */ + tsens_calibration: calib@404 { + reg = <0x404 0x10>; + }; + + tsens_calibration_bckp: calib_bckp@504 { + reg = <0x504 0x11>; + bits = <6 128>; + }; + + pvs_version: pvs-version@6 { + reg = <0x6 0x2>; + bits = <7 2>; + }; + + speed_bin: speed-bin@c{ + reg = <0xc 0x1>; + bits = <2 3>; + }; }; };