On 23/04/2025 11:03, Quentin Schulz wrote:
Hi Jean-Marie,

On 4/22/25 8:36 PM, Verdun, Jean-Marie wrote:
[You don't often get email from ver...@hpe.com. Learn why this is important at 
https://aka.ms/LearnAboutSenderIdentification ]

Hi,

I have written a small patch for the wiznet W5500 adapter. 
(https://docs.wiznet.io/Product/iEthernet/W5500/overview).
I am in some ways ready to push it into u-boot following approval from HPE, but 
as that will be a first for me, I just wanted to get feedback from you.

The wiznet device allows me to add a network adapter to deep embedded devices 
like PCIe board and boot them by using ethernet through a spi bus or gpios by 
using the soft-spi drivers through u-boot. Usually, such devices boot locally 
through a spi-nor or other local storage. I want to promote a PXE like approach 
as to ease firmware updates, improve security, and boot speed. The wiznet 
device can load raw images at about 1.5MB/s in memory and the u-boot is in 
charge at bootstrapping the second stage through the in memory copu.

I successfully tested it by using a raspberry pi 4 device through soft spi as 
we do not have a driver for it inside u-boot. It works at around 360kB/s 
compared to 400kB/s through the linux kernel.

Wiznet device needs in fact 2 drivers, one which behave like “PHY”  and one 
which is perceived as an ethernet adapter. Both needs to be linked through a 
phandle as to use the relevant xfer function to push and receive the data.


An Ethernet MAC you meant I assume.

So, my patchset will contain some work for the spi subsystem and some for the 
net subsystem. Do I need to break them down, or a single patch would be good 
enough ?


Separate drivers, separate patches please. It's likely going to go through 
different maintainer trees. They could be in the same patch series though, to 
give everybody ample context.

Having had a quick glance at the diff in your U-boot fork, it's very unclear to 
me why we need an SPI bus driver (UCLASS_SPI)? The Linux kernel seems to only 
have the Ethernet driver. Is the w5500 acting as an SPI controller instead of 
as an SPI device? I find it hard to believe, but maybe :) ?

Yeah looking at the code, the SPI controller driver simply call the buf xfer, 
so it can be dropped.


I believe you should only need the Ethernet MAC driver (possibly Ethernet PHY 
driver as well?) but built on top of an SPI device (and not driver), 
essentially just calling spi functions taking a udevice as parameter?

Look at drivers/power/pmic/rk8xx.c for example, it is a PMIC driver for an I2C 
(or SPI) device. Or for something closer to your device, maybe have a look at 
the KSZ9477? It seems to require I2C and SPI (but is a DSA switch, so slightly 
different than yours).

Additionally, we do not allow modifications of the dts/upstream directory. The 
patches absolutely need to come from the devicetree-rebasing tree, via the 
`tools/update-subtree.sh pick <commit>` command, so please upstream the binding 
to the Linux kernel first.

The w550 bindings are already upstream in Linux and are already in the U-boot 
tree in `dts/upstream/Bindings/net/wiznet,w5x00.txt` so the driver should 
conform to this.

If you want yaml bindings, please convert them to yaml and submit them to the 
Linux mailing-lists and they will be synced in dts/upstream when the next Linux 
release is done.

Neil


Looking forward to seeing patches on the mailing list!

Cheers,
Quentin

Reply via email to