Hi!
We have a custom board similar to Beaglebone Black and EVM Starter Kit. We have 2 ethernet ports containing 2 Micrel KSZ8081RNA phys where connection is RMII and CPSW is configured to operate in dual EMAC mode. The phys make use of an external 50MHz clock source.
I was hoping to avoid my micrel patch for the KSZ8081RNA phys when moving from linux-yocto 3.14 (dizzy branch) to linux-yocto 3.19 (current master branch for beaglebone board). It seems like the current micrel phy driver (drivers/net/phy/micrel.c in 3.19) will:
1. Set the Broadcast Off override flag correct (set KSZPHY_OMSO_B_CAST_OFF bit in the MII_KSZPHY_OMSO register)
2. Set the RMII 50MHzclock mode flag correct (set KSZPHY_RMII_REF_CLK_SEL bit in the MII_KSZPHY_CTRL register)
However, I don't see how to set the "Override strap-in for RMII mode" flag in a correct way (that is to set KSZPHY_OMSO_RMII_OVERRIDE bit in the MII_KSZPHY_OMSO register). Should devicetree be used to get this correct? Does the micrel driver lack support for what I am trying to do?
My hope is to get rid of the micrel patch listed below.
My current patch for 3.19 includes special config for the KSZ8081 (instead of the generic kszphy_config_init() in drivers/net/phy/micrel.c which I would prefer to use):
static int ksz8081_config_init(struct phy_device *phydev)
{
int regval;
regval = phy_read(phydev, MII_KSZPHY_OMSO);
regval |= KSZPHY_OMSO_B_CAST_OFF;
regval |= KSZPHY_OMSO_RMII_OVERRIDE;
phy_write(phydev, MII_KSZPHY_OMSO, regval);
regval = phy_read(phydev, MII_KSZPHY_CTRL);
regval |= KSZPHY_RMII_REF_CLK_SEL;
phy_write(phydev, MII_KSZPHY_CTRL, regval);
return 0;
}
My custom devicetree does include am33xx.dtsi and contains these additional settings for ethernet:
[...]
&mac {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&cpsw_default>;
pinctrl-1 = <&cpsw_sleep>;
dual_emac = <1>;
status = "okay";
};
&davinci_mdio {
pinctrl-names = "default", "sleep";
pinctrl-0 = <&davinci_mdio_default>;
pinctrl-1 = <&davinci_mdio_sleep>;
status = "okay";
};
&cpsw_emac0 {
phy_id = <&davinci_mdio>, <0>;
phy-mode = "rmii";
dual_emac_res_vlan = <1>;
};
&cpsw_emac1 {
phy_id = <&davinci_mdio>, <3>;
phy-mode = "rmii";
dual_emac_res_vlan = <2>;
};
&phy_sel {
rmii-clock-ext;
};
[...]
My custom board seems to work with the patch and the devicetree listed. However, any help to get rid of the micrel patch would be great!
Thanks!
Best Regards
Einar Saltnes