AM62P: Ethernet with RMII

Other Parts Discussed in Thread: AM62P, AM67

Tool/software:

I am using rmii with AM62P SOC mounted on my custom carrier board.
Phy chip is KSZ8081.
Regarding the clock, there's a clock generated on the board using oscillator and the phy receives it as input to generate its own 50MHz clock.

I have the following DTS but unfortunately I am not able to get the ethernet link up:

	aliases {
		ethernet0 = &cpsw_port1;
		// ethernet1 = &cpsw_port2;
	};

&main_pmx0 {
	bootph-all;

	main_mdio1_pins_default: main-mdio1-default-pins {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x0160, PIN_OUTPUT, 0) /* (F17) MDIO0_MDC */
			AM62PX_IOPAD(0x015c, PIN_INPUT, 0) /* (F16) MDIO0_MDIO */
		>;
		bootph-all;
	};

	main_rmii1_pins_default: main-rmii1-default-pins {
		pinctrl-single,pins = <
			AM62PX_IOPAD(0x0130, PIN_INPUT, 1) /* (B17) RGMII1_TXC.RMII1_CRS_DV */
            AM62PX_IOPAD(0x0148, PIN_INPUT, 1) /* (A16) RGMII1_RXC.RMII1_REF_CLK */
			AM62PX_IOPAD(0x014c, PIN_INPUT, 1) /* (B15) RGMII1_RD0.RMII1_RXD0 */
			AM62PX_IOPAD(0x0150, PIN_INPUT, 1) /* (B16) RGMII1_RD1.RMII1_RXD1 */
			AM62PX_IOPAD(0x0144, PIN_INPUT, 1) /* (A15) RGMII1_RX_CTL.RMII1_RX_ER */
			AM62PX_IOPAD(0x0134, PIN_INPUT, 1) /* (A18) RGMII1_TD0.RMII1_TXD0 */
			AM62PX_IOPAD(0x0138, PIN_INPUT, 1) /* (C17) RGMII1_TD1.RMII1_TXD1 */
			AM62PX_IOPAD(0x012c, PIN_INPUT, 1) /* (B18) RGMII1_TX_CTL.RMII1_TX_EN */
		>;
    };
 };
 
 
 
&cpsw3g {
	pinctrl-names = "default";
	pinctrl-0 = <&main_rmii1_pins_default>;
	status = "okay";
};

&cpsw_port1 {
	//phy-mode = "rgmii-rxid";
	phy-mode = "rmii";
	phy-handle = <&cpsw3g_phy0>;
	status = "okay";
};

// &cpsw_port2 {
// 	phy-mode = "rgmii-rxid";
// 	phy-handle = <&cpsw3g_phy1>;
// 	status = "okay";
// };

&cpsw3g_mdio {
	pinctrl-names = "default";
	pinctrl-0 = <&main_mdio1_pins_default>;
	status = "okay";

	cpsw3g_phy0: ethernet-phy@0 {
		reg = <0>;
		compatible = "microchip,ksz8081", "ethernet-phy-ieee802.3-c22";
		bootph-all;
		//ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
		//ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
		//ti,min-output-impedance;
	};
};


I would appreciate it if you can give me any hint to fix the issue.

Logs from dmesg:

\u@\h:\w$ dmesg | grep -i cpsw

[    1.276860] am65-cpsw-nuss 8000000.ethernet: initializing am65 cpsw nuss version 0x6BA01903, cpsw version 0x6BA81903 Ports: 3 quirks:00000006

[    1.352404] am65-cpsw-nuss 8000000.ethernet: initialized cpsw ale version 1.5

[    1.359536] am65-cpsw-nuss 8000000.ethernet: ALE Table size 512, Policers 32

[    1.367305] am65-cpsw-nuss 8000000.ethernet: CPTS ver 0x4e8a010d, freq:500000000, add_val:1 pps:0

[    1.387349] am65-cpsw-nuss 8000000.ethernet: set new flow-id-base 19

[    6.846624] am65-cpsw-nuss 8000000.ethernet eth0: PHY [8000f00.mdio:00] driver [Micrel KSZ8081 or KSZ8091] (irq=POLL)

[    6.869420] am65-cpsw-nuss 8000000.ethernet eth0: configuring for phy/rmii link mode

 \u@\h:\w$ dmesg | grep -i phy
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] arch_timer: cp15 timer(s) running at 200.00MHz (phys).
[    1.342802] davinci_mdio 8000f00.mdio: phy[0]: device 8000f00.mdio:00, driver Micrel KSZ8081 or KSZ8091
[    7.381436] am65-cpsw-nuss 8000000.ethernet eth0: PHY [8000f00.mdio:00] driver [Micrel KSZ8081 or KSZ8091] (irq=POLL)
[    7.395812] am65-cpsw-nuss 8000000.ethernet eth0: configuring for phy/rmii link mode


Regards,
Mohamed

  • Hi, I'm having the same issue with our hardware on the AM67.

    You'll probably want to include ethtool -S eth0 outputs.
    For me, I get packets on the p0_rx_good_frames, but they do not get forwarded to the eth0 rx_good_frames.

  • Hi Evan,
    thanks for sharing your issue.
    The output from "ethtool -S eth0", shows 0 for all frames.
    I found out that the XI pin for KSZ8081 takes a 25MHZ clk as input but the ref_clk has no signal at all. I am not sure if the KSZ8081 has to be configured in another mode.
    Can you please share your configuration?

  • Hi Mohamed,

    In that case, verify your cabling and check your phy index.
    My hardware was strapped/configured via resistor to 0.

    If your hardware phy is set to a different number then you'll need to change the ethernet-phy@0 and corresponding reg = <0>; to match. (ie, a phy of 1 would be @1 and reg =<1>).
    You might also try removing these two lines, as the driver was auto configuring for me, as long as I had the right phy index/reg.
    compatible = "microchip,ksz8081", "ethernet-phy-ieee802.3-c22";
    bootph-all;

    Also, in my setup, I'm using a crossover cable, since I'm connected directly to a PC, and my setup isn't able to automatically switch the tx/rx pins.

  • Hi Evan,

    I check the PHYAD[1:0] pins and they are configured as Ipd, so they are also strapped with pull-down resistor. so phy-0 should be correct.
    My doubt is that there's something wrong regarding the REF_CLK of the KSZ8081 chip. It should output 50Mhz to the MAC chip but it is not the case for me.

    Also tried removing the driver lines "compatible = "microchip,ksz8081", "ethernet-phy-ieee802.3-c22";", but unfortunately it did not help.

  • Hi Mohamed, my 50MHz clock output is automatically configuring. It's possible to use mdio-tools to try to manually enable it.

    Also, I'd change these pins to outputs:

    AM62PX_IOPAD(0x0134, PIN_OUTPUT, 1) /* (A18) RGMII1_TD0.RMII1_TXD0 */
    AM62PX_IOPAD(0x0138, PIN_OUTPUT, 1) /* (C17) RGMII1_TD1.RMII1_TXD1 */
    AM62PX_IOPAD(0x012c, PIN_OUTPUT, 1) /* (B18) RGMII1_TX_CTL.RMII1_TX_EN */

  • Hi Evan,

    I guess I had a HW issue with my board, I got a new one and the link seems to be up with my current config.
    The thing is it only works in one direction, with tcpdump, I can see packets sent from my board to my pc and pc replies back but nothing is being received by my board. Is it the same issue you face?

  • Hi Mohamed, yes that was the same issue I had. Mine turned out to be a bad pin configuration, bad copy paste from rgmii to rmii.
    Looks like yours should be working as best as I can tell.

  • Hello Mohamed,

    Apologies for the delayed response and thanks Evan for chiming in!

    I guess I had a HW issue with my board, I got a new one and the link seems to be up with my current config.
    The thing is it only works in one direction, with tcpdump, I can see packets sent from my board to my pc and pc replies back but nothing is being received by my board. Is it the same issue you face?

    Can you please share the results of "ethtool -S eth0" after you see that packets are not being received by your board? If your PC is a Linux PC, please share the same "ethtool -S" results on the PC side. 

    Additionally, can you check the results of "ethtool eth0" to see if the Link detected is "yes"?

    What Linux SDK version are you using?

    -Daolin