public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Michael Walle" <michael@walle.cc>,
	devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, "Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH] dt-bindings: nvmem: allow MTD to be explicitly an NVMEM provider
Date: Fri, 10 Mar 2023 14:48:40 +0100	[thread overview]
Message-ID: <20230310144840.5203fe50@xps-13> (raw)
In-Reply-To: <20230310105330.14181-1-zajec5@gmail.com>

Hi Rafał,

zajec5@gmail.com wrote on Fri, 10 Mar 2023 11:53:30 +0100:

> From: Rafał Miłecki <rafal@milecki.pl>
> 
> There are a lot of devices with NVMEM content stored in MTD devices in
> relevant partitions. Add a DT binding for marking such partitions.
> 
> Note: Linux already treats every MTD partition as NVMEM provider so in
> general it doesn't need to care about this binding. It's meant just to
> make DT clearer in describing hardware.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> As explained in commit body this isn't really needed for Linux. I
> thought it'd be a small nice addition for writing clear DTS files.
> ---
>  .../devicetree/bindings/nvmem/mtd.yaml        | 52 +++++++++++++++++++
>  1 file changed, 52 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/mtd.yaml
> 
> diff --git a/Documentation/devicetree/bindings/nvmem/mtd.yaml b/Documentation/devicetree/bindings/nvmem/mtd.yaml
> new file mode 100644
> index 000000000000..7435b2803cf9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/nvmem/mtd.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/nvmem/mtd.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MTD access based NVMEM
> +
> +description: |
> +  MTD partitions can be NVMEM providers. This binding allows explicitly marking
> +  such partitions.

We already have that, it's nvmem-cell? I understand what you want to
do, but I think it suffers from a common problem, see below.

> +  The exact way of handling MTD partition content (NVMEM cells) should be
> +  described using a proper NVMEM layout.

Ok so I believe this is another solution for the layout offset proposed
by Michael. Except that it only fixes it for mtd. I think I would
prefer the former solution which handles all nvmem cases.

> +
> +maintainers:
> +  - Rafał Miłecki <rafal@milecki.pl>
> +
> +allOf:
> +  - $ref: nvmem.yaml#
> +  - $ref: /schemas/mtd/partitions/partition.yaml#
> +
> +properties:
> +  compatible:
> +    const: mtd-nvmem
> +
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    partitions {
> +        compatible = "fixed-partitions";
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +
> +        partition@0 {
> +            compatible = "mtd-nvmem";

Actually there has been valid push-back from devlink gurus against stale
compatibles (on a device-driver point of view) like that. Maybe
something like this instead:

	partition@x{
		<mtd-nvmem-property>

?

> +            reg = <0x0 0x40000>;
> +            label = "device-data";
> +
> +            nvmem-layout {
> +                /* Just a dummy example: Kontron can be found on OTP actually */
> +                compatible = "kontron,sl28-vpd";

The Onie tlv compatible would perfectly apply here.

> +            };
> +        };
> +    };


Thanks,
Miquèl

      reply	other threads:[~2023-03-10 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 10:53 [PATCH] dt-bindings: nvmem: allow MTD to be explicitly an NVMEM provider Rafał Miłecki
2023-03-10 13:48 ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230310144840.5203fe50@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=rafal@milecki.pl \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=zajec5@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox