Switch KSZ9563 on custom carrier board with Verdin AM62

Dear all,

I´m trying to config the KSZ9563 switch in the device tree of my verdin am62 on a custom carrier board. However, my device tree setup doesn´t seem to work has supposed.

tdx-info:

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           6.6.58-7.1.0-gf874412b7190 #1-Torizon SMP PREEMPT Fri Dec  6 14:07:48 UTC 2024
Kernel command line:      root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/85bc54782c663b8559251f0dd5ef9c708b64f87b12bdc99c9fc27c7eceb6bb19/0 CONFIG_KSZ9477=y
Distro name:              NAME="Torizon OS"
Distro version:           VERSION_ID=7.1.0-build.4
Distro variant:           VARIANT="Docker"
Hostname:                 verdin-am62-15363911
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Texas Instruments K3 AM625 SoC
Toradex version:          0073 V1.1B
Serial number:            15363911
Processor arch:           aarch64
------------------------------------------------------------

For device tree configuration, the following lines have been change on the k3-am62-verdin-dev.dtsi:

/* Verdin ETHs */
&cpsw3g {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_rgmii1>, <&pinctrl_rgmii2>;
	status = "okay";
};

/* MDIO, shared by Verdin ETH_1 (On-module PHY) and Verdin ETH_2_RGMII */
&cpsw3g_mdio {
	status = "okay";

	cpsw3g_phy1: ethernet-phy@0 {
		compatible = "microchip,ksz9563";
		reg = <0>;
		interrupt-parent = <&main_gpio0>;
		interrupts = <38 IRQ_TYPE_EDGE_FALLING>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_eth2_rgmii_int>;
		micrel,led-mode = <0>;

		ethernet-ports {
			#address-cells = <1>;
			#size-cells = <0>;

			port@0 {
				reg = <0>;
				label = "lan1";
			};

			port@1 {
				reg = <1>;
				label = "lan2";
			};

			port@2 {
				reg = <2>;
				label = "cpu"; /* SoM communication port */
				ethernet = <&cpsw_port2>;
				phy-mode = "rgmii";

				fixed-link {
                    speed = <100>;
                    full-duplex;
                
                };
			};
		};
	};
};

/* Verdin ETH_1 (On-module PHY) */
&cpsw_port1 {
	status = "okay";
};

/* Verdin ETH_2_RGMII */
&cpsw_port2 {
	phy-handle = <&cpsw3g_phy1>;
	phy-mode = "rgmii-rxid";
	status = "okay";
};

The carrier board hardware, as shown below, has the SOM as the MAC and the switch Port 3 has the PHY:

After flashing the am62 verdin the the boot output is the following:

U-Boot SPL 2024.04-ti-gf498936e31ec (Jan 01 1970 - 00:00:00 +0000)
SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.8--v10.01.08 (Fiery Fox)')
Changed A53 CPU frequency to 1250000000Hz (T grade) in DT
SPL initial stack usage: 13424 bytes
Trying to boot from MMC1
Authentication passed
Authentication passed
Authentication passed
Loading Environment from nowhere... OK
init_env from device 9 not supported!
Authentication passed
Authentication passed
Starting ATF on ARM64 core...

NOTICE:  BL31: v2.11.0(release):v2.11.0-906-g58b25570c9-dirty
NOTICE:  BL31: Built : 00:00:00, Jan  1 1970

U-Boot SPL 2024.04-ti-gf498936e31ec (Jan 01 1970 - 00:00:00 +0000)
SYSFW ABI: 4.0 (firmware rev 0x000a '10.1.8--v10.01.08 (Fiery Fox)')
SPL initial stack usage: 1904 bytes
Trying to boot from MMC1
Authentication passed
Authentication passed


U-Boot 2024.04-ti-gf498936e31ec (Jan 01 1970 - 00:00:00 +0000)

SoC:   AM62X SR1.0 HS-FS
DRAM:  1 GiB
Core:  145 devices, 31 uclasses, devicetree: separate
MMC:   mmc@fa10000: 0, mmc@fa00000: 1
Loading Environment from MMC... OK
i2c_write: error waiting for data ACK (status=0x116)
get_tdx_eeprom: cannot find EEPROM by node
MISSING TORADEX CARRIER CONFIG BLOCKS
i2c_write: error waiting for data ACK (status=0x116)
get_tdx_eeprom: cannot find EEPROM by node
In:    serial@2800000
Out:   serial@2800000
Err:   serial@2800000
Model: Toradex 0073 Verdin AM62 Dual 1GB ET V1.1B
Serial#: 15363911
am65_cpsw_nuss ethernet@8000000: K3 CPSW: nuss_ver: 0x6BA01103 cpsw_ver: 0x6BA81103 ale_ver: 0x00290105 Ports:2
Net:   
Warning: ethernet@8000000port@1 MAC addresses don't match:
Address in ROM is		1c:63:49:1f:c2:85
Address in environment is	00:14:2d:ea:6f:47
eth0: ethernet@8000000port@1 [PRIME]Could not get PHY for mdio@f00: addr 7
am65_cpsw_nuss_port ethernet@8000000port@2: phy_connect() failed

Hit any key to stop autoboot:  0 
MMC: no card present
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
969 bytes read in 10 ms (93.8 KiB/s)
## Executing script at 90280000
7019 bytes read in 11 ms (623 KiB/s)
72119 bytes read in 13 ms (5.3 MiB/s)
39 bytes read in 11 ms (2.9 KiB/s)
Working FDT set to 90200000
Applying Overlay: custom-kargs_overlay.dtbo
192 bytes read in 11 ms (16.6 KiB/s)
11059985 bytes read in 187 ms (56.4 MiB/s)
13160245 bytes read in 177 ms (70.9 MiB/s)
   Uncompressing Kernel Image to 0
## Flattened Device Tree blob at 90200000
   Booting using the fdt blob at 0x90200000
Working FDT set to 90200000
   Loading Ramdisk to 98259000, end 98ee5f35 ... OK
   Loading Device Tree to 0000000098224000, end 0000000098258fff ... OK
Working FDT set to 98224000

Starting kernel ...

[    1.073065] rtc-ds1307 0-0032: hctosys: unable to read the hardware clock
[    1.098377] pca953x 1-0021: failed writing register
Starting systemd-udevd version 255.13^
sysroot.readonly configuration value: 0 (fs writable: 1)
Using legacy ostree bind mount for /
[   13.652663] ina2xx 1-0040: error configuring the device: -121
[   13.714192] nau8822 1-001a: Failed to issue reset: -121
[   14.488454] platform 78000000.r5f: error -ENODEV: mbox_request_channel failed
[   14.495653] k3_r5_rproc bus@f0000:bus@b00000:r5fss@78000000: k3_r5_cluster_rproc_init failed, ret = -19

Torizon OS 7.1.0+build.4 verdin-am62-15363911 ttyS2

For what I can see PHY can´t connect am65_cpsw_nuss_port ethernet@8000000port@2: phy_connect() failed and after boot it does not appear as an ethernet device after run ifconfig -a:

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:0f:5e:1d:bb  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10  bytes 1654 (1.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10  bytes 1654 (1.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Even after forcing the device to be up, which returns SIOCSIFFLAGS: No such device.

I hope you could give me some insights on the device tree setup so that the some recognizes the switch and can connect phy.

If any other info is need, ask me.

Thank you in advance!

Regards,
Carla

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Carla,

Thank you for reaching out with your question about configuring the KSZ9563 switch on your Verdin AM62 module. Let’s go through some steps to help you troubleshoot the device tree setup and ensure the switch is recognized correctly.

  1. Device Tree Configuration:

    • Double-check the compatible property for the KSZ9563. The line compatible = "microchip,ksz9563"; should match the expected string for the driver in the kernel.
    • Verify the reg property values for each port. These should align with the correct addresses as per the switch’s datasheet.
    • Ensure the interrupt-parent and interrupts properties are correctly configured for your hardware setup. The GPIO and interrupt numbers should be accurate.
    • Confirm that the phy-mode is set correctly to match your hardware configuration. For RGMII, ensure any necessary delays (e.g., rgmii-rxid) are specified.
  2. Kernel and Driver Support:

    • Verify that the kernel supports the KSZ9563 switch. The kernel configuration (CONFIG_KSZ9477=y) suggests support for a similar family of switches, but ensure specific support for KSZ9563.
    • Check the kernel logs (dmesg) for any errors or warnings related to the switch or PHY during boot.
  3. Testing and Debugging:

    • Use tools like ethtool to query the status of the network interfaces and PHYs. This can provide additional insights into potential issues.
    • If possible, compare your setup with a known working configuration to isolate whether the issue is with the device tree or elsewhere in the system.

By carefully reviewing these aspects, you should be able to identify and resolve the issue with the KSZ9563 switch configuration on your Verdin AM62 module. If you have any further questions or need additional information, feel free to ask.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

https://community.nxp.com/t5/i-MX-Processors/Device-tree-configuration-for-Imx8M-Plus-with-Ksz9563-ethernet/td-p/1688755.

Hi @carlar !

Sorry for the delay.

I see you marked @ToradexAI bot’s answer as the Solution.

So is this solved on your side?

Also, I just sent you a private message here in Toradex Community. Please be sure to check it :slight_smile:

Best regards,