Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1322 - DSA driver doesn't work as expected in 4.14. Fails to register mdio switches #6299

Closed
openwrt-bot opened this issue Feb 2, 2018 · 2 comments
Labels

Comments

@openwrt-bot
Copy link

npcomplete:

Supply the following if possible:

  • EA9500
  • OpenWrt trunk as of 2018-Feb-02

I have an uncommitted device tree for this device which worked fine with 4.9 see [1]
But, it doesn't work with 4.14. I tried to do some testing around this.

This device has two switches - srab and an other connected via mdio. When I have both
switches defined, both switches gets detected. However, they both fail to register
with dsa framework.

When I remove the mdio switch from the tree, the srab switch is detected and registered.

[ 1.781017] libphy: iProc MDIO bus: probed [ 1.785164] iproc-mdio 18003000.mdio: Broadcom iProc MDIO bus at 0xc88af000 [ 1.792388] libphy: mdio_mux: probed [ 1.796096] libphy: mdio_mux: probed [ 1.800221] libphy: Fixed MDIO Bus: probed

Then later where I expect it to register with dsa:

[ 3.202389] Registering SWP/SWPB emulation handler [ 3.331885] b53_common: found switch: BCM53125, rev 4 [ 3.337004] bcm53xx 1.200:00: failed to register switch: -517 [ 3.342965] b53_common: found switch: BCM53012, rev 0

Here is how 4.9 kernel behaves for the same tree:

[ 1.821879] libphy: iProc MDIO bus: probed [ 1.826054] iproc-mdio 18003000.mdio: Broadcom iProc MDIO bus at 0xc88af000 [ 1.833238] libphy: mdio_mux: probed [ 1.836828] mdio-mux-mmioreg 1800c1c0.mdio_mii_mux: Version 1.0 [ 1.842857] libphy: mdio_mux: probed [ 1.846458] mdio_bus 1.0:10: mdio_device_register [ 1.851261] libphy: mdio_mux: probed [ 1.854869] mdio_bus 1.200:00: mdio_device_register [ 1.859799] mdio-mux-mmioreg 18003000.mdio_ext_mux: Version 1.0 [ 1.866280] libphy: Fixed MDIO Bus: probed [ 1.870398] libphy: mdio_driver_register: bcm53xx [ 2.001933] b53_common: found switch: BCM53125, rev 4 [ 2.007036] bcm53xx 1.200:00: failed to register switch: -517 [ 2.013045] b53_common: found switch: BCM53012, rev 0 [ 3.301933] b53_common: found switch: BCM53125, rev 4 [ 3.307044] bcm53xx 1.200:00: failed to register switch: -517 [ 3.312954] b53_common: found switch: BCM53012, rev 0 [ 3.318039] DSA: switch 0 0 parsed [ 3.321446] DSA: tree 0 parsed [ 3.522060] libphy: dsa slave smi: probed [ 3.526902] Generic PHY fixed-0:03: attached PHY driver [Generic PHY] (mii_bus:phy_addr=fixed-0:03, irq=-1) [ 3.571922] Generic PHY dsa-0.0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-0.0:01, irq=-1) [ 3.621918] Generic PHY dsa-0.0:02: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-0.0:02, irq=-1) [ 3.671919] Generic PHY dsa-0.0:03: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-0.0:03, irq=-1) [ 3.721919] Generic PHY dsa-0.0:04: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-0.0:04, irq=-1) [ 3.861926] b53_common: found switch: BCM53125, rev 4 [ 3.867023] DSA: switch 1 0 parsed [ 3.870425] DSA: tree 1 parsed [ 8.772059] libphy: dsa slave smi: probed [ 8.811922] Generic PHY dsa-1.0:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-1.0:00, irq=-1) [ 8.861920] Generic PHY dsa-1.0:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-1.0:01, irq=-1) [ 8.911920] Generic PHY dsa-1.0:02: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-1.0:02, irq=-1) [ 8.961922] Generic PHY dsa-1.0:03: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-1.0:03, irq=-1) [ 9.011920] Generic PHY dsa-1.0:04: attached PHY driver [Generic PHY] (mii_bus:phy_addr=dsa-1.0:04, irq=-1)

[1] https://forum.lede-project.org/t/build-for-linksys-ea9500/1817

@openwrt-bot
Copy link
Author

npcomplete:

To add more information.

This is a bcm53xx device and there are two switches. The device tree looks like this.
DSA driver was working fine in 4.9 it is broken in 4.14 (or at least below tree doesn't work in 4.14)

&srab {
compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab";
status = "okay";
dsa,member = <0 0>;

ports {
    #address-cells = <1>;
    #size-cells = <0>;

    port@1 {
        reg = <1>;
        label = "lan7";
    };

    port@2 {
        reg = <2>;
        label = "lan4";
    };

    port@3 {
        reg = <3>;
        label = "lan8";
    };

    port@4 {
        reg = <4>;
        label = "wan";
    };

    port@8 {        
        reg = <8>;
        ethernet = <&gmac2>;    
        label = "cpu";

        fixed-link {
            speed = <1000>;
            full-duplex;
        };
    };

    sw0port0: port@0 {
        reg = <0>;    
        label = "extswitch";
        ethernet = <&sw1port8>;

        fixed-link {
            speed = <1000>;
            full-duplex;
        };
    };
};  

};

&mdio {
status = "okay";

    switch@0  {
        compatible = "brcm,bcm53125";
        #address-cells = <1>;
        #size-cells = <0>;
        reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>;
        reset-names = "robo_reset";
        reg = <0>;
        dsa,member = <1 0>;
    
        ports {
            #address-cells = <1>;
            #size-cells = <0>;
    
            port@0 {
                    reg = <0>;
                    label = "lan1";
            };
    
            port@1 {
                    reg = <1>;
                    label = "lan5";
            };
    
            port@2 {
                    reg = <2>;
                    label = "lan2";
            };
    
            port@3 {
                    reg = <3>;
                    label = "lan6";
            };
    
            port@4 {
                    reg = <4>;
                    label = "lan3";
            };
    
            sw1port8:port@8 {
                    reg = <8>;
                    ethernet = <&sw0port0>;    
                    label = "dsa";

                     fixed-link {
                         speed = <1000>;
                         full-duplex;
                     };
            };
        };
    };

};

@openwrt-bot
Copy link
Author

npcomplete:

Looks like I fixed the problem myself. After reading the dsa2.c source code
For dsa ports I changed it from ethernet = <&port> to link = <&port> , then made the mdio switch part of the same tree [dsa,member = <0, 1>] as srab switch [dsa,member = <0, 0>]

&srab { compatible = "brcm,bcm53012-srab", "brcm,bcm5301x-srab"; status = "okay"; dsa,member = <0 0>;
ports {
    #address-cells = <1>;
    #size-cells = <0>;

    port@1 {
        reg = <1>;
        label = "lan7";
    };

    port@2 {
        reg = <2>;
        label = "lan4";
    };

    port@3 {
        reg = <3>;
        label = "lan8";
    };

    port@4 {
        reg = <4>;
        label = "wan";
    };

    port@8 {        
        reg = <8>;
        ethernet = <&gmac2>;    
        label = "cpu";

        fixed-link {
            speed = <1000>;
            full-duplex;
        };
    };

    sw0port0: port@0 {
        reg = <0>;    
        label = "extswitch";
        link = <&sw1port8>;

        fixed-link {
            speed = <1000>;
            full-duplex;
        };
    };
};  

};

&mdio {
status = "okay";

    switch@0  {
        compatible = "brcm,bcm53125";
        #address-cells = <1>;
        #size-cells = <0>;
        reset-gpios = <&chipcommon 10 GPIO_ACTIVE_LOW>;
        reset-names = "robo_reset";
        reg = <0>;
        dsa,member = <0 1>;
    
        ports {
            #address-cells = <1>;
            #size-cells = <0>;
    
            port@0 {
                    reg = <0>;
                    label = "lan1";
            };
    
            port@1 {
                    reg = <1>;
                    label = "lan5";
            };
    
            port@2 {
                    reg = <2>;
                    label = "lan2";
            };
    
            port@3 {
                    reg = <3>;
                    label = "lan6";
            };
    
            port@4 {
                    reg = <4>;
                    label = "lan3";
            };
    
            sw1port8:port@8 {
                    reg = <8>;
                    link = <&sw0port0>;    
                    label = "dsa";

                     fixed-link {
                         speed = <1000>;
                         full-duplex;
                     };
            };
        };
    };

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant