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.

Linux/AM3356: AM335x using KSZ9896C attached to RGMII2 / MDIO issues

Part Number: AM3356

Tool/software: Linux

We have a custom board running an AM335X connected to a KSZ9896C PHY. The phy is an ethernet switch with one port (port 6) configured as a phy in RGMII mode using MDIO. we have configured the PHY correctly with straps to ensure the RGMII mode of the phy and port 6 is connected to the RGMII2 port of the processor. MDIO is also connected for management of the phy and I;m running linux kernel 4.14.79-ti-r84.

my device tree:

 mymdio_gbe_pins_default: mymdio_gbe_pins_default {
                pinctrl-single,pins = <
                        0x14c ( PIN_OUTPUT_PULLUP | MUX_MODE0 ) /* (M18) mdio_clk.mdio_clk */
                        0x148 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (M17) mdio_data.mdio_data */
                >;
        };
  mymdio_gbe_pins_sleep: mymdio_gbe_pins_sleep {
                pinctrl-single,pins = <
                        0x14c ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (M18) mdio_clk.mdio_clk */
                        0x148 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (M17) mdio_data.mdio_data */
                >;
        };
  myrgmii2_gbe_pins_default: myrgmii2_gbe_pins_default {
                pinctrl-single,pins = <
                        0x144 ( PIN_OUTPUT_PULLUP | MUX_MODE7 )
                        0x10c ( PIN_OUTPUT_PULLUP | MUX_MODE7 )
                        0x40 ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (R13) gpmc_a0.rgmii2_tctl */
                        0x44 ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (V14) gpmc_a1.rgmii2_rctl */
                        0x58 ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (U15) gpmc_a6.rgmii2_tclk */
                        0x5c ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (T15) gpmc_a7.rgmii2_rclk */
                        0x54 ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (V15) gpmc_a5.rgmii2_td0 */
                        0x50 ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (R14) gpmc_a4.rgmii2_td1 */
                        0x4c ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (T14) gpmc_a3.rgmii2_td2 */
                        0x48 ( PIN_OUTPUT_PULLDOWN | MUX_MODE2 ) /* (U14) gpmc_a2.rgmii2_td3 */
                        0x6c ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (V17) gpmc_a11.rgmii2_rd0 */
                        0x68 ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (T16) gpmc_a10.rgmii2_rd1 */
                        0x64 ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (U16) gpmc_a9.rgmii2_rd2 */
                        0x60 ( PIN_INPUT_PULLUP | MUX_MODE2 ) /* (V16) gpmc_a8.rgmii2_rd3 */
                >;
        };
        myrgmii2_gbe_pins_sleep: myrgmii2_gbe_pins_sleep {
                pinctrl-single,pins = <
                        0x144 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 )
                        0x40 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (R13) gpmc_a0.rgmii2_tctl */
                        0x44 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (V14) gpmc_a1.rgmii2_rctl */
                        0x58 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (U15) gpmc_a6.rgmii2_tclk */
                        0x5c ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (T15) gpmc_a7.rgmii2_rclk */
                        0x54 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (V15) gpmc_a5.rgmii2_td0 */
                        0x50 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (R14) gpmc_a4.rgmii2_td1 */
                        0x4c ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (T14) gpmc_a3.rgmii2_td2 */
                        0x48 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (U14) gpmc_a2.rgmii2_td3 */
                        0x6c ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (V17) gpmc_a11.rgmii2_rd0 */
                        0x68 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (T16) gpmc_a10.rgmii2_rd1 */
                        0x64 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (U16) gpmc_a9.rgmii2_rd2 */
                        0x60 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (V16) gpmc_a8.rgmii2_rd3 */
                >;
        };

&mac {
    slaves = <1>;
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&myrgmii2_gbe_pins_default>;
    pinctrl-1 = <&myrgmii2_gbe_pins_sleep>;
    //dual_emac = <0>;
    status = "okay";
};

&davinci_mdio {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&mymdio_gbe_pins_default>;
    pinctrl-1 = <&mymdio_gbe_pins_sleep>;
    status = "okay";

};

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

and here is the debug in dmesg I'm seeing:

[    1.311919] libphy: Fixed MDIO Bus: probed
[    1.313265] CAN device driver interface
[    1.367217] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    1.367238] davinci_mdio 4a101000.mdio: detected phy mask ffffffc0
[    1.448454] libphy: 4a101000.mdio: probed
[    1.448492] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
[    1.448507] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver unknown
[    1.448520] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver unknown
[    1.448534] davinci_mdio 4a101000.mdio: phy[3]: device 4a101000.mdio:03, driver unknown
[    1.448547] davinci_mdio 4a101000.mdio: phy[4]: device 4a101000.mdio:04, driver unknown
[    1.448559] davinci_mdio 4a101000.mdio: phy[5]: device 4a101000.mdio:05, driver unknown
[    1.449965] cpsw 4a100000.ethernet: Detected MACID = f4:5e:ab:ef:d6:b2
[    1.450126] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[    1.450141] cpsw 4a100000.ethernet: ALE Table size 1024
[    1.450199] cpsw 4a100000.ethernet: cpts: overflow check period 1250 (jiffies)

I see linux is detecting the phy on the mdio bus and I have an eth0 in linux however no link is detected:

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f4:5e:ab:ef:d6:b2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 45

Settings for eth0:
        Supported ports: [ TP AUI BNC MII FIBRE ]
        Supported link modes:   Not reported
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: No
        Advertised link modes:  Not reported
        Advertised pause frame use: No
        Advertised auto-negotiation: No
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 5
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000000 (0)

        Link detected: no

Does anyone know what's wrong and how I can address this issue?

Thanks,

  • Hi,

    The Linux version you use, kernel 4.14.79-ti-r84 is a community release and is not supported by TI. Please either move to the AM335x Processor SDK (www.ti.com/.../PROCESSOR-SDK-AM335X ) or contact the community on www.beagleboard.org for questions on the version you use.
  • I have converted our board over to running the current TI release of the processor SDK (Linux am335x-evm 4.14.67-gd315a9bb00 #1 PREEMPT Sat Oct 6 03:26:15 UTC 2018 armv7l GNU/Linux)

    Using the device tree (relevant sections only):

    &am33xx_pinmux {
            pinctrl-names = "default";

    davinci_mdio_default: davinci_mdio_default {
                    pinctrl-single,pins = <
                            /* MDIO */
                            0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)    /* mdio_data.mdio_data */
                            0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)                   /* mdio_clk.mdio_clk */
                    >;
            };

            davinci_mdio_sleep: davinci_mdio_sleep {
                    pinctrl-single,pins = <
                            /* MDIO reset value */
                            0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                            0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
                    >;
            };

    davinci_mdio_default: davinci_mdio_default {
                    pinctrl-single,pins = <
                            /* MDIO */
                            0x148 (PIN_INPUT_PULLUP | SLEWCTRL_FAST | MUX_MODE0)    /* mdio_data.mdio_data */
                            0x14c (PIN_OUTPUT_PULLUP | MUX_MODE0)                   /* mdio_clk.mdio_clk */
                    >;
            };

            davinci_mdio_sleep: davinci_mdio_sleep {
                    pinctrl-single,pins = <
                            /* MDIO reset value */
                            0x148 (PIN_INPUT_PULLDOWN | MUX_MODE7)
                            0x14c (PIN_INPUT_PULLDOWN | MUX_MODE7)
                    >;
            };

    };

    &mac {
            slaves = <1>;
            pinctrl-names = "default", "sleep";
            status = "okay";
            pinctrl-0 = <&myrgmii2_gbe_pins_default>;
            pinctrl-1 = <&myrgmii2_gbe_pins_sleep>;
            gpios = <&gpio0 29 GPIO_ACTIVE_LOW>;
    };

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

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

    And the ksz9896C configured with it's port 6 configured as RGMII / mdio (phy) connected to our AM335x RGMII2 / mdio ports I see the flowing debug on boot.

    [    0.927381] mdio_bus fixed-0: GPIO lookup for consumer reset
    [    0.927393] mdio_bus fixed-0: using lookup tables for GPIO lookup
    [    0.927401] mdio_bus fixed-0: lookup for GPIO reset failed
    [    0.927420] libphy: Fixed MDIO Bus: probed
    [    0.946797] mdio_bus 4a101000.mdio: GPIO lookup for consumer reset
    [    0.946809] mdio_bus 4a101000.mdio: using lookup tables for GPIO lookup
    [    0.946816] mdio_bus 4a101000.mdio: lookup for GPIO reset failed
    [    1.002121] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
    [    1.009822] davinci_mdio 4a101000.mdio: detected phy mask ffffffc0
    [    1.020778] libphy: 4a101000.mdio: probed
    [    1.024918] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver unknown
    [    1.032996] davinci_mdio 4a101000.mdio: phy[1]: device 4a101000.mdio:01, driver Microchip KSZ9477
    [    1.041907] davinci_mdio 4a101000.mdio: phy[2]: device 4a101000.mdio:02, driver Microchip KSZ9477
    [    1.050933] davinci_mdio 4a101000.mdio: phy[3]: device 4a101000.mdio:03, driver Microchip KSZ9477
    [    1.059877] davinci_mdio 4a101000.mdio: phy[4]: device 4a101000.mdio:04, driver Microchip KSZ9477
    [    1.068816] davinci_mdio 4a101000.mdio: phy[5]: device 4a101000.mdio:05, driver Microchip KSZ9477
    [    1.078596] cpsw 4a100000.ethernet: Detected MACID = f4:5e:ab:ee:c8:2f
    [    1.085325] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
    [    1.091709] cpsw 4a100000.ethernet: ALE Table size 1024
    [    1.097014] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
    .....

    [   10.528895] net eth0: initializing cpsw version 1.12 (0)
    [   10.772701] Microchip KSZ9477 4a101000.mdio:05: attached PHY driver [Microchip KSZ9477] (mii_bus:phy_addr=4a101000.mdio:05, ir
    q=POLL)
    [   10.936404] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready

    Then in ethtool on eth0 I see:

    Settings for eth0:
            Supported ports: [ TP MII ]
            Supported link modes:   10baseT/Half 10baseT/Full
                                    100baseT/Half 100baseT/Full
                                    1000baseT/Half 1000baseT/Full
            Supported pause frame use: Symmetric Receive-only
            Supports auto-negotiation: Yes
            Supported FEC modes: Not reported
            Advertised link modes:  10baseT/Half 10baseT/Full
                                    100baseT/Half 100baseT/Full
                                    1000baseT/Half 1000baseT/Full
            Advertised pause frame use: No
            Advertised auto-negotiation: Yes
            Advertised FEC modes: Not reported
            Speed: 10Mb/s
            Duplex: Half
            Port: MII
            PHYAD: 5
            Transceiver: internal
            Auto-negotiation: on
            Supports Wake-on: d
            Wake-on: d
            Current message level: 0x00000000 (0)

            Link detected: no

    Does anyone have any guidance on what I'm missing to get the phy working?

  • Hi,
    I apologize since in the initial response we should have indicated that the CPSW-to-external switch use case that is not supported by TI. It does look you made progress since the PHY drivers are reporting in.

    This external switch question is seen a lot in the forums in several threads. While TI is not able to assist in implementation of this use case, it has been implemented successfully by customers who have reported back to the forum.

    One recommendation I have is to work with the switch manufacturer on their driver to understand why the link is not detected.

    Another suggestion/guess would be to perhaps look at fixed phy type solutions.

    You can also look through the TI e2e forums for possible solutions by using a site search, do not use the e2e search utility. In case you are not familiar with how to do a site search with google it would be something like this:

    site:e2e.ti.com switch ethernet

    Best Regards,
    Schuyler