[U-Boot] [PATCH v2 04/17] SPEAr : Placing ethaddr write and read within CONFIG_CMD_NET

Vipin KUMAR vipin.kumar at st.com
Thu May 6 06:11:37 CEST 2010


On 5/4/2010 5:48 PM, Tom Rix wrote:
>>>> +#endif
>>>>      } else if (!strcmp(argv[1], "print")) {
>>>>  
>>>>          if (chip->cpufreq == -1)
>>>> @@ -274,13 +287,14 @@ int do_chip_config(cmd_tbl_t *cmdtp, int flag,
>>>> int argc, char *argv[])
>>>>          else
>>>>              printf("DDR Type    = Not Known\n");
>>>>  
>>>> +#if defined(CONFIG_CMD_NET)
>>>>          if (!i2c_read_mac(mac)) {
>>>>              sprintf(i2c_mac, "%pM", mac);
>>>>              printf("Ethaddr (from i2c mem) = %s\n", i2c_mac);
>>>>          } else {
>>>>              printf("Ethaddr (from i2c mem) = Not set\n");
>>>>          }
>>> From misc_init_r, the mac_id is stored in the enviromement.
>>> Because the enviroment has precendence over the i2c.
>>> Reporting the i2c mac address may be inconsistent or wrong.
>>>
>> The print in the chip_config print clearly says that this mac address
>> is set in i2c memory and in fact this is also the intention.
>>
>> Probably, I should add a comment saying ethaddr in environment
>> variable may be different and it is the one used as mac id in network
>> interface
>> OR should I add a print itself that this is the mac id stored in i2c
>> memory and may be stale ?
> 
> The most useful one should be printed out.
> 
> If the user is setting up a network service list dhcp that depends on
> the mac address, then the mac used by the u-boot network ip should be
> returned.
> 
> If this is providing some board id and the i2c mac is unique, then
> the i2c mac should be used.
> 
> What you don't want to happen is to confuse the user by reporting one
> mac and using another.   Just printing out the the i2c mac may or may not
> be stale will also confuse the user.

I get your point. Though, I believe, educating the user about the mac id
storage behavior is the solution in this case.
Moreover, ethaddr is not set in environment variables by default. So,
the decision remains with the user as to where he wants to store the
ethaddr environment. This command has been introduced to report and save
mac id in i2c memory.
I would add a section regarding mac id storage and reporting in README.spear


More information about the U-Boot mailing list