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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,603 次查看
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!

标签 (3)
标记 (2)
1 解答
1,312 次查看
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 项奖励
回复
4 回复数
1,312 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

1,312 次查看
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 项奖励
回复
1,312 次查看
igorpadykov
NXP Employee
NXP Employee

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

~igor

0 项奖励
回复
1,313 次查看
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 项奖励
回复