mbox series

[0/3] Add support for WASP SoC on AVM router boards

Message ID 20220221135213.GA7264@ubuntu (mailing list archive)
Headers show
Series Add support for WASP SoC on AVM router boards | expand

Message

Daniel Kestrel Feb. 21, 2022, 1:52 p.m. UTC
There is a popular set of Lantiq xrx200 router boards by AVM in
Germany (AVM Fritzbox 3390, 3490, 5490, 5491 and 7490) which
have the strange implementation of having the wifi cards
connected to a separate memory only ATH79 based SoC. It has no
persistent storage and no access to any resource on the Lantiq
host, but is connect to the Lantiq GSWIP switch on an additional
fixed internal network port.
This kernel module is to support booting the secondary SoC called
Wireless Assistant Support Processor (WASP).
After turning it on, a small network boot firmware is sent to
the SoC by using mdio and when it is started, an initramfs
linux image is sent to the SoC using raw ethernet frames.

The whole procedure takes about 6 seconds, if there is no error.
So far tested on 3490, 5490 and 7490 devices based on OpenWrt.

Patch 1/3 adds the vendor name
Patch 2/3 adds the dt-bindings
Patch 3/3 adds the remoteproc driver

To build and run, there is OpenWrt PR 5075.

I have read a couple of responses on other submitted patches and
after that I did the following changes to my code:
- Check for c style comments
- Remove all dev_info output
- Did run checkpatch.pl before, but double check and run again
- Add timeout for send and receive socket in order to not stall
  the kernel module in case of blocking tcpip calls
- Add a timeout to while loop in avm_wasp_load_initramfs_image
  to make sure the loop is not infinite
- Add put_device after using (of_)mdio_find_bus
- Use devm_gpio_free instead of gpio_free
- Check for all of_... calls if they increase ref count and
  add of_put_node if required
- Replace all return -1 with return -<some errno>
- Check if the os methods return error and/or NULL and look up
  how other callers in the kernel sources check for errors
  after calling those methods
- Try to find any pointer references that were not checked in
  code running before accessing them
- Rename all methods to start with avm_wasp_
- Restructure code to aquire mdio bus just before using it and
  free it right after avm_wasp_netboot_load_firmware
- Replace rproc_add and rproc_alloc with devm_ methods and
  remove rproc_del and rproc_free
- make dt_binding_check and fix missing gpio include

I likely still have missed things.

Daniel Kestrel (3):
  dt-bindings: vendor-prefixes: Add AVM
  dt-bindings: remoteproc: Add AVM WASP
  remoteproc: Add AVM WASP driver

 .../bindings/remoteproc/avm,wasp-rproc.yaml   |   93 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |    2 +
 drivers/remoteproc/Kconfig                    |   10 +
 drivers/remoteproc/Makefile                   |    1 +
 drivers/remoteproc/avm_wasp.c                 | 1251 +++++++++++++++++
 drivers/remoteproc/avm_wasp.h                 |   95 ++
 6 files changed, 1452 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/avm,wasp-rproc.yaml
 create mode 100644 drivers/remoteproc/avm_wasp.c
 create mode 100644 drivers/remoteproc/avm_wasp.h