Skip to content

Commit

Permalink
ath79: Reactivate Ubiquiti AirMax targets
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Eckelmann <[email protected]>
  • Loading branch information
ecsv committed Mar 3, 2024
1 parent 3854bae commit b3ae319
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/user/supported_devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ ath79-generic

* Ubiquiti

- NanoBeam 5AC 19 (XC)
- NanoBeam M5 (XW)
- NanoStation Loco M2/M5 (XW)
- NanoStation M2/M5 (XW)
- UniFi AC Lite
- UniFi AC LR
- UniFi AC Mesh
Expand Down
1 change: 1 addition & 0 deletions package/gluon-core/luasrc/lib/gluon/upgrade/020-interfaces
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ if platform.match('ath79', 'generic', {
'tplink,wbs210-v1',
'tplink,wbs210-v2',
'tplink,wbs510-v1',
'ubnt,nanostation-m-xw',
'ubnt,unifi-ap-pro',
}) then
lan_ifname, wan_ifname = wan_ifname, lan_ifname
Expand Down
4 changes: 4 additions & 0 deletions package/gluon-core/luasrc/usr/lib/lua/gluon/platform.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function M.is_outdoor_device()
'tplink,wbs210-v2',
'tplink,wbs510-v1',
'ubnt,uk-ultra',
'ubnt,nanobeam-ac-xc',
'ubnt,nanobeam-m5-xw',
'ubnt,nanostation-loco-m-xw',
'ubnt,nanostation-m-xw',
'ubnt,unifi-ap-outdoor-plus',
'ubnt,unifiac-mesh',
'ubnt,unifiac-mesh-pro',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From: Lech Perczak <[email protected]>
Date: Sun, 17 Dec 2023 18:25:55 +0100
Subject: ath79: generic: disable SPI-NOR write protect unconditionally

Kernel 5.15 introduced a significant change to spi-nor subsystem [1],
which would the SPI-NOR core to no longer unprotect the Flash chips if
their protection bits are non-volatile, which is the case for MX25L6405D
and MX25L12805D, used in Ubiquiti XW and WA lines of devices [2].

However, their bootloader forcibly enables this protection before
continuing to boot, making the kernel not unprotect the flash upon boot,
causing JFFS2 to be unable write to the filesystem. Because sysupgrade
seems to unlock the flash explicitly, the upgrade will work, but the
system will be unable to save configrationm showing the following symptom
in the kernel log:

[ 86.168016] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[ 86.192344] jffs2_build_filesystem(): unlocking the mtd device...
[ 86.192443] done.
[ 86.200669] jffs2_build_filesystem(): erasing all blocks after the end marker...
[ 86.220646] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001e0000
[ 86.292388] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001d0000
[ 86.324867] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001c0000
[ 86.355316] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001b0000
[ 86.402855] jffs2: Newly-erased block contained word 0x19852003 at offset 0x001a0000

Disable the write protection unconditionally for ath79/generic subtarget,
so the XW and WA devices can function again. However, this is only a
stopgap solution - it probably should be investigated if there is a way
to selectively unlock the area used by rootfs_data - but given the lock
granularity, this seems unlikely.

With this patch in place, rootfs_data partition on my Nanostation Loco
M5 XW is writable again.

Fixes: #12882
Fixes: #13750
Fixes: 579703f38c14 ("ath79: switch to 5.15 as default kernel")
Link: http://www.infradead.org/pipermail/linux-mtd/2020-October/082805.html
Link: https://forum.openwrt.org/t/powerbeam-m5-xw-configuration-loss-after-reboot/141925
Signed-off-by: Lech Perczak <[email protected]>

diff --git a/target/linux/ath79/generic/config-default b/target/linux/ath79/generic/config-default
index 06f264b626a72be16854e6f984a2ee4f8b3b906a..09ea9d93d7a567897c9de5fdd925cb13de332930 100644
--- a/target/linux/ath79/generic/config-default
+++ b/target/linux/ath79/generic/config-default
@@ -14,6 +14,8 @@ CONFIG_LEDS_RESET=y
CONFIG_MARVELL_PHY=y
CONFIG_MICREL_PHY=y
CONFIG_MTD_REDBOOT_PARTS=y
+CONFIG_MTD_SPI_NOR_SWP_DISABLE=y
+# CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE is not set
CONFIG_MTD_SPLIT_EVA_FW=y
CONFIG_NVMEM_SYSFS=y
CONFIG_NVMEM_U_BOOT_ENV=y
21 changes: 21 additions & 0 deletions targets/ath79-generic
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,21 @@ device('tp-link-wbs510-v1', 'tplink_wbs510-v1', {

-- Ubiquiti

device('ubiquiti-nanostation-loco-m-xw', 'ubnt_nanostation-loco-m-xw', {
manifest_aliases = {
'ubiquiti-loco-m-xw', -- upgrade from OpenWrt 19.07
'ubiquiti-nanostation-loco-m2-xw', -- upgrade from OpenWrt 19.07
'ubiquiti-nanostation-loco-m5-xw', -- upgrade from OpenWrt 19.07
},
})

device('ubiquiti-nanostation-m-xw', 'ubnt_nanostation-m-xw', {
manifest_aliases = {
'ubiquiti-nanostation-m2-xw', -- upgrade from OpenWrt 19.07
'ubiquiti-nanostation-m5-xw', -- upgrade from OpenWrt 19.07
},
})

device('ubiquiti-unifi-ac-lite', 'ubnt_unifiac-lite', {
factory = false,
packages = ATH10K_PACKAGES_QCA9880,
Expand Down Expand Up @@ -661,6 +676,12 @@ device('ubiquiti-unifi-ap', 'ubnt_unifi-ap', {
},
})

device('ubiquiti-nanobeam-ac-gen1-xc', 'ubnt_nanobeam-ac-xc', {
packages = ATH10K_PACKAGES_QCA9880,
})

device('ubiquiti-nanobeam-m5-xw', 'ubnt_nanobeam-m5-xw')

device('ubiquiti-unifi-ap-outdoor+', 'ubnt_unifi-ap-outdoor-plus', {
manifest_aliases = {
'ubiquiti-unifiap-outdoor+', -- upgrade from OpenWrt 19.07
Expand Down

0 comments on commit b3ae319

Please sign in to comment.