[RFC/PATCH] Linksys WAP300N support

Rafaël Carré funman at videolan.org
Tue Dec 22 14:27:55 EST 2020


Here is my current work in progress to support the Linksys WAP300N router.
See https://openwrt.org/toh/linksys/wap300n for some info.

This is based on the RT6855A SoC.

Current status:
- serial works
- ethernet works (didn't test 1G yet, only 100MB), with a couple small 
changes in the custom OpenWRT driver.
- I could associate with wlan, didn't test much further.
- leds / buttons are missing, I found the gpio pins for the 2 buttons 
and the power led, although not yet wps and wlan led.
- I didn't test mtd write yet
- The ethernet changes need to be revisited, I might need some help here.

More details on the Linux patch:
- ethernet : I didn't get a link with the linux.git driver, it seems 
this target uses a switch although there's only a single ethernet port.

- wireless : I need to load the eeprom from MTD rather than from efuse,
I noticed the ralink,mtd-eeprom OpenWRT change although I couldn't make 
it work yet, likely due to PCI driver (see below)

- pci : current patch uses the pci.c from Linux 2.6.36 provided by vendor.
pci-rt3883 might work with some changes, although I gave up. Maybe some 
help with dts would make it work.

- irq : this is a new controller, I guess I will need some help on how to 
manage priorities for all the interrupts (it seems timer interrupt needs 
to have the bigger priority).

- reset : in vendor Linux code there seems to be absolutely nothing to 
reset individual devices?

- timer : there is a support for a timer although not sure if it's needed 
by OpenWRT. I didn't implement it.

- watchdog : I wrote a new driver although I think the frequencies are off.
vendor Linux uses the watchdog to reset the board. There might be another 
way, maybe in vendor U-Boot code.

- spi : I patched spi-mt7621.c, I needed to unset the MASTER_RS_SLAVE_SEL bit.
Not sure why. I also hacked the frequency calculation, I guess this bit can 
go away if I declare a proper clock in the .dts file.

- dts : this is copy/pasted along the way, there might be a bunch of errors here.
I just wanted stuff to work first, then come back to it later.
There might be some thing that need to move from rt6855a.dtsi to wap300n.dts.
Also things like ethernet and OpenWRT-specific stuff like ralink,mtd-eeprom
might need to move to the OpenWRT dts file.
I did not look yet how the OpenWRT dts can take over the linux.git one.

- gpio : it seems to be different from the OpenWRT-specific gpio-ralink.c
pins are written to using the same register than for reading, rather than 
separate set and unset registers.

I am not sure yet if there should be new PCI and GPIO drivers, or if I should 
ifdef pci-rt3883.c (or pci-mt7620.c) and gpio-ralink.c.
For spi-mt7621, I'm quite sure it should be changed to work for both targets.
Maybe someone can comment on that MASTER_RS_SLAVE_SEL bit?

Also I plan to upstream this Linux patch, already sent an earlier version
a few weeks ago and got some feedback on IRC.

I welcome any comments and guidance


 target/linux/ramips/Makefile                                        |    2 +-
 target/linux/ramips/dts/rt6855.dtsi                                 |   93 +
 target/linux/ramips/dts/rt6855a_linksys_wap300n.dts                 |   18 +
 target/linux/ramips/files/drivers/net/ethernet/ralink/Kconfig       |    6 +-
 target/linux/ramips/files/drivers/net/ethernet/ralink/Makefile      |    1 +
 target/linux/ramips/files/drivers/net/ethernet/ralink/esw_rt3050.c  |   22 +-
 target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c |    4 +-
 target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.h |    1 +
 target/linux/ramips/files/drivers/net/ethernet/ralink/soc_rt6855.c  |  102 +
 target/linux/ramips/image/Makefile                                  |    1 +
 target/linux/ramips/image/rt6855a.mk                                |   15 +
 target/linux/ramips/patches-5.4/333-MIPS-ralink-rt6855a.patch       | 3142 +++++++++++++++++++++++++++++
 target/linux/ramips/rt6855a/base-files/etc/board.d/01_leds          |   12 +
 target/linux/ramips/rt6855a/base-files/etc/board.d/02_network       |   11 +
 target/linux/ramips/rt6855a/base-files/etc/board.d/03_gpio_switches |   11 +
 target/linux/ramips/rt6855a/config-5.4                              | 2531 +++++++++++++++++++++++
 target/linux/ramips/rt6855a/profiles/00-default.mk                  |   17 +
 target/linux/ramips/rt6855a/target.mk                               |   15 +
 18 files changed, 5999 insertions(+), 5 deletions(-)

More information about the openwrt-devel mailing list