All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Moon <linux.amoon@gmail.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-amlogic@lists.infradead.org, netdev@vger.kernel.org
Subject: Re: 32-bit Amlogic SoCs: avoid using Ethernet MAC addresses
Date: Tue, 26 Feb 2019 17:43:36 +0530	[thread overview]
Message-ID: <CANAwSgR0VUmcAiqn4OGzx8972qS4OPD=J2KHO8CGYCYgh6=bUA@mail.gmail.com> (raw)
In-Reply-To: <CAFBinCCCnCBO4dbvGjDuiH6Ba-9mcg3Ax3-vkLipGijubNBFBA@mail.gmail.com>

Hi Martin,

On Tue, 26 Feb 2019 at 17:07, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Tue, Feb 26, 2019 at 11:26 AM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Hi Martin,
> >
> > On Mon, 25 Feb 2019 at 17:49, Anand Moon <linux.amoon@gmail.com> wrote:
> > >
> > > hi Martin,
> > >
> > > +Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > On Mon, 25 Feb 2019 at 02:25, Martin Blumenstingl
> > > <martin.blumenstingl@googlemail.com> wrote:
> > > >
> > > > I have seen Anand's your question in [0]:
> > > > > only issue is I have is the each time their is random MAC address so I
> > > > > get new IP from dhcp server.
> > > > > How can I avoid this. I have tried to enable eFuse driver but with no success.
> > > >
> > > > u-boot on the 64-bit SoCs can read the MAC address from the eFuse and
> > > > pass it (via the .dtb) to the kernel.
> > > > This requires an ethernet0 alias in the mainline .dts though, see [1]
> > > > for and example.
> > > >
> > > > I'm not sure if this also works with the older u-boot on the 32-bit SoCs.
> > > > if it doesn't then there's a nvmem-cells binding for all Ethernet
> > > > controllers: [2] (please note that the function implementing this
> > > > binding was recently renamed: [3])
> > > > as far as I can tell the stmmac driver doesn't support the nvmem-cells
> > > > based binding yet
> > > >
> > > > Anand, if you want to work on this: feel free to do so!
> > > > I have the SDHC MMC driver and a discussion about the power-domain
> > > > drivers on my TODO-list, so I'm pretty busy at the moment.
> > > >
> > > >
> > > > Regards
> > > > Martin
> > > >
> > >
> > > Thanks for your inputs :) 8)
> > >
> > > After enable CONFIG_MESON_MX_EFUSE and added the alias
> > >
> >
> > As far as I can tell this nvmem consist of field.
> >  Board ID
> >  MAC address
> >  Serial Number
> >  UID
> >
> > I feel efues value in nvmem are read with following offset just for testing.
> > but it also need some driver changes to read from secure memory
> > by enable CONFIG_MESON_SM and get the mac address to be set in ethernet driver.
> > > On Odroid C1+
> > > # hexdump /sys/devices/platform/soc/da000000.secbus/da000000.nvmem/meson8b-efuse0/nvmem
> > > 0000000 1143 0000 4b48 3143 3131 3232 3346 4537
> > > 0000010 3942 4432 0000 0000 0000 0000 0000 0000
> > > 0000020 0000 0000 0000 0000 0000 0000 0000 0000
> > > *
> > > 00001b0 0000 0000 1e00 1006 addc 0000 0000 0000    *00:1e:06:10:dc:ad*
> > > mac address from nvmem
> > > 00001c0 0000 0000 0000 4b48 3143 3133 3631 3131
> > > 00001d0 3732 3130 6237 6537 3165 6437 3034 3764
> > > 00001e0 02ad ec24 ff7f acfb d692 5300 0047 0000
> > > 00001f0 0000 0000 0000 aff6 a000 0000 1400 c100
> > > 0000200
> > >
> > arch/arm/boot/dts/meson8b.dtsi
> > @@ -360,6 +360,18 @@
> >         compatible = "amlogic,meson8b-efuse";
> >         clocks = <&clkc CLKID_EFUSE>;
> >         clock-names = "core";
> > +
> > +       board_sn: board-sn@0000000 {
> > +               reg = <0x0000000 0x10>;
> > +       };
> > +
> > +       eth_mac: eth-mac@00001b4 {
> > +               reg = <0x00001b4 0x6>;
> > +       };
> > +
> > +       board_sno: board-sno@00001c0 {
> > +               reg = <0x00001c0 0x30>;
> > +       };
> >
> > This is what I am looking into.
> > If you have some input please share.
> your findings are looking good to me!
>
> I believe that some of the offsets are specific to the Odroid-C1.
> this is what the Endless Mini EC-100's kernel uses: [0] (eth_mac
> matches, but it seems that the other two don't)
>
>
.title = "mac", //for the main network interface
.id = EFUSE_MAC_ID,
.offset = 436,
.enc_len = 6,
.data_len = 6,

offset for mac which is in dec *436* is equal to hex *0x1b4* which I
am using for testing now.

I am changing this offset setting so that I get consistence result out of it.
I will also check with armbina image and see if I can find some thing usefull.

Thanks for your valuable inputs once again :)

Best Regards
-Anand

>
> [0] https://github.com/endlessm/linux-meson/blob/9969d20dc0f034e7a5addd4f6d28a8193e956b16/drivers/amlogic/efuse/efuse_version.c#L519

WARNING: multiple messages have this Message-ID (diff)
From: Anand Moon <linux.amoon@gmail.com>
To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	netdev@vger.kernel.org, linux-amlogic@lists.infradead.org
Subject: Re: 32-bit Amlogic SoCs: avoid using Ethernet MAC addresses
Date: Tue, 26 Feb 2019 17:43:36 +0530	[thread overview]
Message-ID: <CANAwSgR0VUmcAiqn4OGzx8972qS4OPD=J2KHO8CGYCYgh6=bUA@mail.gmail.com> (raw)
In-Reply-To: <CAFBinCCCnCBO4dbvGjDuiH6Ba-9mcg3Ax3-vkLipGijubNBFBA@mail.gmail.com>

Hi Martin,

On Tue, 26 Feb 2019 at 17:07, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Tue, Feb 26, 2019 at 11:26 AM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > Hi Martin,
> >
> > On Mon, 25 Feb 2019 at 17:49, Anand Moon <linux.amoon@gmail.com> wrote:
> > >
> > > hi Martin,
> > >
> > > +Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > >
> > > On Mon, 25 Feb 2019 at 02:25, Martin Blumenstingl
> > > <martin.blumenstingl@googlemail.com> wrote:
> > > >
> > > > I have seen Anand's your question in [0]:
> > > > > only issue is I have is the each time their is random MAC address so I
> > > > > get new IP from dhcp server.
> > > > > How can I avoid this. I have tried to enable eFuse driver but with no success.
> > > >
> > > > u-boot on the 64-bit SoCs can read the MAC address from the eFuse and
> > > > pass it (via the .dtb) to the kernel.
> > > > This requires an ethernet0 alias in the mainline .dts though, see [1]
> > > > for and example.
> > > >
> > > > I'm not sure if this also works with the older u-boot on the 32-bit SoCs.
> > > > if it doesn't then there's a nvmem-cells binding for all Ethernet
> > > > controllers: [2] (please note that the function implementing this
> > > > binding was recently renamed: [3])
> > > > as far as I can tell the stmmac driver doesn't support the nvmem-cells
> > > > based binding yet
> > > >
> > > > Anand, if you want to work on this: feel free to do so!
> > > > I have the SDHC MMC driver and a discussion about the power-domain
> > > > drivers on my TODO-list, so I'm pretty busy at the moment.
> > > >
> > > >
> > > > Regards
> > > > Martin
> > > >
> > >
> > > Thanks for your inputs :) 8)
> > >
> > > After enable CONFIG_MESON_MX_EFUSE and added the alias
> > >
> >
> > As far as I can tell this nvmem consist of field.
> >  Board ID
> >  MAC address
> >  Serial Number
> >  UID
> >
> > I feel efues value in nvmem are read with following offset just for testing.
> > but it also need some driver changes to read from secure memory
> > by enable CONFIG_MESON_SM and get the mac address to be set in ethernet driver.
> > > On Odroid C1+
> > > # hexdump /sys/devices/platform/soc/da000000.secbus/da000000.nvmem/meson8b-efuse0/nvmem
> > > 0000000 1143 0000 4b48 3143 3131 3232 3346 4537
> > > 0000010 3942 4432 0000 0000 0000 0000 0000 0000
> > > 0000020 0000 0000 0000 0000 0000 0000 0000 0000
> > > *
> > > 00001b0 0000 0000 1e00 1006 addc 0000 0000 0000    *00:1e:06:10:dc:ad*
> > > mac address from nvmem
> > > 00001c0 0000 0000 0000 4b48 3143 3133 3631 3131
> > > 00001d0 3732 3130 6237 6537 3165 6437 3034 3764
> > > 00001e0 02ad ec24 ff7f acfb d692 5300 0047 0000
> > > 00001f0 0000 0000 0000 aff6 a000 0000 1400 c100
> > > 0000200
> > >
> > arch/arm/boot/dts/meson8b.dtsi
> > @@ -360,6 +360,18 @@
> >         compatible = "amlogic,meson8b-efuse";
> >         clocks = <&clkc CLKID_EFUSE>;
> >         clock-names = "core";
> > +
> > +       board_sn: board-sn@0000000 {
> > +               reg = <0x0000000 0x10>;
> > +       };
> > +
> > +       eth_mac: eth-mac@00001b4 {
> > +               reg = <0x00001b4 0x6>;
> > +       };
> > +
> > +       board_sno: board-sno@00001c0 {
> > +               reg = <0x00001c0 0x30>;
> > +       };
> >
> > This is what I am looking into.
> > If you have some input please share.
> your findings are looking good to me!
>
> I believe that some of the offsets are specific to the Odroid-C1.
> this is what the Endless Mini EC-100's kernel uses: [0] (eth_mac
> matches, but it seems that the other two don't)
>
>
.title = "mac", //for the main network interface
.id = EFUSE_MAC_ID,
.offset = 436,
.enc_len = 6,
.data_len = 6,

offset for mac which is in dec *436* is equal to hex *0x1b4* which I
am using for testing now.

I am changing this offset setting so that I get consistence result out of it.
I will also check with armbina image and see if I can find some thing usefull.

Thanks for your valuable inputs once again :)

Best Regards
-Anand

>
> [0] https://github.com/endlessm/linux-meson/blob/9969d20dc0f034e7a5addd4f6d28a8193e956b16/drivers/amlogic/efuse/efuse_version.c#L519

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

  reply	other threads:[~2019-02-26 12:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-24 20:55 32-bit Amlogic SoCs: avoid using Ethernet MAC addresses Martin Blumenstingl
2019-02-24 20:55 ` Martin Blumenstingl
2019-02-25  9:25 ` Piero
2019-02-25  9:25   ` Piero
2019-02-25 12:19 ` Anand Moon
2019-02-25 12:19   ` Anand Moon
2019-02-26 10:25   ` Anand Moon
2019-02-26 10:25     ` Anand Moon
2019-02-26 11:37     ` Martin Blumenstingl
2019-02-26 11:37       ` Martin Blumenstingl
2019-02-26 12:13       ` Anand Moon [this message]
2019-02-26 12:13         ` Anand Moon

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='CANAwSgR0VUmcAiqn4OGzx8972qS4OPD=J2KHO8CGYCYgh6=bUA@mail.gmail.com' \
    --to=linux.amoon@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=netdev@vger.kernel.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.