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.

am335x single ethernet port setup on mii2

Can anyone give me some pointers on getting mii2 running in Linux (3.14)? I have custom hardware that is essentially a beaglebone clone but I am using mii2 instead of mii1 due to some pin mux constraints.

My u-boot board file is configured as follows:

static struct cpsw_slave_data cpsw_slaves[] = {
    {
        .slave_reg_ofs    = 0x208,
        .sliver_reg_ofs    = 0xd80,
        .phy_id        = 0,
    },
    {
        .slave_reg_ofs    = 0x308,
        .sliver_reg_ofs    = 0xdc0,
        .phy_id        = 1,
    },
};

static struct cpsw_platform_data cpsw_data = {
    .mdio_base        = CPSW_MDIO_BASE,
    .cpsw_base        = CPSW_BASE,
    .mdio_div        = 0xff,
    .channels        = 8,
    .cpdma_reg_ofs        = 0x800,
    .slaves            = 2,
    .slave_data        = cpsw_slaves,
    .ale_reg_ofs        = 0xd00,
    .ale_entries        = 1024,
    .host_port_reg_ofs    = 0x108,
    .hw_stats_reg_ofs    = 0x900,
    .mac_control        = (1 << 5),
    .control        = cpsw_control,
    .host_port_num        = 0,
    .version        = CPSW_CTRL_VERSION_2,
};

With those settings I can ping local machines and run tftp from u-boot without issue. The Linux side is giving me trouble. For my device tree setup I referenced the Ethernet configuration from am335x-evmsk.dts

&mac {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&cpsw_default>;
    pinctrl-1 = <&cpsw_sleep>;
    dual_emac = <1>;
};

&davinci_mdio {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&davinci_mdio_default>;
    pinctrl-1 = <&davinci_mdio_sleep>;
};

&cpsw_emac0 {
    phy_id = <&davinci_mdio>, <0>;
    phy-mode = "mii";
    dual_emac_res_vlan = <1>;
};

&cpsw_emac1 {
    phy_id = <&davinci_mdio>, <1>;
    phy-mode = "mii";
    dual_emac_res_vlan = <2>;
};

relevant info from my  boot log:

[    1.920423] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[    1.926884] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[    1.934495] libphy: 4a101000.mdio: probed
[    1.938733] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    1.949331] Detected MACID = bc:6a:29:c7:6a:ba
[    1.955654] cpsw: Random MACID = fe:73:2f:b3:1a:5b
...
Configuring network interfaces...
[    5.502567] net eth0: initializing cpsw version 1.12 (0)
[    5.591190] net eth0: phy found : id is : 0x7c0f1
[    5.603314] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
udhcpc (v1.22.1) started
Sending discover...
[    8.670982] libphy: 4a101000.mdio:00 - Link is Up - 100/Full
[    8.677033] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Sending discover...
Sending discover...
No lease, forking to background

I assign a static ip, which works in u-boot, but appears to be ignored by Linux. Output of ifconfig:

eth0      Link encap:Ethernet  HWaddr BC:6A:29:C7:6A:BA
          inet6 addr: fe80::be6a:29ff:fec7:6aba/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1332 (1.3 KiB)
          Interrupt:56

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Is my device tree configuration valid? Is this there a better way to setup ethernet on mii2? I feel like I am missing something obvious.

  • Hi Andrew,

    Linux 3.14 is not offically supported by TI at this time. The latest supported release is v3.12.10.

  • Hi All,

    Anybody has got solution for this . I am facing same problem in out customized board based on Am43xx, where we are using RGMII2 for ethernet.

    I have made changes in board dts file as same for RGMII2. (SDK 7.0 and kernel version 3.12.10)

    &mac {
    /* slaves = <1>; */
    slaves = <2>;  // changed this for RGMII2
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&cpsw_default>;
    pinctrl-1 = <&cpsw_sleep>;
    status = "okay";
    };

    &davinci_mdio {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&davinci_mdio_default>;
    pinctrl-1 = <&davinci_mdio_sleep>;
    status = "okay";
    };

    &cpsw_emac0 {
    phy_id = <&davinci_mdio>, <0>;
    phy-mode = "rgmii";
    };

    &cpsw_emac1 {
    phy_id = <&davinci_mdio>, <1>;
    phy-mode = "rgmii";
    };

    Anything we have to modify in cpsw driver. I am digging into CPSW driver as well. I have doubt whether  default driver has register settings for slave 2 : (0xdc0)

  • Leaving the slaves number as 2 should be ok. Since you removed the dual emac flag that should enable just the ethernet interface and leave the CPSW in switch mode. Try reversing the PHY address for between emac0 and emac1.

  • As a follow on to Schuyler Patton's answer, the hardware address of the PHY is the number you are putting into the second phy_id field. Chances are it is zero so just swapping the address fields should work, but it is worth a quick look at your schematics to verify that is the number you really want.