diff mbox series

[1/2] ARM: dts: meson8b: add the nvmem cell with the board's MAC address

Message ID 20190727194647.15355-2-martin.blumenstingl@googlemail.com (mailing list archive)
State Superseded
Commit 5936e776bddf25538c7fb1d9ab15798ec12e8ffe
Headers show
Series ARM: dts: meson8b: persistent MAC address for Odroid-C1 | expand

Commit Message

Martin Blumenstingl July 27, 2019, 7:46 p.m. UTC
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(+)

Comments

Neil Armstrong July 29, 2019, 7:11 a.m. UTC | #1
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>;
>
Martin Blumenstingl July 29, 2019, 9:45 p.m. UTC | #2
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
Martin Blumenstingl Aug. 5, 2019, 7:16 p.m. UTC | #3
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
diff mbox series

Patch

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>;