Adding support for Mikrotik Hap AX2

From the dmesg in supout, looks like there is a boot NOR chip, spi-nor spi0.0: gd25lq32 (4096 Kbytes) 0x0000002c0000-0x000000340000 : RouterBoot, but they are running a YAFFS filesystem on NAND. This makes booting OpenWrt from NAND with RouterBOOT difficult, as no YAFFS support in OpenWrt, but there are paths around this, like binary patching, or (partially) replacing the bootloader, or using an intermediary booter. Booting from BOOTP/TFTP should still work fine for testing.

To get OpenWrt running, we would want ipq6018 platform support in OpenWrt (very similar to ipq807x). Looks like some work has been done to build a QSDK based source for a similar device here: GL-iNet AX1800 new router - OpenWrt support?

grep --binary-files=text -i -E '.*: \[.*\] .*(nor|nand|routerbo|routeros|gpio|yaffs|radio.*data|name)'
		 10.55@3: [    0.000000] Kernel command line: root=/dev/ram0 no-uart no-buzzer benand_no_swecc=2 yaffs.inband_tags=1 parts=1 boot_part_size=8388608 clk_ignore_unused arm64=Y board=c53-cp ver=7.7 bver=7.5 hw_opt=08290005 boot=1 mlc=11
		 10.55@3: [    0.017825] thermal_sys: Registered thermal governor 'step_wise'
		 10.55@3: [    0.066501] gpio gpiochip0: (1000000.pinctrl): added GPIO chardev (254:0)
		 10.55@3: [    0.066563] gpiochip_setup_dev: registered GPIOs 0 to 79 on device: gpiochip0 (1000000.pinctrl)
		 10.55@3: [    0.066580] gpio gpiochip0: (1000000.pinctrl): created GPIO range 0->79 ==> 1000000.pinctrl PIN 0->79
		 10.55@3: [    0.128058] jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
		 10.55@3: [    0.128513] yaffs: yaffs Installing.
		 10.55@3: [    0.275168] nand: device found, Manufacturer ID: 0x98, Chip ID: 0xa1
		 10.55@3: [    0.275177] nand: Toshiba NAND 128MiB 1,8V 8-bit
		 10.55@3: [    0.275185] nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
		 10.55@3: [    0.275247] 0x000000000000-0x000000800000 : "RouterBoard NAND 1 Boot"
		 10.55@3: [    0.288965] 0x000000800000-0x000008000000 : "RouterBoard NAND 1 Main"
		 10.55@3: [    0.484161] spi-nor spi0.0: found gd25lq32, expected m25p80
		 10.55@3: [    0.484805] spi-nor spi0.0: gd25lq32 (4096 Kbytes)
		 10.55@3: [    0.484844] 0x0000002c0000-0x000000340000 : "RouterBoot"
		 10.55@3: [    0.486731] mdio_bus fixed-0: GPIO lookup for consumer reset
		 10.55@3: [    0.486741] mdio_bus fixed-0: using lookup tables for GPIO lookup
		 10.55@3: [    0.486751] mdio_bus fixed-0: No GPIO consumer reset found
		 10.55@3: [    0.489120] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/wps-button[0]' - status (0)
		 10.55@3: [    0.489268] Registered gpio 0 as wps-button
		 10.55@3: [    0.489298] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/button[0]' - status (0)
		 10.55@3: [    0.489393] Registered gpio 16 as button
		 10.55@3: [    0.489423] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/mode-button[0]' - status (0)
		 10.55@3: [    0.489515] Registered gpio 9 as mode-button
		 10.55@3: [    0.489543] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/usb-power-off[0]' - status (0)
		 10.55@3: [    0.489634] Registered gpio 37 as usb-power-off
		 10.55@3: [    0.489756] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/system-led/red[0]' - status (0)
		 10.55@3: [    0.489852] Registered gpio 19 as system-led:red
		 10.55@3: [    0.489922] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/system-led/green[0]' - status (0)
		 10.55@3: [    0.490017] Registered gpio 20 as system-led:green
		 10.55@3: [    0.490089] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/system-led/blue[0]' - status (0)
		 10.55@3: [    0.490211] Registered gpio 18 as system-led:blue
		 10.55@3: [    0.490286] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/system-wlan-led[0]' - status (0)
		 10.55@3: [    0.490377] Registered gpio 22 as system-wlan-led
		 10.55@3: [    0.490469] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/system-eth-led[0]' - status (0)
		 10.55@3: [    0.490560] Registered gpio 21 as system-eth-led
		 10.55@3: [    0.490631] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led1[0]' - status (0)
		 10.55@3: [    0.490721] Registered gpio 23 as led1
		 10.55@3: [    0.490792] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led2[0]' - status (0)
		 10.55@3: [    0.490884] Registered gpio 24 as led2
		 10.55@3: [    0.490956] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led3[0]' - status (0)
		 10.55@3: [    0.491046] Registered gpio 25 as led3
		 10.55@3: [    0.491118] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led4[0]' - status (0)
		 10.55@3: [    0.491208] Registered gpio 26 as led4
		 10.55@3: [    0.491280] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/led5[0]' - status (0)
		 10.55@3: [    0.491369] Registered gpio 27 as led5
		 10.55@3: [    0.491444] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/poe-led[0]' - status (0)
		 10.55@3: [    0.491535] Registered gpio 29 as poe-led
		 10.55@3: [    0.491611] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/lte-ant-sw1[0]' - status (0)
		 10.55@3: [    0.491703] Registered gpio 33 as lte-ant-sw1
		 10.55@3: [    0.491779] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/lte-ant-sw2[0]' - status (0)
		 10.55@3: [    0.491870] Registered gpio 34 as lte-ant-sw2
		 10.55@3: [    0.491945] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/lte-reset[0]' - status (0)
		 10.55@3: [    0.492037] Registered gpio 60 as lte-reset
		 10.55@3: [    0.492112] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/mpcie-power-off[0]' - status (0)
		 10.55@3: [    0.492204] Registered gpio 35 as mpcie-power-off
		 10.55@3: [    0.535401] yaffs: dev is 32505857 name is "mtdblock1" rw
		 10.55@3: [    0.535407] yaffs: passed flags ""
		 10.55@3: [    0.535416] yaffs: yaffs: Attempting MTD mount of 31.1,"mtdblock1"
		 10.55@3: [    0.535421] yaffs: auto selecting yaffs2
		 10.55@3: [    1.625651] yaffs: block 705 is bad
		 10.55@3: [    1.823818] yaffs: 572 blocks to be sorted...
		 10.55@3: [    2.447209] yaffs: yaffs_read_super: is_checkpointed 0
		 10.55@3: [    2.449637] yaffs: dev is 32505856 name is "mtdblock0" rw
		 10.55@3: [    2.449642] yaffs: passed flags ""
		 10.55@3: [    2.449650] yaffs: yaffs: Attempting MTD mount of 31.0,"mtdblock0"
		 10.55@3: [    2.449655] yaffs: auto selecting yaffs2
		 10.55@3: [    2.454200] yaffs: yaffs_read_super: is_checkpointed 1
		 10.55@3: [   10.384364] board name = C53UiG+5HPaxD2HPaxD
		 10.55@3: [   10.384369] market name = hAP ax³
		 10.55@3: [   10.385582] radio data lz77 decompressed from 5124 to 11848
		 11.47@3: [   11.475478] nand id 1580a198 00000000
		 11.47@3: [   11.475629] uid->nand_id c81660c8
2023.02.18-04:29:14.48@1: [   12.619331] probe_er_radio_data chunkid 8001 caldataid -1
2023.02.18-04:29:14.48@1: [   12.619351] found extended radio data with id 32769
2023.02.18-04:29:14.48@1: [   12.619974] radio data rle decompressed from 11836 to 65536
2023.02.18-04:29:14.60@1: [   12.740917] qcom-pcie 20000000.pci: GPIO lookup for consumer booster
2023.02.18-04:29:14.60@1: [   12.740944] qcom-pcie 20000000.pci: using device tree for GPIO lookup
2023.02.18-04:29:14.60@1: [   12.740978] of_get_named_gpiod_flags: can't parse 'booster-gpios' property of node '/soc/pci@20000000[0]'
2023.02.18-04:29:14.60@1: [   12.741004] of_get_named_gpiod_flags: can't parse 'booster-gpio' property of node '/soc/pci@20000000[0]'
2023.02.18-04:29:14.60@1: [   12.741021] qcom-pcie 20000000.pci: using lookup tables for GPIO lookup
2023.02.18-04:29:14.60@1: [   12.741035] qcom-pcie 20000000.pci: No GPIO consumer booster found
2023.02.18-04:29:14.60@1: [   12.741047] qcom-pcie 20000000.pci: GPIO lookup for consumer pwr
2023.02.18-04:29:14.60@1: [   12.741059] qcom-pcie 20000000.pci: using device tree for GPIO lookup
2023.02.18-04:29:14.60@1: [   12.741082] of_get_named_gpiod_flags: can't parse 'pwr-gpios' property of node '/soc/pci@20000000[0]'
2023.02.18-04:29:14.60@1: [   12.741119] of_get_named_gpiod_flags: parsed 'pwr-gpio' property of node '/soc/pci@20000000[0]' - status (0)
2023.02.18-04:29:14.60@1: [   12.741134] gpio-35 (mpcie-power-off): gpiod_request: status -16
2023.02.18-04:29:14.62@1: [   12.764036] of_get_named_gpiod_flags: parsed 'perst-gpio' property of node '/soc/pci@20000000[0]' - status (0)
2023.02.18-04:29:14.62@1: [   12.764057] gpio-60 (lte-reset): gpiod_request: status -16
2023.02.18-04:29:14.88@3: [   13.025990] probe_er_radio_data chunkid 3 caldataid 3
2023.02.18-04:29:15.93@2: [   14.067625] dwc3-qcom 8af8800.usb30: GPIO lookup for consumer device-power
2023.02.18-04:29:15.93@2: [   14.067646] dwc3-qcom 8af8800.usb30: using device tree for GPIO lookup
2023.02.18-04:29:15.93@2: [   14.067666] of_get_named_gpiod_flags: can't parse 'device-power-gpios' property of node '/soc/usb30@8A00000[0]'
2023.02.18-04:29:15.93@2: [   14.067679] of_get_named_gpiod_flags: can't parse 'device-power-gpio' property of node '/soc/usb30@8A00000[0]'
2023.02.18-04:29:15.93@2: [   14.067688] dwc3-qcom 8af8800.usb30: using lookup tables for GPIO lookup
2023.02.18-04:29:15.93@2: [   14.067695] dwc3-qcom 8af8800.usb30: No GPIO consumer device-power found
2 Likes