Use KSZ9896 as PHY on Jetson AGX Xavier

I’m trying to use KSZ9896 as PHY on Jetson AGX Xavier custom board.KSZ9896 connected over RGMII interface on port 6 and I2C bus.I have modified dtsi and ported driver,but it didn’t work. Please help to make ksz9896 work properly on Jetson AGX Xavier.Thanks a lottopic.txt (4.8 KB)dmesg20200915.log (84.6 KB)

Please check this thread.

Thanks for your reply.We have searched the information of ksz9896 on the forum, but no useful information was found.Can you help confirm our dtsi and dmesg log to see what the problem is?

Hi,

We had some experience with other forum users using KSZ phy. Turns out this is vendor issue too.
Please check this thread.

This is not the same as our problem.ksz9896 is a 6-Port Gigabit Ethernet Switch.There should be more than one ethx after loading the driver, but now there is only one.
dummy0: flags=130<BROADCAST,NOARP> mtu 1500
ether 1a:aa:47:c4:c8:ac txqueuelen 1000 (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

eth0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 48:b0:2d:18:4e:be txqueuelen 1000 (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
device interrupt 41

l4tbr0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 1a:c5:ea:09:39:09 txqueuelen 1000 (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
loop txqueuelen 1 (Local Loopback)
RX packets 12555 bytes 768013 (768.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12555 bytes 768013 (768.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

rndis0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1a:c5:ea:09:39:09 txqueuelen 1000 (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

usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 1a:c5:ea:09:39:0b txqueuelen 1000 (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

root@cookoo:~# ifconfig eth0 up
[ 4713.110877] eth0: Could not attach to PHY
[ 4713.111046] net eth0: eqos_open: Cannot attach to PHY (error: -19)
SIOCSIFFLAGS: No such device

Do you see it as a mdio bus device in the list?

We got ksz9896 driver from GitHub https://github.com/Microchip-Ethernet/EVB-KSZ9477/tree/master/KSZ/linux-drivers/ksz9897
It supports i2c and spi bus.
we used i2c bus.

The KSZ9897 driver creates a virtual MDIO bus and exposes each port in the
switch as a PHY device under that MDIO bus. To access the switch from the
network controller driver a PHY device with PHY id 0 needs to be retrieved
from the virtual MDIO bus. Inside the PHY device’s private data is a pointer
to the switch structure. With that pointer all the switch functions can be
accessed.

Do you see the corresponding mdio device in /sys/bus/mdio_bus/device?

root@cookoo:~# ls /sys/bus/mdio_bus/devices/
sw.0:00 sw.0:01 sw.0:02 sw.0:03 sw.0:04 sw.0:05 sw.0:06

root@cookoo:~# ls /sys/bus/mdio_bus/drivers
‘Broadcom BCM50610’ ‘Marvell 88E1112’ ‘Micrel KSZ8041RNLI’
‘Broadcom BCM50610M’ ‘Marvell 88E1116R’ ‘Micrel KSZ8051’
‘Broadcom BCM5241’ ‘Marvell 88E1118’ ‘Micrel KSZ8061’
‘Broadcom BCM5411’ ‘Marvell 88E1121R’ ‘Micrel KSZ8081 or KSZ8091’
‘Broadcom BCM5421’ ‘Marvell 88E1145’ ‘Micrel KSZ8795’
‘Broadcom BCM5461’ ‘Marvell 88E1149R’ ‘Micrel KSZ886X Switch’
‘Broadcom BCM54616S’ ‘Marvell 88E1240’ ‘Micrel KSZ8873MLL Switch’
‘Broadcom BCM5464’ ‘Marvell 88E1318S’ ‘Micrel KSZ9021 Gigabit PHY’
‘Broadcom BCM5481’ ‘Marvell 88E1510’ ‘Micrel KSZ9031 Gigabit PHY’
‘Broadcom BCM5482’ ‘Marvell 88E1512’ ‘Microchip KSZ889X Switch’
‘Broadcom BCM57780’ ‘Marvell 88E1540’ ‘Microchip KSZ9896 Switch’
‘Broadcom BCM89610’ ‘Marvell 88E3016’ ‘RTL8201CP Ethernet’
‘Broadcom BCMAC131’ ‘Micrel KS8737’ ‘RTL8211B Gigabit Ethernet’
‘Generic 10G PHY’ ‘Micrel KSZ8001 or KS8721’ ‘RTL8211DN Gigabit Ethernet’
‘Generic PHY’ ‘Micrel KSZ8021 or KSZ8031’ ‘RTL8211E Gigabit Ethernet’
‘Marvell 88E1101’ ‘Micrel KSZ8031’ ‘RTL8211F Gigabit Ethernet’
‘Marvell 88E1111’ ‘Micrel KSZ8041’

Hi,

Sorry that we are lacking of knowledge for such phy.
According to the driver, please check why phydev is null in eqos.

kernel/nvidia/driver/net/ethernet/nvidia/eqos/mdio.c

According to zire71’s reply on Sep 18, we have solved the problem.Thank you all the same.

Post the thread you are talking about here.