-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KSZ9477 driver for newer versions of linux kernel #63
Comments
The 5.3 switch driver can be compiled in the 5.4 kernel. Can you tell me the specific error? One major issue is the skb_append_datato_frags function is no longer in the newer kernels probably because no one else uses it. Putting back that function in 5.3 still works, but there is a risk it may not work properly in 5.4. In that case another function should be used to consolidate all socket buffer fragments into one. This decreases the TCP transmit performance significantly. |
In the meantime, we moved to PetaLinux version 2020.2 which ships with Linux 5.4 in attempt to use the KSZ9897 driver for 5.4 included in this repo. However, it doesn't work because this repo's Cadence MAC driver for 5.4 uses phylink framework (#include <linux/phylink.h>). We replaced all Xilinx-included drivers with patched drivers for 5.4 from here, but (after source fixes on Cadence driver required to pass the compilation stage) the build ultimately fails with various linker errors, suggesting that the patched driver relies on functionality still not available in actual version 5.4. As a sanity check, we also went through the 5.4 branch on kernel.org to confirm that mainline Cadence MAC driver was based on pre-phylink code through the entire 5.4 branch lifetime: 5.4 branch: The latest Cadence MAC driver from 5.4: (includes linux/phy.h instead of linux/phylink.h and doesn't use new phylink structs at any point) Please suggest the solution for building patched KSZ9897 driver with kernel 5.4 (i.e. how you tested modifications with version 5.4), or if possible provide Cadence MAC driver which relies on the old linux/phy.h interface instead of phylink framework. |
There are updated drivers for 5.4 and 5.10 in the linux-drivers directory. |
The KSZ9897 5.4 driver patch is not compatible with the mainline 5.4 kernel version (on which Xilinx 5.4 kernel is based on). More specifically, Cadence MAC driver in KSZ9897 5.4 driver patch uses phylink framework, which first appeared in the Cadence MAC driver in the mainline 5.5 version. So we do not understand what is the “original” 5.4 kernel for which the 5.4 KSZ9897 driver patch is made for, and how to build a patched KSZ9897 driver with the kernel 5.4. |
Hi @micreladmin, @triha2work , Same observation here: Would please be able to assign resources to testing and amending as required the drivers and kernel patch (fec.h fec_mains.c) for kernel version 5.4 ? In spite of our best efforts we are still unable to link to the KSZ9477 using the RGMII interface via SPI with our IMX8/FEC ethernet controller. We are looking forward to your help. Kind regards The Flightcell.com software team. |
The MAC driver patches were updated with the mainline kernels instead of the ones from linux4sam. |
@triha2work : I think there was a small mistake generating the |
Also, I have issue with the 5.10 kernel (patches). For some reason, the KSZ chip is not found: By coincidence, this 0x128ee00 is 0x947700 but shifted left one bit? It has something to do with SPI, but what changed? (It seems nothing in the driver, so must be kernel related)?
The SPI probe worked one time with the 5.10 kernel, but didn't have link.
Log for 5.4 kernel:
|
@triha2work , I saw you did some IBA changes. Were they intended to fix my issue here by coincidence? Tried a fresh built with the latest state of What is weird is, when I upgrade (from a working 5.4 kernel) to 5.10, a soft-reset is performed to boot to the new 5.10 kernel. At that time, everything works.
Even after multiple (tested 5 times or so) soft-reboots (
What could be wrong? Some init/power sequence or so? Thanks! |
Update: I got it working if I remove spi-cpha in the DTS for the KSZ. (It also works when removing both spi-cpha and spi-cpol, but not when only removing spi-cpol).
Which means SCL should be low, meaning, no cpol? and
Which means no cpha? As described here? https://dlnware.com/theory/SPI-Transfer-Modes In the datasheet FIGURE 4-11 and FIGURE 4-12 have SCL high, but later on in FIGURE 6-9 and FIGURE 6-10 SCL is default low? I guess this last one is the correct though? But for me, it only works, dropping this spi-spha... Also in mainline linux kernel:
torvalds/linux@4f36d97#diff-e837636426ef5e9f969a0836d2e545c92933531182e89b93fdcf58b3ad9c13ff |
@triha2work : Could you confirm/deny my above findings? Thanks! In both cases I was using the default SPI mode, as configured in the driver. And I was using an unaltered build with the drivers for 5.4 and 5.10 here... Do you have an idea of the spi-cpha ? I changed that in the DTS. We are using the KSZ9477S. |
SPI mode 0 or 3 works for KSZ9477 SPI access. In theory mode 3 works better because it may provide more time for hardware to process the command. All KSZ switches are accessed using SPI mode 3 in Linux drivers. If mode 0 works better than mode 3 then just use mode 0. |
spi-cpol and spi-cpha are used to specifiy the SPI mode. Without them the mode is 0, With them the mode is 3. |
For our new design, based on Xilinx Zynq SoC, we plan to use an Ethernet switch KSZ9477. We use Xilinx PetaLinux 2020.1 that comes with the kernel version 5.4.
We did preliminary testing on EVB-KSZ9477, deploying Linux kernel 4.9 using https://github.com/Microchip-Ethernet/EVB-KSZ9477 according to Microhip Driver Setup Guide.
On the aforementioned Microhip github, KSZ driver files for the linux kernel up to version 5.3 can be found under the folder ..KSZ/linux-drivers/ksz9897. However, there is a significant driver logic difference between the linux kernel versions 5.3 and 5.4 and the Microchip changes are not easily implementable to the kernel 5.4 . On the other hand, all mainline Linux kernel versions 5.x include KSZ9477 driver at linux/drivers/net/dsa/microchip.
Is Microchcip going to commit KSZ9477 driver for newer linux kernel versions soon? Does this driver implemented in the mainline linux kernel by default provide some of the functionalities of the switch, or we need to implement driver for the switch from the ..KSZ/linux-drivers/ksz9897 according to the instructions from the README file for the appropriate kernel version?
The text was updated successfully, but these errors were encountered: