We use the efusA9 as a replacement for an old CPU board. For ethernet we use an RJ45 connector which only supports 100Mbits (4 wires).
As the efusA9 supports 1GBits I don't know what will happen if we use a 1Gbit switch (we only have 1Gbit network). How can we limit
the device to only use 100MBit?
Limit Ethernet to 100MBits
-
-
We also want to use only 4 wires with a legacy device. With the actual BSP this doesn't work with a 1 Gbit network because the auto negotiation for ETH leads to an attempt to establish a 1 Gbit connection (8 wires needed). (As workaround you can connect via a 100 Mbit router.)
F&S announces the 100MBit support in its roadmap of Windows CE for Version 1.90:
- 0002778: [Ethernet] Add possibility to limit transfer speed to 100MBit - newYou can check with F&S if they can provide the same functionality for Linux.
-
Please note that the mentioned roadmap is for Windows CE (sorry!). You can check with F&S if they can provide the same functionality for linux.
-
Oh, thanks :). We need it for linux.
-
In arch/arm/mach-mx6/board-mx6_efusa9.c, look for function mx6_fec_phy_init(). Add the following lines at the end of the function (before the return 0):
Then recompile the kernel.
This modification clears the bits in the PHY register that advertise the 1000MBit connection during auto negotiation.
If you also need this modification in U-Boot, you can modify this setting at runtime. Issue the following commands before doing any network transfers.
The first command clears again the advertise-bits. The second restarts auto negotiation. The third waits until negotiation is complete. I'm not sure if the sleep is necessary, you can also try without.Your F&S Support Team
-
I applied the kernel patch and tested it. Nothing changed.... link speed is still 1000MBit.
PHY: 1:04 - Link is Up - 1000/Full
ADDRCONF(NETDEV_CHANGE): eth0: link becomes readyI didn't change the rate in u-boot.....
Any ideas?
I also see a different in U-Boot and C example:
val &= ~0x0300; vs
dio write FEC 0 3300 -
Please look again. In Linux, we are modifying register 9. And in U-Boot, we write 0 to register 9, so we also clear the appropriate bits. In fact only one of these two bits is active in register 9, so clearing it results in value 0, which is what we write to this register in U-Boot.
The value 3300 written to register 0 triggers the auto-negotiation again. Without this, the 1000 MBit/s remains active.
Maybe this is the reason why your Linux link also shows the high rate. You have to start the link in Linux anew. I'm not sure what happens if the link remains active from U-Boot to Linux. So either keep network off and only start it in Linux, or toggle your network DOWN and UP again.
And are you really sure that the setting is active? You can add a printk() message to the above settings. If you see the message at runtime, it should work. If not, then you are doing something wrong when compiling or downloading the new kernel to your board.
Your F&S Support Team
-
This is the code which is used...
CodeKernel output.... check first line and last lines
Code- Jan 1 00:00:09 telemax user.warn kernel: Limit ethernet to 100MBits
- Jan 1 00:00:09 telemax user.info kernel: ADDRCONF(NETDEV_UP): eth0: link is not ready
- Jan 1 00:00:09 telemax user.info kernel: hub 2-1:1.0: USB hub found
- Jan 1 00:00:09 telemax user.info kernel: hub 2-1:1.0: 4 ports detected
- Jan 1 00:00:09 telemax user.debug kernel: USB Host suspend begins
- Jan 1 00:00:09 telemax user.debug kernel: will suspend roothub and its children
- Jan 1 00:00:09 telemax user.debug kernel: ehci_fsl_bus_suspend begins, DR
- Jan 1 00:00:09 telemax user.debug kernel: ehci_fsl_bus_suspend ends, DR
- Jan 1 00:00:09 telemax user.debug kernel: host suspend ends
- Jan 1 00:00:09 telemax user.debug kernel: ehci_fsl_bus_suspend begins, Host 1
- Jan 1 00:00:09 telemax user.debug kernel: ehci_fsl_bus_suspend ends, Host 1
- Jan 1 00:00:09 telemax user.info kernel: PHY: 1:04 - Link is Up - 1000/Full
- Jan 1 00:00:09 telemax user.info kernel: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Limiting the speed in U-Boot works as you suggested. But as soon as the kernel is started it switches back to 1GBits.
-
How do you start the network? Have you added an additional package like NetworkManager?
Are you already on fsimx6-V2.1 or still on V2.0?
Your F&S Support Team
-
I use fsimx6-V2.1 we also added some packages based on the minimal configuration.
Network is initialized over the /etc/network/interfaces.conf:
Code- # interface file auto-generated by buildroot
- auto lo
- iface lo inet loopback
- auto eth0
- iface eth0 inet static
- address 192.168.25.77
- netmask 255.255.254.0
- auto can0
- iface can0 inet manual
- up /sbin/ip link set $IFACE down
- up /sbin/ip link set $IFACE up txqueuelen 1000 type can bitrate 1000000 sample-point 0.7 triple-sampling off restart-ms 500
- auto can1
- iface can1 inet manual
- up /sbin/ip link set $IFACE down
- up /sbin/ip link set $IFACE up txqueuelen 1000 type can bitrate 1000000 sample-point 0.7 triple-sampling off restart-ms 500
This is my buildroot configuration:
Code- BR2_arm=y
- BR2_cortex_a9=y
- BR2_ARM_EABIHF=y
- BR2_ARM_ENABLE_NEON=y
- BR2_CCACHE=y
- BR2_TOOLCHAIN_EXTERNAL=y
- BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
- BR2_TOOLCHAIN_EXTERNAL_PATH="/usr/local/arm/fs-toolchain-4.7.2-cortexa5-neonvfpv4"
- BR2_TOOLCHAIN_EXTERNAL_HEADERS_3_3=y
- BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
- BR2_TOOLCHAIN_EXTERNAL_CXX=y
- BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
- BR2_ENABLE_LOCALE_PURGE=y
- BR2_TARGET_OPTIMIZATION="-pipe -march=armv7-a"
- BR2_ECLIPSE_REGISTER=y
- BR2_TARGET_GENERIC_HOSTNAME="telemax"
- BR2_TARGET_GENERIC_ISSUE="Welcome to teleworld"
- BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
- BR2_ROOTFS_DEVICE_TABLE=""
- BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1"
- # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
- BR2_ROOTFS_OVERLAY="$(TOPDIR)/board/telerob/fsimx6/overlay"
- BR2_ROOTFS_POST_BUILD_SCRIPT="$(TOPDIR)/board/telerob/fsimx6/final_script_min"
- BR2_LINUX_KERNEL=y
- BR2_LINUX_KERNEL_LOCAL_DIR=y
- BR2_LINUX_KERNEL_CUSTOM_DIR_LOCATION="$(TOPDIR)/../linux-fsimx6"
- BR2_LINUX_KERNEL_DEFCONFIG="fsimx6"
- BR2_LINUX_KERNEL_PATCH="board/telerob/fsimx6/linux-limit100Mbit.patch"
- BR2_PACKAGE_BUSYBOX_CONFIG="board/telerob/common/busybox-1.23.x.config"
- BR2_PACKAGE_LINUX_FIRMWARE=y
- BR2_PACKAGE_LINUX_FIRMWARE_TI_WL127X=y
- BR2_PACKAGE_IPROUTE2=y
- BR2_TARGET_ROOTFS_EXT2=y
- BR2_TARGET_ROOTFS_EXT2_4=y
- # BR2_TARGET_ROOTFS_TAR is not set
- BR2_TARGET_ROOTFS_UBIFS=y
- BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000
- BR2_PACKAGE_AVAHI=y
- BR2_PACKAGE_AVAHI_AUTOIPD=y
- BR2_PACKAGE_AVAHI_DAEMON=y
- BR2_PACKAGE_CAN_UTILS=y
- BR2_PACKAGE_LIGHTTPD=y
- BR2_PACKAGE_OPENSSH=y
- BR2_PACKAGE_PYTHON3=y
- BR2_PACKAGE_PYTHON3_PYC_ONLY=y
- BR2_PACKAGE_PYTHON3_UNICODEDATA=y
- BR2_PACKAGE_PURE_FTPD=y
- #BR2_PACKAGE_LINUX_PAM=y
-
I don't have any deep knowledge of the kernel but after some code research I found the following lines in drivers/net/fec.c:
I changed it to:
As I can see ethernet is now running on 100MBits. I don't think that this is a "good" solution so maybe you have a better idea.
[Update]
Both patches must be applied, if not, network is running on 100MBit but it has many RX errors and no connection can be established. -
Same same but different...I try to do the same for the Kernel included in V3.0.
It seems all files changed there location.Any ideas where the files moved to? -
On device trees, there is already a feature to limit the transfer speed. Unfortunately this is part of the PHY which is not explicitly defined in our default device tree yet. Please try to modify the fec node in arch/arm/boot/dts/efusa9qdl.dtsi as follows. Then recompile the dtb file and download it to the board.
CodeI haven't tested it though. So can you please give some feedback whether this works or not? Thanks.
Your F&S Support Team
-
Perfect, seems to work!