AM3358: Disable energy detect on LAN8710A via device tree

I’m trying to disable the energy detect on LAN8710A using device tree. I’m not an expert with device trees, but I found many examples on line and came up with the changes below. My \KERNEL\drivers\net\phy\smsc.c has support for “disable-energy-detect”. See code snippet from smsc.c below:

if (of_find_property(of_node, "smsc,disable-energy-detect", &len))
enable_energy = 0;

In the following device tree snippet, the (-) represents lines removed and the (+) represents lines I added to my working device tree.

&cpsw_emac0 {

-      phy_id = <&davinci_mdio>, <0>;
+      phy-handle = <&ethphy0>;
      phy-mode = "mii";
      dual_emac_res_vlan = <1>;
};
&cpsw_emac1 {
-      phy_id = <&davinci_mdio>, <1>;
+      phy-handle = <&ethphy1>;
      phy-mode = "mii";
      dual_emac_res_vlan = <2>;
};
&davinci_mdio {
      pinctrl-names = "default", "sleep";
      pinctrl-0 = <&davinci_mdio_default>;
      pinctrl-1 = <&davinci_mdio_sleep>;
      status = "okay";
+
+      ethphy0: ethernet-phy@0 {
+            reg = <0>;
+            smsc,disable-energy-detect;
+      };
+
+      ethphy1: ethernet-phy@1 {
+            reg = <1>;
+            smsc,disable-energy-detect;
+      };
};

Now it doesn’t work. Any idea what I’m doing wrong?

HI @dmccalla which linux branch/tree are you going against? The phy_id → phy-handle shows that you are combing the old driver with TI’s cpsw rewrite…

Regards,

I’m using kernel version 4.4.70-bone-rt-r17. Does that help?

Here’s a code snippet from cpsw.c

  priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
  parp = of_get_property(slave_node, "phy_id", &lenp);
  if (of_phy_is_fixed_link(slave_node)) {
  	struct device_node *phy_node;
  	struct phy_device *phy_dev;

YEah, that is really old…

At least the driver seems to support it…

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/net/phy/smsc.c?h=v4.4.70#n55

Hum…

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

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

&mac {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&cpsw_default>;
	pinctrl-1 = <&cpsw_sleep>;
	status = "okay";
};

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

Maybe?

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

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

&mac {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&cpsw_default>;
	pinctrl-1 = <&cpsw_sleep>;
	status = "okay";
};

&davinci_mdio {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&davinci_mdio_default>;
	pinctrl-1 = <&davinci_mdio_sleep>;

	ethphy0: ethernet-phy@0 {
		reg = <0>;
		smsc,disable-energy-detect;
	};

	ethphy1: ethernet-phy@1 {
		reg = <1>;
		smsc,disable-energy-detect;
	};
};

Might be easier to patch the driver and always enable it?

I patched the driver and I’m moving on.

Thanks for your help.