Ethernet LED MODE change

Refer to Ticket#2019021110000038.

I have tried the solution suggested by support team but didn’t get the results. Please find the attached experiment text

HI @divyathomas

What exactly did not work? What is your application?

Could you provide the version of the Software of your module? Which carrier board are you using?

The patch provided by our support Team was tested in iMX6 and should also work on Vybrid. So does the patch work for you on iMX6 or not? If not, what are the errors?

Best regards, Jaski

Hi, I have modified the code as:

mdio {
	ethphy: ethernet-phy@400d1000 {
		micrel,led-mode = <1>;

PHY address was identified, but LED mode was not changed.

Could you answer my questions, please? Thanks.

Hi Jaski,
I am using a customised board with vybrid module-VF50. I am using various interfaces and everything seems to be working alright wrt my application.

I need to modify device tree file to change the Ethernet LED Mode. I have made changes as per your(support team) recommendations. New built image throws an error:
ethernet-phy@1 has invalid PHY address.

I tried changing ethernet-phy@1 to @0,2 and results were same.

I changed to ethernet-phy@400d1000, My ethernet functionalities were restored except for LED mode remained unchanged. I guess somehow I am not able to access the register to make the change. I have checked the log to see if any error was reported. But nothing was reported.
link text
Attaching my micrel.c file.

Can you confirm the fix works with VF50 as well?

Thanks & regards,

Hi Jaski,
If I modify micrel.c, init as:

static int kszphy_config_init(struct phy_device *phydev)
	struct kszphy_priv *priv = phydev->priv;
	const struct kszphy_type *type;
	int ret;

	if (!priv)
		return 0;

	type = priv->type;

	if (type->has_broadcast_disable)

	if (type->has_nand_tree_disable)

	if (priv->rmii_ref_clk_sel) {
		ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
		if (ret) {
			dev_err(&phydev->dev, "failed to set rmii reference clock\n");
			return ret;
//DT Debug--------------------------------------------------------------
   ret = phy_write(phydev, 0x1E, 0x4000);
	// if (priv->led_mode >= 0)
		// kszphy_setup_led(phydev, type->led_mode_reg, priv->led_mode);
//DT Debug--------------------------------------------------------------

	return 0;

I get the desired output. See the section “//DT Debug---------------------------”


hi @divyathomas

Is there any reason why you put this question to private? With Private Questions Community cannot provide any feedback to your question.

So is the Issue solved now?

Hi Jaski,
This is just a temporary solution. I can’t release multiple versions of source code for various build options. I wanted to add the parameter to the device tree file itself to avoid this issue. Have you tried porting your code on VF50? Can you check & confirm? Anything else you can assist me with a better solution?

Thanks & Regards,

It was accidental to opt “Private” mode. I guess its public now. :slight_smile:


Ok, No Issue. Thanks for putting the question in public.

hi @divyathomas

I will check if the code provided by Toradex works also for VF50. I will come back soon to you.

Best regards, Jaski

hi @divyathomas

I was able to reproduce your issue, vybrid is a little bit different and needs also the phy-handle property to be specified. Furthermore I put the address of the phy into the devicetree too, this prevents a scanning of the mdio-bus and loosing time on boot.
Check in the bootlog of your iMX6 too, if the mdio bus gets scanned or it directly finds the phy. If it gets scanned, do it similar like here to specify the correct address.

By the way, MDIO addresses only go up to 31, so the one you mentioned is not correct this is rather the memory-address of the FEC.

Consider also putting the phy-handle in the iMX6 devicetree for best-practice. As right now it works, due to an assumption the driver makes.

Best regards,

diff --git a/arch/arm/boot/dts/vf-colibri-aster.dtsi b/arch/arm/boot/dts/vf-colibri-aster.dtsi
index 3a5d7473796f..94cdb93b765f 100644
--- a/arch/arm/boot/dts/vf-colibri-aster.dtsi
+++ b/arch/arm/boot/dts/vf-colibri-aster.dtsi
@@ -110,9 +110,20 @@
 &fec1 {
        phy-mode = "rmii";
+       phy-handle = <&ethphy>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_fec1>;
        status = "okay";
+       mdio {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               ethphy: ethernet-phy@0  {
+                       reg = <0>;
+                       micrel,led-mode = <1>;
+               };
+       };
 &i2c0 {

Thanks, It works perfectly.

Hi Jaski,
It works perfectly with Philippe’s patch.


You are welcome. Thanks for the feedback.