All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Antliff <d.antliff@unsw.edu.au>
To: Sean Anderson <seanga2@gmail.com>,
	"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 21:56:57 +0000	[thread overview]
Message-ID: <SY4PR01MB6797D2A8DA42D198C74DF6D2B10C9@SY4PR01MB6797.ausprd01.prod.outlook.com> (raw)
In-Reply-To: <7b864725-2ed2-29b8-b5fd-9233434b8c80@gmail.com>

Hi Sean, thank you for your reply.

On 23 Nov 2022, Sean Anderson wrote:
> On 11/22/22 20:23, David Antliff wrote:
> > 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?
> 
> I don't think such an API exists.

Ok, that's not a problem, I can use the i2c commands to retrieve/write what I need. It's mostly
for debugging at this point.

> This doesn't directly address your question, but have you tried using nvmem-cells?
[snip]
> You'll need 2022.07 for this I think. This is the same method which
> Linux uses. I added this specificly to be able to load MAC addresses
> from EEPROMs without needing to hard code stuff into Kconfig.

Thanks for the suggestion however at the moment I am stuck with an older version of
U-Boot that does not support nvmem-cells. It looks like a good approach though!

For the record, and in case it helps anyone else in a similar situation with an older U-Boot,
 was able to get U-Boot 2021.01 (part of PetaLinux 2021.2) to read the MAC address
from EEPROM with the following settings:

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

# This is a PetaLinux config thing - has to be "invalid":
CONFIG_SUBSYSTEM_ETHERNET_PSU_ETHERNET_3_MAC="ff:ff:ff:ff:ff:ff"

# PetaLinux / yocto: meta-user/recipes-bsp/device-tree/files/system-user.dtsi
/include/ "system-conf.dtsi"
/ {
  chosen {
    xlnx,eeprom = &eeprom;
  };
};

This corresponds to an existing alias in the default PetaLinux device tree:

    eeprom = "/axi/i2c@ff030000/i2c-mux@74/i2c@0/eeprom@54";

Which is already present as:

                        i2c-mux@74 {
                                compatible = "nxp,pca9548";
                                #address-cells = <0x00000001>;
                                #size-cells = <0x00000000>;
                                reg = <0x00000074>;
                                i2c-mux-idle-disconnect;
                                i2c@0 {
                                        #address-cells = <0x00000001>;
                                        #size-cells = <0x00000000>;
                                        reg = <0x00000000>;
                                        phandle = <0x0000006b>;
                                        eeprom@54 {
                                                compatible = "atmel,24c128";
                                                reg = <0x00000054>;
                                                phandle = <0x0000006c>;
                                        };
                                };


I'll definitely look to use nvmem-cells when I am able to update to a newer
version of U-Boot though. Thank you for your help.

-- David.

  parent reply	other threads:[~2022-11-23 21:57 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
2022-11-23 21:56   ` David Antliff [this message]
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=SY4PR01MB6797D2A8DA42D198C74DF6D2B10C9@SY4PR01MB6797.ausprd01.prod.outlook.com \
    --to=d.antliff@unsw.edu.au \
    --cc=seanga2@gmail.com \
    --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.