mbox series

[v3,0/3] mtd: Add support for reading MTD devices via the nvmem API

Message ID 1521933899-362-1-git-send-email-albeu@free.fr
Headers show
Series mtd: Add support for reading MTD devices via the nvmem API | expand

Message

Alban March 24, 2018, 11:24 p.m. UTC
Hi all,

this series add support for reading MTD devices via the nvmem API, this
is mostly needed on embedded devices where things like MAC address and
calibration data is often stored in a partition on the main flash device.

Adding support for the nvmem API to the MTD core is trivial, however there
is a clash in the OF binding used by both subsystems. The current nvmem
binding expect nvmem cell to be subnode of the nvmem device, without any
compatible string. But MTD devices used a similar scheme for partition in
the past, so a subnode from an MTD device could be a partition using the
old binding or an nvmem cell.

To avoid this problem we update the nvmem cell binding to use a 'nvmem-cells'
subnode with compatible string to hold the list of nvmem cells. This new
binding make sure that any kind of device can be used as nvmem provider.

Alban Bedel (3):
  nvmem: Update the OF binding to use a subnode for the cells list
  doc: bindings: Add bindings documentation for mtd nvmem
  mtd: Add support for reading MTD devices via the nvmem API

 .../devicetree/bindings/nvmem/mtd-nvmem.txt        | 27 ++++++++++
 Documentation/devicetree/bindings/nvmem/nvmem.txt  | 55 +++++++++++++-------
 drivers/mtd/Kconfig                                |  1 +
 drivers/mtd/mtdcore.c                              | 59 ++++++++++++++++++++++
 drivers/nvmem/core.c                               | 10 ++++
 include/linux/mtd/mtd.h                            |  2 +
 6 files changed, 137 insertions(+), 17 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/mtd-nvmem.txt

Comments

Petr Štetiar April 18, 2019, 1:36 p.m. UTC | #1
Hi,

I'm wondering what is the status of this patch? I'm currently trying to do
following with modified of_get_mac_address[1] which uses nvmem_get_mac_address
under the hood:

flash@0 {
	partitions {
		compatible = "fixed-partitions";

		art: partition@fe0000 {
			label = "art";
			reg = <0xff0000 0x010000>;
			read-only;

			eth0_addr: ethernet-address@0 {
				reg = <0x0 0x6>;
			};

			eth1_addr: ethernet-address@6 {
				reg = <0x6 0x6>;
			};

			wmac_addr: ethernet-address@1002 {
				reg = <0x1002 0x6>;
			};
	};
};

&eth0 {
        nvmem-cells = <&eth0_addr>;
        nvmem-cell-names = "mac-address";
};

&eth1 {
        nvmem-cells = <&eth1_addr>;
        nvmem-cell-names = "mac-address";
};

&wmac {
        nvmem-cells = <&wmac_addr>;
        nvmem-cell-names = "mac-address";
};

It seems to me, that this use case is not supported yet, but it could be
probably handled with this proposed patch or something similar. What could be
done in order to move forward? Thanks!

1. https://github.com/ynezz/linux/commit/919e9a943af4cdf9b78b0ead17e9855be90d9466

-- ynezz