[beagleboard] BeagleBone : set MAC address?

Guys, where is the MAC address set for eth0 on the BeagleBone?

In the EEPROM. On A6 it's write protected by default, use the test pad
to unprotect.

Additionally how are uBoot environment variables set? On another
uBoot project I did you could set them then run a "saveenv" to save
them to Flash.

Either compiled into u-boot or in your uEnv.txt file. 'saveenv'
doesn't work, there's no where to save them to.

-Andrew

Replying to the beagle list as I'm wrong...

Thanks for the response.

RE MAC address; we are doing our own board; is having the MAC address
in the EEPROM the only way to do it? How would you program the EEPROM
at the factory if starting with a fresh blank part?

>
>> Guys, where is the MAC address set for eth0 on the BeagleBone?
>
> In the EEPROM. On A6 it's write protected by default, use the test
> pad to unprotect.

Well, I may have spoken before my brain understood everything. I'm
actually not sure where the MAC is stored at this moment, sorry.

The MAC addresses are stored in registers of the AM335x. From the TRM:

“The values read from Control Module (Base address 0x44E1_0000) MAC_ID0_LO register (Offset 0x630), MAC_ID0_HI register (Offset 0x634), MAC_ID1_LO register (Offset 0x638), and MAC_ID1_HI register (Offset 0x63C) represent unique MAC addresses assigned to each AM335x device. The values in these registers are programmed into each AM335x device by TI and can not be changed.”

You can read them out by using devmem2:

root@beaglebone:/dev# devmem2 0x44e10630
/dev/mem opened.
Memory mapped at address 0x401b0000.
Read at address 0x44E10630 (0x401b0630): 0x0000F6A3
root@beaglebone:/dev# devmem2 0x44e10634
/dev/mem opened.
Memory mapped at address 0x40201000.
Read at address 0x44E10634 (0x40201634): 0x91A194D4
root@beaglebone:/dev# ifconfig eth0
eth0 Link encap:Ethernet HWaddr D4:94:A1:91:A3:F6
inet addr:10.10.0.100 Bcast:10.10.0.255 Mask:255.255.255.0
inet6 addr: fe80::d694:a1ff:fe91:a3f6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:981079 errors:0 dropped:211 overruns:0 frame:0
TX packets:846542 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:200210379 (190.9 MiB) TX bytes:209507855 (199.8 MiB)

In addition, these values are read out in am33xx_cpsw_init() in arch/arm/mach-omap2/devices.c. You could change that function if you wanted to load a custom MAC address.