I need some help about setting mac address. I don't use uboot. How can I set MAC address of system.
You could google about 'ethtool' utility, in sources for gingerbread I am find some matches with it.
could not say about it more, because never work with it, but may be it will help you
is it only one way to resolve the problem, maybe you will find alternative.
This is a method, ok..
I boot from sdcard...and i save the mac address in the environment of sdcard using "setenv ethaddr <your new mac>".
But if in the same board, i insert a new sdcard..automatically the mac address is different, because like mac address is taken the one present in the new sdcard, instead the mac address must be univocal for a board.
There is a tool under uboot:
mii device - list available devices
mii device <devname> - set current device
mii info <addr> - display MII PHY info
mii read <addr> <reg> - read MII PHY <addr> register <reg>
mii write <addr> <reg> <data> - write MII PHY <addr> register <reg>
mii dump <addr> <reg> - pretty-print <addr> <reg> (0-5 only)
Addr and/or reg may be ranges, e.g. 2-7.
but i can't use it !!
Kirill Danilenko said:
U-BOOT > setenv ethaddr <your new mac>
I have to set mac address too...any idea?
I can set MAC address only using bit burner where i go to write the otp register HW_OCOTP_CUST0 after changing the first fixed 16bit in mx28_evk.c under uboot sources.
Is it possible to do the same thing without using bitburner? Maybe in the boot sequence...what about using mii utilities?
This is how U-Boot does it.(For eth0 only)
int fec_get_mac_addr(unsigned char *mac)
/*set this bit to open the OTP banks for reading*/
/*wait until OTP contents are readable*/
while (BM_OCOTP_CTRL_BUSY & REG_RD(REGS_OCOTP_BASE, HW_OCOTP_CTRL))
mac = 0x00;
mac = 0x04;
val = REG_RD(REGS_OCOTP_BASE, HW_OCOTP_CUSTn(0));
mac = (val >> 24) & 0xFF;
mac = (val >> 16) & 0xFF;
mac = (val >> 8) & 0xFF;
mac = (val >> 0) & 0xFF;
The first 2 32bit OCOTP is used to store mac address. You need to read Enthernet part of datasheet and then you know how to set mac address to register.
Read uboot code and learn how it set mac address.