Controlling LEDs through a 74x164 shift register

I've uploaded those files to github.. Both wifi modules are identified as board-id=31, so I think it needs a variant or something defined in the DTS.
2Ghz BDF: https://github.com/7604timo/netgear-wac510/blob/master/boardData_1_0_IPQ4019_DK01_2G.bin
5Ghz BDF: https://github.com/7604timo/netgear-wac510/blob/master/boardData_1_0_IPQ4019_DK01_5G.bin

I've extracted the calibration data from the ART partition too:
wifi-a000000 (2Ghz): https://github.com/7604timo/netgear-wac510/blob/master/wifi0.caldata
wifi-a800000 (5Ghz): https://github.com/7604timo/netgear-wac510/blob/master/wifi1.caldata

Calibration data is made in this part of the stock init scripts:
dd if=${ART_MTD_BLK} of=${TMP_DIR}/wifi0.caldata bs=32 count=377 skip=128
dd if=${ART_MTD_BLK} of=${TMP_DIR}/wifi1.caldata bs=32 count=377 skip=640

Tim

Offsets for ART are standard,so no need for that.
Thanks for BDF-s

There's loads of BDFs in the firmware - the ones I have are for EU/US. I guess there must be different models sold in different countries. There's also a few other BDFs named like they're for other similar boards:
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK01_2G.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK01_5G.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK03_wifi0.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK03_wifi1.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK04_2G.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK04_2G_neg_pwr.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK04_5G.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK04_5G_neg_pwr.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK05_2G.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK05_5G.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK06_2G.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK06_5G.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK07_wifi0_2G.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK07_wifi0_5G_HB.bin
-r--r--r-- 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_DK07_wifi1_5G_LB.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_Y9803_wifi0.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_Y9803_wifi1.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_YA131_wifi0.bin
-r-xr-xr-x 1 tim tim 12064 Feb 6 14:34 boardData_1_0_IPQ4019_YA131_wifi1.bin

What do we do with them? Just ignore them as they're not for this device?

Tim

Ignore ones that don't match device identification.
It looks like they pack all BDF-s to the same platform and then script reads current device and loads correct ones.

Only regional difference is frequency ranges.

Just got rewritten DTS to compile.
I will upload images now so you can test them,preferably load initramfs to test.
They will not have correct board-2.bin,that will be done later.

Wow - thank you again!

I'll try it out in the morning. I've made a board-2.bin file which works for 2Ghz radio already, but I needed the DTS to include the variant string for the 5Ghz as they both appear as the same board-id. I'll have a go at adding that tomorrow too..

Tim

Great,I dont think that Netgear has made ath10k variant,that is something you can choose then.
If you have board-2.bin done you can check ID-s and everything with ath10k-bdencoder script

Here are the images:
https://drive.google.com/drive/folders/1VyDlOlNVAbQTE8CF7VQHTvNyEuc8SfDl?usp=sharing

It would be best if we dont each do our separate DTS but instead work on one.
My branch is here:

You can simply fork that and when you are done with changes make a PR and I can merge that.

Just downloaded the initramfs image, ready for the morning..

No problem - I can stay on your fork for the DTS changes..

I only know how to boot the initramfs - I tried copying over a normal openwrt image to it and bricked it somehow. Fortunately, Netgear do lifetime warranty's! I may open a new thread when I get to that stage again..

Tim

Well,great thing with initramfs is that you can always load it and then simply syupgrade.

Really?! It's that simple? Ha!

Wow, tomorrow is going to be very exciting then!

Tim

Yeah,but off course you can sysupgrade only OpenWRT images.
Simply copy sysupgrade version of device image and sysupgrade on it if you get bricked.

This is why I dont flash OpenWRT on new devices until I get everything working in OpenWRT.
Much easier to test rather than spend hours recovering from a brick

The new initramfs you kindly made can't see the shift register:
[ 0.929144] spi_master spi0: /soc/spi@78b5000/spi-gpio has no valid 'reg' property (-22)
[ 0.932606] spi_master spi0: Failed to create SPI device for /soc/spi@78b5000/spi-gpio

I'm going to fork your github branch and have a fiddle with the DTS..

Tim

I thought so.
Can you post full bootlog?

Sure:
https://github.com/7604timo/netgear-wac510/blob/master/wac510%20modified%20openwrt%20bootlog.txt

I've just tried adding in a 'reg=<0>;' into the spi-gpio block and now it's complaining about the next property:
[ 0.900280] spi_master spi0: /soc/spi@78b5000/spi-gpio has no valid 'spi-max-frequency' property (-22)
[ 0.903729] spi_master spi0: Failed to create SPI device for /soc/spi@78b5000/spi-gpio

Is there a bracket missing somewhere?

Added that property to the DTS and here's the next error:
[ 0.899932] spi_qup 78b5000.spi: chipselect 0 already in use
[ 0.903359] spi_master spi0: spi_device register error /soc/spi@78b5000/spi-gpio
[ 0.909227] spi_master spi0: Failed to create SPI device for /soc/spi@78b5000/spi-gpio

Just compiling it with chipselect=1 now, but I'm guessing :slight_smile:

Tim

Try using reg=<2>; since 0 and 1 are already registered.
But I think that it wont work even then.
You can see that reg is not needed for spi-gpio
https://www.kernel.org/doc/Documentation/devicetree/bindings/spi/spi-gpio.txt

We can try moving spi-gpio out of spi0 controller.

There's a chap called 'Tom' who has got OpenWrt running on a Netgear device that also uses the 74x164 serial gpio's. His patch (including DTS) is here:
https://patchwork.ozlabs.org/patch/858366/

I'm still new at this, but is it possible to copy out the LED section from his? I couldn't figure out where it starts as there's loads of references to it..

Tim

Sure,like I thought SSR should be registered outside of spi block.
Will have it ready in couple of minutes

This took longer than I thought.
Take a look at my DTS now.
I am building it now.

I have not set triggers for the LEDs as you should first test if GPIOs set even match the LED on the device.
It looks like reset GPIO is 63

Images are ready:https://drive.google.com/drive/folders/1VyDlOlNVAbQTE8CF7VQHTvNyEuc8SfDl?usp=sharing

No mention of the new gpio's in the bootlog:


And they're not showing up in sysfs:
root@OpenWrt:/# ls -l /sys/class/gpio/
--w------- 1 root root 4096 Jan 1 1970 export
lrwxrwxrwx 1 root root 0 Jan 1 1970 gpiochip0 -> ../../devices/platform/soc/1000000.pinctrl/gpio/gpiochip0
--w------- 1 root root 4096 Jan 1 1970 unexport
root@OpenWrt:/#

Is there anything I can try at my end? I tried modifying your fork after I 'git clone'd it, but I couldn't pull your changes back into mine for some reason. I've not used github before, so that could be it :slight_smile:

Tim

They wont show up in bootlog.
I have updated images after you tested them,on the same link.
WiFi should be working with those.

Also,leds are not in /sys/class/gpio,they have their own folder in /sys/class

Most likely you have a conflict in your repository.
You can git reset to my branch state and then make your changes

Aha, I found the /sys/class/leds/ directory. It's empty though - I've just had a quick read-up on it and it looks like it should be populated? Is that correct?

I'll try your next image..

Tim