Bone MAC address

Hey guys!

Is MAC address present in the CPU registers and can be read or it should be stored in an external EEPROM?

It is in the CPU.

Gerald

I do see kernel code trying to set mac address based on eeprom content?

arch/arm/mach-omap2/board-am335xevm.c

static void am335x_evm_setup(struct memory_accessor *mem_acc, void *context)
{
	int ret;
	char tmp[10];

	/* 1st get the MAC address from EEPROM */
	ret = mem_acc->read(mem_acc, (char *)&am335x_mac_addr,
		EEPROM_MAC_ADDRESS_OFFSET, sizeof(am335x_mac_addr));

	if (ret != sizeof(am335x_mac_addr)) {
		pr_warning("AM335X: EVM Config read fail: %d\n", ret);
		return;
	}

	/* Fillup global mac id */
	am33xx_cpsw_macidfillup(&am335x_mac_addr[0][0],	&am335x_mac_addr[1][0]);

There is no MAC data in the EEPROM.

Gerald

I think the mac address is indeed in EEPROM.

EEPROM data format is:
magic
name
version
serial
config
mac_addr //3 mac id's - not just one

Well, we do not put it there at the factory so it has to come from some place else like an OS. Each processor has a unique MAC address that can be read from a register in the processor. The EEPROM is write protected, so to write anything into it you have to ground the WE pin.

We do not use those fields. hey are all zero. You can check the SRM for more details on this.

Gerald

Right
For 3.8 kernel on ubnutu i can see function:
am33xx_dt_cpsw_mac_fixup(...)

this checks if DT has mac-id defined, and if not, it patches it by
reading from CONTROL_MAC_ID1/0 registers.

Makes sense.

Gerald

Correct. These are the locations of the provided MAC addresses, that either your bootloader will put into the device tree or will need to be read out from somewhere else.