STM32MP157F-DK2 + Arduino Ethernet Shield + w5100-spi.c linux driver
I am attempting to implement a second ethernet interface on STM32MP157F-DK2 by using the Arduino Ethernet Shield, which is based on the Wiznet W5500 chip. The implementation aims to use SPI assigned to A7 core to communicate with the shield, which will then convert the SPI messages to be transferred over Ethernet. I have been unsuccessful in configuring this thus far and would like any help possible.
What I have tried so far:
- Modification of the kernel was done using the following page:
https://wiki.st.com/stm32mpu/wiki/How_to_cross-compile_with_the_Distribution_Package
1. Modified the distribution package using menuconfig to include W5500 support such that CONFIG_WIZNET_5100=y and CONFIG_WIZNET_5100_SPI=y. It is my intention to use linux/drivers/net/ethernet/wiznet/w5100-spi.c in order to achieve my goal of SPI->Ethernet.
Specific Problems:
- I am not sure how to configure SPI4 in the device tree for this application. I am hoping to follow https://github.com/torvalds/linux/commit/0114214eca21e85d66a5e206f803db42d1d07960.
- I am using STM32CubeIDE to create and deploy the user applications. The application was created within the CA7 project as referenced by https://wiki.st.com/stm32mpu/wiki/How_to_manage_OpenSTLinux_projects_in_STM32CubeIDE. Unfortunately, STM32CubeIDE has no knowledge of the changes made by menuconfig and the SDK (4.2.1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sysroots/cortexa7t2hf-neon-vfph4-ostl-linux-gnueabi/usr/include) does not include certain files that are needed to compile linux/drivers/net/ethernet/wiznet/w5100-spi.c and linux/drivers/net/ethernet/wiznet/w5100.c/h, even though the necessary files are in the adjacent sources folder of the CA7 project, "linux-6.1.28/include/linux". How could I go about adding the support for this driver so that I can use it in STM32CubeIDE?
- It is my understanding that linux/drivers/net/ethernet/wiznet/w5100-spi.c requires configuring a net device. Is it sufficient to simply write:
struct net_device *dev;
w5500_spi_init(dev);
and then assume the configuration is complete since SPI4 is assigned the .compatible="wiznet,w5500"?
I do have access to the ethernet configuration for the only other device on the bus.
I am open to modifying any part of the implementation.
For example, I have been able to successfully use spidev on SPI4 to send and receive messages to/from itself, but I was unsuccessful in getting the Arduino Ethernet Shield to work in response to the SPI4 messages.
If need be, I would be willing to use the rj45 connector on board for this ethernet to send and receive packets using tcp, but I do not know how to do this and I would still need to solve the problem of adding another ethernet port in the future.
