Limit network link speed in devicetree

On our custom board with the TX2 we need to limit the network link speed to 100 Mbit/s. I’ve tried max-speed from Documentation/devicetree/bindings/net/ethernet.txt but it doesn’t work. The link still comes up as 1Gbps.

Is there a way to do this in the device-tree?

There is a good description of using ethtool to configure wired ethernet here:
https://www.shellhacks.com/change-speed-duplex-ethernet-card-linux/

Normally I would not consider using device tree for such control. If you can get the settings you want to work via ethtool, then more likely there are other standard configuration locations for such configuration. Examples might be udev or as an argument to the ethernet driver. What it comes down to is that you need to mask out what speeds are reported during auto negotiation, or you need to disable auto negotiation (I have not set this up for automatic setup during boot so I couldn’t tell you exactly where).

I plan on using ethtool as a backup. My use case is our custom TX2 board is connected to another computer that supports Gigabit, but the ethernet cable between the two only has 2 pairs. This will be our production setup. In this setup the link auto negotiates to 1 Gbps, but otherwise does not work because there are only 2 pairs in the ethernet cable. So I was hoping to just limit it to 100 Mbps in the devicetree and not worry about some startup script running.

I don’t see the driver is parsing similar thing from dt. Why does the number of cable cause such problem here…? Sorry in advance I don’t really get the point of your problem.

The problem is a 2 pair ethernet cable only works up to 100 Mbps. When I connect this cable between 2 GigE ports, one on our custom TX2 board and the other to a GigE switch or PC, the link auto negotiates to 1 Gbps, but you can’t send/receive data over the link because the pairs that support 1 Gbps are not there. I guess it can auto negotiate 1 Gbps over 2 pairs even though the pairs need to support it are not there.

I was hoping to limit the network speed in the devicetree to 100 Mbps as mentioned in the documentation so I didn’t have to do any startup magic to keep the link at 100 Mbps.