Other Parts Discussed in Thread: AM5726
We have build a prototype board using the Sitara AM5726 with a Marvell Switch 88E6350R.
We are using the latest Linux RT AM57xx Processor SDK 3.01.00.06 running on Linux Kernel rt-4.4.19.
The Sitara CPSW Swich should work in Dual EMAC mode for our application.
EMAC0 is connected via RGMII without a PHY to a FPGA, but is not in use at the moment.
EMAC1 is connected via RGMII without a PHY to Port 5 of the Marvell Switch. The Marvel Switch is configured in single device mode, Port 5 in configured in RGMII mode.
The DSA device driver and the Marvell driver are configured in the kernel configuration. The Pin Mapping is the same as in the AM57xx EVM board (Beagle X-15)
We have the following issues with this constellation:
1. We cannot send or receive messages when the CPSW switch is configured in dual EMAC mode. How can we tell the DSA driver to use the cpsw_emac1 (rgmii1) interface?
2. In Switch mode we can see broadcast messages send from the Sitara board when capturing with Wireshark. But we can not receive any packages with ifconfig.
We can see clock, control and data traffic on the rx lines on port 5 of the Marvell switch, but no received packet in ifconfig.
We have tried all combinations of phy-mode = rgmii with/without internal delay on rx/tx without any success. What can we do now?
Here is a block diagram of our board:
+---------------------+
| |
| |
| |
+---+ FPGA |
+------------------------+ | | |
| | | | |
| AM5726 +--------+ | +---------------------+
| | +----+
| | EMAC0 | RGMII
| +--------+
| +--------+ +---------------------+
| | +---RGMII| |
| | EMAC1 | | | Marvell P1 +----+ lan1
| +--------+ +---+P5 88E6350R |
| +--+ | |
+------------------------+ | | P3 +----+ lan2
+-----+ |
MDIO +---------------------+
The Marvell switch is succesfully detected at startup and the DSA driver is running.
Here is the startup log with some debug messages added to the mdio and DSA driver:
[ 1.572819] libphy: Fixed MDIO Bus: probed
[ 1.578611] --- in davinci_mdio_probe ---
[ 1.627348] davinci_mdio 48485000.mdio: davinci mdio revision 1.6
[ 1.633473] libphy: 48485000.mdio: probed
[ 1.637504] mdio_bus 48485000.mdio: /ocp/ethernet@48484000/mdio@48485000/dsa@0 has invalid PHY address
[ 1.646856] mdio_bus 48485000.mdio: scan phy dsa at address 0
[ 1.653285] mdio_bus 48485000.mdio: scan phy dsa at address 1
[ 1.660043] mdio_bus 48485000.mdio: scan phy dsa at address 2
[ 1.666802] mdio_bus 48485000.mdio: scan phy dsa at address 3
[ 1.673562] mdio_bus 48485000.mdio: scan phy dsa at address 4
[ 1.680322] mdio_bus 48485000.mdio: scan phy dsa at address 5
[ 1.687082] mdio_bus 48485000.mdio: scan phy dsa at address 6
[ 1.693844] mdio_bus 48485000.mdio: scan phy dsa at address 7
[ 1.700603] mdio_bus 48485000.mdio: scan phy dsa at address 8
[ 1.707361] mdio_bus 48485000.mdio: scan phy dsa at address 9
[ 1.714122] mdio_bus 48485000.mdio: scan phy dsa at address 10
[ 1.720883] mdio_bus 48485000.mdio: scan phy dsa at address 11
[ 1.727642] mdio_bus 48485000.mdio: scan phy dsa at address 12
[ 1.734401] mdio_bus 48485000.mdio: scan phy dsa at address 13
[ 1.741163] mdio_bus 48485000.mdio: scan phy dsa at address 14
[ 1.747922] mdio_bus 48485000.mdio: scan phy dsa at address 15
[ 1.754682] mdio_bus 48485000.mdio: scan phy dsa at address 16
[ 1.772877] mdio_bus 48485000.mdio: scan phy dsa at address 17
[ 1.780920] mdio_bus 48485000.mdio: scan phy dsa at address 18
[ 1.788716] mdio_bus 48485000.mdio: scan phy dsa at address 19
[ 1.796512] mdio_bus 48485000.mdio: scan phy dsa at address 20
[ 1.804311] mdio_bus 48485000.mdio: scan phy dsa at address 21
[ 1.812119] mdio_bus 48485000.mdio: scan phy dsa at address 22
[ 1.819915] mdio_bus 48485000.mdio: scan phy dsa at address 23
[ 1.826442] mdio_bus 48485000.mdio: scan phy dsa at address 24
[ 1.833203] mdio_bus 48485000.mdio: scan phy dsa at address 25
[ 1.839963] mdio_bus 48485000.mdio: scan phy dsa at address 26
[ 1.846722] mdio_bus 48485000.mdio: scan phy dsa at address 27
[ 1.854759] mdio_bus 48485000.mdio: scan phy dsa at address 28
[ 1.862323] mdio_bus 48485000.mdio: scan phy dsa at address 29
[ 1.869084] mdio_bus 48485000.mdio: scan phy dsa at address 30
[ 1.875842] mdio_bus 48485000.mdio: scan phy dsa at address 31
[ 1.882601] --- of_mdiobus_register returns 0
[ 1.886803] davinci_mdio 48485000.mdio: phy[16]: device 48485000.mdio:10, driver unknown
[ 1.895112] davinci_mdio 48485000.mdio: phy[17]: device 48485000.mdio:11, driver unknown
[ 1.903241] davinci_mdio 48485000.mdio: phy[18]: device 48485000.mdio:12, driver unknown
[ 1.911369] davinci_mdio 48485000.mdio: phy[19]: device 48485000.mdio:13, driver unknown
[ 1.919498] davinci_mdio 48485000.mdio: phy[20]: device 48485000.mdio:14, driver unknown
[ 1.927626] davinci_mdio 48485000.mdio: phy[21]: device 48485000.mdio:15, driver unknown
[ 1.935753] davinci_mdio 48485000.mdio: phy[22]: device 48485000.mdio:16, driver unknown
[ 1.943882] davinci_mdio 48485000.mdio: phy[27]: device 48485000.mdio:1b, driver unknown
[ 1.952977] cpsw 48484000.ethernet: Detected MACID = fc:0f:4b:7a:c8:c8
[ 1.960292] cpsw 48484000.ethernet: cpsw: Detected MACID = fc:0f:4b:7a:c8:c9
[ 2.131114] NET: Registered protocol family 10
[ 2.146579] sit: IPv6 over IPv4 tunneling driver
[ 2.151762] NET: Registered protocol family 17
[ 2.156439] Distributed Switch Architecture driver version 0.1
[ 2.162298] --- in dsa_probe ---
[ 2.165538] --- in dsa_of_probe ---
[ 2.169074] --- in of_mdio_find_bus ---
[ 2.172928] --- of_mdio_find_bus device ---
[ 2.177167] --- dsa_of_probe OK
[ 2.180322] --- in dsa_setup_dst ---
[ 2.185246] mdio_bus 48485000.mdio: unknown revision 2, using base switch 0x3710
[ 2.192680] cpsw 48484000.ethernet eth0: [0]: detected a Marvell 88E6350 switch
[ 2.665427] libphy: dsa slave smi: probed
[ 2.850429] --- dsa_probe OK
This is part of the device tree we use:
mac: ethernet@48484000 {
compatible = "ti,dra7-cpsw","ti,cpsw";
ti,hwmods = "gmac";
clocks = <&dpll_gmac_ck>, <&gmac_gmii_ref_clk_div>;
clock-names = "fck", "cpts";
cpdma_channels = <8>;
ale_entries = <1024>;
bd_ram_size = <0x2000>;
no_bd_ram = <0>;
mac_control = <0x20>;
slaves = <2>;
active_slave = <0>;
cpts_clock_mult = <0x80000000>;
cpts_clock_shift = <29>;
reg = <0x48484000 0x1000
0x48485200 0x2E00>;
#address-cells = <1>;
#size-cells = <1>;
dual_emac; // comment out for switch mode
ti,no-idle;
/*
* rx_thresh_pend
* rx_pend
* tx_pend
* misc_pend
*/
interrupts = <GIC_SPI 334 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 335 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 336 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 337 IRQ_TYPE_LEVEL_HIGH>;
ranges;
syscon = <&scm_conf>;
status = "disabled";
davinci_mdio: mdio@48485000 {
compatible = "ti,cpsw-mdio";
#address-cells = <1>;
#size-cells = <0>;
ti,hwmods = "davinci_mdio";
bus_freq = <1000000>;
reg = <0x48485000 0x100>;
dsa@0 { // fake phy entry, to avoid 'no mdiobus' error,
// at dsa driver startup
};
};
cpsw_emac0: slave@48480200 {
phy_id = <&davinci_mdio>, <1>;
phy-mode = "rgmii";
dual_emac_res_vlan = <1>; // comment out for switch mode
/* Filled in by U-Boot */
mac-address = [ 00 00 00 00 00 00 ];
fixed-link {
speed = <1000>;
full-duplex;
};
};
cpsw_emac1: slave@48480300 {
phy_id = <&davinci_mdio>, <2>;
phy-mode = "rgmii"; // tested with rgmii-id, rgmii-txid,
// rgmii-rxid (no success)
dual_emac_res_vlan = <2>; // comment out for switch mode
/* Filled in by U-Boot */
mac-address = [ 00 00 00 00 00 00 ];
fixed-link {
speed = <1000>;
full-duplex;
};
};
phy_sel: cpsw-phy-sel@4a002554 {
compatible = "ti,dra7xx-cpsw-phy-sel";
reg= <0x4a002554 0x4>;
reg-names = "gmii-sel";
};
};
dsa@0 {
compatible = "marvell,dsa";
#address-cells = <2>;
#size-cells = <0>;
interrupts = <10>;
dsa,ethernet = <&mac>; // cpsw_emac1 brings ' no ethernet
// device' error, at dsa driver startup
dsa,mii-bus = <&davinci_mdio>;
switch@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0 0>; // MDIO address 0, switch 0 in tree
port@0 {
reg = <0>;
label = "lan1";
};
port@2 {
reg = <2>;
label = "lan2";
};
port@5 {
reg = <5>;
label = "cpu";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
We need to make some "strange" modifications in the device tree to get the DSA and Marvell switch drivers up and running:
1. we need to add a fake phy device named dsa@0 to get rid of error message 'no mdiobus' when DSA driver starts .
2. We need to use <&mac> for dsa,ethernet in dsa section to get rid off error message 'no ethernet' when DSA driver starts.
Because there are no PHY between Sitara and Marvell switch we use fixed link nodes in cpsw_emac1 and in dsa@0 port@5 section.
We can use ifup to bring up lan1 and lan2. Have tested static and dhcp configuration. We can see link port messages when plug/unplug the network cable on lan1/lan2.
Ethtool -d lan1/lan2 brings up correct register dumps of the Marvell switch ports. So we guess, that the MDIO interface is working properly.
Any suggestions?
Regards Peter