MAC Address

MAC Address

I’ll be using a LAN9221 on a custom expansion board
but I’ll also be using a Microchip MAC address eeprom on the i2c bus. So
at some point I’ll have to configure the LAN9221 with this address. Is
this going to be an easy change to the driver? Where exactly do I find the
driver source and what’s the process needed to change it?

Re: MAC Address

Administrator

Hi Dan,

On Sun, Feb 26, 2012 at 7:36 PM, Dan Nelson <[hidden email]> wrote:
> I’ll be using a LAN9221 on a custom expansion board but I’ll also be using a
> Microchip MAC address eeprom on the i2c bus. So at some point I’ll have to
> configure the LAN9221 with this address. Is this going to be an easy change
> to the driver? Where exactly do I find the driver source and what’s the
> process needed to change it?
The LAN9221 gets initialized by uboot with a call to
smc911x_initialize from drivers/net/smc911x.c --- this function has
some code to read an optional eeprom.
Similarly, drivers/net/smsc911x.c is the driver file in linux.

Re: MAC Address

If you fit the optional EEPROM to the LAN9221, you may be interested to know that the utility 'ethtool' is compatible with the LAN9221, and can be used to easily set the MAC address. Ethtool is available in the openembedded recipes. If you include it in your gumstix RFS, you can set the MAC from the command line as follows:

The value 165 is a 'magic number' required by the LAN9221 to confirm that the EEPROM data is a MAC address.
The MAC address bytes need to be entered in decimal, not hex when using this tool.

You can read the MAC back directly from the EEPROM by entering:
# ethtool -e eth0

After setting the MAC and rebooting the unit, the new MAC should take effect. Be warned, on my Gumstix, upon rebooting the system detected the LAN9221 as ETH1 rather then ETH0, since the system uses the MAC address to recognise each LAN card. I had to connect via serial and edit /etc/udev/rules.d/70-persistent-net.rules to get the LAN back to ETH0.

Also, my Windows PC got confused (presumably because it 'saw' two devices with the same IP address but different MAC addresses) and it needed rebooting before it would talk happily to the Gumstix.

If you fit the optional EEPROM to the LAN9221, you may be interested to
know
that the utility 'ethtool' is compatible with the LAN9221, and can be
used
to easily set the MAC address. Ethtool is available in the openembedded
recipes. If you include it in your gumstix RFS, you can set the MAC
from
the command line as follows:

The value 165 is a 'magic number' required by the LAN9221 to confirm
that
the EEPROM data is a MAC address.
The MAC address bytes need to be entered in decimal, not hex when using
this
tool.

You can read the MAC back directly from the EEPROM by entering:
# ethtool -e eth0

After setting the MAC and rebooting the unit, the new MAC should take
effect. Be warned, on my Gumstix, upon rebooting the system detected
the
LAN9221 as ETH1 rather then ETH0, since the system uses the MAC address
to
recognise each LAN card. I had to connect via serial and edit
/etc/udev/rules.d/70-persistent-net.rules to get the LAN back to ETH0.

Also, my Windows PC got confused (presumably because it 'saw' two
devices
with the same IP address but different MAC addresses) and it needed
rebooting before it would talk happily to the Gumstix.

No matter what offsets or values I give "ethtool -E", it always returns "Invalid argument", and after running it just once I can no longer read back the EEPROM with "ethtool -e" either. I end up having to reboot, and then "ethtool -e" can read without issue again but I still can't write.

The ethernet is working perfectly on the device, it's just coming up with a random MAC address at every boot.

Re: MAC Address

When you say the EEPROM is identical, do you mean same part code from same manufacturer? or just same base number? The basic 93C46 part comes in a huge mass of subtly different versions from a lot of manufacturers and I'm pretty sure we've had discontinued notices on some of the ones we originally specified.

Try removing R31(Tobi designator) - the 10K pull-down on nCS which seems wrong to me and I haven't used). You could also try reducing R29 a bit (e.g. 4K7).

Re: MAC Address

Philip - Thanks for the reply. The ethtool behavior (including the odd
"0f ef" pattern) is consistent on all five prototype boards. The part
is the one specified in the Tobi schematic, 93AA76C from Microchip
Technology. I'll try your suggestions in regards to R31 and R29 if the
suggestion below doesn't work.

Katu - That sounds very promising. I've looked closer at the Tobi I
have sitting here and you're right, the part actually being used is the
46A, not the 76C referenced in the schematic. I'll pick up a few
93AA46A and see if swapping it out fixes the problem.

Re: MAC Address

Hi Adam, just noticed your posts.
I can confirm that we use the 93AA46A on our custom PCBs. I would not expect the 76C to work, as it has the wrong memory address pattern.

Quoted from the SMSC92111 Datasheet:
The LAN9221/LAN9221i EEPROM controller also allows the host system to read, write and erase the contents of the Serial EEPROM. The EEPROM controller supports most “93C46” type EEPROMs configured for 128 x 8-bit operation.

Interestingly, this appears to be an error which has crept into Later versions of the schematic; our archived version of the schematic from June 2009 has the correct 93AA46A part shown...

Other than that, we use the same components around the IC as shown the TOBI board schematic.

Re: MAC Address

I'd just like to thank Katu and Chris, swapping out the EEPROM fixed the issue.

The EEPROM specified in the Tobi schematic - 93AA76CST - appears to be incompatible with the LAN9221 being used on the Tobi. It seems to be another case of the part numbers specified in the Tobi schematic not reflecting what's actually being used in production.

The part actually being used on the Tobi appears to be the 93AA46A. After swapping out the EEPROM with this new part, everything works as expected.

Re: MAC Address

Administrator

Adam, Chris and Philip,

Thank you for bringing this to our attention. One of our hardware engineers has confirmed that the 93AA46A is in fact the correct part and we've added this to our README for the Tobi board. We're glad you were able to get everything working as expected!

I'd just like to thank Katu and Chris, swapping out the EEPROM fixed the
issue.

The EEPROM specified in the Tobi schematic - 93AA76CST - appears to be
incompatible with the LAN9221 being used on the Tobi. It seems to be
another case of the part numbers specified in the Tobi schematic not
reflecting what's actually being used in production.

The part actually being used on the Tobi appears to be the 93AA46A. After
swapping out the EEPROM with this new part, everything works as expected.

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >