This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Read MAC address from I2C EEPROM during kernel init

I need to read the MAC address (during Kernel init) from serial EEPROM which is an I2C device.  I appreciate any pointers to existing code or similar implementation.

My environment:  AM335x, ATMEL EEPROM (AT24C01B)  2-wire I2C serial device.

Thanks

Hay

  • Hi Hay,

    Here is an example from the SDK 06.00.00.00. This is from the am335x_evm_setup() function inside the board-am335xevm.c file:

        /* 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]);

    Best regards,
    Miroslav