setting ethernet speed with Device Tree

Hello,

We would like to set ethernet speed to a constant speed & duplex value and turn auto negotiation off.
Can you please point us to the right direction in the device tree?

We came across max speed but think that there should be another entry for directly setting the speed.

We also tried ethtool but we are not sure about the run time characteristic of it.
so when using the ethtool, system boots with auto negotiation mode on and then when the ethtool script turn on it switches to fixed speed.

Best Regards
rifo

Hello,

We implemented the below method and forced the system to 100Mb. Using “requires” and “after” stabilized the system.

root@colibri-imx6:~# cat /etc/rc.local
#! /bin/sh
ethtool -s eth0 speed 100 duplex full autoneg off
exit 0


root@colibri-imx6:~# cat /lib/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
Requires=systemd-networkd.service
After=systemd-networkd.service

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

During regression tests, where we plug and unplug the ethernet very rapidly, we came across the situation (only a couple of times) where the link can’t be up.
Can you please share your suggestions for handling such rare conditions?

Best Regards

Hello,

This is how max speed is set on colibri imx6ull module. For imx6dl module just add the below code to the end of your preferred carrier board device tree file.

&fec {
	mdio {
		ethphy: ethernet-phy@0 {
			max-speed = <100>;
		};
	};
};

Regards, Mlinar

How rapid (Times per second) and how often do you plug and unplug the Ethernet?
What is the use of this test?

Did the suggestion from @mlinar below help?

Hello Mlinar,

Thank you for your answer.
Using max-speed, won’t the system set a link to 10Mbps if PC is set to 10Mbps only
In my case, I should only set a link at 100Mbps or doesn’t set it all on other cases

Hi @rifo!

@jaski.tx asked some questions about the plug/unplug test above. It would be good to understand better your use case, so we can help you better.

Best regards.