Linux-Amlogic Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1
@ 2019-07-27 19:46 Martin Blumenstingl
  2019-07-27 19:46 ` [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address Martin Blumenstingl
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Martin Blumenstingl @ 2019-07-27 19:46 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: linux.amoon, Martin Blumenstingl, linux-kernel, linux-arm-kernel,
	ottuzzi

This series makes Odroid-C1 use the MAC address which is programmed into
the eFuse.

build-time dependencies:
patches are based on top of "ARM: dts: meson8b: add VDDEE / mali-supply"
from [0]

runtime dependencies (without these a random MAC address is assigned,
just like before these patches):
- "nvmem: meson-mx-efuse: allow reading data smaller than word_size"
  from [1]
- "net: stmmac: manage errors returned by of_get_mac_address()" from [2]


[0] https://patchwork.kernel.org/cover/11062361/
[1] https://patchwork.kernel.org/patch/11062659/
[2] https://patchwork.kernel.org/patch/11062657/


Martin Blumenstingl (2):
  ARM: dts: meson8b: add the nvmem cell with the board's MAC address
  ARM: dts: meson8b: odroidc1: use the MAC address stored in the eFuse

 arch/arm/boot/dts/meson8b-odroidc1.dts | 3 +++
 arch/arm/boot/dts/meson8b.dtsi         | 4 ++++
 2 files changed, 7 insertions(+)

-- 
2.22.0


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

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

* [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address
  2019-07-27 19:46 [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Martin Blumenstingl
@ 2019-07-27 19:46 ` Martin Blumenstingl
  2019-07-29  7:11   ` Neil Armstrong
  2019-07-27 19:46 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: use the MAC address stored in the eFuse Martin Blumenstingl
  2019-08-05 21:23 ` [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Kevin Hilman
  2 siblings, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2019-07-27 19:46 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: linux.amoon, Martin Blumenstingl, linux-kernel, linux-arm-kernel,
	ottuzzi

Amlogic's BSP kernel defines that all boards with a MAC address stored
in the eFuse have it at offset 0x1b4. It is up to the board to
decide whether to use this MAC address or not:
- Odroid-C1 uses the MAC address from the eFuse
- EC-100 seems to read the MAC address from eMMC

Add the nvmem cell which describes the Ethernet MAC address. Don't
assign it to the Ethernet controller, because depending on the board the
actual MAC address may be read from somewhere else.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm/boot/dts/meson8b.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
index 30fca9bb4bbe..c7de58b71d08 100644
--- a/arch/arm/boot/dts/meson8b.dtsi
+++ b/arch/arm/boot/dts/meson8b.dtsi
@@ -402,6 +402,10 @@
 	clocks = <&clkc CLKID_EFUSE>;
 	clock-names = "core";
 
+	ethernet_mac_address: mac@1b4 {
+		reg = <0x1b4 0x6>;
+	};
+
 	temperature_calib: calib@1f4 {
 		/* only the upper two bytes are relevant */
 		reg = <0x1f4 0x4>;
-- 
2.22.0


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

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

* [PATCH 2/2] ARM: dts: meson8b: odroidc1: use the MAC address stored in the eFuse
  2019-07-27 19:46 [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Martin Blumenstingl
  2019-07-27 19:46 ` [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address Martin Blumenstingl
@ 2019-07-27 19:46 ` Martin Blumenstingl
  2019-08-05 21:23 ` [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Kevin Hilman
  2 siblings, 0 replies; 7+ messages in thread
From: Martin Blumenstingl @ 2019-07-27 19:46 UTC (permalink / raw)
  To: linux-amlogic, khilman
  Cc: linux.amoon, Martin Blumenstingl, linux-kernel, linux-arm-kernel,
	ottuzzi

Odroid-C1 (and probably other Meson8b boards which are based on the
reference designs) uses the MAC address stored in eFuse at offset 0x1b4.

Assign the nvmem cell to the Ethernet controller as "mac-address" so the
MAC address which is stored in the eFuse is assigned to the Ethernet
controller. This means the MAC address will be consistent across
reboots.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 arch/arm/boot/dts/meson8b-odroidc1.dts | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts
index 90f66dc45115..df428a40a748 100644
--- a/arch/arm/boot/dts/meson8b-odroidc1.dts
+++ b/arch/arm/boot/dts/meson8b-odroidc1.dts
@@ -200,6 +200,9 @@
 	phy-handle = <&eth_phy>;
 	amlogic,tx-delay-ns = <4>;
 
+	nvmem-cells = <&ethernet_mac_address>;
+	nvmem-cell-names = "mac-address";
+
 	mdio {
 		compatible = "snps,dwmac-mdio";
 		#address-cells = <1>;
-- 
2.22.0


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

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

* Re: [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address
  2019-07-27 19:46 ` [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address Martin Blumenstingl
@ 2019-07-29  7:11   ` Neil Armstrong
  2019-07-29 21:45     ` Martin Blumenstingl
  0 siblings, 1 reply; 7+ messages in thread
From: Neil Armstrong @ 2019-07-29  7:11 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-amlogic, khilman
  Cc: linux.amoon, linux-kernel, linux-arm-kernel, ottuzzi

Hi Martin,

On 27/07/2019 21:46, Martin Blumenstingl wrote:
> Amlogic's BSP kernel defines that all boards with a MAC address stored
> in the eFuse have it at offset 0x1b4. It is up to the board to
> decide whether to use this MAC address or not:
> - Odroid-C1 uses the MAC address from the eFuse
> - EC-100 seems to read the MAC address from eMMC
> 
> Add the nvmem cell which describes the Ethernet MAC address. Don't
> assign it to the Ethernet controller, because depending on the board the
> actual MAC address may be read from somewhere else.
> 
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> ---
>  arch/arm/boot/dts/meson8b.dtsi | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
> index 30fca9bb4bbe..c7de58b71d08 100644
> --- a/arch/arm/boot/dts/meson8b.dtsi
> +++ b/arch/arm/boot/dts/meson8b.dtsi
> @@ -402,6 +402,10 @@
>  	clocks = <&clkc CLKID_EFUSE>;
>  	clock-names = "core";
>  
> +	ethernet_mac_address: mac@1b4 {
> +		reg = <0x1b4 0x6>;
> +	};

Is this a fixed position for all boards ? if not, I'll suggest moving
it to the odroid-c1 dt until you have more users.

Neil

> +
>  	temperature_calib: calib@1f4 {
>  		/* only the upper two bytes are relevant */
>  		reg = <0x1f4 0x4>;
> 


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

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

* Re: [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address
  2019-07-29  7:11   ` Neil Armstrong
@ 2019-07-29 21:45     ` Martin Blumenstingl
  2019-08-05 19:16       ` Martin Blumenstingl
  0 siblings, 1 reply; 7+ messages in thread
From: Martin Blumenstingl @ 2019-07-29 21:45 UTC (permalink / raw)
  To: Neil Armstrong, hexdump0815
  Cc: ottuzzi, linux.amoon, khilman, linux-kernel, linux-amlogic,
	linux-arm-kernel

On Mon, Jul 29, 2019 at 9:11 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> Hi Martin,
>
> On 27/07/2019 21:46, Martin Blumenstingl wrote:
> > Amlogic's BSP kernel defines that all boards with a MAC address stored
> > in the eFuse have it at offset 0x1b4. It is up to the board to
> > decide whether to use this MAC address or not:
> > - Odroid-C1 uses the MAC address from the eFuse
> > - EC-100 seems to read the MAC address from eMMC
> >
> > Add the nvmem cell which describes the Ethernet MAC address. Don't
> > assign it to the Ethernet controller, because depending on the board the
> > actual MAC address may be read from somewhere else.
> >
> > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > ---
> >  arch/arm/boot/dts/meson8b.dtsi | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
> > index 30fca9bb4bbe..c7de58b71d08 100644
> > --- a/arch/arm/boot/dts/meson8b.dtsi
> > +++ b/arch/arm/boot/dts/meson8b.dtsi
> > @@ -402,6 +402,10 @@
> >       clocks = <&clkc CLKID_EFUSE>;
> >       clock-names = "core";
> >
> > +     ethernet_mac_address: mac@1b4 {
> > +             reg = <0x1b4 0x6>;
> > +     };
>
> Is this a fixed position for all boards ? if not, I'll suggest moving
> it to the odroid-c1 dt until you have more users.
the 0x1b4 offset is hardcoded in Amlogic's kernel sources
if some board uses another offset then the manufacturer had to patch
the kernel to make it work (like Endless did)

+Cc hexdump0815 - can you please run the following command on your
Meson8b MXQ board:
$ hexdump -C /sys/bus/nvmem/devices/meson8b-efuse0/nvmem | grep
000001b0 | cut -d' ' -f7,8,9,10,12,13

this should print the MAC address that is also used by the stock
firmware and/or printed on the board
if it is then I'm happy to provide a patch also for your MXQ board so
it also uses the correct MAC address


Martin

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

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

* Re: [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address
  2019-07-29 21:45     ` Martin Blumenstingl
@ 2019-08-05 19:16       ` Martin Blumenstingl
  0 siblings, 0 replies; 7+ messages in thread
From: Martin Blumenstingl @ 2019-08-05 19:16 UTC (permalink / raw)
  To: Neil Armstrong, hexdump0815
  Cc: ottuzzi, linux.amoon, khilman, linux-kernel, linux-amlogic,
	linux-arm-kernel

On Mon, Jul 29, 2019 at 11:45 PM Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> On Mon, Jul 29, 2019 at 9:11 AM Neil Armstrong <narmstrong@baylibre.com> wrote:
> >
> > Hi Martin,
> >
> > On 27/07/2019 21:46, Martin Blumenstingl wrote:
> > > Amlogic's BSP kernel defines that all boards with a MAC address stored
> > > in the eFuse have it at offset 0x1b4. It is up to the board to
> > > decide whether to use this MAC address or not:
> > > - Odroid-C1 uses the MAC address from the eFuse
> > > - EC-100 seems to read the MAC address from eMMC
> > >
> > > Add the nvmem cell which describes the Ethernet MAC address. Don't
> > > assign it to the Ethernet controller, because depending on the board the
> > > actual MAC address may be read from somewhere else.
> > >
> > > Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> > > ---
> > >  arch/arm/boot/dts/meson8b.dtsi | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi
> > > index 30fca9bb4bbe..c7de58b71d08 100644
> > > --- a/arch/arm/boot/dts/meson8b.dtsi
> > > +++ b/arch/arm/boot/dts/meson8b.dtsi
> > > @@ -402,6 +402,10 @@
> > >       clocks = <&clkc CLKID_EFUSE>;
> > >       clock-names = "core";
> > >
> > > +     ethernet_mac_address: mac@1b4 {
> > > +             reg = <0x1b4 0x6>;
> > > +     };
> >
> > Is this a fixed position for all boards ? if not, I'll suggest moving
> > it to the odroid-c1 dt until you have more users.
> the 0x1b4 offset is hardcoded in Amlogic's kernel sources
> if some board uses another offset then the manufacturer had to patch
> the kernel to make it work (like Endless did)
>
> +Cc hexdump0815 - can you please run the following command on your
> Meson8b MXQ board:
> $ hexdump -C /sys/bus/nvmem/devices/meson8b-efuse0/nvmem | grep
> 000001b0 | cut -d' ' -f7,8,9,10,12,13
>
> this should print the MAC address that is also used by the stock
> firmware and/or printed on the board
> if it is then I'm happy to provide a patch also for your MXQ board so
> it also uses the correct MAC address
hexdump got back to me on IRC (thank you!) with unfortunate news:
the MXQ board doesn't seem to have the MAC address in the eFuse at all

thus I'll go with Neil's suggestion and move this to meson8b-odroidc1.dts


Martin

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

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

* Re: [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1
  2019-07-27 19:46 [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Martin Blumenstingl
  2019-07-27 19:46 ` [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address Martin Blumenstingl
  2019-07-27 19:46 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: use the MAC address stored in the eFuse Martin Blumenstingl
@ 2019-08-05 21:23 ` Kevin Hilman
  2 siblings, 0 replies; 7+ messages in thread
From: Kevin Hilman @ 2019-08-05 21:23 UTC (permalink / raw)
  To: Martin Blumenstingl, linux-amlogic
  Cc: linux.amoon, Martin Blumenstingl, linux-kernel, linux-arm-kernel,
	ottuzzi

Martin Blumenstingl <martin.blumenstingl@googlemail.com> writes:

> This series makes Odroid-C1 use the MAC address which is programmed into
> the eFuse.

Queued for v5.4.

> build-time dependencies:
> patches are based on top of "ARM: dts: meson8b: add VDDEE / mali-supply"
> from [0]
>
> runtime dependencies (without these a random MAC address is assigned,
> just like before these patches):
> - "nvmem: meson-mx-efuse: allow reading data smaller than word_size"
>   from [1]
> - "net: stmmac: manage errors returned by of_get_mac_address()" from [2]

Looks like the nvmem patch isn't queued yet, but AFAICT queuing these
will have no adverse affect.

Kevin

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

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-27 19:46 [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Martin Blumenstingl
2019-07-27 19:46 ` [PATCH 1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address Martin Blumenstingl
2019-07-29  7:11   ` Neil Armstrong
2019-07-29 21:45     ` Martin Blumenstingl
2019-08-05 19:16       ` Martin Blumenstingl
2019-07-27 19:46 ` [PATCH 2/2] ARM: dts: meson8b: odroidc1: use the MAC address stored in the eFuse Martin Blumenstingl
2019-08-05 21:23 ` [PATCH 0/2] ARM: dts: meson8b: persistent MAC address for Odroid-C1 Kevin Hilman

Linux-Amlogic Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-amlogic/0 linux-amlogic/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-amlogic linux-amlogic/ https://lore.kernel.org/linux-amlogic \
		linux-amlogic@lists.infradead.org linux-amlogic@archiver.kernel.org
	public-inbox-index linux-amlogic


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-amlogic


AGPL code for this site: git clone https://public-inbox.org/ public-inbox