All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Petr Štetiar" <ynezz@true.cz>
To: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	"Alban Bedel" <albeu@free.fr>, "Petr Štetiar" <ynezz@true.cz>,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: [PATCH v2 0/4] of_net: Add NVMEM support to of_get_mac_address
Date: Sun, 28 Apr 2019 14:53:18 +0200	[thread overview]
Message-ID: <1556456002-13430-1-git-send-email-ynezz@true.cz> (raw)

Hi,

this patch series is a continuation of my previous attempt[1], where I've
tried to wire MTD layer into of_get_mac_address, so it would be possible to
load MAC addresses from various NVMEMs as EEPROMs etc.

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.

During the review process of my 1st attempt I was told, that I shouldn't be
using MTD directly, but I should rather use new NVMEM subsystem, so this
patch series tries to accommodate that.

First patch is wiring NVMEM support directly into of_get_mac_address as
it's obvious, that 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 used by quite a lot of drivers in the
tree already.

Second patch is simply updating documentation with NVMEM bits, also adding
some missing bits like mac-address and local-mac-address properties, which
are currently supported by of_get_mac_address.

Third and fourth patches are simply removing duplicate NVMEM code which is
no longer needed as the first patch has added NVMEM support directly into
of_get_mac_address.

Just for a better picture, this patch series and one simple patch[2] on top
of it, allows me to configure 8Devices Carambola2 board's MAC addresses
with following DTS (simplified):

 &spi {
 	flash@0 {
 		partitions {
			art: partition@ff0000 {
				label = "art";
				reg = <0xff0000 0x010000>;
				read-only;

				nvmem-cells {
					compatible = "nvmem-cells";
					#address-cells = <1>;
					#size-cells = <1>;

					eth0_addr: eth-mac-addr@0 {
						reg = <0x0 0x6>;
					};

					eth1_addr: eth-mac-addr@6 {
						reg = <0x6 0x6>;
					};

					wmac_addr: wifi-mac-addr@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";
 };


1. https://patchwork.ozlabs.org/patch/1086628/
2. https://patchwork.ozlabs.org/patch/890738/

-- ynezz

Petr Štetiar (4):
  of_net: Add NVMEM support to of_get_mac_address
  dt-bindings: doc: Reflect new NVMEM of_get_mac_address behaviour
  net: macb: Drop nvmem_get_mac_address usage
  net: davinci_emac: Drop nvmem_get_mac_address usage

 .../devicetree/bindings/net/altera_tse.txt         |  5 ++-
 Documentation/devicetree/bindings/net/amd-xgbe.txt |  5 +--
 .../devicetree/bindings/net/brcm,amac.txt          |  4 +--
 Documentation/devicetree/bindings/net/cpsw.txt     |  5 +--
 .../devicetree/bindings/net/davinci_emac.txt       |  5 +--
 Documentation/devicetree/bindings/net/dsa/dsa.txt  | 13 ++-----
 Documentation/devicetree/bindings/net/ethernet.txt |  6 ++--
 .../devicetree/bindings/net/hisilicon-femac.txt    |  6 ++--
 .../bindings/net/hisilicon-hix5hd2-gmac.txt        |  7 ++--
 .../devicetree/bindings/net/keystone-netcp.txt     |  8 ++---
 Documentation/devicetree/bindings/net/macb.txt     |  5 ++-
 .../devicetree/bindings/net/marvell-pxa168.txt     |  5 +--
 .../devicetree/bindings/net/microchip,enc28j60.txt |  3 +-
 .../devicetree/bindings/net/microchip,lan78xx.txt  |  5 ++-
 .../devicetree/bindings/net/qca,qca7000.txt        |  4 ++-
 .../devicetree/bindings/net/samsung-sxgbe.txt      |  6 ++--
 .../bindings/net/snps,dwc-qos-ethernet.txt         |  6 ++--
 .../bindings/net/socionext,uniphier-ave4.txt       |  4 +--
 .../devicetree/bindings/net/socionext-netsec.txt   |  7 ++--
 .../bindings/net/wireless/mediatek,mt76.txt        |  5 +--
 .../devicetree/bindings/net/wireless/qca,ath9k.txt |  4 +--
 drivers/net/ethernet/cadence/macb_main.c           | 12 ++-----
 drivers/net/ethernet/ti/davinci_emac.c             | 14 +++-----
 drivers/of/of_net.c                                | 42 ++++++++++++++++++++--
 24 files changed, 102 insertions(+), 84 deletions(-)

-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: "Petr Štetiar" <ynezz@true.cz>
To: netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Maxime Ripard" <maxime.ripard@bootlin.com>,
	linux-mediatek@lists.infradead.org,
	"Rob Herring" <robh+dt@kernel.org>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Alban Bedel" <albeu@free.fr>, "Petr Štetiar" <ynezz@true.cz>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	"Heiner Kallweit" <hkallweit1@gmail.com>
Subject: [PATCH v2 0/4] of_net: Add NVMEM support to of_get_mac_address
Date: Sun, 28 Apr 2019 14:53:18 +0200	[thread overview]
Message-ID: <1556456002-13430-1-git-send-email-ynezz@true.cz> (raw)

Hi,

this patch series is a continuation of my previous attempt[1], where I've
tried to wire MTD layer into of_get_mac_address, so it would be possible to
load MAC addresses from various NVMEMs as EEPROMs etc.

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.

During the review process of my 1st attempt I was told, that I shouldn't be
using MTD directly, but I should rather use new NVMEM subsystem, so this
patch series tries to accommodate that.

First patch is wiring NVMEM support directly into of_get_mac_address as
it's obvious, that 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 used by quite a lot of drivers in the
tree already.

Second patch is simply updating documentation with NVMEM bits, also adding
some missing bits like mac-address and local-mac-address properties, which
are currently supported by of_get_mac_address.

Third and fourth patches are simply removing duplicate NVMEM code which is
no longer needed as the first patch has added NVMEM support directly into
of_get_mac_address.

Just for a better picture, this patch series and one simple patch[2] on top
of it, allows me to configure 8Devices Carambola2 board's MAC addresses
with following DTS (simplified):

 &spi {
 	flash@0 {
 		partitions {
			art: partition@ff0000 {
				label = "art";
				reg = <0xff0000 0x010000>;
				read-only;

				nvmem-cells {
					compatible = "nvmem-cells";
					#address-cells = <1>;
					#size-cells = <1>;

					eth0_addr: eth-mac-addr@0 {
						reg = <0x0 0x6>;
					};

					eth1_addr: eth-mac-addr@6 {
						reg = <0x6 0x6>;
					};

					wmac_addr: wifi-mac-addr@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";
 };


1. https://patchwork.ozlabs.org/patch/1086628/
2. https://patchwork.ozlabs.org/patch/890738/

-- ynezz

Petr Štetiar (4):
  of_net: Add NVMEM support to of_get_mac_address
  dt-bindings: doc: Reflect new NVMEM of_get_mac_address behaviour
  net: macb: Drop nvmem_get_mac_address usage
  net: davinci_emac: Drop nvmem_get_mac_address usage

 .../devicetree/bindings/net/altera_tse.txt         |  5 ++-
 Documentation/devicetree/bindings/net/amd-xgbe.txt |  5 +--
 .../devicetree/bindings/net/brcm,amac.txt          |  4 +--
 Documentation/devicetree/bindings/net/cpsw.txt     |  5 +--
 .../devicetree/bindings/net/davinci_emac.txt       |  5 +--
 Documentation/devicetree/bindings/net/dsa/dsa.txt  | 13 ++-----
 Documentation/devicetree/bindings/net/ethernet.txt |  6 ++--
 .../devicetree/bindings/net/hisilicon-femac.txt    |  6 ++--
 .../bindings/net/hisilicon-hix5hd2-gmac.txt        |  7 ++--
 .../devicetree/bindings/net/keystone-netcp.txt     |  8 ++---
 Documentation/devicetree/bindings/net/macb.txt     |  5 ++-
 .../devicetree/bindings/net/marvell-pxa168.txt     |  5 +--
 .../devicetree/bindings/net/microchip,enc28j60.txt |  3 +-
 .../devicetree/bindings/net/microchip,lan78xx.txt  |  5 ++-
 .../devicetree/bindings/net/qca,qca7000.txt        |  4 ++-
 .../devicetree/bindings/net/samsung-sxgbe.txt      |  6 ++--
 .../bindings/net/snps,dwc-qos-ethernet.txt         |  6 ++--
 .../bindings/net/socionext,uniphier-ave4.txt       |  4 +--
 .../devicetree/bindings/net/socionext-netsec.txt   |  7 ++--
 .../bindings/net/wireless/mediatek,mt76.txt        |  5 +--
 .../devicetree/bindings/net/wireless/qca,ath9k.txt |  4 +--
 drivers/net/ethernet/cadence/macb_main.c           | 12 ++-----
 drivers/net/ethernet/ti/davinci_emac.c             | 14 +++-----
 drivers/of/of_net.c                                | 42 ++++++++++++++++++++--
 24 files changed, 102 insertions(+), 84 deletions(-)

-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-04-28 12:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-28 12:53 Petr Štetiar [this message]
2019-04-28 12:53 ` [PATCH v2 0/4] of_net: Add NVMEM support to of_get_mac_address Petr Štetiar
2019-04-28 12:53 ` [PATCH v2 1/4] " Petr Štetiar
2019-05-01 20:19   ` Rob Herring
2019-05-02  9:05     ` Petr Štetiar
2019-05-07 16:06       ` Rob Herring
2019-05-08  9:02         ` Petr Štetiar
2019-04-28 12:53 ` [PATCH v2 2/4] dt-bindings: doc: Reflect new NVMEM of_get_mac_address behaviour Petr Štetiar
2019-04-28 12:53   ` Petr Štetiar
2019-04-28 16:53   ` Andrew Lunn
2019-04-28 16:53     ` Andrew Lunn
2019-04-28 16:53     ` Andrew Lunn
2019-05-01 20:22     ` Rob Herring
2019-05-01 20:22       ` Rob Herring
2019-05-01 20:22       ` Rob Herring
2019-04-28 12:53 ` [PATCH v2 3/4] net: macb: Drop nvmem_get_mac_address usage Petr Štetiar
2019-04-28 16:56   ` Andrew Lunn
2019-04-28 21:08     ` Petr Štetiar
2019-04-28 21:36       ` Andrew Lunn
2019-04-29  7:55         ` Petr Štetiar
2019-04-29 13:02           ` Andrew Lunn
2019-04-30 14:13             ` Handling of EPROBE_DEFER in of_get_mac_address [Was: Re: [PATCH v2 3/4] net: macb: Drop nvmem_get_mac_address usage] Petr Štetiar
2019-05-01 13:54               ` Andrew Lunn
2019-04-28 12:53 ` [PATCH v2 4/4] net: davinci_emac: Drop nvmem_get_mac_address usage Petr Štetiar
2019-04-28 16:58   ` Andrew Lunn

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=1556456002-13430-1-git-send-email-ynezz@true.cz \
    --to=ynezz@true.cz \
    --cc=albeu@free.fr \
    --cc=andrew@lunn.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.