All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Antliff <d.antliff@unsw.edu.au>
To: Michal Simek <monstr@monstr.eu>,
	"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: Setting MAC address from I2C EEPROM - debug / commands? (Xilinx)
Date: Wed, 23 Nov 2022 22:14:07 +0000	[thread overview]
Message-ID: <SY4PR01MB679767DF2E6B9DE1092894F7B10C9@SY4PR01MB6797.ausprd01.prod.outlook.com> (raw)
In-Reply-To: <5381fce5-7227-9920-5956-4ce33e4d0070@monstr.eu>

Hi Michal,

On 23 Nov 2022, Michal Simek wrote:
>> On 11/23/22 04:14, Sean Anderson wrote:
>>> On 11/22/22 20:23, David Antliff wrote:
>>> Hi,
>>>
>>> I'm looking to extract the board's MAC address from serial I2C EEPROM at boot
>>> time, so
>>> I'm trying to work out how I can tell if U-Boot is actually able to
>>> communicate with this
>>> EEPROM, outside of manual i2c commands.
>>>
>>> I have set CONFIG_ZYNQ_MAC_IN_EEPROM and CONFIG_ZYNQ_MAC_IN_EEPROM
>>> however I'm not completely sure that this is working with UltraScale+ Zynq MPSoC
>>> boards - I'm using a ZCU208. There's no log message on the U-Boot console to say
>>> that there was an attempt to read the MAC address, and with ethaddr unset, this
>>> variable is set by U-Boot to the value taken from the device tree rather than
>>> EEPROM:
>
> That was the old way how to this was achieve and based on DTS in the mainline it
> is not used on any existing board because none defined xlnx,eeprom property.
> 
> I just sent the patch to remove also Kconfig entries which we forget to clean up.
>
> But the way how it is working now is that eeprom is referenced by nvmem alias.
> You can find conversion here
> 531abcb71e60 ("xilinx: Convert xlnx,eeprom property to nvmem alias")
>
> Then you have nvmem link to eeprom which can be used.
> 
> In board_init() you can see calling xilinx_read_eeprom() which reads this link.
>
> This structure was added for FRU format decoding also with supporting legacy
> format used on zcu1xx boards.
>
> IIRC zcu208 is not using legacy format used on zcu1xx boards
> xilinx_read_eeprom_legacy() and there is one more legacy format which is not
> currently supported by this code.
> But it shouldn't be that complicated to add support for it because it is pretty
> much just different layout.
>
>That's why I am suggesting you to create that nvmem0 link and take a look at
> that format to support.
>
> Then mac address is saved to environment variables and used by ethernet driver.

Thank you for your advice - if I were using a newer version of U-Boot I would certainly
look into this. Please see my reply to Sean for what I ended up doing, which is obviously
prior to any nvmem-cells support, and uses the old Kconfig options and xlnx,eeprom.

I'm using PetaLinux 2021.2, but I note that in the 2022.1 changelog there is this:

    U-Boot: Added support for reading MAC address from multi-record FRU data in EEPROM

Unfortunately until I have a chance to update my version of PetaLinux, I am unable
to test or contribute to the head of U-Boot. Thank you for your help though. This all adds
context to what I'm doing, and makes me think I really should figure out how to update to a
newer version of U-Boot sooner rather than later.

-- David.


  parent reply	other threads:[~2022-11-23 22:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  1:23 Setting MAC address from I2C EEPROM - debug / commands? (Xilinx) David Antliff
2022-11-23  3:14 ` Sean Anderson
2022-11-23  8:45   ` Michal Simek
2022-11-23 13:27     ` Michael Walle
2022-11-23 15:11       ` Michal Simek
2022-11-23 15:26         ` Sean Anderson
2022-11-23 22:14     ` David Antliff [this message]
2022-11-23 21:56   ` David Antliff
2023-06-12  3:25   ` David Antliff
2023-06-12  4:01     ` Sean Anderson
2023-06-12  4:16       ` David Antliff
2023-06-12  5:32         ` David Antliff

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=SY4PR01MB679767DF2E6B9DE1092894F7B10C9@SY4PR01MB6797.ausprd01.prod.outlook.com \
    --to=d.antliff@unsw.edu.au \
    --cc=monstr@monstr.eu \
    --cc=u-boot@lists.denx.de \
    /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.