Next on my list of things to sort out on my Netgear WAC510 is the LEDs.
From the Netgear firmware bootlog, I see these lines:
[ 0.154086] gpiochip_add: registered GPIOs 0 to 69 on device: 1000000.pinctrl
[ 0.154106] GPIO chip 1000000.pinctrl: created GPIO range 0->69 ==> 1000000.pinctrl PIN 0->69
[ 0.156359] sps:sps is ready.
[ 0.161704] bio: create slab <bio-0> at 0
[ 0.162620] of_get_named_gpiod_flags exited with status 0
[ 0.162640] of_get_named_gpiod_flags exited with status 0
[ 0.162675] gpiochip_find_base: found new base at 248
[ 0.162823] gpiochip_add: registered GPIOs 248 to 255 on device: shift_register_74hc164.7
The Netgear firmware addresses the LEDs using GPIO's 248-254, so I think it's safe to assume they're connected to the 74x164 shift register.
I've compiled my initramfs OpenWrt image with 74x164 and spi support, but the 74x164 chip isn't being detected.
Does anyone have any pointers on how to make the 74x164 kernel module 'see' the chip on the board and control the LEDs?
All I've got so far is a gpiochip0 (base 0) which gives me gpio0->gpio99. If I set all the pins to outputs and toggle them on/off I get weird results which makes me think perhaps the gpiochip0 is taking over the 74x164 address space.
For example:
If I set gpio0-4 as '1', all 7 LEDs light up in one go. If I then toggle gpio5 high/low, after each toggle one more LED goes out, in order starting from one side of the board until all the LEDs are off again. All from toggling gpio5.
If I go all the way through and get up to gpio63, I can toggle the eth1 port.
Am I right in thinking the 74x164 chip is being controlled by the wrong module? How do you fix that if it is, and what else is going on if it isn't?
So, the gpio's are currently connected to:
/sys/devices/platform/soc/1000000.pinctrl/gpiochip0/
I wonder if that's wrong, and if some of those gpio's should instead be connected to another SPI bus? My soc is currently showing these:
root@OpenWrt:/# ls -l /sys/devices/platform/soc/
1000000.pinctrl/ a6000.hsphy/
1800000.clock-controller/ a8000.hsphy/
1949000.tcsr/ a800000.wifi/
194b000.tcsr/ b012000.regulator/
1953000.ess_tcsr/ b017000.watchdog/
1957000.tcsr/ b088000.clock-controller/
2089000.regulator/ b098000.clock-controller/
22000.rng/ b099000.regulator/
4ab000.restart/ b0a8000.clock-controller/
60f8800.usb2/ b0a9000.regulator/
7884000.dma/ b0b8000.clock-controller/
78af000.serial/ b0b9000.regulator/
78b5000.spi/ c000000.ess-switch/
8af8800.usb3/ c080000.edma/
8e04000.dma/ driver_override
8e3a000.crypto/ modalias
90000.mdio/ of_node/
98000.ess-psgmii/ subsystem/
9a000.ssphy/ uevent
a000000.wifi/
I think I need the stock Device Tree (dts) file for my device. Booting into the stock Netgear firmware I can see the device tree under /proc and the entries I'm trying to create are all in there.
No, I've not made a DTS before.. I'd never even heard of a DTS until last week! I've used Linux for years, but I've only been aware of OpenWrt for a few years and have always wanted to figure out how people seem to get their devices working with it. Adding support for my device seems like a good way to contribute back
I'm managing to boot into an initramfs version of the ipq4019-ap.dk01.c1 via a console cable and uboot. I can get 2.4Ghz wifi working using the calibration data and the BDF file for the ath10k module. Not tried the 5Ghz yet. The eth1 port is working too, all using the DTS from ipq4019-ap.dk01.c1.
But the LEDs are on this shift register which I think needs to be defined in the DTS.. The stock firmware lists the shift register under /proc/device-tree/soc as 'shift_register_74hc164', but it doesn't give an address for it or any other way to communicate with it. Where is the magic in the stock DTS that links the 74hc164 to the gpio's? I couldn't see it listed in there....?
I'll try it first thing in the morning as my device is at work..
Am I correct in thinking that the important parts in the DTS file are the numbers 4 and 5 in the spi-gpio block, which denote the GPIO pins that the SPI bus is located on?
I can physically see the 74hc164 chip on the PCB, so I may be able to buzz it out, but I do think at least one of the SPI pins is 5 as that's the one that gives me the weird LED signals when I toggle it. I look forward to trying it out tomorrow..
I get the same openssl errors when I try to compile the Netgear GPL'd firmware. I got further through the compiling of it by replacing the openssl package with the latest one, but then different errors came up as openssl had removed a function which was referred to and I went to the OpenWrt build system instead.
It still needs to be compiled, there is a syntax error in the DTS which prevents it from compiling properly.
I think that in the end, I will not just include DTS for the reference board, but instead move all relevant parts into WAC510 DTS like I did with Jalapeno.
Most likely, shift register block is not indented correctly, or something like that.
GPIO4 is data GPIO and GPIO5 is serial clock one.
I don't know if I will have time today or will have to do it tomorrow.