From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A692FC4332F for ; Wed, 23 Nov 2022 03:14:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4980C85509; Wed, 23 Nov 2022 04:14:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OwiQlUfz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A13DE85516; Wed, 23 Nov 2022 04:14:36 +0100 (CET) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 23E55854FE for ; Wed, 23 Nov 2022 04:14:34 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qk1-x72d.google.com with SMTP id v8so11662300qkg.12 for ; Tue, 22 Nov 2022 19:14:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=HpwxHzt6ZkrM+l4XH9tt6XJBnzUoBmdXWiTQVqGUPNE=; b=OwiQlUfz8hUSM5VDErNsrne++JuTHjbDvvpK3JXCpTXH3Ud4jvgCELp3DGd8ZnHnFy MdbOG3y1wt9Fr1jtWQzn0eyqlig2mCbqfG8Xa8XY2Rkk/MZaC6sZrlgqNG79aScYU1sB kwmDGqu2Ds9pa6zqGJEEaaoklrWtr8wk0gTnM5Ddklz+bU4fvMaWlcSDuzanFzttPnYv vjei3YtYPOANEmSE/TyAEcRPqn4e2/lODY9ab3TijQu5NuyQ04fv961Box79Q6Exk9B+ ZD9gGKO/o8LlA9xfPY+udHkGo3hvlZEYZTHN/36xi/AQxvxB2szbnDuLWnpbt8exacNx JWvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HpwxHzt6ZkrM+l4XH9tt6XJBnzUoBmdXWiTQVqGUPNE=; b=sns4X3lTtz6dZg3zo8ylpyJPx7ZEFHDfKWJElPscp0E6YFIX60FZEN+kCcLAxxv16v JQsgGmxPsMH+YKqbEfYZWERsGbGrYAtRDFJCBpiwynZcV1O87J2gW7Vnt3ItWwwNkMWk 2C1zRzfa1mPVpceHmCo4T9QVs2MMmZOvP69lAHgi19FMSaVf09nFG/DbCtrQ7A6kB3sO OJDvLcyr/WoKNL37mypr4VUfONvYwg/cDOTyZ+NzUmnnBg2syQOb8KCyU9DdICOTp8Hk NJkPVwUUwOEKvwKJS58jr/B8N9FZgWwYeRr2jLuEeaC8xqe7/c06+UlsCHdJ8yLtIblC 2rlQ== X-Gm-Message-State: ANoB5plL6Rm1I/zvBpMyRFklHOc6GGtPIij1li8ct98e5mCj6W2yECih D2lC4NIsR4I86kdpMjvcpig= X-Google-Smtp-Source: AA0mqf7M5xwNR2Ai+LKhzBdutmK3Aa8/I982bCRrbFMcBv47zuQbYXhCGvOeGm2K7l6zumPmBJusuw== X-Received: by 2002:a37:5ec3:0:b0:6fa:faac:926d with SMTP id s186-20020a375ec3000000b006fafaac926dmr23689021qkb.33.1669173272762; Tue, 22 Nov 2022 19:14:32 -0800 (PST) Received: from [192.168.1.201] (pool-173-73-95-180.washdc.fios.verizon.net. [173.73.95.180]) by smtp.gmail.com with ESMTPSA id c9-20020ac81109000000b003a569a0afcasm9050198qtj.66.2022.11.22.19.14.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Nov 2022 19:14:32 -0800 (PST) Message-ID: <7b864725-2ed2-29b8-b5fd-9233434b8c80@gmail.com> Date: Tue, 22 Nov 2022 22:14:31 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: Sean Anderson Subject: Re: Setting MAC address from I2C EEPROM - debug / commands? (Xilinx) To: David Antliff , "u-boot@lists.denx.de" References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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: > > 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? I don't think such an API exists. > 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. This doesn't directly address your question, but have you tried using nvmem-cells? You enable CONFIG_NVMEM and CONFIG_I2C_EEPROM, and modify your device tree like i2c { eeprom@54 { #address-cells = <1>; #size-cells = <1>; compatible = "atmel,24c08"; reg = <0x54>; mac_address: mac-address@23 { reg = <0x23 6>; }; }; }; ethernet { nvmem-cells = <&mac_address>; nvmem-cell-names = "mac-address"; }; 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. --Sean