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.

Dynamic MAC address setting in DM8168

Hi,

I am using the latest EZSDK, 5_05_02_00 for DM8168 board. My U-boot version is u-boot-2010.06-psp04.04.00.01 and the Linux version is linux-2.6.37-psp04.04.00.01. When I am trying set the MAC address in the U-boot level, I can able set it in the U-boot. But while launching the Linux, the MAC address is reading from e-fuse registers and I am not getting the MAC address which I set in the U-boot. I want to know, what are the changes needs to be done in the Linux kernel source.

Thanks in advance.

Regards,
Salih

  • Salih,

    Muhammad Salih said:
    But while launching the Linux, the MAC address is reading from e-fuse registers and I am not getting the MAC address which I set in the U-boot.

    Where do you see/check that MAC address is changed in the linux kernel? Is it from the linux kernel boot up console output or with some user space command?

    Regards,
    Pavel

  • I trace the linux kernel code and found this:

    ti-ezsdk_dm816x-evm_5_05_02_00/board-support/linux-2.6.37-psp04.04.00.01/arch/arm/mach-omap2/devices.c

    void ti816x_ethernet_init(void)
    {
    u32 mac_lo, mac_hi;

    mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_LO);
    mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_HI);
    ti816x_emac1_pdata.mac_addr[0] = mac_hi & 0xFF;
    ti816x_emac1_pdata.mac_addr[1] = (mac_hi & 0xFF00) >> 8;
    ti816x_emac1_pdata.mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
    ti816x_emac1_pdata.mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
    ti816x_emac1_pdata.mac_addr[4] = mac_lo & 0xFF;
    ti816x_emac1_pdata.mac_addr[5] = (mac_lo & 0xFF00) >> 8;
    ........
    }

    Can you try comment this two lines:

    //mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_LO);
    //mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_HI);
    Then set the MAC ID manually:
    mac_lo = <your value>
    mac_hi =<your value>

    When setting a MAC address please ensure that the LS-bit of the 1st byte is not 1 i.e. when setting the MAC address: y in xy:ab:cd:ef:gh:jk has to be an even number.

    See also the below e2e thread:
    e2e.ti.com/.../82859

    BR
    Pavel
  • Hi,

    I am using the command "ifconfig" in the Linux Kernel console. I want to fetch the MAC address from U-boot which I am manually setting in it. Below is the command which I am using to set the MAC:

    iW-G12M-U-Boot > setenv ethaddr '02:03:04:05:06:08'

    How can I fetch this value in my Linux kernel without modifying the Linux source code.

    Thanks in advance.

    Regards,
    Salih

  • Hi,

    And also, is it possible to re-program the e-fuse registers once it is already programmed?. If so, how can I do the same in my source code.

    Thanks in advance.

    Regards,
    Salih
  • Salih,

    Muhammad Salih said:
    And also, is it possible to re-program the e-fuse registers once it is already programmed?

    No, you can not. The e-fuse registers (MAC_ID0_LO, MAC_ID0_HI, MAC_ID1_LO, MAC_ID1_HI) are read only.

    You can try with the EMAC MACADDRLO and MACADDRHI registers, which are read/write.


    BR
    Pavel

  • Hi Pavel,

    Thanks for your reply. I want to know, whether all the DM8168 Processor having the valid MAC ID which purchased by IEEE. If so, is it possible to use the same MAC ID for our product?.

    Thanks in advance.

    Regards,
    Salih
  • Muhammad Salih said:
    I want to know, whether all the DM8168 Processor having the valid MAC ID which purchased by IEEE. If so, is it possible to use the same MAC ID for our product?

    Yes you can. See below e2e threads for more info:

    Regards,
    Pavel