Commit Graph

679 Commits

Author SHA1 Message Date
Marcin Gajda
6d8b36bfd8 ipq40xx: Netgear LBR20 fix for proper img builds
Without UBINIZE_OPTS it is possile to have error:
"ubi0 error: ubi_attach_mtd_dev: failed to atach mtd23, error -22"

This solve this problem.

Signed-off-by: Marcin Gajda <mgajda@o2.pl>
2024-02-24 19:49:39 +01:00
John Audia
33e72e0b3d kernel: bump 6.1 to 6.1.79
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.79

Manually rebased:
	ath79/patches-6.1/900-unaligned_access_hacks.patch

All other patches automatically rebased.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne, ramips/tplink_archer-a6-v3, flogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: x86/64/AMD Cezanne, ramips/tplink_archer-a6-v3, flogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2024-02-24 19:25:02 +01:00
Marcin Gajda
07b9186e88 ipq40xx: Add support Netgear LBR20
**Netgear LBR20** is a router with two gigabit ethernets , three wifi radios and integrated LTE cat.18 modem.

SoC Type: Qualcomm IPQ4019
RAM: 512 MiB
Flash: 256 MiB , SLC NAND, 2 Gbit (Macronix MX30LF2G18AC)
Bootloader: U-Boot
Modem: LTE CAT.18 Quectel EG-18EA ,  Max. 1.2Gbps downlink / 150Mbps uplink

WiFi class AC2200:
- radio0 : 5G on QCA9888 , WiFi5- 802.11a/n/ac MU-MIMO 2x2 , 887Mbps , 80MHz - limited for low channels
- radio1: 2,4G on IPQ4019 ,WiFi4- 802.11b/g/n MIMO2x2 300Mbps 40Mhz
- radio2: 5G on IPQ4019 , WiFi5- 802.11a/n/ac MU-MIMO 2x2 , 887Mbps ,80Mhz - limited for high channels  (from 100 up to 165) . Becouse of DFS remember to set country before turning on.

Ethernet: 2x1GbE (WAN/LAN1, LAN2)
LEDs:  section power : green and red  , section on top (orbi) drived by TLC59208F: red, green ,blue and white
USB ports: No
Buttons:  2 Reset and SYNC(WPS)
Power: 12 VDC, 2,5 A
Connector type: Barrel

OpenWRT Installation
1. Simplest way is just do upgrade from webpage with *factory.img
2. You can also do it with standard tool for Netgear's debricking - NMPRFlash
3. Most advanced way is to open device , connect to UART console and :
- Prepare OpenWrt initramfs image in TFTP server root (server IP 192.168.1.10)
- Connect serial console (115200,8n1) to UART connector
- Connect TFTP server to RJ-45 port
- Stop in u-Boot and run u-Boot command:

> setenv serverip 192.168.1.10
> set fdt_high 0x85000000
> tftpboot 0x83000000 openwrt-ipq40xx-generic-netgear_lbr20-initramfs-zImage.itb
> bootm 0x83000000

- Login via ssh
- upload or download *sysupgrade.bin ( like wget ... or scp transfer)
-  Install image via "sysupgrade -n" (like “sysupgrade -n /tmp/openwrt-ipq40xx-generic-netgear_lbr20-squashfs-sysupgrade.bin”)

Back to Stock
- Download firmware from official Netgear's webpage , it will be *.img file after decompressing.
- Use NMRPFlash tool  ( detailed insructions on project page https://github.com/jclehner/nmrpflash )

Open the case
- Unscrew nuts and remove washers from antenna's conectors.
- There are two Torx T10 screws under the label next to antenna conectors. You have to unglue this label from left and right corner to get it
- Two parts of shell covers will slide out from eachother , you have to unglue two small rubber pads and namplate sticker on bottom to do that.
- PCB is screwed with 4Pcs of Torx T10 screws
- Before lifting up PCB remove pigtiles for LTE antennas and release them from PCB and radiator (black and white wires)
- On other side of PCB ,in left bottom corner there is already soldered with 4 pins UART connector for console. Counting from left it is  +3,3V , TX , RX ,GND (reffer to this picture: https://i.ibb.co/Pmrf9KB/20240116-103524.jpg )

BDF's files are in firmware_qca-wireless  https://github.com/openwrt/firmware_qca-wireless/ and in parallel sent to ath10k@lists.infradead.org.

Signed-off-by: Marcin Gajda <mgajda@o2.pl>
2024-02-23 19:46:23 +01:00
Daniel Golle
4cb6bd9a6d mediatek: switch to pending XFI 10G Ethernet drivers
Replace previous patch adding paths and SerDes modes with patch series
pending upstream adding dedicated drivers for XFI T-PHY and USXGMII PCS,
extends LynxI PCS to be a standalone platform driver and as a consequence
makes much less changes to the actual Ethernet driver mtk_eth_soc.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-02-15 19:06:36 +00:00
Christian Marangi
1b931c33a2
ipq40xx: adapt to new Upstream QCA807x PHY driver
Adapt patches to new Upstream QCA807x PHY driver.

Rework the PHY patch to new PHY Package nodes.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-11 21:08:29 +01:00
Christian Marangi
c6ed34940d
ipq40xx: fix dts error in LED color/function conversion
Fix DTS error in LED color/function conversion due to a bug in the
conversion script.

Fixes: a9e0d97e1f ("ipq40xx: convert to new LED color/function format where possible")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-09 01:44:19 +01:00
Christian Marangi
a9e0d97e1f
ipq40xx: convert to new LED color/function format where possible
Initial conversion to new LED color/function format
and drop label format where possible. The same label
is composed at runtime.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-07 14:48:37 +01:00
Christian Marangi
502ac21e8f
ipq40xx: drop redundant label with new LED color/function format
Drop redundant label with new LED color/function format declared.
This was needed previously when the new format wasn't supported by
leds.sh functions script. Now that is supported this property
can be removed in favor of the new format.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-07 14:48:37 +01:00
Christian Marangi
997acc7f86
generic: 6.1: backport at803x split patches
Backport at803x split patches merged upstream to tidy things up for the
at803x PHY driver.

New Kernel config are introduced hence any user needs to be updated.

Downstream ipq40xx patch require rework to correctly move them to the
qcom specific PHY directory.

All affected patch automatically refreshed.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-01 16:21:52 +01:00
John Audia
ff413129f9 kernel: bump 6.1 to 6.1.72
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.72

Manually rebased:
	generic/hack-6.1/650-netfilter-add-xt_FLOWOFFLOAD-target.patch

All other patches automatically rebased.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
2024-01-19 21:24:44 +01:00
Christian Marangi
d6beb56576
ipq40xx: drop PSGMII PHY patch
Drop PSGMII PHY patch as it has been moved to generic in preparation for
the PHY driver to be also used for ipq807x SoC as the same PHY is also
used there.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-01-16 01:00:31 +01:00
Rosen Penev
89ff407d68
treewide: use ethtool_puts instead of memcpy
The former is a safer and more readable version.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2024-01-05 16:12:49 +01:00
Christian Lamparter
3f442c1eb9 ipq40xx: update ASUS RT-AC58U leds DTS nodes
- use color, function, function-enumerator properties.
 - removes the label properties from LED nodes.
 - add panic-indicator to the blue power/status LED.

Note: yes this brings the combined LAN/"switch" LED sort of back,
though I fully admit, it's a bit jank. Do you know a better option?
then please tell/make a PR!

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-12-02 21:57:38 +01:00
Christian Lamparter
4f7835cbf0 ipq40xx: enable CONFIG_LED_TRIGGER_PHY for AC42U
The AC42U already had PHY Triggers in the DTS.
We are probably going to use them at some point.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2023-12-02 21:57:12 +01:00
John Audia
c20bedf1f5 kernel: bump 6.1 to 6.1.64
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.64

Removed upstreamed:
	ixp4xx/patches-6.1/0001-mtd-cfi_cmdset_0001-Byte-swap-OTP-info.patch[1]
	mvebu/patches-6.1/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch[2]
	qualcommax/patches-6.1/0026-v6.7-clk-qcom-ipq8074-drop-the-CLK_SET_RATE_PARENT-flag-f.patch[3]

Manually rebased:
	bcm27xx/patches-6.1/950-0111-MMC-added-alternative-MMC-driver.patch

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.64&id=3b93096d29c5b9ca2af94be4ee9949c1767acf17
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.64&id=b3fd9db79e30d5eb5f76ef1f5b7e4f444af574ea
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.64&id=877080a3490102da26b8d969588159b2385f739e

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-11-29 23:38:39 +01:00
Tony Ambardar
a7818e0550 ipq40xx: enable UBI size checks for some Linksys NAND devices
Add correct NAND_SIZE in device definitions for EA6350v3, EA8300, MR8300,
WHW01 and WHW03v2, to enable improved image size checks wrt UBI reserved
blocks on NAND devices.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-11-26 18:37:21 +01:00
Tony Ambardar
b16e14a220 image: use helper function for size units
Add the make function 'exp_units' for helping evaluate k/m/g size units in
expressions, and use this to consistently replace many ad hoc substitutions
like '$(subst k,* 1024,$(subst m, * 1024k,$(IMAGE_SIZE)))' in makefiles.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-11-26 18:37:20 +01:00
Tony Ambardar
c66511bc48 ipq40xx: fix typo in Linksys WHW01 image definition
Use lower-case "k" in IMAGE_SIZE for Linksys WHW01, permitting proper unit
conversions in build recipes (e.g. 75776k -> 75776*1024).

Fixes: 2a9f3b7717 ("ipq40xx: fix up Linksys WHW01 board name, device definition")
Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2023-11-26 18:37:20 +01:00
Rosen Penev
7e316bc53a
ipq40xx: remove mac-address-increment
nvmem-layout allows removal

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:14:54 +01:00
Rosen Penev
fe8dd23882
ipq40xx: convert to nvmem-layout
Allows replacing mac-address-increment with mac-base.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:14:54 +01:00
Rosen Penev
14467fd515
ipq40xx: fix dtc warnimg
I2C bus unit address format error, expected "62"

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:14:51 +01:00
Robert Marko
5dae4a6aba ipq40xx: refresh patches
CI reported that ipq40xx needed a refresh, so lets refresh it.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2023-11-25 00:12:01 +01:00
John Audia
2b75f108fb kernel: bump 6.1 to 6.1.63
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.63

Removed upstreamed:
	generic/backport-6.1/815-v6.6-2-leds-turris-omnia-Drop-unnecessary-mutex-locking.patch
	generic/backport-6.1/815-v6.7-1-leds-turris-omnia-Do-not-use-SMBUS-calls.patch
	ixp4xx/patches-6.1/0007-watchdog-ixp4xx-Make-sure-restart-always-works.patch

Manually rebased:
	bcm27xx/patches-6.1/950-0606-hwrng-bcm2835-sleep-more-intelligently.patch

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.63&id=7d0e60e4ff840e97fb18afb2a7344442c10a6fdf
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.63&id=63cdeb20ee3bfef820b045b8d3b8395f9f815a74
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.63&id=8803da01fe1b4ca3d37745283f7e73c6c2558c0c

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-11-23 22:51:52 +01:00
Leon M. Busch-George
2657e8cab7 ipq40xx: wpj428: switch to zimage to fit kernel partition
Like with some other ipq40xx devices, the kernel image size for the WPJ428
is limited in stock u-boot. For that reason, the current release doesn't
include an image for the board.
By switching to the zImage format, the kernel image size is reduced which
re-enables the build process. The image boots and behaved normally through
a few days of testing.

Before the switch to kernel version 6.1, it was possible to reduce the
image size by enough when disabling UBIFS and its otherwise unneeded
dependencies.

Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
2023-10-20 18:13:57 +02:00
Koen Vandeputte
b8e52852bd ipq40xx: switch to performance governor by default
Doing a simple ping to my device shows this:

64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=2.00 ms
64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=2.02 ms
64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=1.68 ms
64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=1.91 ms
64 bytes from 10.0.253.101: icmp_seq=5 ttl=64 time=1.92 ms
64 bytes from 10.0.253.101: icmp_seq=6 ttl=64 time=2.04 ms

Some users even report higher values on older kernels:

64 bytes from 192.168.1.10: seq=0 ttl=64 time=0.612 ms
64 bytes from 192.168.1.10: seq=1 ttl=64 time=2.852 ms
64 bytes from 192.168.1.10: seq=2 ttl=64 time=2.719 ms
64 bytes from 192.168.1.10: seq=3 ttl=64 time=2.741 ms
64 bytes from 192.168.1.10: seq=4 ttl=64 time=2.808 ms

The problem is that the governor is set to Ondemand, which causes
the CPU to clock all the way down to 48MHz in some cases.

Switching to performance governor:

64 bytes from 10.0.253.101: icmp_seq=1 ttl=64 time=0.528 ms
64 bytes from 10.0.253.101: icmp_seq=2 ttl=64 time=0.561 ms
64 bytes from 10.0.253.101: icmp_seq=3 ttl=64 time=0.633 ms
64 bytes from 10.0.253.101: icmp_seq=4 ttl=64 time=0.526 ms

In theory, using the Performance governor should increase power draw,
but it looks like it really does not matter for this soc.

Using a calibrated precision DC power supply (cpu idle):

Ondemand
24.00V * 0.134A = 3.216 Watts
48.00V * 0.096A = 4.608 Watts

Performance
24.00V * 0.135A = 3.240 Watts
48.00V * 0.096A = 4.608 Watts

Let's simply switch to the Performance governor by default
to fix the general jittery behaviour on devices using this soc.

Tested on: MikroTik wAP ac

Fixes: #13649
Reviewed-by: Robert Marko <robimarko@gmail.com>
Reviewed-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
2023-10-20 15:11:41 +02:00
Robert Marko
b7eea2db73
ipq40xx: use upstreamed SDI disable support
Google WiFi board has what seems as debug version of TZ/QSEE and it is
always enabling SDI (Secure Debug Image) and in order to do a regular
reboot it must be disabled, as otherwise you are stuck in a debug state
where you are supposed to extract debug logs via QCA tooling which is not
helpfull at all for regular users.

So, instead of using our downstream version to disable SDI lets use the
version that was merged upstream and relies on a boolean property in the
SCM node instead of checking the compatible.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Tested-by: Brian Norris <computersforpeace@gmail.com>
2023-10-02 19:03:30 +02:00
Christian Marangi
33908b2ad7
ipq40xx: refresh qca8k patches
Refresh qca8k patches to sync with the generic backports changes.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-30 13:51:20 +02:00
Glen Lee
74e7f8ebbd ipq40xx: add support for Extreme Networks WS-AP391x series APs
This in a single image to run many types of hardware in the AP391x
series (AP3912/AP3915/AP3916/AP3917/AP7662).

Hardware
--------
Qualcomm IPQ4029 WiSoC
2T2R 802.11 abgn
2T2R 802.11 nac
Macronix MX25L25635E SPI-NOR (32M)
512M DDR3 RAM
1-4x Gigabit Ethernet
Senao EXT1025 HD Camera (AP3916 only)
USB 2.0 Port (AP3915e only)

1x Cisco RJ-45 Console port
  - except for AP3916 and AP3912 where there is no external serial
    console and it is TDB how to solder one. Possibly J12 is UART with
    pin1 = 3.3V, pin2 = GND, pin3 = TXD, pin4 = RXD.
  - Settings: 115200 8N1

Installation With Serial Console
--------------------------------

1. Attach to the Console port. Power up the device and press the s key
   to interrupt autoboot.

2. The default username / password to the bootloader is admin / new2day

3. Check uboot variables using printenv, and update if necessary:

   $ setenv AP_MODE 0
   $ setenv WATCHDOG_COUNT 0
   $ setenv WATCHDOG_LIMIT 0
   $ setenv AP_PERSONALITY identifi
   $ setenv serverip <SERVER_IPADDR>
   $ setenv ipaddr <UNIQUE_IPADDR>
   $ setenv MOSTRECENTKERNEL 0; ## OpenWRT only uses the primary image
   $ saveenv
   $ saveenv ## 2nd time to write the secondary copy

4. On the TFTP server located at <SERVER_IPADDR>, download the OpenWrt
   initramfs image. Rename and serve it as vmlinux.gz.uImage.3912

5. TFTP boot the OpenWrt initramfs image from the AP serial console:

   $ run boot_net

6. Wait for OpenWrt to start. Internet port sw-eth5 is assiged to LAN
   bridge and sw-eth4 (if available) is assigned to WAN.  The LAN port
   will use default IP address 192.168.1.1 and run a DHCP server.

   If you already have a working DHCP server or already have 192.168.1.1
   on your network you MUST DISCONNECT the LAN cable from your active
   network immediately after the power/status LED turns green!

   At this point, you need to temporarily reconfigure the AP to have
   a way to transfer the OpenWRT sysupgrade image to it.

   Reconfigure the newly converted OpenWRT AP using serial console or
   plug in a PC to a sw-eth5 as a separate network. Note -- the LAN/WAN
   port assignments were designed to make it possible to convert to
   OpenWRT without serial console and using a common firmware
   image for many AP models -- they may not make the most sense when
   fully deployed.

7. Download and transfer the sysupgrade image to the device using e.g.
   SCP.

8. Install OpenWrt to the device using "sysupgrade"

   $ sysupgrade -n /path/to/openwrt.bin

9. After it boots up again, as in step 6, connect to AP and reconfigure
   for final deployment.

This build supports APs in the AP391x series and similar such as WiNG
AP7662.

Ethernet devices within OpenWRT are named "sw-eth1" thru "sw-eth5".
Mapping from OpenWRT internal naming to external naming on the case is
as follows:

```
            |sw-eth1|sw-eth2|sw-eth3|sw-eth4|sw-eth5
------------+-------+-------+-------+-------+-------
AP3917      |       |       |       |  GE2  |  GE1
------------+-------+-------+-------+-------+-------
AP7662      |       |       |       |  GE2  |  GE1
------------+-------+-------+-------+-------+-------
AP3916      |       |       |       |  CAM* |  GE1
------------+-------+-------+-------+-------+-------
AP3915      |       |       |       |       |  GE1
------------+-------+-------+-------+-------+-------
AP3912      |       |  P1   |  P2   |  P3   | LAN1
------------+-------+-------+-------+-------+-------
```

By default sw-eth4 is mapped to WAN. All others are assigned to the
LAN.

CAM* - On AP3916, sw-eth4 is the camera's interface.  You should
reconfigure this to be on LAN after OpenWRT boots from flash.

Installation Without Serial Console
-----------------------------------

The main premise is to set u-boot environment variables using the
Extreme Networks firmware's rdwr_boot_cfg program.

$ rdwr_boot_cfg

Utility to manipulate the boot ROM config blocks
All errors are written to the sytem log file (/tmp/log/ap.log)

```
Usage: rdwr_boot_cfg <read_all|read_var|read_var_f|write_var|rm_var> ...
   read_all             read the entire active block
   read_var <var>       read a single variable from the active block
   read_var_f <var>     read a single variable from the active block
(formatted)
   write_var <var=val>  write a single variable/value pair to both
blocks
   rm_var <var>         delete a single variable from both blocks
```

WARNING: Be very sure you have set the u-boot environment correctly.
If not, it can only be fixed by attaching serial console!

Be aware that the Extreme Networks shell environment will automatically
reboot every 5 minutes if there is no controller present.

Read and understand these steps fully before attempting.  It is easy
to make mistakes!

1. Place the OpenWRT initramfs on the TFTP server and name it as
   vmlinux.gz.uImage.3912

2. Boot up to Extreme Networks WING-Campus mode OS.  Port GE1/LAN1
   will be a DHCP **client**.  Find out the IP address from your DHCP
   server and SSH in.  Default user/passwd is admin/new2day or
   admin/admin123.

   If it is booting to WING-Distributed mode, use this command to
   convert to Campus mode.

   $ operational-mode centralized

3. Upon bootup you have about 5mins to changed these u-boot variables
   if necessary using the rdwr_boot_cfg command in Linux shell:

   $ rdwr_boot_cfg write_var AP_MODE=0
   $ rdwr_boot_cfg write_var MOSTRECENTKERNEL=0
   $ rdwr_boot_cfg write_var WATCHDOG_COUNT=0
   $ rdwr_boot_cfg write_var WATCHDOG_LIMIT=0
   $ rdwr_boot_cfg write_var AP_PERSONALITY=identifi
   $ rdwr_boot_cfg write_var serverip=<SERVER_IPADDR>
   $ rdwr_boot_cfg write_var ipaddr=<UNIQUE_IPADDR>
   $ rdwr_boot_cfg write_var bootcmd="run boot_net"

4. Reboot AP.

5. Connect PC with ethernet to GE1/LAN1 port.  You should get a
   DHCP address in the 192.168.1.x range and should be able to
   SSH to the new OpenWRT TFTP recovery/installation shell.

6. At this point, u-boot is still set to TFTP boot, so you have to
   replace the TFTP image with the original Extreme Networks image so
   that you can change the u-boot environment.

   See the instructions for Extracting Extreme Networks firmware
   image.

   DON'T REBOOT YET!

7. Next you must follow steps 6 thru 8 from the Installation with serial
   console.  After which you should have OpenWRT installed to primary
   flash firmware.

8. Now Reboot.  This time it will boot using TFTP into Extreme Networks
   image.  You may need to reconnect cables at this point -- GE1/LAN1
   will be a DHCP **client** and you can SSH in -- just like step 2.
   Get the IP address from you own DHCP server.

9. Set u-boot env as follows:

   $ rdwr_boot_cfg write_var MOSTRECENTKERNEL=0
   $ rdwr_boot_cfg write_var WATCHDOG_COUNT=0
   $ rdwr_boot_cfg write_var bootcmd="run boot_flash"

10. Reboot AP.  This time it should be into OpenWRT.  GE1/LAN1 will be
   a DHCP **server** and have static IP 192.168.1.1 -- just like step 5.

11. SSH into the LAN port and reconfigure to final configuration. Don't
   make any changes that prevent you from SSH or Luci access!

Restoring Extreme Networks firmware
-----------------------------------

Assuming you have the original Extreme Networks image:

1. Login to OpenWRT shell

2. scp the Extreme Networks packaged firmware image file AP391x-*.img to
   /tmp

3. Extract the firmware uimage file:

   $ tar xjf AP391x-*.img vmlinux.gz.uImage

4. Force run sysupgrade:

   $ sysupgrade -F /tmp/AP391x-*.img /

5. Restore the u-boot varable(s):

   $ rdwr_boot_cfg write_var WATCHDOG_LIMIT=3

USB 2.0 Port on AP3915e
-----------------------
Enable this by setting LED "eth:amber_or_usb_enable" to ALWAYS ON.

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Glen Lee <g2lee@yahoo.com>
2023-09-25 23:21:09 +02:00
Andreas Böhler
4c83b6a4f8 ipq40xx: ZTE MF282 Plus fix sysupgrade
While adding support for the MF282 Plus, an entry in platform.sh was
overlooked - this fixes sysupgrade on this devices.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-25 20:18:52 +02:00
Andreas Böhler
964b576fc1 ipq40xx: ZTE MF287 fix sysupgrade
While refactoring support for the MF287 series, an entry in platform.sh
was overlooked - this fixes sysupgrade on this devices.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-25 20:18:04 +02:00
Christian Marangi
ab015abd4a
ipq40xx: drop patches/files/config for kernel 5.15
Drop patches/files/config for kernel 5.15 now that they are not used
anymore.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-25 19:33:28 +02:00
Christian Marangi
d686f2153c
ipq40xx: move to kernel 6.1 by default
Move ipq40xx to kernel 6.1 by default.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-25 19:33:28 +02:00
Leon M. Busch-George
98d325aaf8 ipq40xx: wpj428: panic on squashfs error to work around boot limbo
Apparently, a few ipq40xx devices have sporadic problems when reading the
flash over SPI. When that happens, the result of the faulty SPI read is
cached and it isn't re-attempted. Depending on when it happens, the router
either panics and reboots or is left in a partially broken state (an
application wont start).
The data on the flash is alright.

This wasn't the case with Openwrt with Linux < 5.x but I wasn't able to
work out which software change was responsible.

Github user karlpip created a patch for testing that disabled the cache
entirely and added logs. Typically, only one or two SPI operations fail at
a time:

  [689200.631152] spi-nor spi0.0: SPI transfer failed: -110
  [689200.631280] spi_master spi0: failed to transfer one message from queue
  [689200.635369] jffs2: Write of 68 bytes at 0x00ffccf4 failed. returned -110, retlen 0
  [689200.642014] jffs2: Not marking the space at 0x00ffccf4 as dirty because the flash driver returned retlen zero

Because reads aren't re-attempted, squashfs can't recover:

  [3171844.279235] SQUASHFS error: Failed to read block 0x2bb912: -5
  [3171844.279284] SQUASHFS error: Unable to read fragment cache entry [2bb912]
  [3171844.283980] SQUASHFS error: Unable to read page, block 2bb912, size 14e6c
  [3171844.291650] SQUASHFS error: Unable to read fragment cache entry [2bb912]
  [3171844.297831] SQUASHFS error: Unable to read page, block 2bb912, size 14e6c

I assume there to be some kind of underlying electrical problem because,
in my experience, this happens a lot more when PoE is used.

NoTengoBattery has made an in-depth investigation:
https://forum.openwrt.org/t/patch-squashfs-data-probably-corrupt/70480

.. and created a patch that evicts the page cache and retries reading:
https://github.com/NoTengoBattery/openwrt/blob/linksys-ea6350v3-mastertrack/target/linux/ipq40xx/patches-5.4/9996-fs_squashfs_improve_squashfs_error_resistance.patch

The patch also works well with the WPJ428 but NoTengoBattery didn't try to
upstream it ("This is not the solution that should be used").

In 2020, I tried and failed to create a working patch that prevents faulty pages to
be cached in the first place. Because I needed a solution, I backported
  "squashfs: add option to panic on errors " (10dde05b89980ef)
which has since become available in Openwrt.

The 'error=panic' option has been tested on a fleet of multiple hundred
WPJ428s over multiple years. Without this patch, devices regularly went
into 'limbo' on reboot or update and required a manual reboot.
Devices with this patch don't. I was initially concerned that the kernel
panic would leave devices with a real corrupted data but I haven't seen a
case of actual corruption since (outside of people turning off the power
during upgrades).

The WPJ428 is the only device I tested this patch on - others might also
benefit.

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
2023-09-24 18:55:35 +02:00
John Audia
e3559fb445
kernel: bump 6.1 to 6.1.54
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.54

Removed upstreamed:
	generic/backport-6.1/020-v6.3-02-UPSTREAM-mm-multi-gen-LRU-rename-lrugen-lists-to-lru.patch[1]
	ipq806x/patches-6.1/140-v6.5-hwspinlock-qcom-add-missing-regmap-config-for-SFPB-M.patch[2]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.54&id=a73d04c460521e45f257d28d73df096e41ece324
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.54&id=e93bc372dbc0bde133c854c03502a95617041972

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-09-23 13:10:28 +02:00
Andreas Böhler
7354d17ff4
ipq4019: add support for ZTE MF282 Plus aka DreiTube
The ZTE MF282 Plus is a LTE router used (exclusively?) by the network
operator "3". It is very similar to the MF286/MF287 but in the form factor
of the MF282.

Specifications
==============

SoC: IPQ4019
RAM: 256MiB
Flash: 8MiB SPI-NOR + 128MiB SPI-NAND
LAN: 1x GBit LAN
LTE: ZTE Cat6
WiFi: 802.11a/b/g/n/ac SoC-integrated

MAC addresses
=============

LAN: from config
WiFi 1: from config + 1
WiFi 2: from config + 2

Installation
============

Option 1 - TFTP
---------------

TFTP installation using UART is preferred. Disassemble the device and
connect serial. Put the initramfs image as openwrt.bin to your TFTP server
and configure a static IP of 192.168.1.100. Load the initramfs image by
typing:

  setenv serverip 192.168.1.100
  setenv ipaddr 192.168.1.1
  tftpboot 0x84000000 openwrt.bin
  bootm 0x84000000

From this intiramfs boot you can take a backup of the currently installed
partitions as no vendor firmware is available for download:

  ubiattach -m9
  cat /dev/ubi0_0 > /tmp/ubi0_0
  cat /dev/ubi0_1 > /tmp/ubi0_1

Copy the files /tmp/ubi0_0 and /tmp/ubi0_1 somewhere save.

Once booted, transfer the sysupgrade image and run sysupgrade. You might
have to delete the stock volumes first:

  ubirmvol /dev/ubi0 -N ubi_rootfs
  ubirmvol /dev/ubi0 -N kernel

Option 2 - From stock firmware
------------------------------

The installation from stock requires an exploit first. The exploit consists
of a backup file that forces the firmware to download telnetd via TFTP from
192.168.0.22 and run it. Once exploited, you can connect via telnet and
login as admin:admin.

The exploit will be available at the device wiki page.

Once inside the stock firmware, you can transfer the -factory.bin file to
/tmp by using "scp" from the stock frmware or "tftp".

ZTE has blocked writing to the NAND. Fortunately, it's easy to allow write
access - you need to read from one file in /proc. Once done, you need to
erase the UBI partition and flash OpenWrt. Before performing the operation,
make sure that mtd9 is the partition labelled "rootfs" by calling
"cat /proc/mtd".

Complete commands:

  cd /tmp
  tftp -g -r factory.bin 192.168.0.22
  cat /proc/driver/sensor_id
  flash_erase /dev/mtd9 0 0
  dd if=/tmp/factory.bin of=/dev/mtdblock9 bs=131072

Afterwards, reboot your device and you should have a working OpenWrt
installation.

Restore Stock
=============

Option 1 - via UART
-------------------

Boot an OpenWrt initramfs image via TFTP as for the initial installation.
Transfer the two backed-up files to your box to /tmp.

Then, run the following commands - replace $kernel_length and $rootfs_size
by the size of ubi0_0 and ubi0_1 in bytes.

  ubiattach -m 9
  ubirmvol /dev/ubi0 -N kernel
  ubirmvol /dev/ubi0 -N rootfs
  ubirmvol /dev/ubi0 -N rootfs_data
  ubimkvol /dev/ubi0 -N kernel -s $kernel_length
  ubimkvol /dev/ubi0 -N ubi_rootfs -s $rootfs_size
  ubiupdatevol /dev/ubi0_0 /tmp/ubi0_0
  ubiupdatevol /dev/ubi0_1 /tmp/ubi0_1

Option 2 - from within OpenWrt
------------------------------

This option requires to flash an initramfs version first so that access
to the flash is possible. This can be achieved by sysupgrading to the
recovery.bin version and rebooting. Once rebooted, you are again in a
default OpenWrt installation, but no partition is mounted.

Follow the commands from Option 1 to flash back to stock.

LTE Modem
=========

The LTE modem is similar to the MF286R, it provides an RNDIS interface
and an AT interface.

Other Notes
===========

There is one GPIO Switch "Power button blocker" which, if enabled, does not
trigger a reset of the SoC if the modem reboots. If disabled, the SoC is
rebooted along with the modem. The modem can be rebooted via the exported
GPIO "modem-reset" in /sys/class/gpio.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-20 14:29:20 +02:00
Andreas Böhler
053f8f92d1
ipq40xx: ZTE MF287 series: move to gpio-export for modem-reset GPIO
Turn the "gpio-restart" node into a "gpio-export" node for all MF287
variants, similar to the MF287 Pro. Unfortunately, there doesn't seem to be
a "power button blocker" GPIO for the MF287 and MF287 Plus, so a modem
reset always triggers a system reset.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-19 11:43:36 +02:00
Andreas Böhler
9c7578d560
ipq40xx: refactor ZTE MF287 series
The ZTE MF287 requires a different board calibration file for ath10k than
the ZTE MF287+. The two devices receive their own DTS, thus the device tree
is slightly refactored.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-19 11:43:36 +02:00
Chukun Pan
9889de3397
ipq40xx: add support for YYeTs LE1
Hardware Highlights:
SoC:	  Qualcomm IPQ4019 717 MHz
RAM:	  512M NT5CC256M16ER-EK
Flash:    32M SPI NOR MX25L25635F
WIFI1:    2.4 GHz 2T2R integrated
WIFI2:    5 GHz 2T2R integrated
Ethernet: QCA8075 (4x LAN, 1x WAN)
LEDS:     power, wlan2g, wlan5g, usb
USB:      1x 3.0
Button:   Reset

Installation:
  Upload factory.bin in stock firmware's upgrade
  page, and this will take a few minutes.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-09-18 12:20:04 +02:00
Andreas Böhler
a9cc3708e0
ipq40xx: fix image building for ZTE MF287 series
For the ZTE MF287 series, a special recovery image is built. The Makefile
worked fine on snapshot, but created corrupt images on the 23.05 images.
By using the appropriate variable, this should be fixed.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
2023-09-18 11:49:37 +02:00
Robert Marko
98bad1b4fc ipq40xx: 6.1: add missing secure QFPROM symbol
Kernel config for 6.1 on ipq40xx is missing the config for
CONFIG_NVMEM_QCOM_SEC_QFPROM which them makes the build stop with a prompt.

Symbol is there in 5.15 config but 6.1 config was based of a version that
does not yet have it set as it was introduced after the 6.1 PR.

So, disable CONFIG_NVMEM_QCOM_SEC_QFPROM to fix building on 6.1.

Fixes: 825cfa4e36 ("ipq40xx: 6.1: refresh kernel config")
Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 22:19:23 +02:00
Robert Marko
b50827fb10
ipq40xx: add 6.1 as testing kernel
Allow selecting 6.1 as the testing kernel.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:25 +02:00
Robert Marko
825cfa4e36
ipq40xx: 6.1: refresh kernel config
Refresh the kernel config via make kernel_menuconfig.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:24 +02:00
Robert Marko
cd9c721124
ipq40xx: 6.1: use latest DSA and ethernet patches
This pulls-in the latest version of qca8k based IPQ4019 driver as well as
the latest version of IPQESS that was sent upstream.

Both qca8k and IPQESS have been improved and cleaned up compared to current
version of patches.

PSGMII PHY mode and missing reset have been upstreamed and will be in
the kernel 6.6.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-09-17 21:00:24 +02:00
Robert Marko
4c010932a5
ipq40xx: 6.1: adapt and refresh patches
Adapt and refresh patches to apply.

DSA and ethernet driver patches are dropped as they will be replaced with
the latest version that was sent upstream.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:24 +02:00
Robert Marko
3d6d8bcd8f
ipq40xx: qca807x: adapt for 6.1
Kernel 6.1 has changed format of sfp_parse_support(), so lets adapt to
those changes so it works on newer kernels as well.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:23 +02:00
Robert Marko
bd242a42a6
ipq40xx: copy 5.15 patches and config to 6.1
Copy the 5.15 patches and config as a base for 6.1 support.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:23 +02:00
Robert Marko
70dfb696c0
ipq40xx: update ESS reset patch with pending upstream
Use the split version of ESS reset patch that was sent upstream.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:23 +02:00
Robert Marko
9bfbdfa778
ipq40xx: move DSA and ethernet driver to 5.15 specific directory
As a preparation to move to 6.1, we need to move the DSA and ethernet
drivers to a 5.15 specific directory as 6.1 will use the latest patchset
that was sent upstream which is too hard to backport to 5.15.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2023-09-17 21:00:22 +02:00
Thomas Makin
3121bf4f13
ipq40xx: add support for Netgear RBX40
This adds support for the RBR40 and RBS40 (sold together as RBK40),
two netgear routers identical to SRR60/SRS60 in all but antennae (and
hardware id). See 2cb24b3f3c for details.

Signed-off-by: Thomas Makin <halorocker89@gmail.com>
2023-09-16 12:08:03 +02:00
Thomas Bong
8554a4a7e3 ipq40xx: compress kernel for Magic 2 WiFi next
The bootcmd limits the kernel to 4 MiB which is
exceeded when using Device/FitImage. Device/FitzImage
reduces the size to around 3 MiB.

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Thomas Bong <thomas.bong@devolo.de>
2023-09-03 23:11:51 +02:00