of_net: add NVMEM support to of_get_mac_address
authorPetr Štetiar <ynezz@true.cz>
Fri, 3 May 2019 14:27:06 +0000 (16:27 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 6 May 2019 04:47:07 +0000 (21:47 -0700)
commitd01f449c008a3f41fa44c603e28a7452ab8f8e68
tree5494aee8663654b70f4c5bdd85fbd2f270d24662
parent8ef5cc4f3c12dfb2fde74762feaff13c0d6b685c
of_net: add NVMEM support to of_get_mac_address

Many embedded devices have information such as MAC addresses stored
inside NVMEMs like EEPROMs and so on. Currently there are only two
drivers in the tree which benefit from NVMEM bindings.

Adding support for NVMEM into every other driver would mean adding a lot
of repetitive code. This patch allows us to configure MAC addresses in
various devices like ethernet and wireless adapters directly from
of_get_mac_address, which is already used by almost every driver in the
tree.

Predecessor of this patch which used directly MTD layer has originated
in OpenWrt some time ago and supports already about 497 use cases in 357
device tree files.

Cc: Alban Bedel <albeu@free.fr>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/of/of_net.c