Commit Graph

3439 Commits

Author SHA1 Message Date
Du Cai
8ac69159f2 ramips: use lzma-loader on JCG Q20
Fixes the LZMA uncompression issue on JCG Q20.

Signed-off-by: Du Cai <caidu@smail.nju.edu.cn>
2022-10-09 22:50:57 +02:00
John Audia
9110126620 kernel: bump 5.15 to 5.15.72
Removed upstreamed:
  generic/pending-5.15/722-net-mt7531-only-do-PLL-once-after-the-reset.patch[1]
  bcm53xx/patches-5.15/082-v6.0-clk-iproc-Do-not-rely-on-node-name-for-correct-PLL-s.patch[2]

All other patches automatically rebased

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200, mvebu/cortexa72
Run-tested: bcm2711/RPi4B, mt7622/RT3200, mvebu/cortexa72 (RB5009UG+S+IN)

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.72&id=5de02ab84aeca765da0e4d8e999af35325ac67c2
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.72&id=ab5c5787ab5ecdc4a7ea20b4ef542579e1beb49d

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-10-09 22:26:16 +02:00
Matthias Schiffer
149fc3a269
ramips: fix switch setup for ASUS RT-AX53U
The device has only 1 WAN + 3 LAN ports. Remove "lan4" interface
corresponding to the non-existing port.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2022-10-03 13:23:41 +02:00
Alexey Kosmakov
a664d39c5b ramips: add support for SNR SNR-CPE-ME2-Lite
SNR SNR-CPE-ME2-Lite is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on MT7621A.

Specification:
    - SoC           : MediaTek MT7621A
    - RAM           : DDR3 128 MiB
    - Flash         : SPI-NOR 16 MiB
    - WLAN          : 2.4 GHz 2T2R (MediaTek MT7603E)
                      5 GHz 2T2R (MediaTek MT7613BE)
    - Ethernet      : 10/100/1000 Mbps x5
      - Switch      : MediaTek MT7530 (SoC)
    - UART          : through-hole on PCB
      - J4: 3.3V, GND, TX, RX
      - 57600n8
    - Power         : 12 VDC, 1.5 A

Flash instruction via WEB (firmware 1.10.4 and later)
    1. Boot SNR-CPE-ME2-Lite normally with "Router" mode
    2. Access to "http://192.168.1.1/" and open "Administration -> Management" page
    3. Select the OpenWrt factory image in "Firmware update" section and click "Update" button
    4. Wait ~120 seconds to complete flashing

Flash instruction via TFTP (all version):
    1. Boot SNR-CPE-ME2-Lite to recovery mode (hold the reset button while power on)
    2. Send firmware via TFTP client:
       TFTP Server address: 192.168.1.1
       TFTP Client address: 192.168.1.131
    3. Wait ~120 seconds to complete flashing

Signed-off-by: Alexey Kosmakov <a.kosmakov@nagtech.ru>
2022-10-02 20:21:55 +02:00
Mark King
bf5b1a53d4 ramips: enable LZMA loader to fix Linksys RE6500 boot
At some point after 21.02.3 and before 22.03.0, the size limits of the
Linksys RE6500 were reached and prevent booting from the 22.03.0 release
or builds of current SNAPSHOT. This patch allows builds of master to boot
again and has been tested on my device.

Fixes: #8577

Signed-off-by: Mark King <mark@vemek.co>
2022-10-02 20:21:55 +02:00
Daniel Golle
ca0e7054d8 ramips: add led driver to UniFi FlexHD defaut package set
Add kmod-leds-ubnt-ledbar to the packages selected by default on the
UniFi FlexHD access point.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-30 13:29:58 +01:00
Felix Fietkau
4363faef8a kernel: move ubnt ledbar driver to a separate package
Simplifies the tree by removing a non-upstream kernel patch and related kconfig
symbols

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-09-30 11:28:51 +02:00
Kazuhiro Ito
e739ccb2f6 ramips: update MAC address configuration for Buffalo WSR-1166DHP
Convert MAC address and label_mac configuration of Buffalo
WSR-1166DHP to use the generic function of OpenWrt.

Apply commit 770cfe9 for WCR-1166DS to WSR-1166DHP too.

Tested on the device and MAC address is kept before and after this
change.

Signed-off-by: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
2022-09-28 22:35:02 +09:00
Daniel Golle
c93c5365c0
kernel: pick patches for MediaTek Ethernet from linux-next
Pick patches with several fixes and improvements, preparation for
upcoming WED (TX) [1] as well as basic XDP support [2] with MediaTek's
Filogic SoCs to the mtk_eth_soc driver.

Also pick follow-up patch fixing Ethernet on MT7621 [3].

Tested on Bananapi BPi-R3 (MT7986), Bananapi BPi-R64 (MT7622),
Bananapi BPi-R2 (MT7623), MikroTik RouterBoard M11G (MT7621).

[1]: https://patchwork.kernel.org/project/netdevbpf/list/?series=662108&state=*
[2]: https://patchwork.kernel.org/project/netdevbpf/list/?series=675368&state=*
     (the first part of the series adding wed nodes to mt7986a.dtsi was
      applied to the copy of mt7986a.dtsi in our tree)
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=5e69163d3b9931098922b3fc2f8e786af8c1f37e

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-22 23:55:02 +01:00
Arınç ÜNAL
c77858aa79 ramips: mt7621-dts: change phy-mode of gmac1 to rgmii
Change phy-mode of gmac1 to rgmii on mt7621.dtsi. Same code path is
followed for delayed rgmii and rgmii phy-mode on mtk_eth_soc.c.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-09-18 11:50:32 +02:00
Arınç ÜNAL
2a6ef7f53d ramips: fix GB-PC1 and GB-PC2 LEDs
Add the missing LEDs for GB-PC2. Some of these LEDs don't exist on the
device schematics. Tests on a GB-PC2 by me and Petr proved otherwise.

Remove ethblack-green and ethblue-green LEDs for GB-PC1. They are not wired
to GPIO 3 or 4 and the wiring is currently unknown.

Set ethyellow-orange to display link state and activity of the ethyellow
interface for GB-PC2.

Link: https://github.com/ngiger/GnuBee_Docs/blob/master/GB-PCx/Documents/GB-PC2_V1.1_schematic.pdf
Tested-by: Petr Louda <petr.louda@outlook.cz>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-09-18 11:50:32 +02:00
Sungbo Eo
b201462c89 ramips: 5.15: add disabled PINCTRL_AW9523
Otherwise kernel 5.15 will fail to build on subtargets except for mt7621
that has enabled the config.
The disabled PINCTRL_AW9523 config disappears after a refresh, it needs
to be added back manually.

Fixes: 675cf75578 ("ramips: add config-5.15 for mt7620 subtarget")
Fixes: 001176994a ("ramips: add config-5.15 for mt76x8 subtarget")
Fixes: b9d9f33c33 ("ramips: add config-5.15 for rt288x subtarget")
Fixes: 0164dc0c25 ("ramips: add config-5.15 for rt305x subtarget")
Fixes: ef59da8669 ("ramips: add config-5.15 for rt3883 subtarget")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2022-09-18 03:09:19 +09:00
Sungbo Eo
bcd5d35dc0 ramips: 5.15: refresh subtarget kconfigs
Refresh config with `make kernel_oldconfig`.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2022-09-18 03:09:19 +09:00
Rosen Penev
cfd916065f
mt7621: fix Linksys E7350 GPIO
When converting this device to use both GMACs, I mistakenly removed
state_default, which prevented GPIO LEDs and keys from being used.

Fixes: f4eef5f2a1 ("ramips: add support for Linksys E7350")

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-13 22:19:10 +02:00
Rosen Penev
fb59070466
mt7621: fix Belkin RT1800 GPIO
When converting this device to use both GMACs, I mistakenly removed
state_default, which prevented GPIO LEDs and keys from being used.

Add back and and extra LEDs that were missing.

Tested all LEDs by turning them on.

Fixes: 26a6a6a60b ("ramips: add support for Belkin RT1800")

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-13 22:19:10 +02:00
Daniel Golle
31a6605de0 mac80211: rt2x00: experimental improvements for MT7620 wifi
Serge Vasilugin reports:

To improve mt7620 built-in wifi performance some changes:
1. Correct BW20/BW40 switching (see comments with mark (1))
2. Correct TX_SW_CFG1 MAC reg from v3 of vendor driver see
	https://gitlab.com/dm38/padavan-ng/-/blob/master/trunk/proprietary/rt_wifi/rtpci/3.0.X.X/mt76x2/chips/rt6352.c#L531
3. Set bbp66 for all chains.
4. US_CYC_CNT init based on Programming guide, default value was 33 (pci),
   set chipset bus clock with fallback to cpu clock/3.
5. Don't overwrite default values for mt7620.
6. Correct some typos.
7. Add support for external LNA:
    a) RF and BBP regs never be corrected for this mode
    b) eLNA is driven the same way as ePA with mt7620's pin PA
	but vendor driver explicitly pin PA to gpio mode (for forrect calibration?)
	so I'm not sure that request for pa_pin in dts-file will be enough

First 5 changes (really 2) improve performance for boards w/o eLNA/ePA.
Changes 7 add support for eLNA

Configuration w/o eLAN/ePA and with eLNA show results
tx/rx (from router point of view) for each stream:
 35-40/30-35 Mbps for HT20
 65-70/60-65 Mbps for HT40

Yes. Max results for 2T2R client is 140-145/135-140
with peaks 160/150, It correspond to mediatek driver results.
Boards with ePA untested.

Reported-by: Serge Vasilugin <vasilugin@yandex.ru>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-12 21:37:08 +01:00
Sergei Burakov
2905ce3d64 ramips: add support for ZyXEL Keenetic 4G Rev.B Device
Specification:
SoC: RT5350
CPU Frequency: 360 MHz
Flash Chip: Macronix MX25L6406E (8192 KiB)
RAM: Winbond W9825G6JH-6 (32768 KiB)
3x 10/100 Mbps Ethernet (2x LAN, 1x WAN)
1x external antenna
UART (J1) header on PCB (57800 8n1)
Wireless: SoC-intergated: 2.4GHz 802.11bgn
USB: Yes
8x LED, 2x button

Flash instruction:
Configure PC with static IP 192.168.99.8/24 and start TFTP server.
Rename "openwrt-ramips-rt305x-zyxel_keenetic-4g-b-squashfs-sysupgrade.bin"
to "rt305x_firmware.bin" and place it in TFTP server directory.
Connect PC with one of LAN ports, press the reset button, power up
the router and keep button pressed until power LED start blinking.
Router will download file from TFTP server, write it to flash and reboot.

Signed-off-by: Sergei Burakov <senior.anonymous@mail.ru>
2022-09-13 01:01:52 +09:00
Shiji Yang
6cbcc34f50 ramips: disable unsupported background radar detection
Background radar detection is not supported on devices that
using MT7905, so disable this feature in the following devices:
  asus,rt-ax53u
  jcg,q20
  tplink,eap615-wall-v1
  xiaomi,mi-router-cr6606
  xiaomi,mi-router-cr6608
  xiaomi,mi-router-cr6609
  yuncore,ax820

Devices with MT7915 lacking a DFS antenna also do not support
background DFS:
  totolink,x5000r
  cudy,x6

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2022-09-12 00:14:02 +01:00
Jasper Scholte
4fcfb61ec9 ramips: use lzma-loader on Sitecom WLR-6000
Fixes the boot loader LZMA decompression issue:
LZMA ERROR 1 - must RESET board to recover

Signed-off-by: Jasper Scholte <NightNL@outlook.com>
2022-09-11 22:22:42 +02:00
Sven Wegener
820f0c07c5 ramips: add support for Ubiquiti UniFi FlexHD
Hardware
--------

- SoC: MediaTek MT7621AT with 128 MiB RAM and 32 MiB Flash
- Wi-Fi: MediaTek MT7603 (b/g/n, 2x2) and MediaTek MT7615 (ac, 4x4)
- Bluetooth: CSR8811 (internal USB, install kmod-bluetooth)

Installation
------------

1. Connect to the booted device at 192.168.1.20 using username/password
   "ubnt".

2. Update the bootloader environment.

   $ fw_setenv devmode TRUE
   $ fw_setenv boot_openwrt "fdt addr \$(fdtcontroladdr);
     fdt rm /signature; bootubnt"
   $ fw_setenv bootcmd "run boot_openwrt"

3. Transfer the OpenWrt sysupgrade image to the device using SCP.

4. Check the mtd partition number for bs / kernel0 / kernel1

   $ cat /proc/mtd

5. Set the bootselect flag to boot from kernel0

   $ dd if=/dev/zero bs=1 count=1 of=/dev/mtdblock4

6. Write the OpenWrt sysupgrade image to both kernel0 as well as kernel1

   $ dd if=openwrt.bin of=/dev/mtdblock6
   $ dd if=openwrt.bin of=/dev/mtdblock7

7. Reboot the device. It should boot into OpenWrt.

Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2022-09-11 20:26:42 +01:00
David Santamaría Rogado
548db4980f
ramips: ASUS RT-ACx5P phy[01]radio to phy[01]tpt
phy[01]radio leaves the leds always on, if they are set through sysfs the leds
get off.
Set the triggers to phy[01]tpt to make them work.

Signed-off-by: David Santamaría Rogado <howl.nsp@gmail.com>
2022-09-11 11:42:03 +02:00
Daniel Golle
ef59da8669 ramips: add config-5.15 for rt3883 subtarget
Add Kernel config for testing Linux 5.15 for the rt3883 subtarget.
Compile tested only.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-11 02:49:28 +01:00
Daniel Golle
0164dc0c25 ramips: add config-5.15 for rt305x subtarget
Add Kernel config for testing Linux 5.15 for the rt305x subtarget.
Tested on ZyXEL NBG-419N, works but bad wireless performance.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-11 02:49:28 +01:00
Daniel Golle
b9d9f33c33 ramips: add config-5.15 for rt288x subtarget
Add Kernel config for testing Linux 5.15 for the rt288x subtarget.
Compile tested only.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-11 02:49:28 +01:00
Daniel Golle
001176994a ramips: add config-5.15 for mt76x8 subtarget
Add Kernel config for testing Linux 5.15 for the mt76x8 subtarget.
Compile tested only.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-11 02:49:28 +01:00
Rosen Penev
f4eef5f2a1 ramips: add support for Linksys E7350
Linksys E7350 is an 802.11ax (Wi-Fi 6) router, based on MediaTek
MT7621A.

Specifications:
- SoC: MT7621 (880MHz, 2 Cores)
- RAM: 256 MB
- Flash: 128 MB NAND
- Wi-Fi:
  - MT7915D: 2.4/5 GHz (DBDC)
- Ethernet: 5x 1GiE MT7530
- USB: 1x USB 3.0
- UART: J4 (57600 baud)
  - Pinout: [3V3] (TXD) (RXD) (blank) (GND)

Notes:
* This device has a dual-boot partition scheme, but this firmware works
  only on boot partition 1.

Installation:

Upload the generated factory.bin image via the stock web firmware
updater.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-11 01:30:11 +02:00
Rosen Penev
26a6a6a60b ramips: add support for Belkin RT1800
Belkin RT1800 is an 802.11ax (Wi-Fi 6) router, based on MediaTek
MT7621A.

Specifications:
- SoC: MT7621 (880MHz, 2 Cores)
- RAM: 256 MB
- Flash: 128 MB NAND
- Wi-Fi:
  - MT7915D: 2.4/5 GHz (DBDC)
- Ethernet: 5x 1GiE MT7530
- USB: 1x USB 3.0
- UART: J4 (57600 baud)
  - Pinout: [3V3] (TXD) (RXD) (blank) (GND)

Notes:
* This device has a dual-boot partition scheme, but this firmware works
  only on boot partition 1.

Installation:

Upload the generated factory.bin image via the stock web firmware
updater.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-09-11 01:30:11 +02:00
Ray Wang
fe609889e2 ramips: add RT-N600 alternative name to RT-AC1200
RT-N600 is internally the same as RT-AC1200, as veryfied by @russinnes .
Adding alt_name so that people can find it in firmware selector.

Signed-off-by: Ray Wang <raywang777@foxmail.com>
Tested-by: Russ Innes <russ.innes@gmail.com>
2022-09-11 01:30:11 +02:00
Andrey Butirsky
5806914794 ramips: add support for Kroks Rt-Cse SIM Injector DS
Aka Kroks Rt-Cse5 UW DRSIM (KNdRt31R16), ID 1958:
https://kroks.ru/search/?text=1958
See Kroks OpenWrt fork for support of other models:
https://github.com/kroks-free/openwrt

Device specs:
- CPU: MediaTek MT7628AN
- Flash: 16MB SPI NOR
- RAM: 64MB
- Bootloader: U-Boot
- Ethernet: 5x 10/100 Mbps
- 2.4 GHz: b/g/n SoC
- USB: 1x
- SIM-reader: 2x (driven by a dedicated chip with it's own firmware)
- Buttons: reset
- LEDs: 1x Power, 1x Wi-Fi, 12x others (SIM status, Internet, etc.)

Flashing:
- sysupgrade image via stock firmware WEB interface, IP: 192.168.1.254
- U-Boot launches a WEB server if Reset button is held during power up,
  IP: 192.168.1.1

MAC addresses as verified by OEM firmware:
vendor   OpenWrt   source
LAN      eth0      factory 0x4 (label)
2g       wlan0     label

Signed-off-by: Andrey Butirsky <butirsky@gmail.com>
2022-09-11 01:30:11 +02:00
Andrey Butirsky
0a79c77a4e ramips: add support for Kroks Rt-Pot mXw DS RSIM router
Aka "Kroks KNdRt31R19".
Ported from v19.07.8 of OpenWrt fork:
see https://github.com/kroks-free/openwrt
for support of other models.

Device specs:
- CPU: MediaTek MT7628AN
- Flash: 16MB SPI NOR
- RAM: 64MB
- Bootloader: U-Boot
- Ethernet: 1x 10/100 Mbps
- 2.4 GHz: b/g/n SoC
- mPCIe: 1x (usually equipped with an LTE modem by vendor)
- Buttons: reset
- LEDs: 1x Modem, 1x Injector, 1x Wi-Fi, 1x Status

Flashing:
- sysupgrade image via stock firmware WEB interface.
- U-Boot launches a WEB server if Reset button is held during power up.
Server IP: 192.168.1.1

SIM card switching:
The device supports up to 4 SIM cards - 2 locally on board and 2 on
remote SIM-injector.
By default, 1-st local SIM is active.
To switch to e.g. 1-st remote SIM:
echo 0 > /sys/class/gpio/modem1power/value
echo 0 > /sys/class/gpio/modem1sim1/value
echo 1 > /sys/class/gpio/modem1rsim1/value
echo 1 > /sys/class/gpio/modem1power/value

MAC addresses as verified by OEM firmware:
vendor   OpenWrt   source
LAN      eth0      factory 0x4 (label)
2g       wlan0     label

Signed-off-by: Kroks <dev@kroks.ru>
[butirsky@gmail.com: port to master; drop dts-v1]
Signed-off-by: Andrey Butirsky <butirsky@gmail.com>
2022-09-11 01:30:11 +02:00
Daniel Golle
675cf75578 ramips: add config-5.15 for mt7620 subtarget
Add Kernel config for testing Linux 5.15 for the mt7620 subtarget.
Tested on Youku YK-L1 which boots fine.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-10 22:52:20 +01:00
Daniel Golle
017aea0016 kernel: mtk_eth_soc: fix hw hash reporting for MT7986
Import patch from Linux 6.0.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-09-07 04:21:41 +01:00
Daniel Golle
aab466f422 kernel: backport generic phylink validate
Backport generic phylink validate series and make use of it for
mtk_eth_soc Ethernet driver as well as mt7530 DSA driver.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2022-08-30 13:36:28 +01:00
Thibaut VARÈNE
7bee10a7d2 ramips: define Yuncore AX820 switch LEDs
This patch defines the two switch LED to bring them under user control.

Fixes: a0e1d3ab7b ("ramips: improve YunCore AX820 LEDs")
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
[rmilecki: leave "label"s in place]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2022-08-29 16:21:34 +02:00
John Audia
edeae512c0 kernel: bump 5.15 to 5.15.63
All patches automatically rebased.

Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200

Signed-off-by: John Audia <therealgraysky@proton.me>
2022-08-25 22:07:43 +02:00
Arınç ÜNAL
f1c9afd801 ramips: mt7621-dts: mux phy0/4 to gmac1
Mux the MT7530 switch's phy0/4 to the SoC's gmac1 on devices where RGMII2
pins are available. This achieves 2 Gbps total bandwidth to the CPU using
the second RGMII.

The ports called "wan" are muxed where possible. On a minority of devices,
this is not possible. Those cases:

mt7621_ampedwireless_ally-r1900k.dts: lan3
mt7621_ubnt_edgerouter-x.dts: eth0
mt7621_gnubee_gb-pc1.dts: ethblue
mt7621_linksys_re6500.dts: lan1
mt7621_netgear_wac104.dts: lan4
mt7621_tplink_eap235-wall-v1.dts: lan0
mt7621_tplink_eap615-wall-v1.dts: lan0
mt7621_ubnt_usw-flex.dts: lan1

The "wan" port is just what the vendor designated on the board/plastic
chasis of the device. On a technical level, there is no difference between
a lan and wan port on MT7621AT, MT7621DAT and MT7621ST SoCs. Prefer
connecting to WAN via the port described above for these devices to benefit
the feature brought with this patch.

mt7621_d-team_newifi-d2.dts cannot benefit this feature, although it looks
like it should, because the rgmii2 pins are wired to unused components.

Tested on a range of devices documented on the GitHub PR.

Link: https://github.com/openwrt/openwrt/pull/10238
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-08-20 22:56:12 +02:00
Arınç ÜNAL
81bd10e4a2 ramips: mt7621-dts: remove DTS_LEGACY from ethernet node
Remove DTS_LEGACY put for claiming pin groups for the ethernet node from
the ethernet node. It's not an old kernel trait. These bindings need to be
there on the newer kernels as well.

Fixes: a3764ee29d ("ramips: add linux 5.15 support for mt7621")
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-08-20 22:56:12 +02:00
Arınç ÜNAL
271456abd8 ramips: mt7621-dts: do not claim rgmii2 group as gpio for certain devices
These devices do not use rgmii2 as gpio, therefore remove rgmii2 pin group
from state-default. Remove overwriting the ethernet node for these devices.

Move claiming the rgmii2 group from mt7621_zyxel_nwa-ax.dtsi to
mt7621_zyxel_nwa50ax.dts as it's only the latter using rgmii2 pins as gpio.

Remove duplicate ethernet overwrite from mt7621_tplink_archer-x6-v3.dtsi.

Claim rgmii2 group as gpio on mt7621_bolt_arion.dts as it uses an rgmii2
pin, 26, as gpio.

Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-08-20 22:56:12 +02:00
Arınç ÜNAL
4807bd6a00 ramips: fix GB-PC1 and GB-PC2 device support
Change switch port labels to ethblack & ethblue.
Change lan1 & lan2 LEDs to ethblack_act & ethblue_act and fix GPIO pins.
Add the external phy with ethyellow label on the GB-PC2 devicetree.
Do not claim rgmii2 as gpio, it's used for ethernet with rgmii2 function.
Enable ICPlus PHY driver for IP1001 which GB-PC2 has got.
Update interface name and change netdev function.
Enable lzma compression to make up for the increased size of the kernel.
Make spi flash bindings on par with mainline Linux to fix read errors.

Tested on GB-PC2 by Petr.

Tested-by: Petr Louda <petr.louda@outlook.cz>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
2022-08-20 22:56:12 +02:00
Mikhail Zhilkin
a6b0d08060
ramips: get MAC addr from the encrypted partition (WG4хх223)
This commit resolves #10062. Adds decryption of the Arcadyan WG4xx223
configuration partition (board_data)to get base MAC address from it.
As a result, after this change the hack with saving MAC addressees to
u-boot-env before installation of OpenWrt is no longer necessary.

This is necessary for the following devices:
- Beeline Smartbox Flash (Arcadyan WG443223)
- MTS WG430223 (Arcadyan WG430223)

Example:
+----------------+-------------------+------------------------+
|                |    MTS WG430223   | Beeline Smartbox Flash |
+----------------+-------------------+------------------------+
| base mac (mtd) | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:06      |
| label          | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:09      |
| LAN            | A4:xx:xx:51:xx:F6 | 30:xx:xx:51:xx:09      |
| WAN            | A4:xx:xx:51:xx:F4 | 30:xx:xx:51:xx:06      |
| WLAN_2g        | A4:xx:xx:51:xx:F5 | 30:xx:xx:51:xx:07      |
| WLAN_5g        | A6:xx:xx:21:xx:F5 | 32:xx:xx:41:xx:07      |
+----------------+-------------------+------------------------+

Collected statistic shows that the 2-4th bits of the 7th byte of the
WLAN_5g MAC are the constant (see #10062 for more details):
- Beeline Smartbox Flash - 100
- MTS WG430223 - 010

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2022-08-19 14:41:18 +02:00
David Bauer
9c8605dee2 ramips: fix ZyXEL NWA55AXE model name
The model name was missing a letter.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-18 18:02:51 +02:00
Mikhail Zhilkin
85b41cbd3b ramips: add support for Beeline SmartBox TURBO
Beeline SmartBox TURBO is a wireless WiFi 5 router manufactured by
Sercomm company.

Device specification
--------------------
SoC Type: MediaTek MT7621AT
RAM: 256 MiB
Flash: 256 MiB, Micron MT29F2G08ABAGA3W
Wireless 2.4 GHz (MT7603EN): b/g/n, 2x2
Wireless 5 GHz (MT7615E): a/n/ac, 4x4
Ethernet: 5xGbE (WAN, LAN1, LAN2, LAN3, LAN4)
USB ports: 1xUSB3.0
Button: 2 buttons (Reset & WPS)
LEDs: 1 RGB LED
Power: 12 VDC, 1.5 A
Connector type: barrel
Bootloader: U-Boot

Installation
-----------------
1.  Login to the router web interface (admin:admin)
2.  Navigate to Settings -> WAN -> Add static IP interface (e.g.
    10.0.0.1/255.255.255.0)
3.  Navigate to Settings -> Remote cotrol -> Add SSH, port 22,
    10.0.0.0/255.255.255.0 and interface created before
4.  Change IP of your client to 10.0.0.2/255.255.255.0 and connect the
    ethernet cable to the WAN port of the router
5.  Connect to the router using SSH shell (SuperUser:SNxxxxxxxxxx, where
    SNxxxxxxxxxx is the serial number from the backplate label)
6.  Run in SSH shell:
       sh
7.  Make a mtd backup (optional, see related section)
8.  Change bootflag to Sercomm1 and reboot:
       printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3
       reboot
9.  Login to the router web interface (admin:admin)
10. Remove dots from the OpenWrt factory image filename
11. Update firmware via web using OpenWrt factory image

Revert to stock
---------------
1. Change bootflag to Sercomm1 in OpenWrt CLI and then reboot:
      printf 1 | dd bs=1 seek=7 count=1 of=/dev/mtdblock3
2. Optional: Update with any stock (Beeline) firmware if you want to
   overwrite OpenWrt in Slot 0 completely.

mtd backup
----------
1. Set up a tftp server (e.g. tftpd64 for windows)
2. Connect to a router using SSH shell and run the following commands:
      cd /tmp
      for i in 0 1 2 3 4 5 6 7 8 9 10; do nanddump -f mtd$i /dev/mtd$i; \
      tftp -l mtd$i -p 10.0.0.2; md5sum mtd$i >> mtd.md5; rm mtd$i; done
      tftp -l mtd.md5 -p 10.0.0.2

MAC Addresses
-------------
+-----+-----------+---------+
| use | address   | example |
+-----+-----------+---------+
| LAN | label     | *:54    |
| WAN | label + 1 | *:55    |
| 2g  | label + 4 | *:58    |
| 5g  | label + 5 | *:59    |
+-----+-----------+---------+
The label MAC address was found in Factory 0x21000

Co-developed-by: Maximilian Weinmann <x1@disroot.org>
Signed-off-by: Maximilian Weinmann <x1@disroot.org>
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2022-08-13 20:52:37 +02:00
Hauke Mehrtens
ff06edd1f0 kernel: Activate CONFIG_GPIOLIB in generic configuration
All targets expect the malta target already activate the CONFIG_GPIOLIB
option. Move it to generic kernel configuration and also activate it for
malta.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2022-08-10 21:36:17 +02:00
Jo-Philipp Wich
b5ec04f81a Revert "nftables: fix parsing date expressions"
This reverts commit eada892577.

The commit contained unrelated target changes.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-09 11:50:52 +02:00
Jo-Philipp Wich
eada892577 nftables: fix parsing date expressions
Musl libc does not support the non-POSIX "%F" format for strptime() so
replace all occurrences of it with an equivalent "%Y-%m-%d" format.

Fixes: #10419
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-08-09 00:20:14 +02:00
André Valentin
2cc5059240 ramips: add support for ZyXEL LTE3301-Plus
The ZyXEL LTE3301-PLUS is an 4G indoor CPE with 2 external LTE antennas.

Specifications:

 - SoC: MediaTek MT7621AT
 - RAM: 256 MB
 - Flash: 128 MB MB NAND (MX30LF1G18AC)
 - WiFi: MediaTek MT7615E
 - Switch: 4 LAN ports (Gigabit)
 - LTE: Quectel EG506 connected by USB3 to SoC
 - SIM: 1 micro-SIM slot
 - USB: USB3 port
 - Buttons: Reset, WPS
 - LEDs: Multicolour power, internet, LTE, signal, Wifi, USB
 - Power: 12V, 1.5A

The device is built as an indoor ethernet to LTE bridge or router with
Wifi.

UART Serial:

57600N1
Located on populated 5 pin header J5:

 [o] GND
 [ ] key - no pin
 [o] RX
 [o] TX
 [o] 3.3V Vcc

MAC assignment:
lan:  98:0d:67:ee:85:54 (base, on the device back)
wlan: 98:0d:67:ee:85:55

Installation from web GUI:

- Log in as "admin" on http://192.168.1.1/
- Upload OpenWrt initramfs-recovery.bin image on the
  Maintenance -> Firmware page
- Wait for OpenWrt to boot and ssh to root@192.168.1.1
- format ubi device: ubiformat /dev/mtd6
- attach ubi device: ubiattach -m6
- create rootfs volume: ubimkvol /dev/ubi0 -n0 -N rootfs -s 1MiB
- rootfs_data volume: ubimkvol /dev/ubi0 -n1 -N rootfs_data -s 1MiB
- run sysupgrade with sysupgrade image

For more details about flashing see
commit 2449a63208 ("ramips: mt7621: Add support for ZyXEL NR7101").

Please note that this commit is needed:
firmware-utils: add marcant changes for ZyXEL NBG6716 and LTE3301-PLUS

Signed-off-by: André Valentin <avalentin@marcant.net>
2022-08-06 20:33:59 +02:00
Reto Schneider
2293f1abe4 ramips: mt7628: fix memory controller reset bit
According to MediaTek MT7688 Datasheet v1.4, as well as the MT7628
counterpart, the memory controller reset bit (MC_RST) is 10, not 20.
Reset bit 20 is used for for UART 2 (UART2_RST).

Please note: Due to the lack of hardware, I was not able to test this
change.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2022-08-06 19:58:46 +02:00
David Yang
577f3fdbc9 ramips: add support for Netcore NW5212
This patch adds support for Netcore NW5212, provided by some carrier in
China.

Specifications:
--------------

* SoC: Mediatek MT7620A
* RAM: 128MB DDR2
* Flash: 16MB SPI NOR flash (Winbond W25Q128BV)
* WiFi 2.4GHz: builtin
* Ethernet: builtin
* LED: Power, WAN, LAN 1-4, WiFi
* Buttons: Reset (GPIO 13)
* UART: Serial console (57600 8n1)
* USB: 1 x USB2

Installation:
------------

The router comes with OpenWrt 14.07 built with MTK SDK. However, as the
modem is provided by carriers, so the web interface is highly minimized and
only contains a static page with no interaction options.

There are two possible ways to gain the access.

1) Open the shell and use a UART2USB convert to gain TTY access. Please
   notice you have to remove resistance R54 at the back of the board
   otherwise you won't be able to input anything.
2) Use built-in backdoor. Access http://192.168.1.1/cgi-bin/_/testxst to
   start dropbear service at port 9122. Be warned the software is super
   old and only diffie-hellman-group1-sha1, diffie-hellman-group14-sha1,
   kexguess2@matt.ucc.asn.au is support, you may not be able to connect it
   with an up-to-date ssh client.

After you can control the device, flash the firmware as usual. Here are
some hints for that.

Option 1 (via original firmware):

1) Setup HTTP server on your computer, for example:
     python3 -m http.server
2) Connect to the route and flash:
     cd /tmp
     wget http://<your-computer-host>/<your-firmware-name>
     mtd -r write <your-firmware-name> firmware

Option 2 (replacing u-boot via breed):

1) Download breed-mt7620-reset13.bin from https://breed.hackpascal.net/
2) Setup HTTP server on your computer, for example:
     python3 -m http.server
   You can skip this step if your breed is already accessible from HTTP,
   since the original wget does not support HTTPS.
3) Connect to the route and flash breed:
     cd /tmp
     wget http://<your-computer-host>/breed-mt7620-reset13.bin
     mtd write breed-mt7620-reset13.bin Bootloader
4) Reboot. Hold reset key or press any key in TTY to enter breed.
5) Access breed web interface (http://192.168.1.1/). Choose the flash
   layout to be 0x50000 and flash new firmware.

MAC addresses:
-------------

There are three MACs stored in factory, as in MT7620A reference design:

source address   usage
   0x4 label     WLAN
  0x28 label     MAC 1
  0x2e label + 1 MAC 2

However, the OEM firmware only uses one single MAC (label) for all
interfaces, probably a misconfiguration.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2022-08-06 19:58:46 +02:00
David Yang
b00a02aaa0 ramips: add support for Netgear PR2000
This patch adds support for Netgear PR2000, sold as "Travel Router and
Range Extender".

Specifications:
--------------

* SoC: Mediatek MT7620N
* RAM: 64MB DDR2
* Flash: 16MB SPI NOR flash (Macronix MX25L12805D)
* WiFi 2.4GHz: builtin
* Ethernet: builtin
* LED: Power, Internet, WiFi, USB
* Buttons: Reset (GPIO 1/2)
* UART: Serial console (57600 8n1)
* USB: 1 x USB2

SPECIAL NOTES:
-------------

Problem: WiFi is super weak, but SSID beacons seems to be right.

Solve: Change 36h in factory partition (namely 0xf60036) to be 0x0.

Explain: Clearly Netgear have different ideas on how EEPROM is used. Bit 2
of 36h indicates the presence of External LNA for 11g (2.4 GHz) band,
which seems to be incorrectly set by Netgear (originally 0x04). Lifting it
solves the problem of weak RX signal.

Installation:
------------

There are two possible ways to install the firmware. Flashing via web
interface of original firmware is not tested due to a broken firmware.

1) Open the shell and use a UART2USB convert to gain TTY access (TP7: RXD,
   TP9: TXD, TP10: GND). Please notice you have to remove resistance R54
   next to TP7 otherwise you won't be able to input anything.
2) Use well-known Netgear debug switch. Access
   http://192.168.168.1/setup.cgi?todo=debug to start telnet service
   (username: root, password: <none>).

Please back up firmware if you want to go back to the original.

After you can control the device, flash the firmware as usual. Here are
some hints for that.

Option 1 (via nmrpflash):

1) Download nmrpflash from https://github.com/jclehner/nmrpflash
2) Use *-factory.img and flash:
     nmrpflash -L
     nmrpflash -i net* -f <your-firmware-name>
3) Turn off then turn on the device, wait it finishing flash.

Option 2 (replacing u-boot via breed):

1) Download breed-mt7620-reset1.bin from https://breed.hackpascal.net/
2) Setup HTTP server on your computer, for example:
     python3 -m http.server
   You can skip this step if your breed is already accessible from HTTP,
   since the original wget does not support HTTPS.
3) Connect to the route and flash breed:
     cd /tmp
     wget http://<your-computer-host>/breed-mt7620-reset1.bin
     dd if=breed-mt7620-reset1.bin of=/dev/mtdblock0 bs=64k
4) Reboot. Hold reset key or press any key in TTY to enter breed.
5) Access breed web interface (http://192.168.1.1/). Choose memory layout
   to be 0x40000 and flash new firmware.

Remark:
------

As a "Range Extender", it has a switch to switch between Wired mode (GPIO
21 low) and Wireless mode (GPIO 20 low), which is not implemented in this
patch. However, the router will be turned off when it switches to the
middle, which makes this switch much less useful.

MAC addresses:
-------------

The OEM firmware uses one single MAC for all interfaces, located at
0xf700b0.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2022-08-06 19:58:46 +02:00
Lea Teuberth
45255aa0e8 ramips: adding support for Asus RP-AC56
Specifications:
	CPU:     MT7621A dual-core 880MHz
	RAM:     64MB DDR2
	FLASH:   16MB MX25L12805D NOR SPI
	WIFI:    2.4GHz 2x2 MT7603 b/g/n PCI
	WIFI:    5GHz 2x2 MT7662 a/b/ac PCI
	ETH:     1xLAN 1000base-T integrated
	SWITCH:  MT7530 Port 0: LAN, Port 6: CPU
	LED:     Power, 2.4GHz WiFi, 5GHz WiFi
	BTN:     WPS, Reset
	UART:    Near ETH port, from ETH: 3V3-TxD-GND-RxD 57600 8n1
	MISC:    Audio support

Installation:
	1. Update using recovery mode
	   - while holdig "reset" button, power on the device
	   - keep holding "reset" until power led is flashing yellow
	   - set own IP to 192.168.1.75, subnet mask: 255.255.255.0
	   - push firmware image (can be factory.bin or sysupgrade.bin)
	     using tftp client in binary mode to 192.168.1.1

Notes:
	This board has only two MAC addresses programmed in the "factory" partition:
	- MAC for wlan0 (2.4GHz) at offset 0x0004
	- MAC for wlan1 (5GHz) at offset 0x8004
	- stock firmware re-uses wlan0 MAC for ethernet
	- no valid addresses found in 0x28, 0x2e, 0xe000 and 0xe006

Signed-off-by: Lea Teuberth <lea.teuberth@outlook.com>
2022-08-06 19:58:46 +02:00