All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Antliff <d.antliff@unsw.edu.au>
To: "u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Setting MAC address from I2C EEPROM - debug / commands? (Xilinx)
Date: Wed, 23 Nov 2022 01:23:00 +0000	[thread overview]
Message-ID: <SY4PR01MB67974669541F025886A18C1FB10C9@SY4PR01MB6797.ausprd01.prod.outlook.com> (raw)

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:

ethernet@ff0e0000 {
    ...
    local-mac-address = [00 0a 35 00 22 01];
    ...

I would expect it to be 00 0a 35 07 60 1c based on the contents of the EEPROM.

I would like to understand how to debug this. I read that the command "eeprom" has been
deprecated for some time (I don't have it enabled), with some I2C serial EEPROM devices
now supported by the "Driver Model" - aka DM.

Thus I did find:

> dm uclass
...
uclass 39: i2c_eeprom
0     eeprom@54 @ 7dd21420
...

And I'm able to communicate with the device via commands like:

ZynqMP> i2c md 54 0.2 40 200000 
0000: 5a 43 55 32 30 38 ff ff ff ff ff ff ff ff ff ff    ZCU208..........
0010: ff 41 30 32 38 33 32 32 30 34 31 34 33 33 32 38    .A02832204143328
0020: 31 2e 33 00 0a 35 07 60 1c 00 0a 35 07 60 1d 00    1.3..5.`...5.`..
0030: 0a 35 07 60 1e 00 0a 35 07 60 1f 41 08 ff ff ff    .5.`...5.`.A....

The MAC address is 6 bytes starting at offset 0x23 (00 0a 35 07 60 1c).

My question is - is the 'i2c' command now the accepted and best way to interact with an
I2C EEPROM? Or is there another command I can enable (other than "eeprom") that will
provide a generic interface for accessing EEPROMs and prove that U-Boot can "see" this
device?

The EEPROM device in question is an M24128.

CONFIG_SYS_I2C_EEPROM_ADDR=0x54
CONFIG_SYS_I2C_EEPROM_BUS=6
CONFIG_SYS_EEPROM_SIZE=16384
CONFIG_SYS_I2C_EEPROM_ADDR_LEN=2
CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET=0x23
CONFIG_ZYNQ_MAC_IN_EEPROM=y

U-Boot 2021.01 (Xilinx fork: git://github.com/Xilinx/u-boot-xlnx.git)

P.S. if this is better directed to Xilinx or the Xilinx community then I'm happy to do that,
but in case it's a more generic U-Boot issue I thought it best to ask here first. Please
don't flame me for using Xilinx, I'm trying to do my best with what I'm given.

-- David.

             reply	other threads:[~2022-11-23  1:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23  1:23 David Antliff [this message]
2022-11-23  3:14 ` Setting MAC address from I2C EEPROM - debug / commands? (Xilinx) 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
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=SY4PR01MB67974669541F025886A18C1FB10C9@SY4PR01MB6797.ausprd01.prod.outlook.com \
    --to=d.antliff@unsw.edu.au \
    --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.