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.