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.

CPSW switch driver doesnt't read in phy_id value from dts device tree file

Hi,

I can't get the CPSW switch driver to read in phy_id values from "am335x-bone-common.dtsi".

I have put the following values, and it seems to register vlan values and so on, but completely disregards
 the <0> or <8> value in the phy_id field property. Instead it always gives me <0> and <1> no matter what.

I can see how it traverses the slaves and reads in values in cpsw.c but I don't know where <1> comes from?

What could be wrong?

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

&cpsw_emac1 {
    phy-mode = "mii";
    phy_id = <&davinci_mdio>, <8>;
    dual_emac_res_vlan = <2>;
};

&mac {
    slaves = <2>;
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&cpsw_default>;
    pinctrl-1 = <&cpsw_sleep>;
    dual_emac = <1>;
};

Best regards, Johan

  • Hi JRJ,

    Please see file <>/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/am335x-evmsk.dts. It's a very similar for what are you looking for.

    BR
    Ivan
  • Thanks, but it looks exactly the same with differentv values <0> and <1> just:

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

    &cpsw_emac1 {
    phy_id = <&davinci_mdio>, <1>;
    phy-mode = "rgmii-txid";
    };

    It's likte the switch driver doesn't care about the values, or they are being replaced somewhere before they get read in in cpsw.c ....
  • If I do hexdump I get:

    root@pf-machine:~# hexdump /proc/device-tree/ocp/ethernet@4a100000/slave@4a10020
    0/phy_id
    0000000 0000 3500 0000 0000
    0000008
    root@pf-machine:~# hexdump /proc/device-tree/ocp/ethernet@4a100000/slave@4a10030
    0/phy_id
    0000000 0000 3500 0000 0100
    0000008

    which doesn't seem to correspond to <0> and <8> from the device tree at all.
  • The mdio drivers polls the PHY for information on start up. I may be wrong but I believe the address strapping is one of the values pulled from the PHY. The device tree entry is tying the mac to a PHY so on link changes the cpsw mac driver can take appropriate action.

    When booting, assuming the both PHYs are connected, what is being printed in the console log after the INIT statement and cpsw version statement?

    INIT: Entering runlevel: 5
    Configuring network interfaces... [    8.337090] net eth0: initializing cpsw version 1.12 (0)