How do I set first 2 bytes of i.MX28 MAC address?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I set first 2 bytes of i.MX28 MAC address?

Jump to solution
1,222 Views
jkuz
Contributor II

We are using an i.MX287 and currently running maintain kernel 2.6.35.3 

Currently, 32 bits of MAC address is set by OTP bits. This is working for us. We can set fuses and these 32 bits will be detected and set properly.

However, first 8 bits which is part of vendor ID is always "00:04". How can we change this in the kernel/driver so that these bits are configurable?

We are only using one Ethernet interface (eth0) on this chip

Thanks!

Labels (3)
Tags (2)
1 Solution
931 Views
jkuz
Contributor II

For reference, the MAC address is set by mx28_init_fec() init function in arch/arm/mach-mx28/device.c 

mac[0] and mac[1] are hard coded here into the fec platform data structure, and the other 4 bytes are set by the OTP registers. 

My solution will be to read both OTP registers 0-1 and use both of them to set the entire 48 bit mac address. This will give maximum flexibility in addressing our units.

Originally OTP register 0 was for eth0 and OTP register 1 for eth1 since the imx28 has two Ethernet interfaces. Our hardware platform has removed eth1, so we will use both registers for the MAC

Thanks

Jason

View solution in original post

0 Kudos
4 Replies
931 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jason

one can try to set in uboot:

U-Boot> setenv ethaddr 00:04:9F:00:EA:D7

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

931 Views
jkuz
Contributor II

Thank you. I agree this may be the best solution.

Right now, uboot does not set MAC address bootarg for kernel. One option is patching uboot to take the full MAC address from the first two words of OTP bits and send to the kernel. 

I would still like any information, if possible, on how we can do this in the kernel without changes to uboot. The first 2 bytes of the MAC are being set somehow when the kernel boots, since ethaddr bootarg is not being set by uboot. 

0 Kudos
931 Views
igorpadykov
NXP Employee
NXP Employee

one can look in linux/drivers/net/fec.c

~igor

0 Kudos
932 Views
jkuz
Contributor II

For reference, the MAC address is set by mx28_init_fec() init function in arch/arm/mach-mx28/device.c 

mac[0] and mac[1] are hard coded here into the fec platform data structure, and the other 4 bytes are set by the OTP registers. 

My solution will be to read both OTP registers 0-1 and use both of them to set the entire 48 bit mac address. This will give maximum flexibility in addressing our units.

Originally OTP register 0 was for eth0 and OTP register 1 for eth1 since the imx28 has two Ethernet interfaces. Our hardware platform has removed eth1, so we will use both registers for the MAC

Thanks

Jason

0 Kudos