Set ethernet speed on both ethernet ports for Apalis i.MX8 Yocto Linux

Hi All,

We are using Toradex Reference Image on Apalis i.MX8 using Yocto project.
We are trying to get and set network speed on both the ethernet ports eth0 and eth1.
We are able to get the ethernet speed using “ethtool” command.

root@apalis-imx8-07107218:~# ethtool eth0
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full 
	                                     100baseT/Half 100baseT/Full 
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 100Mb/s
	Duplex: Full
	Port: MII
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes

For setting the ethernet speed we are using below command:
ethtool -s eth0 speed 10 duplex half autoneg off
This command is setting the speed as 10 Mbps

root@apalis-imx8-07107218:~# ethtool eth0                                    
Settings for eth0:
	Supported ports: [ TP MII ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	Supported pause frame use: Symmetric
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 
	Advertised pause frame use: Symmetric
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Speed: 10Mb/s
	Duplex: Half
	Port: MII
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: off
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@apalis-imx8-07107218:~#

But on reboot, the ethernet speed is reset to previous value (100 Mbps).
Is there any other way to set the ethernet speed permanently and retain is even after reboot?

Regards,
Prathamesh Kulkarni

Hi All,

Can anyone please help me on this?

Regards,
Prathamesh Kulkarni

Hi @prathamesh.kulkarni

Welcome to toradex community.
have you tried configuring the phy speed in the devicetree with max-speed flag?
https://elixir.bootlin.com/linux/v5.4.193/source/Documentation/devicetree/bindings/net/ethernet-phy.yaml#L59

But on reboot, the ethernet speed is reset to previous value (100 Mbps)

Write simple service which will auto start for every boot.
Please refer to the how-to-autorun-application-at-the-start-up-in-linux for more details.

Thanks @ashok.tx we need to make the ethernet speed configurable through user application.
We are able to set the speed using systemd service. But is there any way by which we can set the ethernet speed manually and retain it after reboot?
Is there any way to set the ethernet speed using connmanctl service?

Regards,
Prathamesh Kulkarni