linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] mtd: core: OTP nvmem provider support
@ 2021-04-16 11:49 Michael Walle
  2021-04-16 11:49 ` [PATCH 1/5] nvmem: core: allow specifying of_node Michael Walle
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Michael Walle @ 2021-04-16 11:49 UTC (permalink / raw)
  To: linux-mtd, devicetree, linux-kernel
  Cc: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
	Rob Herring, Srinivas Kandagatla, Michael Walle

The goal is to fetch a (base) MAC address from the OTP region of a SPI NOR
flash.

This is the first part, where I try to add the nvmem provider support to
the MTD core.

I'm not sure about the device tree bindings. Consider the following two
variants:

(1)
    flash@0 {
        ..

        otp {
            compatible = "mtd-user-otp";
            #address-cells = <1>;
            #size-cells = <1>;

            serial-number@0 {
                reg = <0x0 0x8>;
            };
        };
    };

(2)
    flash@0 {
        ..

        otp {
            compatible = "mtd-user-otp";
            #address-cells = <1>;
            #size-cells = <1>;

			some-useful-name {
                compatible = "nvmem-cells";

                serial-number@0 {
                    reg = <0x0 0x8>;
                };
			};
        };
    };

Both bindings use a subnode "opt[-N]". We cannot have the nvmem cells as
children to the flash node because of the legacy partition binding.

(1) seems to be the form which is used almost everywhere in the kernel.
That is, the nvmem cells are just children of the parent node.

(2) seem to be more natural, because there might also be other properties
inside the otp subnode and might be more future-proof.

At the moment this patch implements (1).

Michael Walle (5):
  nvmem: core: allow specifying of_node
  dt-bindings: mtd: add YAML schema for the generic MTD bindings
  dt-bindings: mtd: add OTP bindings
  dt-bindings: mtd: spi-nor: add otp property
  mtd: core: add OTP nvmem provider support

 .../devicetree/bindings/mtd/common.txt        |  16 +-
 .../bindings/mtd/jedec,spi-nor.yaml           |   6 +
 .../devicetree/bindings/mtd/mtd.yaml          |  89 +++++++++++
 drivers/mtd/mtdcore.c                         | 149 ++++++++++++++++++
 drivers/nvmem/core.c                          |   4 +-
 include/linux/mtd/mtd.h                       |   2 +
 include/linux/nvmem-provider.h                |   2 +
 7 files changed, 252 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/mtd.yaml

-- 
2.20.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-04-20 15:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 11:49 [PATCH 0/5] mtd: core: OTP nvmem provider support Michael Walle
2021-04-16 11:49 ` [PATCH 1/5] nvmem: core: allow specifying of_node Michael Walle
2021-04-16 11:49 ` [PATCH 2/5] dt-bindings: mtd: add YAML schema for the generic MTD bindings Michael Walle
2021-04-16 11:49 ` [PATCH 3/5] dt-bindings: mtd: add OTP bindings Michael Walle
2021-04-16 18:30   ` Rob Herring
2021-04-16 18:46     ` Rob Herring
2021-04-16 11:49 ` [PATCH 4/5] dt-bindings: mtd: spi-nor: add otp property Michael Walle
2021-04-16 18:30   ` Rob Herring
2021-04-16 11:49 ` [PATCH 5/5] mtd: core: add OTP nvmem provider support Michael Walle
2021-04-16 18:44 ` [PATCH 0/5] mtd: core: " Rob Herring
2021-04-16 19:26   ` Michael Walle
2021-04-20 14:08     ` Rob Herring
2021-04-20 15:03       ` Michael Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).