Skip to content

RFC mtd: core: OTP nvmem provider support

Michael Walle linux-devicetree linux-mtd lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4nvmem: core: allow specifying of_nodedrivers/nvmem/core.c include/linux/nvmem-provider.h+5 -11 reply
2/4dt-bindings: mtd: add YAML schema for the generic MTD bindingsDocumentation/devicetree/bindings/mtd/common.txt Documentation/devicetree/bindings/mtd/mtd.yaml+40 -151 reply
3/4dt-bindings: mtd: add OTP bindingsDocumentation/devicetree/bindings/mtd/mtd.yaml+71 -02 replies
4/4mtd: core: add OTP nvmem provider supportdrivers/mtd/mtdcore.c include/linux/mtd/mtd.h+151 -00 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchRob HerringSrinivas Kandagatla
1/4A-b
2/4R-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/4] mtd: core: OTP nvmem provider support

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 (4):
nvmem: core: allow specifying of_node
dt-bindings: mtd: add YAML schema for the generic MTD bindings
dt-bindings: mtd: add OTP bindings
mtd: core: add OTP nvmem provider support

 .../devicetree/bindings/mtd/common.txt        |  16 +-
 .../devicetree/bindings/mtd/mtd.yaml          | 110 +++++++++++++
 drivers/mtd/mtdcore.c                         | 149 ++++++++++++++++++
 drivers/nvmem/core.c                          |   4 +-
 include/linux/mtd/mtd.h                       |   2 +
 include/linux/nvmem-provider.h                |   2 +
 6 files changed, 267 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/mtd.yaml
Signature · 1 line
2.20.1