Commit Graph

864 Commits

Author SHA1 Message Date
David Bauer
f82ccee512 mediatek: make GL-MT2500 image work with U-Boot recovery
Append metadata in the special GL.iNet format.
This also enables use of the web-based U-Boot recovery.

U-Boot-Recovery
===============

The GL-MT2500 provides web-based U-Boot recovery. For this, hold the
reset button pressed for 5 seconds when attaching power to the device.

The LED will blink 5 times. Release the reset button.

The OpenWrt sysupgrade image can be installed by navigating to
http://192.168.1.1 in a web-browser.

The device does not work as a DHCP server, so manual IP configuration is
required.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-12-03 06:50:52 +01:00
David Bauer
9217d85a2c mediatek: remove kernel build-directives for GL-MT2500
The build-directives for the GL-MT2500 are not required, as the default
ones produce working images.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-12-03 06:49:03 +01:00
David Bauer
fd1a14a75e mediatek: add missing eMMC packages for GL-MT2500
Signed-off-by: David Bauer <mail@david-bauer.net>
2023-12-03 06:49:03 +01:00
Chen Minqiang
cb86e313d3 mediatek: filogic: Update bootcount init script permissions
Change permissions of the bootcount init script from old mode 100644
to new mode 100755 to ensure its executability.

Fixes: 6cc14bf66a ("filogic: support Telenor branded ZyXEL EX5700")
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2023-12-02 21:57:38 +01:00
Luis Mita
2af07eb853 mediatek: add support for Confiabits MT7981
Confiabits MT7981 is a Wi-Fi 6 router based on MediaTek MT7981.

Specification:
 - SoC: MediaTek MT7981B
 - CPU: 2x 1.3 GHz Cortex-A53
 - Flash: 128 MiB SPI NAND
 - RAM: 256 MiB
 - WLAN: 2.4 GHz, 5 GHz (MediaTek MT7976CN, 802.11ax)
 - Ethernet: 4x 10/100/1000 Mbps MT7531AE (3xLAN, 1xWAN)
 - USB 2.0 port
 - Buttons: 1 Reset button, 1 Mesh button.
 - LEDs: 7x light-blue, 2x warm-white
 - Serial console: internal 4-pin header, 115200 8n1
 - Power: 12 VDC, 1.5 A

MAC addresses in stock firmware and in this commit:
+---------+-------------------+-----------+
|         | MAC               | Algorithm |
+---------+-------------------+-----------+
| WAN     | 00:0c:43:xx:xx:e1 | label+1   |
| LAN     | 00:0c:43:xx:xx:e0 | label     |
| WLAN 2g | 00:0c:43:xx:xx:e0 | label     |
| WLAN 5g | 02:0c:43:xx:xx:e0 |           |
+---------+-------------------+-----------+
The label MAC was found in 'Factory', 0x4

Installation:
The stock firmware is OpenWrt-based. If you can reach LuCI or SSH, just use the sysupgrade image
with the 'Keep settings' option turned off.

Signed-off-by: Luis Mita <luis@luismita.com>
2023-11-29 23:52:14 +01:00
John Audia
6c118efc01 kernel: bump 5.15 to 5.15.140
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.140

Removed upstreamed:
	mvebu/patches-5.15/106-Revert-i2c-pxa-move-to-generic-GPIO-recovery.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.140&id=06d320ca170b4e59bb261e2ce3ffe84e9154d42b

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-11-29 23:41:33 +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
Daniel Golle
507ad4f078 mediatek: add kmod-usb3 to default package set of the ZBT-Z8102AX
Include XHCI USB drivers on the ZBT-Z8102AX router, the drivers are
required to be able to use the USB-connected M.2 slots for 4G/5G modems.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-11-29 21:13:32 +00:00
David Bauer
6b73d9bf49 mediatek: copy config for Acer Predator W6
Config was previously not copied on sysupgrade.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-11-27 08:02:41 +01:00
David Bauer
1239668648 mediatek: add support for GL.iNet GL-MT2500
Hardware
--------
SoC:  MediaTek MT7981BA
RAM:  1GB DDR4 (NANYA NT5AD512M16C4-JR)
MMC:  8GB eMMC (Samsung 8GTF4R)
ETH:  1000Base-T LAN (ePHY)
      2500Base-T WAN (MaxLinear GPY211C)
BTN:  1x Reset Button
LED:  System (blue/white)
      VPN (white)
USB:  1x USB-A (USB 3.0)
UART: 115200 8N1 - Pinout on board next to LAN port
      Don't connect 3.3V!

Known Issues
------------
U-Boot vendor recovery does not seem to accept any images, neither
GL.iNet images nor OpenWrt images. Recovery requires serial access!

Installation
------------
Upload the OpenWrt sysupgrade image to the Gl.iNet Web-UI. Make sure to
not retain existing settings.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-11-27 08:02:41 +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
Rosen Penev
3eb899fd36
mediatek: use mac-base
mac-address-increment is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:45:26 +01:00
Rosen Penev
405bc5be13
mediatek: convert to nvmem-layout
Will allow removing mac-address-increment.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:45:26 +01:00
Chukun Pan
07482d15af
mediatek: filogic: reorder alphabetically
Reorder scripts and image recipes to keep alphabetical order.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-11-25 23:16:35 +01:00
Chukun Pan
b74ae69596
mediatek: filogic: remove kmod-usb2 for GL-MT6000
The usb driver requires kmod-usb3, not kmod-usb2.
Remove the useless kmod-usb2 from default package.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-11-25 23:16:34 +01:00
Chukun Pan
1be6347b7d
mediatek: Cetron CT3003: fixes typo for spi properties
Same as commit 3674689, correct 'buswidth' to 'bus-width'.
Also move the nmbm properties outside the partition definition.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-11-25 23:16:34 +01:00
Hauke Mehrtens
d99aed31a0 mediatek: filogic: Fix GPIOs for Zbtlink ZBT-Z8102AX
The PGIO configuration should be added for the ZBT-Z8102AX and not the ZBT-Z8103AX

Fixes: c8c2f52262 ("mediatek: add support for Zbtlink ZBT-Z8102AX")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2023-11-25 22:25:42 +01:00
Valerio 'ftp21' Mancini
b5df398a36 mediatek: add Zyxel EX5601-T0 with uboot custom partition
The flash procedure is similar to the Xiaomi AX6000 router.

Load openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb from original Zyxel U-Boot:

tftpboot openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb
bootm 0x46000000
Load mtd-rw
insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1

Format ubi and create ubootenv partitions

ubidetach -p /dev/mtd5; ubiformat /dev/mtd5 -y; ubiattach -p /dev/mtd5
ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
Copy openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb to /tmp and create recovery partition.
If your recovery image is larger than 10MiB, size the recovery partition accordingly to make it fit.

ubimkvol /dev/ubi0 -n 2 -N recovery -s 10MiB
ubiupdatevol /dev/ubi0_2  openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-initramfs-recovery.itb
Copy preloader and uboot to /tmp and write them in the mtd

mtd write /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-preloader.bin bl2
mtd write /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-bl31-uboot.fip fip
Now write the firmware:
sysupgrade -n  /tmp/openwrt-mediatek-filogic-zyxel_ex5601-t0-ubootmod-squashfs-sysupgrade.itb

To create a correct BL2, I had to add a profile for 'spim:4k+256' as I could not find a way to value the variable 'NAND_TYPE'.

Features and fixes from hitech95 tree has been squashed, I'm attaching his commit message:

The Power LED was not working correctly and not reacting
 to the boot process and statuses.

The board has space (footprint) for an unpopulated Zigbee chip,
 while we dont know the device model having this chip populated
 we have to assure that the common dts doesnt enable
 interfaces that share pins with such device.

In this instance the PCIe and the uart1 and uart2 are disabled.
Some of the control PCIE pins seems to be used for the Zigbee chip,
 UART1 seems to be used as a flash port while UART2 should be the
 main comunication interface of Zigbee chip.

The Zigbee chip should be a EFR32MG21. But the pins used for UART
 seems to be not on standard PINS used by other adapters.
 So it cannot run firmwares shared on the web.
 But it should be possible to build a custom firmware with
 the corrtect pinmux.

This commit also contains the following squashed commit from hitech95
 - mediatek: fix sysupgrade for Zyxel EX7601-T0 ubootmod

Changes and fixes added in common board:
 - added aliases for boot status leds.
 - added aliases for the mac-label-device.
 - added pin claims for core features (MDIO and UART 0)
 - added default LEDs configuration (01_leds)
 - added default network configuration (02_network)
 - added missing kmod-usb3 module for USB3
 - fixed LED names
 - fixed reset pin for SLIC chip
 - removed unused pinmux configurations and devices
 - fix LAN (switch) port numbering
 - using nvmem cells for wifi eeprom, dropping deprecated "mediatek,mtd-eeprom"
 - proper factory partition and mac address handling
 - cleaned up spi_nand sections and partition

Changes and fixxes added in stock layout:
 - added NMBM, if u-boot has it, the kernel must be informed.

Co-authored-by: Nicolò Veronese <nicveronese@gmail.com>
Co-developed-by: Nicolò Veronese <nicveronese@gmail.com>
Signed-off-by: Nicolò Veronese <nicveronese@gmail.com>
Signed-off-by: Valerio 'ftp21' Mancini <ftp21@ftp21.eu>
2023-11-25 14:51:21 +01:00
Daniel Golle
1b70025ad1 mediatek: remove DTS property added by mistake
Remove bogus 'phy-handle = <&phy0>;', an undefined reference.

Fixes: c8c2f52262 ("mediatek: add support for Zbtlink ZBT-Z8102AX")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-11-25 03:22:47 +00:00
Daniel Golle
c8c2f52262 mediatek: add support for Zbtlink ZBT-Z8102AX
Specifications:
SoC: MediaTek MT7981B
RAM: 1024MiB
Flash: SPI-NAND 128 MiB
Switch: 1 WAN, 4 LAN (Gigabit)
USB: two M.2 slots for 5G modems via USB 3.0 hub, external USB 3.0 port
Buttons: Reset, Mesh
Power: DC 12V 1A
WiFi: MT7976CN
UART: 115200n8
UART Layout:
VCC-RX-TX-GND

Installation:
A. Through OpenWrt Dashboard:
If your router comes with OpenWrt preinstalled (modified by the seller),
you can easily upgrade by going to the dashboard (192.168.1.1) and then
navigate to System -> Backup/Flash firmware, then flash the firmware

B. Through TFTP
Standard installation via UART:

1. Connect USB Serial Adapter to the UART, (NOTE: Don't connect the VCC pin).
2. Power on the router. Make sure that you can access your router via UART.
3. Restart the router then repeatedly press ctrl + c to skip default boot.
4. Type > bootmenu
5. Press '2' to select upgrade firmware
6. Press 'Y' on 'Run image after upgrading?'
7. Press '0' and hit 'enter' to select TFTP client (default)
8. Fill the U-Boot's IP address and TFTP server's IP address.
9. Finally, enter the 'firmware' filename.

Based on patch adding support for similar Zbtlink ZBT-Z8103AX device by
Ian Ishmael C. Oderon.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-11-24 21:28:35 +00: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
Rani Hod
aaeb379023 mediatek: fiilogic: device tree switch@1f fix
Quite a few `fiilogic` devices use the `mt7531` switch.
Some of them have a DT node that looks like:
```
switch: switch@0 {
	compatible = "mediatek,mt7531";
	reg = <31>;
...
};
```
This commit changes the DT node name to `switch@1f`.

Signed-off-by: Rani Hod <rani.hod@gmail.com>
2023-11-22 19:42:23 +02:00
Chukun Pan
626344c992 mediatek: filogic: add JCG Q30 PRO support
Hardware specification:
  SoC: MediaTek MT7981B 2x A53
  Flash: Winbond 128MB
  RAM: DDR3 256MB
  Ethernet: 4x 10/100/1000 Mbps
  Switch: MediaTek MT7531AE
  WiFi: MediaTek MT7976C
  Button: Reset
  Power: DC 12V 1A

Flash instructions:
  1. Connect to your PC via the Gigabit port of the router,
     set a static ip on the ethernet interface of your PC.
     (ip 192.168.1.254, gateway 192.168.1.1)
  2. Attach UART, pause at u-boot menu.
  3. Select "Upgrade ATF BL2", then use preloader.bin
  4. Select "Upgrade ATF FIP", then use bl31-uboot.fip
  5. Download the initramfs image, and type "reset",
     waiting for tftp recovery to complete.
  6. After openwrt boots up, perform sysupgrade.

Note:
  1. Since NMBM is disabled, we must back up all partitions.
  2. Although we can upgrade new firmware in the stock firmware,
     we need the special fit image signature of MediaTek and
     dual boot (hack kernel) to make u-boot boot it. So just
     abandon these hacks and flash it via the serial port.

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-11-19 16:52:16 +01:00
Petr Štetiar
8fc496be86
treewide: fix shell errors during dump stage
Fixes following issues:

 bash: -c: line 1: `echo 1686820180<LINUX_VERMAGIC> | /staging_dir/host/bin/mkhash md5 | cut -b1-8'
 bash: -c: line 1: `echo 1686820180<LINUX_VERMAGIC> | /staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/''
 bash: -c: line 1: syntax error near unexpected token `|'
 bash: line 1: *1024*1024: syntax error: operand expected (error token is "*1024*1024")
 bash: line 1: (64 + ): syntax error: operand expected (error token is ")")
 expr: syntax error: missing argument after '+'

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-11-13 14:01:25 +01:00
Roland Reinl
44cd32d764 mediatek: Add support for TP-Link EAP225v5
Device specification:
- MT7629 with 16MB NOR flash W25Q128 and 128 MB DDR3 RAM.
- MT7761N and MT7762N wireless chips (currenlty no driver in OpenWrt available)
  - WiFi is NOT working on this device
- Dual core but second CPU doesn't seem to work (Error message during boot: "CPU1: failed to come online")

There are two similar merge requests for similar devices with the same issues:
- https://github.com/openwrt/openwrt/pull/12286
- https://github.com/openwrt/openwrt/pull/5084

UART interface is next to the reset button, pinout:
- 1: TX (the pin with the arrow marker)
- 2: RX
- 3: GND
- 4: VCC

UART settings: 115200,8n1, 3.3V

U-Boot menu can be entered by pressing Ctrl+B during startup.

Booting initramfs:
- Set your computers IP adress to 192.168.1.110
- Run a TFTP server providing the initramfs image
- Power on the AP, press Ctrl+B to get to the U-Boot menu
- Select "1. System Load Linux to SDRAM via TFTP"
- Update kernel file name, input server IP and input device IP (if they deviate from the defaults)
- After booting, create a backup of all partitions, especially for kernel and root_fs. They are required for reverting back to stock firmware
- The sysupgrade image can be flashed now

MAC adresses:
- LAN and 2.4GHz use the same MAC (the one printed on the device)
- 5GHz WiFi MAC is LAN MAC + 1

GPIOs:
- GPIO 21 is the reset pin (low active)
- GPIO 55 is for the green LED (active high)
- GPIO 56 is for the yellow/amber LED (active high)

Signed-off-by: Roland Reinl <reinlroland+github@gmail.com>
2023-11-12 17:39:52 +01:00
Roland Reinl
e3a6945b58 mediatek: Add support for D-Link EAGLE PRO AI M32
Specification:
 - MT7622BV SoC with 2.4GHz wifi
 - MT7975AN + MT7915AN for 5GHz
 - MT7531BE Switch
 - 512MB RAM
 - 128 MB flash
 - 3 LEDs (red, orange, white)
 - 2 buttons (WPS and Reset)

MAC addresses:
 - WAN MAC is stored in partition "Odm" at offset 0x83
 - LAN (as printed on the device) is WAN MAC + 1
 - WLAN MAC (2.4 GHz) is WAN MAC + 2
 - WLAN MAC (5GHz) is WAN MAC + 3

Disassembly: Remove 4 screws in the bottom and 2 screws in the top (after removing the blue cover on the top), then the board can be pulled out.

The pins for the serial console are already labeled on the board (VCC, TX, RX, GND). Serial settings: 3.3V, 115200,8n1

Flashing via Recovery Web Interface:
- Set your IP address to 192.168.0.10, subnetmask 255.255.255.25
- Press the reset button while powering on the deivce
- Keep the reset button pressed until the status LED blinks fast
- Open a Chromium based and goto http://192.168.0.1
- Download openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-recovery.bin

Flashing via uBoot:
- Open the case, connect to the UART console
- Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router
- Run a tftp server which provides openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-initramfs-kernel.bin. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later.
- Power on the device and select "1. System Load Linux to SDRAM via TFTP." in the boot menu
- Enter image file, tftp server IP and device IP (if they differ from the default).
- TFTP download to RAM will start. After a few seconds OpenWrt initramfs should start
- The initramfs is accessible via 192.168.1.1, change your IP address accordingly (or use multiple IP addresses on your interface)
- Create a backup of the Kernel1 partition, this file is required if a revert to stock should be done later
- Perform a sysupgrade using openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-squashfs-sysupgrade.bin
- Reboot the device. OpenWrt should start from flash now

Revert back to stock using the Recovery Web Interface:
- Set your IP address to 192.168.0.10, subnetmask 255.255.255.25
- Press the reset button while powering on the deivce
- Keep the reset button pressed until the status LED blinks fast
- Open a Chromium based and goto http://192.168.0.1
- Flash a decrypted firmware image from D-Link. Decrypting an firmware image is described below.

Decrypting a D-Link firmware image:
- Download https://github.com/RolandoMagico/firmware-utils/blob/M32/src/m32-firmware-util.c
- Compile a binary from the downloaded file, e.g. gcc m32-firmware-util.c -lcrypto -o m32-firmware-util
- Run ./m32-firmware-util M32 --DecryptFactoryImage <OriginalFirmware> <OutputFile>
- Example for firmware 1.03.01_HOTFIX: ./m32-firmware-util M32 --DecryptFactoryImage M32-REVA_1.03.01_HOTFIX.enc.bin M32-REVA_1.03.01_HOTFIX.decrypted.bin

Revert back to stock using uBoot:
- Open the case, connect to the UART console
- Set your IP address to 10.10.10.3, subnet mask 255.255.255.0. Connect to one of the LAN interfaces of the router
- Run a tftp server which provides the previously created backup of the Kernel1 partition. You can rename the file to iverson_uImage (no extension), then you don't have to enter the whole file name in uboot later.
- Power on the device and select "2. System Load Linux Kernel then write to Flash via TFTP." in the boot menu
- Enter image file, tftp server IP and device IP (if they differ from the default).
- TFTP download to FLASH will start. After a few seconds the stock firmware should start again

There is also an image openwrt-mediatek-mt7622-dlink_eagle-pro-ai-m32-a1-squashfs-tftp.bin which can directly be flashed via U-Boot and TFTP. It can be used if no backup of the Kernel1 partition is reuqired.

Flahsing via OEM web interface is currently not possible, the OEM images are encrypted and require a specific memory layout which is not compatible to the partition layout of OpenWrt.

Signed-off-by: Roland Reinl <reinlroland+github@gmail.com>
2023-11-12 17:33:41 +01:00
John Audia
573c8c3d78 kernel: bump 5.15 to 5.15.138
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.138

Removed upstreamed:
	generic/backport-5.15/819-v6.6-0018-nvmem-imx-correct-nregs-for-i.MX6SLL.patch[1]
	generic/backport-5.15/819-v6.6-0019-nvmem-imx-correct-nregs-for-i.MX6UL.patch[2]
	generic/backport-5.15/819-v6.6-0020-nvmem-imx-correct-nregs-for-i.MX6ULL.patch[3]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6e22bf6f00d593b0a7e0b2f418fde89317424671
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6efd498009b987a92f57f3bdae476f0503364fb7
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.138&id=6e22bf6f00d593b0a7e0b2f418fde89317424671

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-11-10 17:33:59 +01:00
David Bauer
ae500e62e2 mediatek: add label-mac for GL.iNet GL-MT3000
The MAC-address of gmac0 matches the one printed on the bottom label.

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-11-03 23:06:33 +01:00
Łukasz M
5a603c7a31 mediatek: mt7981: improve fan behaviour
This doubles the number of cooling-levels.
In addition the fan is turned on with a low speed at lower temperatures
and with a higher speed at higher temperatures.
This also attempts to reduce the likelihood of constant start-stop actions.

The change only affects the GL.iNet MT3000 and has been tested with it.

Signed-off-by: Łukasz M <lukasz1992m@gmail.com>
2023-11-03 23:06:07 +01:00
Mikhail Zhilkin
45a50a06fb treewide: fix MERCUSYS brand spelling
This commit fixes MERCUSYS brand spelling. The proper name is capitalized.

Link: https://www.mercusys.com/
Link: https://github.com/torvalds/linux/blob/master/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c#L7779

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-11-03 23:06:07 +01:00
Patryk Kowalczyk
0c3f4bd85e filogic: fix wifi eeprom filename for tuf-ax6000
The router use mt7986_eeprom_mt7976_dual.bin

Fixes: d522ccecb2 ("filogic: add support for ASUS TUF AX6000")

Signed-off-by: Patryk Kowalczyk <patryk@kowalczyk.ws>
2023-11-03 23:06:07 +01:00
Patryk Kowalczyk
d522ccecb2 filogic: add support for ASUS TUF AX6000
Hardware
========
SOC: MediaTek MT7986
RAM: 512MB DDR3
FLASH: 256MB SPI-NAND
WIFI: Mediatek MT7986 DBDC 802.11ax 2.4/5 GHz 4T4R
ETH: MediaTek MT7530 Switch (LAN)
MaxLinear GPY211C 2.5 N-Base-T PHY (WAN)
MaxLinear GPY211C 2.5 N-Base-T PHY (LAN)
UART: 3V3 115200 8N1 (Do not connect VCC)
USB 3.1

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

Download the OpenWrt initramfs image. Copy the image to a TFTP server
reachable at 192.168.1.70/24. Rename the image to TUF-AX6000.bin.

Connect to the serial console, interrupt the auto boot process by
pressing '4' when prompted or press '1' and set client IP, server
IP and name of the image.

yOU don't need to open the case or even soldering anything.
use three goldpin wires, remove their plastic cover and connect
them to the console pinout via the case holes.

You can see three holes
From Bottom: RX, TX, Ground - partially covered

Download & Boot the OpenWrt initramfs image.

In case of option '4'
$ setenv ipaddr 192.168.1.1
$ setenv serverip 192.168.1.70
$ tftpboot 0x46000000 TUF-AX6000.bin
$ bootm 0x46000000

In case of option '1'
1: Load System code to SDRAM via TFTP.
Please Input new ones /or Ctrl-C to discard
Input device IP (192.168.1.1) ==:
Input server IP (192.168.1.70) ==:
Input Linux Kernel filename (TUF-AX6000.trx) ==:

Wait for OpenWrt to boot. Transfer the sysupgrade
image to the device using scp and install using sysupgrade.

$ sysupgrade -n <path-to-sysupgrade.bin>

Missing features
================

2.5Gb LAN port LED is ON during boot or when the LAN cable is disconnected

The cover yellow light is not supported. (only blue one)

Signed-off-by: Patryk Kowalczyk <patryk@kowalczyk.ws>
2023-10-31 21:12:15 +01:00
Tianling Shen
423186d7d8 mediatek: add CMCC RAX3000M support
Hardware specification:
  SoC: MediaTek MT7981B 2x A53
  Flash: 64GB eMMC or 128 MB SPI-NAND
  RAM: 512MB
  Ethernet: 4x 10/100/1000 Mbps
  Switch: MediaTek MT7531AE
  WiFi: MediaTek MT7976C
  Button: Reset, Mesh
  Power: DC 12V 1A
- UART: 3.3v, 115200n8
  --------------------------
  |         Layout         |
  |   -----------------    |
  | 4 | GND TX VCC RX | <= |
  |   -----------------    |
  --------------------------

Gain SSH access:
1. Login into web interface, and download the configuration.
2. Enter fakeroot, decompress the configuration:
   tar -zxf cfg_export_config_file.conf
3. Edit 'etc/config/dropbear', set 'enable' to '1'.
4. Edit 'etc/shadow', update (remove) root password:
   'root::19523:0:99999:7:::'
5. Repack 'etc' directory:
   tar -zcf cfg_export_config_file.conf etc/
   * If you find an error about 'etc/wireless/mediatek/DBDC_card0.dat',
     just ignore it.
6. Upload new configuration via web interface, now you can SSH to RAX3000M.

Check stroage type:
Check the label on the back of the device:
"CH EC CMIIT ID: xxxx" is eMMC version
"CH    CMIIT ID: xxxx" is NAND version

eMMC Flash instructions:
1. SSH to RAX3000M, and backup everything, especially 'factory' part.
   ('data' partition can be ignored, it's useless.)
2. Write new GPT table:
   dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-gpt.bin of=/dev/mmcblk0 bs=512 seek=0 count=34 conv=fsync
3. Erase and write new BL2:
   echo 0 > /sys/block/mmcblk0boot0/force_ro
   dd if=/dev/zero of=/dev/mmcblk0boot0 bs=512 count=8192 conv=fsync
   dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-preloader.bin of=/dev/mmcblk0boot0 bs=512 conv=fsync
4. Erase and write new FIP:
   dd if=/dev/zero of=/dev/mmcblk0 bs=512 seek=13312 count=8192 conv=fsync
   dd if=openwrt-mediatek-filogic-cmcc_rax3000m-emmc-bl31-uboot.fip of=/dev/mmcblk0 bs=512 seek=13312 conv=fsync
5. Set static IP on your PC:
   IP 192.168.1.254, GW 192.168.1.1
6. Serve OpenWrt initramfs image using TFTP server.
7. Cut off the power and re-engage, wait for TFTP recovery to complete.
8. After OpenWrt has booted, perform sysupgrade.
9. Additionally, if you want to have eMMC recovery boot feature:
     (Don't worry! You will always have TFTP recovery boot feature.)
   dd if=openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb of=/dev/mmcblk0p4 bs=512 conv=fsync

NAND Flash instructions:
1. SSH to RAX3000M, and backup everything, especially 'Factory' part.
2. Erase and write new BL2:
   mtd erase BL2
   mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-preloader.bin BL2
3. Erase and write new FIP:
   mtd erase FIP
   mtd write openwrt-mediatek-filogic-cmcc_rax3000m-nand-bl31-uboot.fip FIP
4. Set static IP on your PC:
   IP 192.168.1.254, GW 192.168.1.1
5. Serve OpenWrt initramfs image using TFTP server.
6. Cut off the power and re-engage, wait for TFTP recovery to complete.
7. After OpenWrt has booted, erase UBI volumes:
   ubidetach -p /dev/mtd0
   ubiformat -y /dev/mtd0
   ubiattach -p /dev/mtd0
8. Create new ubootenv volumes:
   ubimkvol /dev/ubi0 -n 0 -N ubootenv -s 128KiB
   ubimkvol /dev/ubi0 -n 1 -N ubootenv2 -s 128KiB
9. Additionally, if you want to have NAND recovery boot feature:
     (Don't worry! You will always have TFTP recovery boot feature.)
   ubimkvol /dev/ubi0 -n 2 -N recovery -s 20MiB
   ubiupdatevol /dev/ubi0_2 openwrt-mediatek-filogic-cmcc_rax3000m-initramfs-recovery.itb
10. Perform sysupgrade.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2023-10-28 19:05:07 +02:00
John Audia
b357564463 kernel: bump 6.1 to 6.1.57
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.57

Manually rebased:
	generic/pending-6.1/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch

Removed upstreamed:
	qualcommax/patches-6.1/0134-PCI-qcom-Fixing-broken-pcie-enumeration-for-2_3_3-co.patch[1]

All other patches automatically rebased.

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

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

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: John Audia <therealgraysky@proton.me>
2023-10-14 15:51:53 +02:00
John Audia
1a15a8cdb9 kernel: bump 6.1 to 6.1.56
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.1.56

Removed upstreamed:
	bcm53xx/patches-6.1/032-v6.6-0008-ARM-dts-BCM5301X-Extend-RAM-to-full-256MB-for-Linksy.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.1.56&id=226590fbd96717fce218878044df3568c825ba8e

Build system: x86/64
Build-tested: x86/64/AMD Cezanne, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: x86/64/AMD Cezanne, filogic/xiaomi_redmi-router-ax6000-ubootmod

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-10-08 14:01:47 +02:00
John Audia
ac3a5911da kernel: bump 5.15 to 5.15.134
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.134

Removed upstreamed:
	generic/backport-5.15/894-Fix-up-backport-for-13619703038.patch[1]

All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.134&id=d7acb7031758141225844bea073860b48fd92092

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-10-07 10:00:03 -04:00
Daniel Golle
ed3ccf44e6 mediatek: fix wrong variable name in patch for Linux 6.1
The name of the variable holding the pointer to the private struct has
changed between Linux 5.15 and Linux 6.1 and adding the identical patch
fixing PCIe #PERST de-assert broke the build on Linux 6.1.
Also change the name in the patch to fix the build.

Fixes: 6a2e17d5c1 ("mediatek: fix PCIe #PERST being de-asserted too early")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-10-05 20:40:12 +02:00
John Audia
89895937dd kernel: bump 5.15 to 5.15.133
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.133

Removed upstreamed:
	bcm47xx/patches-5.15/101-v5.18-mtd-rawnand-brcmnand-Allow-SoC-to-provide-I-O-operations.patch[1]

Cherry picked build fix.[2] All other patches automatically rebased.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.133&id=56cf9f446b331414a15ef0e8dedf23583ec2c427
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git/tree/queue-5.15/fix-up-backport-of-136191703038-interconnect-teach-l.patch

Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
2023-10-04 21:03:12 +02:00
Daniel Golle
6a2e17d5c1
mediatek: fix PCIe #PERST being de-asserted too early
The driver for MediaTek gen3 PCIe hosts de-asserts all reset
signals at the same time using a single register write operation.
Delay the de-assertion of the #PERST signal by 100ms as some PCIe
devices fail to come up otherwise.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-10-03 17:38:34 +02:00
Mikhail Zhilkin
85b0d7592c mediatek: fix eeprom loading (Mercusys MR90X v1)
Commit mt76: drop default eeprom file for mt7986-firmware
(e3aa645b26) breaks eeprom loading for
Mercusys MR90X v1. As a result WiFi is not working at all.

This commit adds Mercusus MR90x to the caldata script (it works after the
commit mentioned above). And we can safely drop "81_fix_eeprom" script
as it's no longer required.

Fixes: e3aa645b26
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-10-02 11:40:27 +01:00
Jianhui Zhao
fe10f97439 filogic: add support for GL.iNet GL-MT6000
Hardware specification:
* SoC: MediaTek MT7986A 4x A53
* Flash: 8GB EMMC
* RAM: 1GB DDR4
* Ethernet:
  * 2x2.5G RJ45 port (RTL8221B)
  * 4x1G RJ45 ports (MT7531AE)
* WLAN:
  * 2.4GHz: MT7976GN 4T4R
  * 5GHz: MT7976AN 4T4R
* Button: Reset
* LED: 1 x dual color LED
* USB: 1 x USB 3.0
* Power: DC 12V 4A
* UART: 3V3 115200 8N1 (Pinout: GND TX RX VCC)
* JTAG: 9 PIN

If you want to use u-boot from OpenWrt, you can upgrade it safely.
* bl2: openwrt-mediatek-filogic-glinet_gl-mt6000-preloader.bin
* fip: openwrt-mediatek-filogic-glinet_gl-mt6000-bl31-uboot.fip

`openwrt-mediatek-filogic-glinet_gl-mt6000-squashfs-factory.bin` is used in OpenWrt's u-boot.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2023-09-29 00:18:26 +01:00
INAGAKI Hiroshi
7383eb266b mediatek: add support for Buffalo WSR-3200AX4S
Buffalo WSR-3200AX4S is a 2.4/5 GHz band 11ax (Wi-Fi 6) router, based on
MT7622B.

Specification:

- SoC         : MediaTek MT7622B
- RAM         : DDR3 512 MiB
- Flash       : SPI-NAND 128 MiB (Winbond W25N01GVZEIG)
- WLAN        : 2.4/5 GHz 4T4R
  - 2.4 GHz   : MediaTek MT7622B (SoC)
  - 5 GHz     : MediaTek MT7915
- Ethernet    : 5x 10/100/1000 Mbps
  - Switch    : MediaTek MT7531
- LEDs/Keys   : 6x/5x (2x: buttons, 3x: slide-switches)
- UART        : through-hole on PCB (J4)
  - assignment: 3.3V, GND, TX, RX from tri-angle marking
  - settings  : 115200n8
- Power       : 12 VDC, 1.5 A

Flash instruction using factory.bin image:

1. Boot WSR-3200AX4S with "Router" mode
2. Access to "http://192.168.11.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory.bin image and click update ("更新実行")
   button
4. Wait ~120 seconds to complete flashing

Note:

- This device has 2x OS images on flash. The first one will always be
  used for booting and the secondary is for backup.

- This support generates multiple factory*.bin image:

  - factory.bin      : for flashing from OEM WebUI
  - factory-uboot.bin: for flashing from U-Boot or clean installation
                       via sysupgrade (don't use for normal sysupgrade)

Known issues:

- Wi-Fi MAC addresses won't be applied to each adapter.

MAC Addresses:

LAN    : C4:3C:EA:xx:xx:60 (board_data, mac (text))
WAN    : C4:3C:EA:xx:xx:60 (board_data, mac (text))
2.4 GHz: C4:3C:EA:xx:xx:61
5 GHz  : C4:3C:EA:xx:xx:68

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:12 +02:00
INAGAKI Hiroshi
9f640cae75 mediatek: separate dts/dtsi for Buffalo WSR series
Separate dts/dtsi from the dts of Buffalo WSR-2533DHP2 to prepare adding
suppport for WSR-3200AX4S.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:12 +02:00
INAGAKI Hiroshi
e8646f5b3d mediatek: expand kernel size to 6MiB for WSR-2533DHP2
Expand kernel partition size on WSR-2533DHP2 for the kernel larger than
4 MiB.
To prevent upgrading from old firmware before this commit, bump the
compat version to 1.1 and add a message for forced sysupgrade using
factory-uboot.bin image.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
INAGAKI Hiroshi
d0929006f2 mediatek: merge trx helpers in image/mt7622.mk
Merge similar helpers of trx image generation, "buffalo-kernel-trx" and
"trx-nand".

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
INAGAKI Hiroshi
4d9113017b mediatek: drop pwm7_pins from Buffalo WSR-2533DHP2
MediaTek MT7622 doesn't support ch7 of PWM and pinctrl groups were dropped from
driver source[0]. So pwm7-related groups are unavailable now, then, kernel shows a
warning.

[    0.370264] mt7622-pinctrl 10211000.pinctrl: invalid group "pwm_ch7_2" for function "pwm"

Drop that pinmux from pinctrl node.

[0]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/pinctrl/mediatek/pinctrl-mt7622.c?id=57972641810a97566ffd13e4be3f6a66d61eb3b5

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
INAGAKI Hiroshi
94606abf63 mediatek: add label-mac-device for Buffalo WSR-2533DHP2
Add label-mac-device with "&gmac0" phandle for Buffalo WSR-2533DHP2.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
INAGAKI Hiroshi
de62e01652 mediatek: update NVMEM bindings for Buffalo WSR-2533DHP2
Update NVMEM-related nodes and use newer binding for MAC addresses on
Buffalo WSR-2533DHP2.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
INAGAKI Hiroshi
6b8e7144c8 mediatek: update LED/Key bindings for Buffalo WSR-2533DHP2
Update LED and key nodes with newer DeviceTree bindings for WSR-2533DHP2.

- LED
  - use led-[0-9] for node name of LEDs
  - add "color" and "function" properties
  - drop default-state = "on" from green:power LED
    - this LED will be turned on by led-running alias

- key
  - drop unnecessary poll-interval property
  - use key-[0-9] for node name of keys

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2023-09-24 18:42:11 +02:00
Elbert Mai
75ee5546e9 mediatek: filogic: add support for Ubiquiti UniFi 6 Plus (U6+)
Ubiquiti U6+ is a dual-band WiFi 6 PoE access point.
It is a drop-in upgrade of the U6 lite.

Specifications
---

- SoC: MediaTek MT7981A dual-core ARM Cortex-A53 1.3 GHz
- RAM: 256 MB DDR3-2133 RAM
- Flash: 16 MB SPI NOR and 4 GB eMMC
- LAN: 1x Gigabit Ethernet with 802.3af/at support
- WLAN: MediaTek MT7976C 2x2 MIMO dual-band WiFi 6
- LEDs: 1x blue and 1x white
- Buttons: 1x reset button

Installation
---

1. Power device using a PoE injector or switch
2. Connect via Ethernet to the device with static IP 192.168.1.2
3. SSH into the device with password: ubnt

        $ ssh ubnt@192.168.1.20

4. Unlock kernel partitions for writing

        $ echo 5edfacbf > /proc/ubnthal/.uf

5. Confirm correct partitions

        $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p6/uevent
        PARTNAME=kernel0
        $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p7/uevent
        PARTNAME=kernel1
        $ grep PARTNAME /sys/block/mmcblk0/mmcblk0p8/uevent
        PARTNAME=bs

6. Set and confirm bootloader environment

        $ fw_setenv boot_openwrt "fdt addr \$(fdtcontroladdr); fdt rm /signature; bootubnt"
        $ fw_setenv bootcmd_real "run boot_openwrt"
        $ fw_printenv

7. Copy sysupgrade image to /tmp/openwrt.bin via scp
8. Copy kernel and rootfs to mmcblk0p6 and mmcblk0p7, respectively

        $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/kernel -O | dd of=/dev/mmcblk0p6
        $ tar xf /tmp/openwrt.bin sysupgrade-ubnt_unifi-6-plus/root -O | dd of=/dev/mmcblk0p7

9. Ensure device boots from mmcblk0p6

        $ echo -ne "\x00\x00\x00\x00\x2b\xe8\x4d\xa3" > /dev/mmcblk0p8

10. Reboot the device

        $ reboot

Signed-off-by: Elbert Mai <code@elbertmai.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2023-09-24 17:16:16 +02:00