Installing OpenWrt on Mikrotik wAP R (RBwAPR-2nD)

I do not have access to serial console right now but here is the initramfs bootlog:

[    0.000000] Linux version 4.9.109 (buildbot@crazyhorse) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7199-70f4845) ) #0 Fri Jun 22 07:43:56 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] User-defined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 804d9674, node_mem_map 81000020
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: no-uart no-buzzer no-nand parts=1 boot_part_size=16777216 gpio=8520495 HZ=325000000 mem=64M kmac=64:D1:54:7D:E4:B0 board=wap-lte board=wap-lte hw_opt=00684001 boot=0 mlc=11 console=ttyS0,115200 rootfstype=squashfs noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 57652K/65536K available (3583K kernel code, 156K rwdata, 844K rodata, 2064K init, 217K bss, 7884K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:650.000MHz, DDR:600.000MHz, AHB:300.000MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 5880801374 ns
[    0.000009] sched_clock: 32 bits at 325MHz, resolution 3ns, wraps every 6607641598ns
[    0.008875] Calibrating delay loop... 432.53 BogoMIPS (lpj=2162688)
[    0.071946] pid_max: default: 32768 minimum: 301
[    0.077295] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084807] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.095506] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.106694] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.114785] NET: Registered protocol family 16
[    0.123499] MIPS: machine is MikroTik RouterBOARD wAP R-2nD
[    0.386411] clocksource: Switched to clocksource MIPS
[    0.393207] NET: Registered protocol family 2
[    0.399082] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.407053] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.414274] TCP: Hash tables configured (established 1024 bind 1024)
[    0.421600] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.428269] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.435638] NET: Registered protocol family 1
[    0.440658] PCI: CLS 0 bytes, default 32
[    2.566421] random: fast init done
[    2.603938] Crashlog allocated RAM at address 0x3f00000
[    2.610870] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    2.625073] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.631728] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.728536] io scheduler noop registered
[    2.732986] io scheduler deadline registered (default)
[    2.739263] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    2.749035] console [ttyS0] disabled
[    2.773221] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    2.783019] console [ttyS0] enabled
[    2.790567] bootconsole [early0] disabled
[    2.804340] m25p80 spi0.0: unrecognized JEDEC id bytes: ef, 70, 18
[    2.811732] libphy: Fixed MDIO Bus: probed
[    2.929922] libphy: ag71xx_mdio: probed
[    3.558719] ag71xx-mdio.1: Found an AR934X built-in switch
[    3.612255] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    3.619946] NET: Registered protocol family 10
[    3.627621] NET: Registered protocol family 17
[    3.632264] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    3.645689] 8021q: 802.1Q VLAN Support v1.8
[    3.664809] Freeing unused kernel memory: 2064K
[    3.669523] This architecture does not have kernel memory protection.
[    3.689519] init: Console is alive
[    3.693266] init: - watchdog -
[    3.716263] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.725663] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.743888] init: - preinit -
[    3.955087] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    5.066849] random: procd: uninitialized urandom read (4 bytes read)
[    5.587843] eth0: link up (1000Mbps/Full duplex)
[    5.592644] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.104696] random: dropbearkey: uninitialized urandom read (32 bytes read)
[    7.113281] random: dropbearkey: uninitialized urandom read (32 bytes read)
[   10.325927] random: dropbearkey: uninitialized urandom read (32 bytes read)
[   10.341710] random: dropbear: uninitialized urandom read (32 bytes read)
[   18.216738] random: dropbear: uninitialized urandom read (32 bytes read)
[   24.112750] random: dropbear: uninitialized urandom read (32 bytes read)
[   25.804425] random: dropbear: uninitialized urandom read (32 bytes read)
[  125.386452] random: crng init done

and ifconfig

root@(none):~# ifconfig 
eth0      Link encap:Ethernet  HWaddr 64:D1:54:7D:E4:B0  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::66d1:54ff:fe7d:e4b0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:831 errors:0 dropped:4 overruns:0 frame:0
          TX packets:265 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:105339 (102.8 KiB)  TX bytes:41450 (40.4 KiB)
          Interrupt:5 

FYC - this unit was LTE kit but I removed the modem before booting into initramfs -- when trying to run sysupgrade with modem installed unit would reboot into RouterOS.

Hm, it looks like SPI NOR flash used is a new one as its ID is not known.
Can you read the full model number from it?

The rebooting issue could be due to PCI power GPIO setting.
But serial is really needed to figure out why does it simply reboot.

This unit is from the recent batch (post April). The model ID from the back is RBwAPR-2nD. FCC ID TV7WAPR2ND. Is this what you were after?

Yes, guessed that. I'm trying to get hardware for serial.

No,I meant to read the full model number from the SPI NOR flash memory.
Its usually 8 or 16 pin IC and often in 25Q something form.
But I need everything to get the JEDEC ID and patch that in.

25Q128JVSM 1748

OK,will look at it tommorow.
There is a PR for that flash.

Also,support for wAP R was merged couple of days ago but I dont really know how it was accepted since the whole PR simply added the id for wAP R and nothing else.
Its missing a lot

Thank you! Tomorrow I will try to get serial & get to the bottom of PCIe issue.

There is a big chance that OpenWrt does not even get written as SPI NOR flash is not detected as one of the supported ones.
UART should uncover that,but I will make a patched version with that JEDEC ID included

My friend just send me a pic from his older unit, its 25Q128FVSC 1713

However this unit is bricked - so we cannot try it. (Not bricked, more of a toasted!)

That one should be supported as is it an older revision.
The one in your wAP is really new, will push it to Linux-MTD too since the PR author did not.

What happened to that unit?

It was installed in marine environment - water damage under power.

Also,support for wAP R was merged couple of days ago but I dont really know how it was accepted since the whole PR simply added the id for wAP R and nothing else.
Its missing a lot

The things I know are missing are LEDs, reset switch, enabling USB, and enabling PCI. Ethernet works, though.

That is really weird.
As ethernet is initialised in the same way.

This is really hard without having the device

I found these in linux_3_3_5_patch .I'm guessing it's the gpio pin mapping? Other than actually trying each pin, I'm not sure how to tell the different LEDs apart, and I'm not even sure what the control pin is. The reset button?

+		.platform_data = &(unsigned[]) {
+			PLD(user_led, 14, GPIO),
+			PLDI(led1, 12, GPIO),
+			PLDI(led2, 13, GPIO),
+			PLD(led3, 3, GPIO),
+			PLDI(pcie_power_off, 15, GPIO),
+			PLED(control, 10, GPIO, PLED_CFG_INV | PLED_CFG_ON),
+			0
+		},

I already added those into images.
In order to see which LED is which go into /sys/class/leds and manually turn them on one by one and note them

Where would you get the JEDEC ID for the W25Q128JVSM? I can build with the patch and try on the unit

I already made the build with the patch
https://drive.google.com/drive/folders/1w9pgfiC9fhQe9mDl6J4icBeK8LAkO7_S?usp=sharing

Worked very nicely, thank you very much! Do you mind sharing your patch? I'd like to build as well, I am using custom packaged images.