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.

I want change eth1's physical address.

Hi.

I made prototypes with C6A8168 CPU .

Our board has 2 EMAC ports but one of them don't operate.

Our kernel can detect eth0 but can't detect eth1.

I want detect eth1.

So I want change eth1's physical address.

Where can I this part in kernel source?

Please, reply my answer.

Thank you.

  • I visit there.

    But I don't get any information for me.

    I want know how can I change eth1's physical address in kernel source not menuconfig.

    My kernel image already on 'TI CPSW Switch as Dual EMAC.

    Our prototype is changed address line.

    If board boot I can see 'PHY 0:01' message.

    It is eth0's physical address.

    And also I can see 'PHY 0:02' message eth1's message in EVM.

    But our prototype's eth1 physical address isn't 0:02.

    Our prototype's eth1 physical address is 0:03.

    So I want change eth1's physical address 0:02 to 0:03.

    Where can I find it in kernel source?

    Please answer.

    Thank you.

  • For 816x, PHY addresses are configured in the kernel source at arch/arm/mach-omap2/devices.c, around lines 1241-1251.  (In PSP 04.04.00.01, the location might be a bit different in other versions.)

    - Mark

  • I can found 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;

     ti816x_emac1_pdata.ctrl_reg_offset = TI816X_EMAC_CNTRL_OFFSET;  ti816x_emac1_pdata.ctrl_mod_reg_offset = TI816X_EMAC_CNTRL_MOD_OFFSET;  ti816x_emac1_pdata.ctrl_ram_offset = TI816X_EMAC_CNTRL_RAM_OFFSET;  ti816x_emac1_pdata.ctrl_ram_size = TI816X_EMAC_CNTRL_RAM_SIZE;  ti816x_emac1_pdata.version = EMAC_VERSION_2;  ti816x_emac1_pdata.hw_ram_addr = TI816X_EMAC1_HW_RAM_ADDR;  ti816x_emac1_pdata.interrupt_enable = NULL;  ti816x_emac1_pdata.interrupt_disable = NULL;  ti816x_emac1_device.dev.platform_data = &ti816x_emac1_pdata;  platform_device_register(&ti816x_emac1_device);

     platform_device_register(&ti816x_mdio_device);  clk_add_alias(NULL, dev_name(&ti816x_mdio_device.dev),    NULL, &ti816x_emac1_device.dev);

     mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID1_LO);  mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID1_HI);  ti816x_emac2_pdata.mac_addr[0] = mac_hi & 0xFF;  ti816x_emac2_pdata.mac_addr[1] = (mac_hi & 0xFF00) >> 8;  ti816x_emac2_pdata.mac_addr[2] = (mac_hi & 0xFF0000) >> 16;  ti816x_emac2_pdata.mac_addr[3] = (mac_hi & 0xFF000000) >> 24;  ti816x_emac2_pdata.mac_addr[4] = mac_lo & 0xFF;  ti816x_emac2_pdata.mac_addr[5] = (mac_lo & 0xFF00) >> 8;

     ti816x_emac2_pdata.ctrl_reg_offset = TI816X_EMAC_CNTRL_OFFSET;  ti816x_emac2_pdata.ctrl_mod_reg_offset = TI816X_EMAC_CNTRL_MOD_OFFSET;  ti816x_emac2_pdata.ctrl_ram_offset = TI816X_EMAC_CNTRL_RAM_OFFSET;  ti816x_emac2_pdata.ctrl_ram_size = TI816X_EMAC_CNTRL_RAM_SIZE;  ti816x_emac2_pdata.version = EMAC_VERSION_2;  ti816x_emac2_pdata.hw_ram_addr = TI816X_EMAC2_HW_RAM_ADDR;  ti816x_emac2_pdata.interrupt_enable = NULL;  ti816x_emac2_pdata.interrupt_disable = NULL;  ti816x_emac2_device.dev.platform_data = &ti816x_emac2_pdata;  platform_device_register(&ti816x_emac2_device);

     ti816x_emac_mux(); }

    ==============================================

     

    I think this source is MAC address.

    I want know that C6A816x CPU looking EMCA controller's address.

    Where can I find this part in kernel source?

  • Hello,

    Please, refer to <linux_home>/drivers/net/davinci_emac.c

    BR

    Vladimir

  • Hi.

    I find this part.

    I can find "static int emac_dev_open(struct net_device *ndev)".

    Is this right?

    I can't know where part am I edit.

    Please tell me in detail.

    Thank you.

  • Hi,

    Lines related to the PHY ID are these:

    line 1657         phy = bus_find_device(&mdio_bus_type, NULL, NULL, match_first_device);

    line 1660         priv->phy_id = dev_name(phy);

    But this values comes deep from the generic device code. It is hard to track it, even with ctags. This is either set deep in the generic driver code or it is enumerated (previous device number plus one).

    BR

    Vladimir

  • The emac_platform_data structures that that code is getting the PHY address from come from arch/arm/mach-omap2/devices.c as I pointed to above.

    At lines 1241-1251 of that file, there is:

      1241  static struct emac_platform_data ti816x_emac1_pdata = {
      1242          .rmii_en        =       0,
      1243          .phy_id         =       "0:01",
      1244          .gigabit_en     =       1,
      1245  };
      1246  
      1247  static struct emac_platform_data ti816x_emac2_pdata = {
      1248          .rmii_en        =       0,
      1249          .phy_id         =       "0:02",
      1250          .gigabit_en     =       1,
      1251  };

    In your case, you want to change the .phy_id on ti816x_emac2_pdata to be "0:03".

    If you have a slightly different version of this file such that the line numbers don't match then search for the ti816x_emac2_pdata symbol.

  • Hi, all

    Yes, Mark Thompson is right, this is the place. You should modify ".phy_id". I've just tried it and it is working as expected.

    Thanks a lot, Mark Thompson.

    BR

    Vladimir

  • Hi

    I use dm8168

    I also meet the same problem,

    Our board has 2 EMAC ports,and our kernel can detect eth0 but can't detect eth1.

    Do you mean its problem with cpu prototypes ?

    I do not quite understand well what do really mean, can change physical address solve this problem?

    xavier

  • Hi Xavier,

    Did you try with the commands described below ?

    http://processors.wiki.ti.com/index.php?title=TI81XX_PSP_Ethernet_Switch_User_Guide#Bringing_Up_interfaces

    Best Regards,

    Pavel