Commit Graph

3242 Commits

Author SHA1 Message Date
Rui Salvaterra 182eaa4916 kernel: bump 5.10 to 5.10.32
Deleted (reverse-appliable):
mediatek/patches-5.10/360-mtd-rawnand-mtk-Fix-WAITRDY-break-condition-and-time.patch

Automatically refreshed:
ath79/patches-5.10/0036-GPIO-add-named-gpio-exports.patch
generic/backport-5.10/600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch
generic/backport-5.10/601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch
generic/backport-5.10/602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch
generic/backport-5.10/603-v5.12-net-fix-race-between-napi-kthread-mode-and-busy-poll.patch
generic/pending-5.10/600-netfilter_conntrack_flush.patch
generic/pending-5.10/613-netfilter_optional_tcp_window_check.patch
generic/pending-5.10/680-NET-skip-GRO-for-foreign-MAC-addresses.patch
generic/pending-5.10/768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch
lantiq/patches-5.10/0030-GPIO-add-named-gpio-exports.patch
ramips/patches-5.10/800-GPIO-add-named-gpio-exports.patch

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-22 15:13:56 +01:00
Rui Salvaterra 3326b5e75c treewide: switch the timer frequency to 100 Hz
Some targets select HZ=100, others HZ=250. There's no reason to select a higher
timer frequency (and 100 Hz are available in every architecture), so change all
targets to 100 Hz.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-21 10:31:10 +01:00
Rui Salvaterra 27b5bae2ec treewide: remove redundant ubifs kconfig symbols
For the targets which enable ubifs, these symbols are already part of the
generic kconfigs. Drop them from the target kconfigs.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-21 10:31:07 +01:00
David Bauer 75c01ee2b9 ramips: fix at803x patch
This patch broke while refreshing on a kernel bump. It adds the
config_aneg function twice to the AR8035 PHY now.

Restore the old behavior to restore the patches original intent.

Fixes commit 57e32650ef ("kernel: bump 5.10 to 5.10.31")
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-04-18 14:42:06 +02:00
Ilya Lipnitskiy fa6f57f66c ramips: replace mt7621s hack with upstream patch
Refresh patches.

Tested on a dual-core MT7621 device (Ubiquiti ER-X) and a single-core
MT7621 device (Netgear R6220).

This change will make future kernel upgrades easier (avoids conflicts
with upstream).

Link: https://lore.kernel.org/lkml/20210407200738.149207-1-ilya.lipnitskiy@gmail.com/
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Chuanhong Guo <gch981213@gmail.com>
2021-04-17 21:56:05 +02:00
David Bentham 17e690017d ramips: reduce spi-max-frequency for Xiaomi MI Router 4AG
Reduce spi-max-frequency for Xiaomi MI Router 4AG model

Xiaomi MI Router 4AG MTD uses two flash chips (no specific on router versions when produced from factory) - GD25Q128C and W25Q128BV.

These flash chips are capable of high frequency, but due to poor board design or manufacture process.

We are seeing the following errors in the linux kernel bootup:

`spi-nor spi0.0: unrecognized JEDEC id bytes: cc 60 1c cc 60 1c
 spi-nor: probe of spi0.0 failed with error -2`

This causes the partitions not to be detected

`VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6`

Then creates a bootloop and a bricked router.

The solution to limit this race condition is to reduce the frequency from 80 mhz to 50 mhz.

Signed-off-by: David Bentham <db260179@gmail.com>
2021-04-17 21:56:05 +02:00
John Audia 6d4ef67926 kernel: bump 5.4 to 5.4.113
Ran update_kernel.sh in a fresh clone without any existing toolchains.  No
manual intervention needed.

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2021-04-17 21:50:08 +02:00
Rui Salvaterra 57e32650ef kernel: bump 5.10 to 5.10.31
Automatically refreshed:
ramips/patches-5.10/710-at803x.patch

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-17 21:50:08 +02:00
Rui Salvaterra a3d431ccf7 kernel: bump 5.10 to 5.10.30
Deleted (reverse-applicable):
mvebu/patches-5.10/101-ARM-dts-turris-omnia-configure-LED-2--INTn-pin-as-interrupt-pin.patch

Automatically refreshed:
bcm63xx/patches-5.10/143-gpio-fix-device-tree-gpio-hogs-on-dual-role-gpio-pin.patch
generic/backport-5.10/610-v5.13-02-netfilter-Fix-fall-through-warnings-for-Clang.patch
generic/backport-5.10/610-v5.13-10-netfilter-nftables-update-table-flags-from-the-commi.patch
generic/hack-5.10/204-module_strip.patch
generic/hack-5.10/902-debloat_proc.patch
generic/pending-5.10/203-kallsyms_uncompressed.patch
generic/pending-5.10/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
generic/pending-5.10/920-mangle_bootargs.patch
mediatek/patches-5.10/115-dts-bpi64-add-snand-support.patch
mediatek/patches-5.10/602-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch
mediatek/patches-5.10/900-dts-mt7622-bpi-r64-aliases-for-dtoverlay.patch
ramips/patches-5.10/323-mt7621-memory-detect.patch

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-04-16 12:58:53 +01:00
Ilya Lipnitskiy 85ca6923bc ramips: gpio-ralink: use ngpios, not ralink,num-gpios
DTS properties that match *-gpios are treated specially.

Use ngpios instead, as most GPIO drivers upstream do.

Fixes 5.10 DTS errors such as:
  OF: /palmbus@300000/gpio@600: could not find phandle

Fixes DTC warnings such as:
  Warning (gpios_property): /palmbus@300000/gpio@600:ralink,num-gpios:
  Could not get phandle node for (cell 0)

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Daniel Golle <daniel@makrotopia.org>
2021-04-15 00:00:54 +08:00
Ilya Lipnitskiy 5f07c579f8 ramips: rt288x: replace hack with a kconfig change
Use an existing kernel config symbol to fix devices whose ramstart is
not zero. See upstream patch message for more details.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Cc: Tobias Wolf <dev-NTEO@vplace.de>
Cc: Daniel Golle <daniel@makrotopia.org>
2021-04-15 00:00:54 +08:00
DENG Qingfang f99c9cd9c4 ramips: mt7530 swconfig: fix race condition in register access
The mt7530_{r,w}32 operation over MDIO uses 3 mdiobus operations and
does not hold a lock, which causes a race condition when multiple
threads try to access a register, they may get unexpected results.

To avoid this, handle the MDIO lock manually, and use the unlocked
__mdiobus_{read,write} in the critical section.

This fixes the "Ghost VLAN" artifact[1] in MT7530/7621 when the VLAN
operation and the swconfig LED link status poll race between each other.

[1] https://forum.openwrt.org/t/mysterious-vlan-ids-on-mt7621-device/64495

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
2021-04-15 00:00:54 +08:00
Ilya Lipnitskiy 679c557e91 ramips: drop obsolete arcs_cmdline override patch
CONFIG_MIPS_CMDLINE_FROM_DTB is set to 'y' for all ramips targets
already, which will ensure that the value of 'bootargs' will take
precedence over whatever is in arcs_cmdline.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-04-15 00:00:54 +08:00
Shiji Yang 882a6116d3 ramips: improve pinctrl for Youku YK-L1
1. rename led pin "air" to a more common name "wlan" and use "phy0tpt" to trigger it.
2. led "wan" can be triggered by ethernet pinctrl by default so just drop it.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-04-10 20:48:26 +02:00
Szabolcs Hubai dd3c1ad8ee ramips: rt305x: use lzma-loader for ZyXEL Keenetic Lite rev.B
Fixes boot loader LZMA decompression issue,
reported by GitHub user KOLANICH at [0].

The reported LZMA ERROR has date of 2020-07-20, soon after
the device support landed:

Ralink UBoot Version: 3.5.2.4_ZyXEL

....

3: System Boot system code via Flash.
   Image Name:   MIPS OpenWrt Linux-4.14.187
   Created:      2020-07-20   3:39:11 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1472250 Bytes =  1.4 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

[0] fea232ae8f (commitcomment-45016560)

Fixes: 4dc9ad4af8 ("ramips: add support for ZyXEL Keenetic Lite Rev.B")
Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
2021-04-08 09:20:59 +02:00
Kevin Darbyshire-Bryant 438e88e672 kernel: bump 5.10 to 5.10.27
Use update_kernel to refresh all patches, required manual updates to:

610-netfilter_match_bypass_default_checks.patch
611-netfilter_match_bypass_default_table.patch
762-net-bridge-switchdev-Refactor-br_switchdev_fdb_notif.patch
764-net-bridge-switchdev-Send-FDB-notifications-for-host.patch

Run-tested: x86_64

Nothing screamed out but any funny business with linux bridging should
suspect this update first.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-04-03 21:07:22 +01:00
Shiji Yang dfc9044fad ramips: fix IMAGE_SIZE of HC5x6: fix image size of HC5x61
"firmware" partition size defined in the device tree file is 0xf70000,
so the right IMAGE_SIZE is 15808k

Fixes: df1e5d6463 ("ramips: fix partition layout of hiwifi hc5x61")
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-04-03 18:56:02 +02:00
Daniel Engberg e83f7e5d76 ramips: Fix booting on MQmaker WiTi board
This fixes the dreaded "lzma error 1" also reported on similar devices
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3057

Fixes: FS#3057
Signed-off-by: Daniel Engberg <daniel.engberg.lists@pyret.net>
2021-04-03 18:56:02 +02:00
René van Dorst 12f3d1466a ramips: Fix booting on MTC WR1201
This fixes the dreaded "lzma error 1" also reported on similar devices
Ref: https://bugs.openwrt.org/index.php?do=details&task_id=3057

Fixes: FS#3057
Signed-off-by: René van Dorst <opensource@vdorst.com>
2021-04-03 18:56:02 +02:00
Ilya Lipnitskiy a86c3fd800 ramips: mt7620: ralink-i2s: fix modpost error
Fixes the following error when building without CONFIG_MODULE_STRIPPED:
  FATAL: modpost: sound/soc/ralink/snd-soc-ralink-i2s: struct
  of_device_id is not terminated with a NULL entry!

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-31 01:10:01 +01:00
Rui Salvaterra 070ead4d4a ramips/mt7621: enable support for cpuidle
MIPS Coherent Processor Systems (CPS), which include the MT7621 SoC, support
deep sleep idle states and have a specific cpuidle driver for them.
Enable support for it, while also switching from constant timer ticks to the
idle dynticks model, with the TEO governor.

Run-tested on a Redmi AC2100.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-03-31 00:58:49 +01:00
Rui Salvaterra 9c3b2d7ff7 ramips/mt7621: drop the timer recalibration patch
We've been carrying this patch for many years [1], in order to fix a timer
calibration issue on MT7621. Turns out, after retesting with a recent kernel
(Linux 5.10), the system works perfectly fine without it (no rcu_sched stalls
or inconsistent BogoMIPS values across CPUs).

Manually refreshed:
322-mt7621-fix-cpu-clk-add-clkdev.patch
323-mt7621-memory-detect.patch

[1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=6f4a903533361a2906a4d94ac6f597cd9c6c47bc

Suggested-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Tested-by: Donald Hoskins <grommish@gmail.com>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-03-31 00:58:49 +01:00
Rui Salvaterra 4b2e4518ac ramips/mt7621: drop the weak reordering patch
In order to fix random hangs on MT7621, we've been selecting
WEAK_REORDERING_BEYOND_LLSC for years [1]. However, these random hangs have been
most likely caused by an oversight in the MIPS implementation of the kernel
memory consistency model, which has already been fixed for some time (and
backported to stable) [2].

Manually refreshed:
321-mt7621-timer.patch

[1] https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=5c971cd6fdd7298a2017bdb6bea870088eddb8b9
[2] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/arch/mips?h=linux-5.4.y&id=42344113ba7a1ed7b5654cd5270af0d5698d8521

Suggested-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
Tested-by: Donald Hoskins <grommish@gmail.com>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-03-31 00:58:49 +01:00
Shiji Yang b88d2850c6 ramips: correct switch config of Youku yk1
There are only two lan ports and one wan port on Youku yk1

Fixes: e9baf8265b ("ramips: add support for Youku YK1")

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[add Fixes:]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-27 16:54:15 +01:00
Kevin Darbyshire-Bryant eb964298b3 kernel: bump 5.10 to 5.10.24
Straightforward refresh of patches using update_kernel.

Run tested: x86_64 (apu2)

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2021-03-24 11:36:31 +00:00
Shiji Yang bf7ddb18f1 ramips: speed up spi frequency for Youku YK-L1
Youku YK-L1 has a huge storage space up to 32 MB. It is better to
use a higher spi clock to read or write serial nor flash chips.
Youku YK-L1 has Winbond w25q256fvfg on board that can support
104 MHz spi clock so 48 MHz is safe enough.
The real frequency can only be sysclk(580MHz ) /3 /(2^n) so 80 MHz
defined in dts file will set only 48 MHz in spi bus.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-03-22 20:54:34 +01:00
John Audia 2c81b16964 kernel: bump 5.4 to 5.4.106
Ran update_kernel.sh in a fresh clone without any existing toolchains.

Manually rebased:
  bcm27xx/950-0993-xhci-quirks-add-link-TRB-quirk-for-VL805.patch
  layerscape/701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[remove accidental whitespace edit]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-21 22:45:20 +01:00
INAGAKI Hiroshi b3ca1f30ef ramips: add support for ELECOM WRC-1750GST2
ELECOM WRC-1750GST2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 256 MiB (NT5CC128M16JR-EK)
- Flash		: SPI-NOR 32 MiB (MX25L25645GMI-08G)
- WLAN		: 2.4/5 GHz 3T3R (2x MediaTek MT7615)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LEDs/Keys	: 4x/6x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, GND, TX, RX, from ethernet port side
  - 57600n8
- Power		: 12 VDC, 1.5 A

Flash instruction using factory image:

1. Boot WRC-1750GST2 normally with "Router" mode
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~120 seconds to complete flashing

MAC addresses:

LAN	: 04:AB:18:xx:xx:23 (Factory, 0xE000 (hex))
WAN	: 04:AB:18:xx:xx:24 (Factory, 0xE006 (hex))
2.4GHz	: 04:AB:18:xx:xx:25 (Factory, 0x4    (hex))
5GHz	: 04:AB:18:xx:xx:26 (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2021-03-21 22:45:20 +01:00
Shiji Yang df6154848a ramips: create shared DTSI for MT7620 Phicomm K2x series devices
Improve compatibility of the device tree include file. Now a new .dtsi
file will support both PSG1218A, PSG1218B and K2G.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[improve commit title, rebase]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-21 22:45:20 +01:00
Shiji Yang c36e47c5da ramips: increase SPI frequency for Phicomm series devices
From many teardown image in the internet, I find Phicomm K1/k2 series use
Winbond W25Q64/W25Q128 or GigaDevice GD25Q64/GD25Q128 Flash chips. both of
them support 100+ MHz clock spi operate and fast-read instruction. PSG1218
with W25x or GD25x has been tested and it can run well in OpenWrt v19.07.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[improve commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-21 22:45:20 +01:00
Shiji Yang d160b2c824 ramips: increase SPI frequency for HIWIFI HC5x61 devices
HIWIFI HC5x61 devices support high speed spi clock up to 100+ MHz.
So set spi frequency to 80 MHz here (Due to frequency division the
real clock is 48 MHz).
I have tested HC5661 and it can run well in OpenWrt v19.07.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[adjust commit title and wrap message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-21 22:45:20 +01:00
Ilya Lipnitskiy f65b0afadb ramips: move spi-nor-add-gd25q512 patch to generic
A SPI NOR flash should not be target-specific, so move it to generic in
case another platform needs to use it.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-19 01:25:26 +01:00
Lech Perczak 410fb05b44 rampis: use lzma-loader for ZTE MF283+
Without that, after merging support to master, the device fails to boot
due to LZMA decompression error:

3: System Boot system code via Flash.
## Booting image at bc080000 ...
raspi_read: from:80000 len:40
.   Image Name:   MIPS OpenWrt Linux-5.4.99
   Created:      2021-02-25  23:35:00 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1786664 Bytes =  1.7 MB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:80040 len:1b4328
............................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

Use lzma-loader to fix it.

Fixes: 59d065c9f8 ("ramips: add support for ZTE MF283+")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
2021-03-19 01:25:26 +01:00
Shiji Yang a94a20373b ramips: improve GPIO pin control for HC5x61
HC5661 does not have USB port, remove usb power control pin.
HC5x61 do not have LAN LEDs, remove ethernet LED control pin.
Only HC5861 has PA in 2.4G channel.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-03-19 01:25:26 +01:00
David Bauer ac5675ec8f ramips: fix broken UniFi 6 Lite image
Ubiquiti's own bootloader expects the configuration mode to be present
with a "@" instead of a "-" for the sperator character. Otherwise
booting of the image fails.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-03-18 00:54:25 +01:00
Kabuli Chana 1cd098784e kernel: bump 5.10 to 5.10.23
update kernel to 5.10.23, rebase patches, deleted upstreamed patch:

target/linux/generic/backport-5.10/830-v5.12-0001-net-usb-qmi_wwan-support-ZTE-P685M-modem.patch

compile / test - mvebu / mamba, rango

Signed-off-by: Kabuli Chana <newtownBuild@gmail.com>
[refresh again]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-13 17:06:42 +01:00
John Audia e7fa97b326 kernel: bump 5.4 to 5.4.105
Ran update_kernel.sh in a fresh clone without any existing toolchains.

Removed upstreamed generic-backports:
  830-v5.12-0001-net-usb-qmi_wwan-support-ZTE-P685M-modem.patch
  831-v5.9-usbip-tools-fix-build-error-for-multiple-definition.patch
  755-v5.8-net-dsa-add-GRO-support-via-gro_cells.patch

Build system: x86_64
Build-tested: ipq806x/R7800
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
[squash patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-13 17:06:35 +01:00
Adrian Schmutzler 9397b22df1 treewide: make AddDepends/usb-serial selective
Make packages depending on usb-serial selective, so we do not have
to add kmod-usb-serial manually for every device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-06 12:38:38 +01:00
Adrian Schmutzler 85b1f4d8ca treewide: remove execute bit and shebang from board.d files
So far, board.d files were having execute bit set and contained a
shebang. However, they are just sourced in board_detect, with an
apparantly unnecessary check for execute permission beforehand.

Replace this check by one for existance and make the board.d files
"normal" files, as would be expected in /etc anyway.

Note:

This removes an apparantly unused '#!/bin/sh /etc/rc.common' in
target/linux/bcm47xx/base-files/etc/board.d/01_network

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-06 11:30:06 +01:00
Ilya Lipnitskiy b021642cac ramips: 5.10: refresh configs
Run-tested on Ubiquiti EdgeRouter X.

Compile tested on all other subtargets.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Ilya Lipnitskiy 10267e1729 ramips: 5.10: port and refresh patches, ralink drv
Enable testing kernel.

Fix compile errors by using new kernel APIs.

Fix fuzz by manually editing patches to ensure the code goes in the
right place.

For 721-NET-no-auto-carrier-off-support.patch, revert upstream commit
a307593a6 to keep the OpenWrt ralink driver operational.

Add mt7621-pci-phy patch to select REGMAP_MMIO as discussed in PR #3693
and #3952.

Run automatic quilt refresh on the rest.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Ilya Lipnitskiy ef1e652016 ramips: 5.10: rename patches to follow guide
Rename patches to follow the 3-digit classification from the OpenWrt
Developer Guide.

https://openwrt.org/docs/guide-developer/build-system/use-patches-with-buildsystem#naming_patches

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Ilya Lipnitskiy 3149d8e7be ramips: 5.10: delete upstreamed patches
0098-disable_cm.patch is not needed because upstream fixed CM handling.

The rest are straightforward removals of upstreamed patches.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Ilya Lipnitskiy eda836e390 ramips: 5.10: copy patches from 5.4
Strict copy, no changes made.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Ilya Lipnitskiy a9966793e8 ramips: copy config-5.4 to config-5.10
Strict copy, no changes made.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 11:24:12 +01:00
Adrian Schmutzler cc4ee2eeb4 Revert "ramips: add support for kernel 5.10"
This reverts commit b4aad29a1d.

This was accidentally folded into a single commit. Remove it and
apply it properly again.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-03-06 11:23:38 +01:00
Ilya Lipnitskiy 2629d2d5b1 apm821xx, mt7621, oxnas, rockchip, zynq: remove PLUGIN_HOSTCC
This config symbol should not be defined in target configs.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-06 03:52:33 +00:00
Ilya Lipnitskiy b4aad29a1d
ramips: add support for kernel 5.10
Enable testing kernel.

Delete upstreamed patches:
 0098-disable_cm.patch can be dropped, upstream fixed CM handling.

Fix compile errors by using new kernel APIs.

Fix fuzz by manually editing patches to ensure the code goes in the
right place.

For 721-NET-no-auto-carrier-off-support.patch, revert upstream commit
a307593a6 to keep the OpenWrt ralink driver operational.

Add mt7621-pci-phy patch to select REGMAP_MMIO as discussed in PR #3693
and #3952.

Rename patches to follow the 3-digit classification from the OpenWrt
Developer Guide.

Run automatic quilt refresh.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-05 23:55:51 +00:00
Ilya Lipnitskiy 38ba1f9b4c
ramips: 5.4: refresh configs
Automatic refresh by running make kernel_oldconfig on each target.

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-05 23:55:46 +00:00
Ilya Lipnitskiy 58ad113087 ramips: rename mtk-hsdma to hsdma-mt7621
Follows upstream rename:
https://lore.kernel.org/driverdev-devel/20210130034507.2115280-1-ilya.lipnitskiy@gmail.com/

Fixes ramips builds on 5.4.102

Cc: John Audia <graysky@archlinux.us>
Cc: David Bauer <mail@david-bauer.net>
Cc: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
2021-03-04 23:43:02 -10:00
Jason A. Donenfeld 196f3d586f kernel-5.4: bump to 5.4.102 and refresh patches
5.4.102 backported a lot of stuff that our WireGuard backport already
did, in addition to other patches we had, so those patches were
removed from that part of the series. In the process other patches were
refreshed or reworked to account for upstream changes.

This commit involved `update_kernel.sh -v -u 5.4`.

Cc: John Audia <graysky@archlinux.us>
Cc: David Bauer <mail@david-bauer.net>
Cc: Petr Štetiar <ynezz@true.cz>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2021-03-04 22:06:53 +01:00
Shiji Yang df1e5d6463 ramips: fix partition layout of hiwifi hc5x61
Changes:
 * Increase "oem" partition size from 0x10000 to 0x20000
 * Correct partition lables, synchronize with official firmware

Evidence:
It should be the same as hiwifi hc5x61a and the fact indeed the
case. Here is part of dmesg boot log read from official firmware:
[    1.470000] Creating 7 MTD partitions on "raspi":
[    1.470000] 0x000000000000-0x000000030000 : "u-boot"
[    1.480000] 0x000000030000-0x000000040000 : "hw_panic"
[    1.490000] 0x000000040000-0x000000050000 : "Factory"
[    1.490000] 0x000000fc0000-0x000000fe0000 : "oem"
[    1.500000] 0x000000fe0000-0x000000ff0000 : "bdinfo"
[    1.510000] 0x000000ff0000-0x000001000000 : "backup"
[    1.510000] 0x000000050000-0x000000fc0000 : "firmware"

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-03-01 00:34:23 +01:00
Lech Perczak 59d065c9f8 ramips: add support for ZTE MF283+
ZTE MF283+ is a dual-antenna LTE category 4 router, based on Ralink
RT3352 SoC, and built-in ZTE P685M PCIe MiniCard LTE modem.

Hardware highlighs:
- CPU: MIPS24KEc at 400MHz,
- RAM: 64MB DDR2,
- Flash: 16MB SPI,
- Ethernet: 4 10/100M port switch with VLAN support,
- Wireless: Dual-stream 802.11n (RT2860), with two internal antennas,
- WWAN: Built-in ZTE P685M modem, with two internal antennas and two
  switching SMA connectors for external antennas,
- FXS: Single ATA, with two connectors marked PHONE1 and PHONE2,
  internally wired in parallel by 0-Ohm resistors, handled entirely by
  internal WWAN modem.
- USB: internal miniPCIe slot for modem,
  unpopulated USB A connector on PCB.
- SIM slot for the WWAN modem.
- UART connector for the console (unpopulated) at 3.3V,
  pinout: 1: VCC, 2: TXD, 3: RXD, 4: GND,
  settings: 57600-8-N-1.
- LEDs: Power (fixed), WLAN, WWAN (RGB),
  phone (bicolor, controlled by modem), Signal,
  4 link/act LEDs for LAN1-4.
- Buttons: WPS, reset.

Installation:
As the modem is, for most of the time, provided by carriers, there is no
possibility to flash through web interface, only built-in FOTA update
and TFTP recovery are supported.

There are two installation methods:
(1) Using serial console and initramfs-kernel - recommended, as it
allows you to back up original firmware, or
(2) Using TFTP recovery - does not require disassembly.

(1) Using serial console:
To install OpenWrt, one needs to disassemble the
router and flash it via TFTP by using serial console:
- Locate unpopulated 4-pin header on the top of the board, near buttons.
- Connect UART adapter to the connector. Use 3.3V voltage level only,
  omit VCC connection. Pin 1 (VCC) is marked by square pad.
- Put your initramfs-kernel image in TFTP server directory.
- Power-up the device.
- Press "1" to load initramfs image to RAM.
- Enter IP address chosen for the device (defaults to 192.168.0.1).
- Enter TFTP server IP address (defaults to 192.168.0.22).
- Enter image filename as put inside TFTP server - something short,
  like firmware.bin is recommended.
- Hit enter to load the image. U-boot will store above values in
  persistent environment for next installation.
- If you ever might want to return to vendor firmware,
  BACK UP CONTENTS OF YOUR FLASH NOW.
  For this router, commonly used by mobile networks,
  plain vendor images are not officially available.
  To do so, copy contents of each /dev/mtd[0-3], "firmware" - mtd3 being the
  most important, and copy them over network to your PC. But in case
  anything goes wrong, PLEASE do back up ALL OF THEM.
- From under OpenWrt just booted, load the sysupgrade image to tmpfs,
  and execute sysupgrade.

(2) Using TFTP recovery
- Set your host IP to 192.168.0.22 - for example using:
sudo ip addr add 192.168.0.22/24 dev <interface>
- Set up a TFTP server on your machine
- Put the sysupgrade image in TFTP server root named as 'root_uImage'
  (no quotes), for example using tftpd:
  cp openwrt-ramips-rt305x-zte_mf283plus-squashfs-sysupgrade.bin /srv/tftp/root_uImage
- Power on the router holding BOTH Reset and WPS buttons held for around
  5 seconds, until after WWAN and Signal LEDs blink.
- Wait for OpenWrt to start booting up, this should take around a
  minute.

Return to original firmware:
Here, again there are two possibilities are possible, just like for
installation:
(1) Using initramfs-kernel image and serial console
(2) Using TFTP recovery

(1) Using initramfs-kernel image and serial console
- Boot OpenWrt initramfs-kernel image via TFTP the same as for
  installation.
- Copy over the backed up "firmware.bin" image of "mtd3" to /tmp/
- Use "mtd write /tmp/firmware.bin /dev/mtd3", where firmware.bin is
  your backup taken before OpenWrt installation, and /dev/mtd3 is the
  "firmware" partition.

(2) Using TFTP recovery
- Follow the same steps as for installation, but replacing 'root_uImage'
  with firmware backup you took during installation, or by vendor
  firmware obtained elsewhere.

A few quirks of the device, noted from my instance:
- Wired and wireless MAC addresses written in flash are the same,
  despite being in separate locations.
- Power LED is hardwired to 3.3V, so there is no status LED per se, and
  WLAN LED is controlled by WLAN driver, so I had to hijack 3G/4G LED
  for status - original firmware also does this in bootup.
- FXS subsystem and its LED is controlled by the
  modem, so it work independently of OpenWrt.
  Tested to work even before OpenWrt booted.
  I managed to open up modem's shell via ADB,
  and found from its kernel logs, that FXS and its LED is indeed controlled
  by modem.
- While finding LEDs, I had no GPL source drop from ZTE, so I had to probe for
  each and every one of them manually, so this might not be complete -
  it looks like bicolor LED is used for FXS, possibly to support
  dual-ported variant in other device sharing the PCB.
- Flash performance is very low, despite enabling 50MHz clock and fast
  read command, due to using 4k sectors throughout the target. I decided
  to keep it at the moment, to avoid breaking existing devices - I
  identified one potentially affected, should this be limited to under
  4MB of Flash. The difference between sysupgrade durations is whopping
  3min vs 8min, so this is worth pursuing.

In vendor firmware, WWAN LED behaviour is as follows, citing the manual:
- red - no registration,
- green - 3G,
- blue - 4G.
Blinking indicates activity, so netdev trigger mapped from wwan0 to blue:wwan
looks reasonable at the moment, for full replacement, a script similar to
"rssileds" would need to be developed.

Behaviour of "Signal LED" in vendor firmware is as follows:
- Off - no signal,
- Blinking - poor coverage
- Solid - good coverage.

A few more details on the built-in LTE modem:
Modem is not fully supported upstream in Linux - only two CDC ports
(DIAG and one for QMI) probe. I sent patches upstream to add required device
IDs for full support.
The mapping of USB functions is as follows:
- CDC (QCDM) - dedicated to comunicating with proprietary Qualcomm tools.
- CDC (PCUI) - not supported by upstream 'option' driver yet. Patch
  submitted upstream.
- CDC (Modem) - Exactly the same as above
- QMI - A patch is sent upstream to add device ID, with that in place,
  uqmi did connect successfully, once I selected correct PDP context
  type for my SIM (IPv4-only, not default IPv4v6).
- ADB - self-explanatory, one can access the ADB shell with a device ID
  added to 51-android.rules like so:

SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
LABEL="android_usb_rules_begin"
SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", ATTR{idProduct}=="1275", ENV{adb_user}="yes"
ENV{adb_user}=="yes", MODE="0660", GROUP="plugdev", TAG+="uaccess"
LABEL="android_usb_rules_end"

While not really needed in OpenWrt, it might come useful if one decides to
move the modem to their PC to hack it further, insides seem to be pretty
interesting. ADB also works well from within OpenWrt without that. O
course it isn't needed for normal operation, so I left it out of
DEVICE_PACKAGES.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[remove kmod-usb-ledtrig-usbport, take merged upstream patches]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-26 13:57:54 +01:00
DENG Qingfang 06af45ec05 ramips: remove obsolete mx25l25635f compatible hack
The kernel bump to 5.4 has removed the mx25l25635f hack, and the
mx25l25635f compatible is no longer required.

Signed-off-by: DENG Qingfang <dqfext@gmail.com>
2021-02-24 00:30:40 +01:00
Stijn Segers 06356f0020 ramips: overwrite reset gpio properties in DIR-860L DTS
As suggested by Sergio, this adds GPIOs 19 and 8 explicitly into the
DIR-860L DTS, so the PCI-E ports get reset and the N radio (radio1)
on PCI-E port 1 comes up reliably.

Fixes the following error that popped up in dmesg:

    [    1.638942] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)

Suggested-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
2021-02-23 21:10:56 +01:00
Sander Vanheule 773949c152 ramips: mt7621: enable SX150x driver
The Netgear R6800 and R6700v2 devices have a Semtech SX1503 GPIO
expander controlling the device LEDs. This expander was initially
supported on 4.14, but support was lost in the transition to 5.4.

Since this driver cannot be built as a kernel module, enable it in the
kernel config for all mt7621 devices.

Run-tested on a Netgear R6800.

Cc: Stijn Segers <foss@volatilesystems.org>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Tested-by: Stijn Segers <foss@volatilesystems.org>
2021-02-23 21:10:56 +01:00
Shiji Yang d1176ad95a ramips: improve gpio control for Phicomm PSG1218
Description:
1. From key and led config setting, we can find only "uartf" and "i2c" are used
as gpio by check mt7620 datasheet. It's time to remove unused pin group.

2. PSG1218 only have three led, so we can remove ethernet led pinctrl. refer to
Phicomm K2G.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-02-23 18:31:35 +01:00
Shiji Yang 567a88e4b9 ramips: fix Phicomm PSG1218A switch port labels
The lan port sequence was reversed compared to the labels.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[improve commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-22 18:49:57 +01:00
Adrian Schmutzler d4520d75a1 ramips: move aliases to the top in SoC DTSI files
The aliases node is expected as one of the first entries, and
having it there matches alphabetic sorting as well.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-22 18:49:57 +01:00
Adrian Schmutzler 86a4d78022 ramips: drop redundant definitions of serial0 in aliases
These were redefines of the same value already set in the SoC dtsi
files.

Reported-by: Shiji Yang <yangshiji66@qq.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-22 18:49:57 +01:00
Shiji Yang 55263ffedb ramips: correct/add Phicomm K2x WAN/label MAC address
Phicomm K2G:
add missing label_mac

Phicomm PSG1218A & PSG1218B:
The previous wan mac was set as factory@0x28 +1 (originally based
on the default case for the ramips target), but the correct wan mac
is factory@0x28 -1, being equal to factory@0x2e.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-22 17:32:35 +01:00
Stijn Segers af1b6799c6 ramips: overwrite reset gpio properties in EX6150 DTS
The Netgear EX6150 can, just like the D-Link DIR-860L rev B1, fail to
initialise both radios in some cases. Add the reset GPIOs explicitly
so the PCI-E devices get re-initialised properly. See also FS #3632.

Error shows up in dmesg as follows:

  [    1.560764] mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK)

Tested-by: Kurt Roeckx <kurt@roeckx.be>
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
[removed period from commit title]
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-02-20 01:27:00 +01:00
Seo Suchan ca6954e2dc ramips: use lzma-loader for Wevo devices
As kernel size increased it start to fail to load squishfs image,
using lzma-loader fixed it.
wevo_11acnas is almost same device as w2914ns-v2 except ram size,
so I expect same thing would've happen in that device too.

Signed-off-by: Seo Suchan <abnoeh@mail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-02-19 14:09:50 +01:00
Sander Vanheule 1e75909a35 ramips: mt7621: add TP-Link EAP235-Wall support
The TP-Link EAP235-Wall is a wall-mounted, PoE-powered AC1200 access
point with four gigabit ethernet ports.

When connecting to the device's serial port, it is strongly advised to
use an isolated UART adapter. This prevents linking different power
domains created by the PoE power supply, which may damage your devices.

The device's U-Boot supports saving modified environments with
`saveenv`. However, there is no u-boot-env partition, and saving
modifications will cause the partition table to be overwritten. This is
not an issue for running OpenWrt, but will prevent the vendor FW from
functioning properly.

Device specifications:
* SoC: MT7621DAT
* RAM: 128MiB
* Flash: 16MiB SPI-NOR
* Wireless 2.4GHz (MT7603EN): b/g/n, 2x2
* Wireless 5GHz (MT7613BEN): a/n/ac, 2x2
* Ethernet: 4× GbE
  * Back side: ETH0, PoE PD port
  * Bottom side: ETH1, ETH2, ETH3
* Single white device LED
* LED button, reset button (available for failsafe)
* PoE pass-through on port ETH3 (enabled with GPIO)

Datasheet of the flash chip specifies a maximum frequency of 33MHz, but
that didn't work. 20MHz gives no errors with reading (flash dump) or
writing (sysupgrade).

Device mac addresses:
Stock firmware uses the same MAC address for ethernet (on device label)
and 2.4GHz wireless. The 5GHz wireless address is incremented by one.
This address is stored in the 'info' ('default-mac') partition at an
offset of 8 bytes.
From OEM ifconfig:
    eth     a4:2b:b0:...:88
    ra0     a4:2b:b0:...:88
    rai0    a4:2b:b0:...:89

Flashing instructions:
* Enable SSH in the web interface, and SSH into the target device
* run `cliclientd stopcs`, this should return "success"
* upload the factory image via the web interface

Debricking:
U-boot can be interrupted during boot, serial console is 57600 baud, 8n1
This allows installing a sysupgrade image, or fixing the device in
another way.
* Access serial header from the side of the board, close to ETH3,
  pin-out is (1:TX, 2:RX, 3:GND, 4:3.3V), with pin 1 closest to ETH3.
* Interrupt bootloader by holding '4' during boot, which drops the
  bootloader into its shell
* Change default 'serverip' and 'ipaddr' variables (optional)
* Download initramfs with `tftpboot`, and boot image with `bootm`
    # tftpboot 84000000 openwrt-initramfs.bin
    # bootm

Revert to stock:
Using the tplink-safeloader utility from the firmware-utils package,
TP-Link's firmware image can be converted to an OpenWrt-compatible
sysupgrade image:
  $ ./staging_dir/host/bin/tplink-safeloader -B EAP235-WALL-V1 \
      -z EAP235-WALLv1_XXX_up_signed.bin -o eap235-sysupgrade.bin

This can then be flashed using the OpenWrt sysupgrade interface. The
image will appear to be incompatible and must be force flashed, without
keeping the current configuration.

Known issues:
- DFS support is incomplete (known issue with MT7613)
- MT7613 radio may stop responding when idling, reboot required.
  This was an issue with the ddc75ff704 version of mt76, but appears to
  have improved/disappeared with bc3963764d.
  Error notice example:
  [ 7099.554067] mt7615e 0000:02:00.0: Message 73 (seq 1) timeout

Hardware was kindly provided for porting by Stijn Segers.

Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Sander Vanheule <sander@svanheule.net>
2021-02-19 14:00:08 +01:00
Stijn Segers 0265cba40a ramips: remove factory image for TP-Link Archer C20 v1
Similarly to the Archer C2 v1, the Archer C20 v1 will brick when one
tries to flash an OpenWrt factory image through the TP-Link web UI.
The wiki page contains an explicit warning about this [1].

Disable the factory image altogether since it serves no purpose.

[1] https://openwrt.org/toh/tp-link/tp-link_archer_c20_v1#installation

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2021-02-19 13:56:27 +01:00
John Audia 5d3a6fd970 kernel: bump 5.4 to 5.4.99
Ran update_kernel.sh in a fresh clone without any existing toolchains.
No manual changes needed.

Build system: x86_64
Build-tested: bcm27xx/bcm2711

Signed-off-by: John Audia <graysky@archlinux.us>
2021-02-18 20:04:50 +01:00
Kurt Roeckx 539966554d ramips: mark toggle input on EX6150 as a switch
The Netgear EX6150 has an Access Point/Extender switch. Set it as
an EV_SW. Otherwise when it's set to Access Point, it will trigger
failsafe mode during boot.

Fixes: FS#3590
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
2021-02-15 00:00:38 +01:00
Sander Vanheule 69551a2442 ramips: manage low reset lines
The bootloader of a number of recent TP-Link devices does not properly
initialise the MT7621's internal switch when booting from flash. To
enable the mt7530 driver to clear the reset on the switch, the ramips
reset controller must be allowed to toggle these.

Backport upstream commit 3f9ef7785a9c from mips-next to allow control of
the "mcm" reset line.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2021-02-14 09:33:42 +01:00
Stijn Segers ad5e29d38a ramips: remove factory image for TP-Link Archer C2 v1
Initial commit 8375623a06 ("ramips: add support for TP-Link Archer
C2") contains detailed installation instructions, which do not mention
a factory image. From what I can see, no support to install OpenWrt
through the vendor web interface has been added since. The factory
image is also conspicuously absent from the device page in the wiki.
Yet, it is available for download.

I bricked my Archer C2 loading the factory image through the web UI.
Serial showed this error during bootloop:

  Uncompressing Kernel Image ... LZMA ERROR 1 - must RESET board to recover

This patch disables the undocumented factory image so users won't get
tricked into thinking easy web UI flashing actually works.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2021-02-13 21:21:01 +01:00
INAGAKI Hiroshi 08768b44d9 ramips: add support for ELECOM WRC-1167FS
ELECOM WRC-1167FS is a 2.4/5 GHz band 11ac (WiFi-5) router, based on
MT7628AN.

Specification:

- SoC		: MediaTek MT7628AN
- RAM		: DDR2 64 MiB (NT5TU32M16FG-AC)
- Flash		: SPI-NOR 16 MiB (W25Q128JVSIQ)
- WLAN		: 2.4/5 GHz 2T2R
  - 2.4 GHz	: MediaTek MT7628AN (SoC)
  - 5 GHz	: MediaTek MT7612E
- Ethernet	: 10/100 Mbps x2
  - Switch	: MT7628AN (SoC)
- LEDs/Keys	: 6x, 3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J1: 3.3V, GND, TX, RX from "J1" marking
  - 57600n8
- Power		: 12 VDC, 1 A

Flash instruction using factory image:

1. Boot WRC-1167FS normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button to
   perform firmware update
4. Wait ~120 seconds to complete flashing

Notes:

- Last 0x800000 (8 MiB) in SPI-NOR flash is not used on stock firmware

- Additional padding in factory image is required to avoid incomplete
  flashing on stock firmware

MAC addresses:

- LAN	: BC:5C:4C:xx:xx:68 (Config, ethaddr (text) / Factory, 0x28   (hex))
- WAN	: BC:5C:4C:xx:xx:69 (Config, wanaddr (text) / Factory, 0x22   (hex))
- 2.4GHz: BC:5C:4C:xx:xx:6A (Config, rmac    (text) / Factory, 0x4    (hex))
- 5GHz	: BC:5C:4C:xx:xx:6B (Config, rmac2   (text) / Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2021-02-11 16:37:53 +01:00
Adrian Schmutzler 598b29585e target: use SPDX license identifiers on Makefiles
Use SPDX license tags to allow machines to check licenses.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-10 15:47:18 +01:00
Andrew Pikler cd2b661453 ramips: add support for Cudy WR1300
Specifications:
 - SoC: MediaTek MT7621AT
 - RAM: 128 MB (DDR3)
 - Flash: 16 MB (SPI NOR)
 - WiFi: MediaTek MT7603E, MediaTek MT7612E
 - Switch: 1 WAN, 4 LAN (Gigabit)
 - Ports: 1 USB 3.0
 - Buttons: Reset, WPS
 - LEDs: Power, System, Wan, Lan 1-4, WiFi 2.4G, WiFi 5G, WPS, USB
 - Power: DC 12V 1A tip positive

UART Serial:
  115200 baud
  Located on unpopulated 4 pin header near J4:

  J4
  [o] Rx
  [o] Tx
  [o] GND
  [ ] Vcc - Do not connect

Installation:

Download and flash the manufacturer's built OpenWRT image available at
http://www.cudytech.com/openwrt_software_download
Install the new OpenWRT image via luci (System -> Backup/Flash firmware)
Be sure to NOT keep settings. The force upgrade may need to be checked
due to differences in router naming conventions.

Recovery:
 - Loads only signed manufacture firmware due to bootloader RSA verification
 - serve tftp-recovery image as /recovery.bin on 192.168.1.88/24
 - connect to any lan ethernet port
 - power on the device while holding the reset button
 - wait at least 8 seconds before releasing reset button for image to
   download
 - See http://www.cudytech.com/newsinfo/547425.html

MAC addresses as verified by OEM firmware:

use   address   source
LAN   *:f0      label
WAN   *:f1      label + 1
2g    *:f0      label
5g    *:f2      label + 2

The label MAC address is found in bdinfo 0xde00.

Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
2021-02-09 13:58:18 +01:00
Chukun Pan 82032f3509 ramips: add support for JCG Y2
JCG Y2 is an AC1300M router

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W25Q128JVSQ 16MiB
  RAM: Nanya NT5CB128M16 256MiB
  WLAN: 2.4/5 GHz 2T2R (1x MediaTek MT7615)
  Ethernet: 10/100/1000 Mbps x5
  LED: POWER, INTERNET, 2.4G, 5G
  Button: Reset
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page.

MAC addresses map:
  0x0004  *:c8  wlan2g/wlan5g/label
  0xe000  *:c7  lan
  0xe006  *:c6  wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2021-02-09 13:10:33 +01:00
Szabolcs Hubai 1e9afcca56 ramips: disable default build for HooToo HT-TM02
While the latest version of 19.07 release is usable,
the current master is unbootable on the device in a normal way.

"Normal way" installations includes:
- sysupgrade (e.g. from 19.07)
- RESET button recovery with Ron Curry's (Wingspinner) UBoot image
  (10.10.10.3 + "Kernal.bin")
- RESET button recovery with original U-Boot
  (10.10.10.254 + "kernel")

One could flash and boot the latest master sysupgrade image successfully
with serial access to the device. But a sysupgrade from this state still
breaks the U-Boot and soft-bricks the device.

Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
2021-02-07 22:06:57 +01:00
Adrian Schmutzler 1c0e13db43 ramips: mt7621: use preferred logic in lib/upgrade/iodata.sh
shellcheck recommends || and && over "-a" and "-o" because the
latter are not well defined.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-07 21:58:51 +01:00
INAGAKI Hiroshi 88fbddb49d ramips: add support for I-O DATA WN-DX1200GR
I-O DATA WN-DX1200GR is a 2.4/5 GHz band 11ac (WiFi-5) router, based on
MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 128 MiB
- Flash		: raw NAND 128 MiB
- WLAN		: 2.4/5 GHz 2T2R
  - 2.4 GHz	: MediaTek MT7603E
  - 5 GHz	: MediaTek MT7613BE
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LEDs/keys	: 2x/3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J5: 3.3V, TX, RX, NC, GND from triangle-mark
  - 57600n8
- Power		: 12 VDC, 1 A

Flash instruction using initramfs image:

1. Boot WN-DX1200GR normally
2. Access to "http://192.168.0.1/" and open firmware update page
   ("ファームウェア")
3. Select the OpenWrt initramfs image and click update ("更新") button
   to perform firmware update
4. On the initramfs image, perform sysupgrade with the
   squashfs-sysupgrade image
5. Wait ~120 seconds to complete flashing

Notes:

- currently, mt7615e driver in mt76 doesn't fully support MT7613
  (MT7663) wifi chip
  - the eeprom data in flash is not used by mt7615e driver and the
    driver reports the tx-power up to 3dBm
  - the correct MAC address for MT7613BE in eeprom data cannot be
    assigned to the phy

- last 0x80000 (512 KiB) in NAND flash is not used on stock firmware

- stock firmware requires "customized uImage header" (called as "combo
  image") by MSTC (MitraStar Technology Corp.), but U-Boot doesn't

  - uImage magic ( 0x0 - 0x3 ) : 0x434F4D43 ("COMC")
  - header crc32 ( 0x4 - 0x7 ) : with "data length" and "data crc32"
  - image name   (0x20 - 0x37) : model ID and firmware versions
  - data length  (0x38 - 0x3b) : kernel + rootfs
  - data crc32   (0x3c - 0x3f) : kernel + rootfs

MAC addresses:

LAN:	50:41:B9:xx:xx:08 (Ubootenv, ethaddr (text) / Factory, 0x1E000 (hex))
WAN:	50:41:B9:xx:xx:0A (Factory,  0x1E006 (hex))
2.4GHz:	50:41:B9:xx:xx:08 (Factory,  0x4     (hex))
5GHz:	50:41:B9:xx:xx:09 (Factory,  0x8004  (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[add check whether dflag_offset is set]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-07 21:58:51 +01:00
Yanase Yuki d468ff97b7 build: move elx-header into image-commands.mk
ELECOM WAB-I1750-PS will need this in ath79, so move it to common
Makefile.

Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
2021-02-05 21:57:19 +01:00
Adrian Schmutzler 3f4d1dad00 ramips: replace full-text licenses by SPDX identifier
This replaces several full-text and abbreviated licenses found in
DTS files by the corresponding SPDX identifiers.

This should make it easier to identify the license both by humans
and machines.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 18:18:00 +01:00
David Bentham 4a18039785 ramips: add support for UniElec U7621-01
UniElec U7621-01 is a router platform board, the smaller model of
the U7621-06.
The device has the following specifications:

- MT7621AT (880 MHz)
- 256 of RAM (DDR3)
- 16 MB of FLASH (SPI NOR)
- 5x 1 Gbps Ethernet (MT7621 built-in switch)
- 1x 2.4Ghz MT7603E
- 1x 5Ghz MT7612
- 1x miniPCIe slots (PCIe bus only)
- 1x miniSIM slot
- 1x USB 2.0 (uses the usb 3.0 driver)
- 8x LEDs (1x GPIO-controlled)
- 1x reset button
- 1x UART header (4-pins)
- 1x GPIO header (30-pins)
- 1x DC jack for main power (12 V)

The following has been tested and is working:

- Ethernet switch
- 1x 2.4Ghz MT7603E (wifi)
- 1x 5Ghz MT7612 (wifi)
- miniPCIe slots (tested with Wi-Fi cards and LTE modem cards)
- miniSIM slot (works with normal size simcard)
- sysupgrade
- reset button

Installation:

This board has no locked down bootloader. The seller can be asked to
install openwrt v18.06, so upgrades are standard sysupgrade method.

Recovery:

This board contains a Chinese, closed-source bootloader called Breed
(Boot and Recovery Environment for Embedded Devices). Breed supports web
recovery and to enter it, you keep the reset button pressed for around
5 seconds during boot. Your machine will be assigned an IP through DHCP
and the router will use IP address 192.168.1.1. The recovery website is
in Chinese, but is easy to use. Click on the second item in the list to
access the recovery page, then the second item on the next page is where
you select the firmware. In order to start the recovery, you click the
button at the bottom.

LEDs list (left to right):

- ESW_P0_LED_0
- ESW_P1_LED_0
- ESW_P2_LED_0
- ESW_P3_LED_0
- ESW_P4_LED_0
- CTS2_N (GPIO10, configured as "status" LED)
- LED_WLAN# (connected with pin 44 in wifi1 slot)

Signed-off-by: David Bentham <db260179@gmail.com>
[add DEVICE_VARIANT, fix DEVICE_PACKAGES, remove &gpio]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 17:31:51 +01:00
Ewan Parker ddafcc7947 ramips: add support for Hi-Link HLK-7688A
Specifications:

  - SoC: MediaTek MT7688AN
  - RAM: 128 MB
  - Flash: 32 MB
  - Ethernet: 5x 10/100 (1x WAN, 4x LAN)
  - Wireless: built in 2.4GHz (bgn)
  - USB: 1x USB 2.0 port
  - Buttons: 1x Reset
  - LEDs: 1x (WiFi)

Flash instructions:

  - Configure TFTP server with IP address 10.10.10.3
  - Name the firmware file as firmware.bin
  - Connect any Ethernet port to the TFTP server's LAN
  - Choose option 2 in U-Boot
  - Alternatively choose option 7 to upload firmware to the built-in
    web server

MAC addresses as verified by OEM firmware:

  use   address   source
  2g    *:XX      factory 0x4
  LAN   *:XX+1    factory 0x28
  WAN   *:XX+1    factory 0x2e

Notes:

This board is ostensibly a module containing the MediaTek MT7688AN SoC,
128 MB DDR2 SDRAM and 32 MB flash storage.  The SoC can be operated in
IoT Gateway Mode or IoT Device Mode.

From some vendors the U-Boot that comes installed operates on UART 2
which is inaccessible in gateway mode and operates unreliably in the
Linux kernel when using more than 64 MB of RAM.  For those, updating
U-Boot is recommended.

Signed-off-by: Ewan Parker <ewan@ewan.cc>
[add WLAN to 01_leds]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-02-05 14:54:47 +01:00
INAGAKI Hiroshi eb11cd9ea3 ramips: add support for ELECOM WRC-2533GHBK-I
ELECOM WRC-2533GHBK-I 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/5 GHz 4T4R (2x MediaTek MT7615)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/keys	: 4x/3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, RX, GND, TX from SoC side
  - 57600n8
- Power		: 12VDC, 1.5A

Flash instruction using factory image:

1. Boot WRC-2533GHBK-I normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~150 seconds to complete flashing

MAC addresses:

LAN	: BC:5C:4C:xx:xx:89 (Config, ethaddr (text))
WAN	: BC:5C:4C:xx:xx:88 (Config, wanaddr (text))
2.4GHz	: BC:5C:4C:xx:xx:8A (Factory, 0x4    (hex))
5GHz	: BC:5C:4C:xx:xx:8B (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-01-29 15:32:07 +01:00
Adrian Schmutzler 703fd8aef4 ramips: remove generic profiles
On a platform with many very different devices, like found on ramips,
the generic profiles seem like remnants of the past that do not
have a real use anymore.

Remove them to have one thing less to maintain.

Actually, rt288x didn't have a default profile in the first place.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Paul Spooren <mail@aparcar.org>
2021-01-27 21:31:20 +01:00
Felix Fietkau ff9846dbb9 ramips: use lzma-loader on zbtlink devices
Fixes boot loader LZMA decompression issues

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-27 18:26:53 +01:00
Adrian Schmutzler f52081bcf9 treewide: provide global default for SUPPORTED_DEVICES
The majority of our targets provide a default value for the variable
SUPPORTED_DEVICES, which is used in images to check against the
compatible on a running device:

  SUPPORTED_DEVICES := $(subst _,$(comma),$(1))

At the moment, this is implemented in the Device/Default block of
the individual targets or even subtargets. However, since we
standardized device names and compatible in the recent past, almost
all targets are following the same scheme now:

  device/image name:  vendor_model
  compatible:         vendor,model

The equal redundant definitions are a symptom of this process.

Consequently, this patch moves the definition to image.mk making it
a global default. For the few targets not using the scheme above,
SUPPORTED_DEVICES will be defined to a different value in
Device/Default anyway, overwriting the default. In other words:
This change is supposed to be cosmetic.

This can be used as a global measure to get the current compatible
with: $(firstword $(SUPPORTED_DEVICES))
(Though this is not precisely an achievement of this commit.)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-23 12:45:21 +01:00
Bjørn Mork 402408b368 kernel: mtdsplit_uimage: replace "edimax, uimage" parser
The "edimax,uimage"" parser can be replaced by the generic
parser using device specific openwrt,partition-magic and
openwrt,offset properties.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 01a1e21863 kernel: mtdsplit_uimage: replace "openwrt, okli" parser
The only difference between the "openwrt,okli" and the generic
parser is the magic.  Set this in device tree for all affected
devices and  remove the "openwrt,okli" parser.

Tested-by: Michael Pratt <mcpratt@protonmail.com> # EAP300 v2, ENS202EXT and ENH202
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 5ab5bacda2 kernel: mtdsplit_uimage: replace "fonfxc" and "sge" parsers
Convert users of the "fonfxc" and "sge" parsers to the generic
"openwrt,uimage", using device specific "openwrt,padding" properties.

Tested-by: Stijn Segers <foss@volatilesystems.org> [DIR-878 A1]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Adrian Schmutzler b3eccbca7c ramips: fix port labels for Xiaomi Mi Router 4
The OEM assignment of LAN ports is swapped.

Fixes: c2a7bb520a ("ramips: mt7621: add support for Xiaomi Mi Router 4")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:56:43 +01:00
Dmytro Oz c2a7bb520a ramips: mt7621: add support for Xiaomi Mi Router 4
Xiaomi Mi Router 4 is the same as Xiaomi Mi Router 3G, except for
the RAM (256Mib→128Mib), LEDs and gpio (MiNet button).

Specifications:

Power: 12 VDC, 1 A
Connector type: barrel
CPU1: MediaTek MT7621A (880 MHz, 4 cores)
FLA1: 128 MiB (ESMT F59L1G81MA)
RAM1: 128 MiB (ESMT M15T1G1664A)
WI1 chip1: MediaTek MT7603EN
WI1 802dot11 protocols: bgn
WI1 MIMO config: 2x2:2
WI1 antenna connector: U.FL
WI2 chip1: MediaTek MT7612EN
WI2 802dot11 protocols: an+ac
WI2 MIMO config: 2x2:2
WI2 antenna connector: U.FL
ETH chip1: MediaTek MT7621A
Switch: MediaTek MT7621A

UART Serial
[o] TX
[o] GND
[o] RX
[ ] VCC - Do not connect it

MAC addresses as verified by OEM firmware:

use   address   source
LAN   *:c2      factory 0xe000 (label)
WAN   *:c3      factory 0xe006
2g    *:c4      factory 0x0000
5g    *:c5      factory 0x8000

Flashing instructions:

1.Create a simple http server (nginx etc)
2.set uart enable
To enable writing to the console, you must reset to factory settings
Then you see uboot boot, press the keyboard 4 button (enter uboot command line)
If it is not successful, repeat the above operation of restoring the factory settings.
After entering the uboot command line, type:

setenv uart_en 1
saveenv
boot

3.use shell in uart
cd /tmp
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0
nvram set flag_try_sys1_failed=1
nvram commit
reboot
4.login to the router http://192.168.1.1/

Installation via Software exploit
Find the instructions in the https://github.com/acecilia/OpenWRTInvasion

Signed-off-by: Dmytro Oz <sequentiality@gmail.com>
[commit message facelift, rebase onto shared DTSI/common device
definition, bump uboot-envtools]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:53:19 +01:00
Adrian Schmutzler 93be5926a2 ramips: mt7621: create DTSI for Xiaomi NAND devices
This creates a DTSI for Xiaomi devices with 128M NAND.

This allows to consolidate the partitions and a few other nodes for
AC2100 family and Mi Router 3G.

Note that the Mi Router 3 Pro has 256M NAND and differently sized
partitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Adrian Schmutzler 5a46b71826 ramips: mt7621: reorganize shared device definitions for Xiaomi
This creates a shared device definition for Xiaomi devices with
NAND and "separate" images, i.e. kernel1.bin and rootfs0.bin.

This allows to consolidate similar/duplicate code for AC2100 family
and Mi Router 3G.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Rui Salvaterra 41b096b448 ramips: mt7621: refresh the kernel config
The removed config symbols are already enabled by the generic kernel
configuration (or by default), while the added ones are forcefully
enabled by the specific architecture.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-01-15 19:12:57 +01:00
Sungbo Eo 583e39e3d5 kernel: drop empty kmod-ledtrig-* packages
The following four led triggers are enabled in generic config.

* kmod-ledtrig-default-on
* kmod-ledtrig-heartbeat
* kmod-ledtrig-netdev
* kmod-ledtrig-timer

Drop the packages and remove them from DEVICE_PACKAGES.
There's no other package depending on them in this repo.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:24:31 +01:00
John Audia 4ebec0b3e2 kernel: bump 5.4 to 5.4.87
All modification by update_kernel.sh.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Compile-tested [*]: ath79/{generic,tiny}, ipq40xx, octeon,
                    ramips/mt7621, realtek, x86/64.
Run-tested [*]:     ramips/mt7621 (DIR-878 A1, R6800, RT-AC57U),
                    octeon (EdgeRouter Lite).

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-08 21:09:17 +01:00
Leon M. George 211fed5f49 ramips: remove trailing whitespace in Makefiles
Remove trailing whitespaces in two *.mk files.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[fix title, add message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-07 19:51:50 +01:00
David Bauer b4c0d377f6 ramips: limit 5GHz channels for UniFi 6 Lite
The MT7915 radio currently advertises 2.4GHz channels while the antenna
path only supports 5 GHz. Limit the radio to 5GHz channels to prevent
users from configuring non-supported channels.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-06 00:00:01 +01:00
David Bauer fb4d7a9680 ramips: add support for Ubiquiti UniFi 6 Lite
Hardware
--------
MediaTek MT7621AT
256M DDR3
32M SPI-NOR
MediaTek MT7603 2T2R 802.11n 2.4GHz
MediaTek MT7915 2T2R 802.11ax 5GHz

Not Working
-----------
 - Bluetooth (connected to UART3)

UART
----

UART is located in the lower left corner of the board. Pinout is

0 - 3V3 (don't connect)
1 - RX
2 - TX
3 - GND

Console is 115200 8N1.

Boot
----

1. Connect to the serial console and connect power.

2. Double-press ESC when prompted

3. Set the fdt address

   $ fdt addr $(fdtcontroladdr)

4. Remove the signature node from the control FDT

   $ fdt rm /signature

5. Transfer and boot the OpenWrt initramfs image to the device.
   Make sure to name the file C0A80114.img and have it reachable at
   192.168.1.1/24

   $ tftpboot; bootm

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.

Below are the original installation instructions prior to the discovery
of "devmode=TRUE". They are not required for installation and are
documentation only.

The bootloader employs signature verification on the FIT image
configurations. This way, booting unauthorized image without patching
the bootloader is not possible. Manually configuring the bootcmd in the
U-Boot envronment won't work, as this is restored to the default value
if modified.

The bootloader is made up of three different parts.

1. The SPL performing early board initialization and providing a XModem
   recovery in case the PBL is missing

2. The PBL being the primary U-Boot application and containing the
   control FDT. It is LZMA packed with a uImage header.

3. A Ubiquiti standalone U-Boot application providing the main boot
   routine as well as their recovery mechanism.

In a perfect world, we would only replace the PBL, as the SPL does not
perform checks on the PBLs integrity. However, as the PBL is in the same
eraseblock as the SPL, we need to at least rewrite both.

The bootloader will only verify integrity in case it has a "signature"
node in it's control device-tree. Renaming the signature node to
something else will prevent this from happening.

Warning: These instructions are based on the firmware intially
shipped with the device and potentially brick your device in a way it
can only be recovered using a SPI flasher.

Only (!) proceed if you understand this!

1. Extract the bootloader from the U-Boot partition using the OpenWrt
   initramfs image.

2. Split the bootloader into it's 3 components:

   $ dd if=bootloader.bin of=spl.bin bs=1 skip=0 count=45056
   $ dd if=bootloader.bin of=pbl.uimage bs=1 skip=45056 count=143360
   $ dd if=bootloader.bin of=ubnt.uimage bs=1 skip=188416

3. Strip the uImage header from the PBL

   $ dd if=pbl.uimage of=pbl.lzma bs=64 skip=1

4. Decompress the PBL

   $ lzma -d pbl.lzma --single-stream

   The decompressed PBL sha256sum should be
   d8b406c65240d260cf15be5f97f40c1d6d1b6e61ec3abed37bb841c90fcc1235

5. Open the decompressed PBL using your favorite hexeditor. Locate the
   control FDT at offset 0x4CED0 (0xD00DFEED). At offset 0x4D5BC, the
   label for the signature node is located. Rename the "signature"
   string at this offset to "signaturr".

   The patched PBL sha256sum should be
   d028e374cdb40ba44b6e3cef2e4e8a8c16a3b85eb15d9544d24fdd10eed64c97

6. Compress the patched PBL

   $ lzma -z pbl --lzma1=dict=67108864

   The resulting pbl.lzma file should have the sha256sum
   7ae6118928fa0d0b3fe4ff81abd80ecfd9ba2944cb0f0a462b6ae65913088b42

7. Create the PBL uimage

   $ SOURCE_DATE_EPOCH=1607909492 mkimage -A mips -O u-boot -C lzma
     -n "U-Boot 2018.03 [UniFi,v1.1.40.71]" -a 84000000 -e 84000000
     -T firmware -d pbl.lzma patched_pbl.uimage

   The resulting patched_pbl.uimage should have the sha256sum
   b90d7fa2dcc6814180d3943530d8d6b0d6a03636113c94e99af34f196d3cf2ce

8. Reassemble the complete bootloader

   $ dd if=patched_pbl.uimage of=aligned_pbl.uimage bs=143360 count=1
     conv=sync
   $ cat spl.bin > patched_uboot.bin
   $ cat aligned_pbl.uimage >> patched_uboot.bin
   $ cat ubnt.uimage >> patched_uboot.bin

   The resulting patched_uboot.bin should have the sha256sum
   3e1186f33b88a525687285c2a8b22e8786787b31d4648b8eee66c672222aa76b

9. Transfer your patched bootloader to the device. Also install the
   kmod-mtd-rw package using opkg and load it.

   $ insmod mtd-rw.ko i_want_a_brick=1

   Write the patched bootloader to mtd0

   $ mtd write patched_uboot.bin u-boot

10. Erase the kernel1 partition, as the bootloader might otherwise
    decide to boot from there.

    $ mtd erase kernel1

11. Transfer the OpenWrt sysupgrade image to the device and install
    using sysupgrade.

FIT configurations
------------------

In the future, the MT7621 UniFi6 family can be supported by a single
OpenWrt image.

config@1: U6 Lite
config@2: U6 IW
config@3: U6 Mesh
config@4: U6 Extender
config@5: U6 LR-EA (Early Access - GA is MT7622)

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-05 16:25:13 +01:00
Adrian Schmutzler 1fb40a72da treewide: use more descriptive names for concatenated partitions
A few devices in ath79 and ramips use mtd-concat to concatenate
individual partitions into a bigger "firmware" or "ubi" partition.

However, the original partitions are still present and visible,
and one can write to them directly although this might break the
actual virtual, concatenated partition.

As we cannot do much about the former, let's at least choose more
descriptive names than just "firmwareX" in order to indicate the
concatenation to the user. He might be less tempted into overwriting
a "fwconcat1" than a "firmware1", which might be perceived as an
alternate firmware for dual boot etc.

This applies the new naming consistently for all relevant devices,
i.e. fwconcatX for virtual "firmware" members and ubiconcatX for
"ubi" members.

While at it, use DT labels and label property consistently, and
also use consistent zero-based indexing.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-27 20:33:45 +01:00
INAGAKI Hiroshi 7ba2f5c96f ramips: add support for ELECOM WRC-1167GST2
ELECOM WRC-1167GST2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based
on MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 256 MiB
- Flash		: SPI-NOR 32 MiB
- WLAN		: 2.4/5 GHz 2T2R (MediaTek MT7615D)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/keys	: 6x/6x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, GND, TX, RX from ethernet port side
  - 57600n8
- Power		: 12VDC, 1A

MAC addresses:

LAN	: 04:AB:18:**:**:07 (Factory, 0xE000 (hex))
WAN	: 04:AB:18:**:**:08 (Factory, 0xE006 (hex))
2.4 GHz	: 04:AB:18:**:**:09 (none)
5 GHz	: 04:AB:18:**:**:0A (none)

Flash instruction using factory image:

1. Boot WRC-1167GST2 normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~150 seconds to complete flashing

Notes:

- there is no way to configure the correct MAC address for secondary phy
  (5GHz) on MT7615D
- Wi-Fi band on primary phy (2.4GHz) cannot be limitted by specifying
  ieee80211-freq-limit
  (fail to register secondary phy due to error)
- mtd-mac-address in the wifi node is required for using
  mtd-mac-address-increment

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[rebase onto split DTSI]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-22 21:44:57 +01:00
INAGAKI Hiroshi a04d733e56 ramips: add support for ELECOM WRC-1167GS2-B
ELECOM WRC-1167GS2-B 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/5 GHz 2T2R (MediaTek MT7615D)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/keys	: 6x/6x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, GND, TX, RX from ethernet port side
  - 57600n8
- Power		: 12VDC, 1A

MAC addresses:

LAN	: 04:AB:18:**:**:13 (Factory, 0xFFF4 (hex))
WAN	: 04:AB:18:**:**:14 (Factory, 0xFFFA (hex))
2.4 GHz	: 04:AB:18:**:**:15 (none)
5 GHz	: 04:AB:18:**:**:16 (Factory, 0x4 (hex))

Flash instruction using factory image:

1. Boot WRC-1167GS2-B normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~120 seconds to complete flashing

Notes:

- there is no way to configure the correct MAC address for secondary phy
  (5GHz) on MT7615D
- Wi-Fi band on primary phy (2.4GHz) cannot be limitted by specifying
  ieee80211-freq-limit
  (fail to register secondary phy due to error)
- mtd-mac-address in the wifi node is required for using
  mtd-mac-address-increment

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[rebase onto split DTSI patch]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-22 21:44:57 +01:00
Adrian Schmutzler d0b7e186e6 ramips: mt7621: create DTSI for ELECOM WRC GS devices with 2 PCI
This creates a dedicated DTSI for ELECOM WRC GS devices with 2 PCI
WiFi chips in preparation for the 1 chip - dual radio devices, so
the latter can reuse part of the common definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-22 21:44:57 +01:00
Andrew Pikler 28262f815e ramips: add support for D-Link DIR-882 R1
Specifications:
- SoC: MediaTek MT7621AT
- RAM: 128 MB (DDR3)
- Flash: 16 MB (SPI NOR)
- WiFi: MediaTek MT7615N (x2)
- Switch: 1 WAN, 4 LAN (Gigabit)
- Ports: 1 USB 2.0, 1 USB 3.0
- Buttons: Reset, WiFi Toggle, WPS
- LEDs: Power, Internet, WiFi 2.4G WiFi 5G, USB 2.0, USB 3.0

The R1 revision is identical to the A1 revision except
- No Config2 Parition, therefore
- factory partition resized to 64k from 128K
- Firmware partition offset is 0x50000 not 0x60000
- Firmware partitions size increased by 64K
- Firmware partition type is "denx,uimage", not "sge,uimage"
- Padding of image creation "uimage-padhdr 96" removed

Installation:
- Older firmware versions: put the factory image on a USB stick, turn on
the telnet console, and flash using the following cmd
"fw_updater Linux /mnt/usb_X_X/firmware.bin"

- D-Link FailsafeUI:
Power down the router, press and hold the reset button, then
re-plug it. Keep the reset button pressed until the internet LED stops
flashing, then jack into any lan port and manually assign a static IP
address in 192.168.0.0/24 other than 192.168.0.0 (e.g. 192.168.0.2)
and go to http://192.168.0.1
Flash with the factory image.

Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
2020-12-22 19:11:50 +01:00
Andrew Pikler 40437b18f4 firmware: add tool for signing d-link ru router factory firmware images
Some Russian d-link routers require that their firmware be signed with a
salted md5 checksum followed by the bytes 0x00 0xc0 0xff 0xee. This tool
signs factory images the OEM's firmware accepts them.

Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
2020-12-22 19:11:50 +01:00
Michael Pratt a459696eb1 ramips: add support for Senao Engenius ESR600H
FCC ID: A8J-ESR750H

Engenius ESR600H is an indoor wireless router with a gigabit switch,
2.4 GHz and 5 GHz wireless, internal and external antennas, and a USB port.

**Specification:**

  - RT3662F			MIPS SOC, 5 GHz WMAC (2x2)
  - RT5392L			PCI on-board, 2.4 GHz (2x2)
  - AR8327			RGMII, 7-port GbE, 25 MHz clock
  - 40 MHz reference clock
  - 8 MB FLASH			25L6406EM2I-12G
  - 64 MB RAM
  - UART at J12			(unpopulated)
  - 2 internal antennas		(5 GHz)
  - 2 external antennas		(2.4 GHz)
  - 9 LEDs, 1 button		(power, wps, wifi2g, wifi5g, 5 LAN/WAN)
  - USB 2 port			(GPIO controlled power)

**MAC addresses:**

  MAC Addresses are labeled as WAN and WLAN
  U-boot environment has the the vendor MAC address for ethernet
  MAC addresses in "factory" are part of wifi calibration data

  eth0.2	WAN	*:13:e7		u-boot-env wanaddr
  eth0.1	----	*:13:e8		u-boot-env wanaddr + 1
  phy0		WLAN	*:14:b8		factory 0x8004
  phy1		----	*:14:bc		factory 0x4

**Installation:**

  Method 1: Firmware upgrade page

  OEM webpage at 192.168.0.1
  username and password "admin"
  Navigate to Network Setting --> Tools --> Firmware
  Click Browse and select the factory.dlf image
  Click Continue to confirm and wait 6 minutes or more...

  Method 2: Serial console to load TFTP image:

  (see TFTP recovery)

**Return to OEM:**

  Unlike most Engenius boards, this does not have a 'failsafe' image
  the only way to return to OEM is serial access to uboot

  Unlike most Engenius boards, public images are not available...
  so the only way to return to OEM is to have a copy
  of the MTD partition "firmware" BEFORE flashing openwrt.

**TFTP recovery:**

  Unlike most Engenius boards, TFTP is reliable here
  however it requires serial console access
  (soldering pins to the UART pinouts)

  build your own image...
  with 'ramdisk' selected under 'Target Images'

  rename initramfs-kernel.bin to 'uImageESR-600H'
  make the file available on a TFTP server at 192.168.99.8
  interrupt boot by holding or pressing '4' in serial console
  as soon as board is powered on

  `tftpboot 0x81000000`
  `bootm 0x81000000`
  perform a sysupgrade

**Format of OEM firmware image:**

  This Engenius board uses the Senao proprietary header
  with a unique Product ID. The header for factory.bin is
  generated by the mksenaofw program included in openwrt.

  .dlf file extension is also required for OEM software to accept it

**Note on using OKLI:**

  the kernel is now too large for the bootloader to handle
  so OKLI is used via the `kernel-loader` image command
  recently in master several other ramips boards have the same problem

  'Kernel panic - not syncing: Failed to find ralink,rt3883-sysc node'

  see commit ad19751edc

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2020-12-22 19:11:50 +01:00
INAGAKI Hiroshi fa373b219d ramips: unify elecom-*-factory for ELECOM WRC-GHBK2-S/GS/GST devices
Most of Build/elecom-wrc-factory and Build/elecom-wrc-gs-factory are
nearly equal, Unify those definitions by using "-N" option of mkhash and
splitting the appending text at the end of firmware image for WRC-GS/GST
devices.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2020-12-22 19:11:50 +01:00
Aleksander Jan Bajkowski 77575d4c02 kernel: move some disabled symbols to generic
Move some disabled config options found in lantiq target to generic.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
2020-12-22 19:11:50 +01:00
John Audia a282a04538 kernel: bump 5.4 to 5.4.85
All modifications made by update_kernel.sh run in a fresh clone
without any existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
2020-12-22 19:11:50 +01:00
Robert Marko 7a181a65f2 treewide: fix initramfs detection
Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to
now use tmpfs, it causes $(rootfs_type) to now return tmpfs when
running initramfs image instead of being empty.

This broke initramfs detection which is required so that when installing
on MikroTik devices firmware partition would first get erased fully
before writing.

So, lets test for $(rootfs_type) returning "tmpfs" instead.

Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail)

Signed-off-by: Robert Marko <robimarko@gmail.com>
2020-12-20 17:14:56 +00:00
Adrian Schmutzler 58c5deb975 ramips: do not enable unused GPIO controllers
Several devices enable GPIO controllers not used in the DTS files.

Drop them.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-17 12:10:10 +01:00
Xinfa Deng d89a7f0120 ramips: add support for GL.iNet GL-MT1300
The GL-MT1300 is a high-performance new generation pocket-sized router
that offers a powerful hardware and first-class cybersecurity protocol
with unique and modern design.

Specifications:
- SoC: MT7621A, Dual-Core @880MHz
- RAM: 256 MB DDR3
- Flash: 32 MB
- Ethernet: 3 x 10/100/1000: 2 x LAN + 1 x WAN
- Wireless: 1 x MT7615D Dual-Band 2.4GHz(400Mbps) + 5GHz(867Mbps)
- USB: 1 x USB 3.0 port
- Slot: 1 x MicroSD card slot
- Button: 1 x Reset button
- Switch: 1 x Mode switch
- LED: 1 x Blue LED + 1 x White LED

MAC addresses based on vendor firmware:
WAN : factory 0x4000
LAN : Mac from factory 0x4000 + 1
2.4GHz : factory 0x4
5GHz : Mac form factory 0x4 + 1

Flashing instructions:
1.Connect to one of LAN ports.
2.Set the static IP on the PC to 192.168.1.2.
3.Press the Reset button and power the device (do not release the button).
  After waiting for the blue led to flash 5 times, the white led will
  come on and release the button.
4.Browse the 192.168.1.1 web page and update firmware according to web
  tips.
5.The blue led will flash when the firmware is being upgraded.
6.The blue led stops blinking to indicate that the firmware upgrade is
  complete and U-Boot automatically starts the firmware.

For more information on GL-MT1300, see the OFFICIAL GL.iNet website:
https://www.gl-inet.com/products/gl-mt1300/

Signed-off-by: Xinfa Deng <xinfa.deng@gl-inet.com>
[add input-type for switch, wrap long line in 10_fix_wifi_mac]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-17 12:05:26 +01:00
John Audia afd4bf08bc kernel: bump 5.4 to 5.4.83
Manually merged:
  layerscape/808-i2c-0011-i2c-imx-support-slave-mode-for-imx-I2C-driver.patch
  layerscape/808-i2c-0012-i2c-imx-correct-code-of-errata-A-010650-for-layersca.patch

Remaining modifications made by update_kernel.sh

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711, x86/64 [*],
              ramips/mt7621 [*], ath79/tiny [*], ipq40xx [*], octeon [*],
              realtek [*]
Run-tested: ipq806x/R7800, ramips/mt7621 [*], octeon [*], realtek [*]

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2020-12-15 12:05:26 +01:00
Adrian Schmutzler 6d4382711a ramips: use full names for Xiaomi Mi Router devices
This aligns the device/image names of the older Xiaomi Mi Router
devices with their "friendly" model and DEVICE_MODEL properties.

This also reintroduces consistency with the newer devices already
following that scheme.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-08 17:18:57 +01:00
Adrian Schmutzler 89e6cc5c76 ramips: mt7628: create shared DTSI for Xiaomi Mi Router 4A/4C
The Xiaomi Mi Router 4A (100M) and 4C are relatively similar in
their specs. Create a shared DTSI for them.

Partitions are split in preparation for Mi Router 4AC.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-08 15:39:00 +01:00
Adrian Schmutzler 66d12ce667 ramips: remove redundant status for USB controllers
mt7621, mt7628an and rt5350 have USB controllers (ehci/ohci or xhci)
enabled by default. Thus, this patch drops redundant status=okay
statements in derived device DTS files.

While at it, also drop an explicit status=okay in mt7621.dtsi, as
this is default.

Note:

For rt5350, about 50 % of the devices enabled ehci/ohci in the DTS
files, and there is actually no device actively disabling it.
It looks like only a few people are aware that the controllers are
enabled by default here.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-07 14:22:00 +01:00
Adrian Schmutzler e6a181dcea ramips: simplify status for ehci/ohci on mt7628 TP-Link devices
At the moment, ehci/ohci is enabled in mt7628an SoC DTSI, then
disabled in the TP-Link-specific DTSI files, and finally enabled
again in the DTS files of the devices needing it.

This on-off-on scheme is hard to grasp on a quick look. Thus, this
patch drops the status in the TP-Link-specific DTSI files, having
the TP-Link devices treated like the rest of mt7628an DTSes, i.e.
ehci/ohci is enabled by default and needs to be disabled explicitly
where needed.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-07 14:22:00 +01:00
Adrian Schmutzler aafee2b3e9 ramips: drop redundant status for gpio/gpio0
The first gpio controller (gpio or gpio0) is always enabled by
default in the SoC DTSI files. No need to set status=okay in the
device DTS files a second time.

Remove the redundant statements.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-12-04 15:52:23 +01:00
Pavel Chervontsev 6d98c098e4 ramips: add support for ASUS RT-N56U B1
Specifications:

SoC: MediaTek MT7621ST (880 MHz)
FLASH: 16 MiB (Macronix MX25L12835FM2I-10G)
RAM: 128 MiB (Nanya NT5CB64M16FP-DH)
WiFi: MediaTek MT7603EN bgn 2x2:2
WiFi: MediaTek MT7612EN an 2x2:2
BTN: Reset, WPS
LED: - Power
- WiFi 2.4 GHz
- WiFi 5 GHz
- WAN
- LAN {1-4}
- USB {1-2}
UART: UART is present as pin hole next to the aluminium capacitor.
3V3 - RX - GND - TX / 115200-8N1
3V3 is the nearest on the aluminium capacitor and nut hole (pin1).
USB: 2 ports
POWER: 12VDC, 1.5A (Barrel 5.5x2.1)

Installation:

Via TFTP:
    Set your computers IP-Address to 192.168.1.75
    Power up the Router with the Reset button pressed.
    Release the Reset button after 5 seconds.
    Upload OpenWRT sysupgrade image via TFTP:
    tftp -4 -v -m binary 192.168.1.1 -c put IMAGE

MAC addresses:

0x4     *:98  2g/wan, label
0x22    *:9c
0x28    *:98
0x8004  *:9c  5g/lan

Though addresses are written to 0x22 and 0x28, it appears that the
vendor firmware actually only uses 0x4 and 0x8004. Thus, we do the
same here.

Signed-off-by: Pavel Chervontsev <cherpash@gmail.com>
[add MAC address overview, add label-mac-device, fix IMAGE_SIZE]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-28 20:51:50 +01:00
Sander Vanheule f29231ece7 ramips: mt7621: replace missing custom-initramfs-uimage
custom-initramfs-uimage was replaced by calls to uImage, but apparently
mtc_wr1201 was missed in the transistion. Use uImage for this device
too.

Fixes: 9f574b1b87 "ramips: mt7621: drop custom uImage function"

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2020-11-26 09:12:57 +01:00
Adrian Schmutzler b69c21738e treewide: add space before SPDX identifier
Strictly, an SPDX identifier requires a space between the comment
marker and the identifier itself. The choice of the comment marker
itself is irrelevant.

Correct:

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT

Wrong:

//SPDX-License-Identifier: GPL-2.0-or-later OR MIT

Fix that in the whole tree (actually, only ramips contained wrong
uses).

Found by checkpatch.pl

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-25 19:34:13 +01:00
Ataberk Özen 4287f73989 ramips: add support for Xiaomi Mi Router 4C
This commit adds support for Xiaomi's Mi Router 4C device.

Specifications:

- CPU: MediaTek MT7628AN (580MHz)
- Flash: 16MB
- RAM: 64MB DDR2
- 2.4 GHz: IEEE 802.11b/g/n with Integrated LNA and PA
- Antennas: 4x external single band antennas
- WAN: 1x 10/100M
- LAN: 2x 10/100M
- LEDs: 2x yellow/blue. Programmable (labelled as power on case)
                      - Non-programmable (shows WAN activity)
- Button: Reset

How to install:

1- Use OpenWRTInvasion to gain telnet and ftp access.
2- Push openwrt firmware to /tmp/ using ftp.
3- Connect to router using telnet. (IP: 192.168.31.1 -
   Username: root - No password)
4- Use command "mtd -r write /tmp/firmware.bin OS1" to flash into
   the router..
5- It takes around 2 minutes. After that router will restart itself
   to OpenWrt.

Signed-off-by: Ataberk Özen <ataberkozen123@gmail.com>
[wrap commit message, bump PKG_RELEASE for uboot-envtools, remove
dts-v1 from DTS, fix LED labels]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-25 19:34:13 +01:00
Sander Vanheule 9f574b1b87 ramips: mt7621: drop custom uImage function
Use the mkimage argument overrides provided by uImage to implement the
customisations required for the initramfs, instead of the near-identical
custom function.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2020-11-25 15:51:22 +01:00
Filip Moc b641eb6ecf ramips: add support for TP-Link MR6400 v5
TL-MR6400v5 is very similar to TL-MR6400v4. Main differences are:
  - smaller form factor
  - different LED GPIOs
  - different switch connections

You can flash via tftp recovery:
 - serve tftp-recovery image as /tp_recovery.bin on 192.168.0.225/24
 - connect to any ethernet port
 - power on the device while holding the reset button
 - wait at least 8 seconds before releasing reset button

Flashing via OEM web interface does not work.

LTE module does not support DHCP so it must be configured via QMI.

Hardware Specification (v5.0 EU):
 - SoC: MT7628NN
 - Flash: Winbond W25Q64JVS (8MiB)
 - RAM: ESMT M14D5121632A (64MiB)
 - Wireless: SoC platform only (2.4GHz b/g/n, 2x internal antenna)
 - Ethernet: 1NIC (4x100M)
 - WWAN: TP-LINK LTE MODULE (2x external detachable antenna)
 - Power: DC 9V 0.85A

Signed-off-by: Filip Moc <lede@moc6.cz>
2020-11-25 13:23:06 +01:00
Filip Moc 4f4f6def0e ramips: add license to TP-Link MR6400 v4's DTS
Signed-off-by: Filip Moc <lede@moc6.cz>
2020-11-25 13:23:06 +01:00
John Audia 9100566267 kernel: bump 5.4 to 5.4.79
Manually rebased patches:
  ath79/patches-5.4/910-unaligned_access_hacks.patch
  bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch
  bcm27xx/patches-5.4/950-0414-SQUASH-Fix-spi-driver-compiler-warnings.patch
  ipq806x/patches-5.4/093-4-v5.8-ipq806x-PCI-qcom-Use-bulk-clk-api-and-assert-on-error.patch

Removed since could be reverse-applied by quilt and found to be included upstream:
  ipq806x/patches-5.4/096-PCI-qcom-Make-sure-PCIe-is-reset-before-init-for-rev.patch

All modifications made by update_kernel.sh

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[refresh altered targets after rebase]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-24 15:36:59 +01:00
René van Dorst 6e1a4496f5 ramips: phy: at803x: Select SFP interface mode that both sides supports.
Currently sfp_select_interface() return the fastest interface that
the sfp modules supports even if the phy don't support that mode.

For example an GPON module that support both 2500basex and 1000basex.
Currently sfp_select_interface() picks 2500basex instead of 1000basex.

So limit the interfaces which both sides supports before calling
sfp_select_interface() or return an error if we don't have match.

Reviewed-by: John Thomson <git@johnthomson.fastmail.com.au>
Tested-by: Braihan Cantera <bcanterac@gmail.com> [MikroTik RB760iGS + Nokia G-010S-A 3FE46541AA SFP]
Tested-by: John Thomson <git@johnthomson.fastmail.com.au> [Mikrotik rb760igs + SFP SM/LC, SFP base1000T, SFP+ passive DAC]
Signed-off-by: René van Dorst <opensource@vdorst.com>
2020-11-23 22:53:15 +01:00
Filip Moc 0d65177658 ramips: add support for TP-Link MR6400 v4
You can flash via tftp recovery:
 - serve tftp-recovery image as /tp_recovery.bin on 192.168.0.225/24
 - connect to any ethernet port
 - power on the device while holding the reset button
 - wait at least 8 seconds before releasing reset button

Flashing via OEM web interface does not work.

LTE module does not support DHCP so it must be configured via QMI.

Hardware Specification (v4.0 EU):
 - SoC: MT7628NN
 - Flash: Winbond W25Q64JVS (8MiB)
 - RAM: ESMT M14D5121632A (64MiB)
 - Wireless: SoC platform only (2.4GHz b/g/n, 2x internal antenna)
 - Ethernet: 1NIC (4x100M)
 - WWAN: TP-LINK LTE MODULE (2x external detachable antenna)
 - Power: DC 9V 0.85A

Signed-off-by: Filip Moc <lede@moc6.cz>
2020-11-23 00:46:40 +00:00
Marc Egerton f276395cda ramips: add support for the Hak5 WiFi Pineapple Mark 7
This patch adds support for the WiFi Pineapple Mark 7, a wireless
penetration testing tool.

Specifications:
    * SoC: MediaTek MT7628 (580MHz)
    * RAM: 256MiB (DDR2)
    * Storage 1: 32MiB NOR (SPI)
    * Storage 2: 2GB eMMC
    * Wireless 1: 802.11b/g/n 2.4GHz (Built In)
    * Wireless 2: 802.11b/g/n 2.4GHz (MT7601)
    * Wireless 3: 802.11b/g/n 2.4GHz (MT7601)
    * USB: 1x USB Type-A 2.0 Host Port
    * Ethernet: 1x USB Type-C AX88772C Ethernet
    * UART: 57600 8N1 on PCB
    * Inputs: 1x Reset Button
    * Outputs: 1x RGB LED
    * FCCID: 2AA52MK7

Flash Instructions:
    Original firmware is based on OpenWRT.
    Use sysupgrade via SSH to flash.

Signed-off-by: Marc Egerton <foxtrot@realloc.me>
[pepe2k@gmail.com: set only required/used gpio groups to gpio function]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2020-11-18 23:49:34 +01:00
Adrian Schmutzler e0cc68daad ramips: use m25p,fast-read on Xiaomi Mi Router 4A Gb/3G v2
The Xiaomi Mi Router 4A Gigabit model has a race condition on bootup
causing the SQUASHFS data errors to appear and create a bootloop
scenario.

Adding the m25p,fast-read property resolves this issue.

Suggested-by: David Bentham <db260179@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-18 21:13:46 +01:00
DENG Qingfang fe1f11ce32 ramips: mt7621: fix Telco X1 GPIO switches
The GPIO base of MT7621 GPIO 0~31 is 480 on kernel 5.4
Fix the GPIO numbering.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
2020-11-16 13:43:39 +01:00
Adrian Schmutzler a51e46e543 ramips: add Xiaomi Mi Router 4A Gigabit explicitly
This device has previously been supported by the image
for Xiaomi Mi Router 3G v2. Since this is not obvious, the
4A is marketed as a new major revision and it also seems to
have a different bootloader, this will be both more tidy and
more helpful for the users.

Apart from that, note that there also is a 100M version of
the device that uses mt7628 platform, so a specifically named
image will also prevent confusion in this area.

Specifications:

- SoC:      MediaTek MT7621
- Flash:    16 MiB NOR SPI
- RAM:      128 MiB DDR3
- Ethernet: 3x 10/100/1000 Mbps (switched, 2xLAN + WAN)
- WIFI0:    MT7603E 2.4GHz 802.11b/g/n
- WIFI1:    MT7612E 5GHz 802.11ac
- Antennas: 4x external (2 per radio), non-detachable
- LEDs:     Programmable "power" LED (two-coloured, yellow/blue)
            Non-programmable "internet" LED (shows WAN activity)
- Buttons:  Reset

Installation:

Bootloader won't accept any serial input unless "boot_wait" u-boot
environment variable is changed to "on".

Vendor firmware won't accept any serial input until "uart_en" is
set to "1".

Using the https://github.com/acecilia/OpenWRTInvasion exploit you
can gain access to shell to enable these options:

To enable uart keyboard actions - 'nvram set uart_en=1'
To make uboot delay boot work - 'nvram set boot_wait=on'
Set boot delay to 5 - 'nvram set bootdelay=5'

Then run 'nvram commit' to make the changes permanent.

Once in the shell (following the OpenWRTInvasion instructions) you
can then run the following to flash OpenWrt and then reboot:

'cd /tmp; curl https://downloads.openwrt.org/...-sysupgrade.bin
  --output firmware.bin; mtd -e OS1 -r write firmware.bin OS1'

Suggested-by: David Bentham <db260179@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-12 17:18:26 +01:00
James McGuire de768829a5 ramips: add support for D-Link DIR-2640 A1
This patch adds support for D-Link DIR-2640 A1.

Specifications:
* Board: AP-MTKH7-0002
* SoC: MediaTek MT7621AT
* RAM: 256 MB (DDR3)
* Flash: 128 MB (NAND)
* WiFi: MediaTek MT7615N (x2)
* Switch: 1 WAN, 4 LAN (Gigabit)
* Ports: 1 USB 2.0, 1 USB 3.0
* Buttons: Reset, WPS
* LEDs: Power (blue/orange), Internet (blue/orange), WiFi 2.4G (blue),
        WiFi 5G (blue), USB 3.0 (blue), USB 2.0 (blue)

Notes:
* WiFi 2.4G and WiFi 5G LEDs are wired directly to the wireless chips

Installation:
* D-Link Recovery GUI: power down the router, press and hold the reset
  button, then re-plug it. Keep the reset button pressed until the power
  LED starts flashing orange, manually assign a static IP address under
  the 192.168.0.xxx subnet (e.g. 192.168.0.2) and go to http://192.168.0.1

* Some modern browsers may have problems flashing via the Recovery GUI,
  if that occurs consider uploading the firmware through cURL:

    curl -v -i -F "firmware=@file.bin" 192.168.0.1

MAC addresses:

lan   factory 0xe000     *:a7 (label)
wan   factory 0xe006     *:aa
2.4   factory 0xe000 +1  *:a8
5.0   factory 0xe000 +2  *:a9

Seems like vendor didn't replace the dummy entries in the calibration data.

Signed-off-by: James McGuire <jamesm51@gmail.com>
[fix device definition title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-11 17:35:10 +01:00
Anton Ryzhov df469befdc ramips: fix kernel oops in `mt7621_nfc_write_page_hwecc`
`mt7621_nfc_write_page_hwecc` may be called with `buf=NULL`, but
`mt7621_nfc_check_empty_page` always tries to read it.
That caused Oops:
`Unable to handle kernel paging request at virtual address 00000000`

Fixes: FS#3416
Signed-off-by: Anton Ryzhov <anton@ryzhov.me>
2020-11-04 22:08:11 +08:00
John Thomson 254f51443d mt7621: mikrotik: use vmlinuz (zBoot ELF)
- minimal built initramfs: 11MB vmlinux ELF -> 4.5MB vmlinuz
- ~5 seconds for kernel decompression, which was equivalent to the
  additional time to load the uncompressed ELF from SPI NOR.
- Removes requirement for lzma-loader, which may have been causing some
  image builds to fail to boot on Mikrotik mt7621.

Fixes: FS#3354
Suggested-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
2020-10-29 21:35:03 +08:00
Chuanhong Guo 42af05ca1f ramips: add linux zboot support
linux-mips has zboot code which can create a self-extracting kernel
image.
This allows enabling kernel zboot support for ramips targets.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-10-29 21:20:10 +08:00
Nuno Goncalves 2a860bf4f4 ramips: add support for Wavlink WL-WN530HG4
Same hardware as Phicomm K2G but different flash layout.

Specification:
- SoC: MediaTek MT7620A
- Flash: 8 MB
- RAM: 64 MB
- Ethernet: 4 FE ports and 1 GE port (RTL8211F on port 5)
- Wireless radio: MT7620 for 2.4G and MT7612E for 5G, both equipped
  with external PA.
- UART: 1 x UART on PCB - 57600 8N1

Flash instruction:
To avoid requiring UART for TFTP a dual flash procedure is suggested
to install the squashfs image:
1. Rename openwrt-ramips-mt7620-wavlink_wl-wn530hg4-initramfs-kernel.bin
   to WN530HG4-WAVLINK.
2. Flash this file with the factory web interface.
3. With OpenWRT now running use standard sysupgrade to install the
   squashfs image.

Signed-off-by: Nuno Goncalves <nunojpg@gmail.com>
[remove dts-v1, remove model from LED labels, wrap commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-27 21:20:16 +01:00
Jianhui Zhao 63ab77d0eb ramips: mt7621: use lzma-loader for U7621-06
The U7621-06 fails to boot if the kernel is large.
Enabling lzma-loader resolves the issue.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
2020-10-25 22:30:02 +08:00
Chuanhong Guo 23be410b3d ramips: add support for TOTOLINK X5000R
Specifications:
- SoC: MT7621AT
- RAM: 256MB
- Flash: 16MB (EN25QH128A)
- Ethernet: 5xGbE
- WiFi: MT7915 2x2 2.4G 573.5Mbps + 2x2 5G 1201Mbps

Known issue:
MT7915 DBDC variant isn't supported yet.

Flash instruction:
Upload the sysupgrade firmware to the firmware upgrade page in
vendor fw.

Other info:
MT7915 seems to have two PCIEs connected to MT7621. Card detected on
PCIE0 has an ID of 14c3:7916 and the other one on PCIE1 has 14c3:7915.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-10-25 22:27:44 +08:00
Richard Fröhning 33b76d66d1 ramips: add support for TP-Link RE200 v4
TP-Link RE200 v4 is a wireless range extender with Ethernet and 2.4G and 5G
WiFi with internal antennas.
It's based on MediaTek MT7628AN+MT7610EN like the v2/v3.

Specifications
--------------

- MediaTek MT7628AN (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 2T2R 2.4 GHz and 1T1R 5 GHz
- 1x 10/100 Mbps Ethernet
- 8x LED (GPIO-controlled), 2x button
- UART connection holes on PCB (57600 8n1)

There are 2.4G and 5G LEDs in red and green which are controlled
separately.

MAC addresses
-------------

The MAC address assignment matches stock firmware, i.e.:

LAN : *:8E
2.4G: *:8D
5G  : *:8C

MAC address assignment has been done according to the RE200 v2.

The label MAC address matches the OpenWrt ethernet address.

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

Web Interface
-------------

It is possible to upgrade to OpenWrt via the web interface. Simply flash
the -factory.bin from OEM. In contrast to a stock firmware, this will not
overwrite U-Boot.

Recovery
--------

Unfortunately, this devices does not offer a recovery mode or a tftp
installation method. If the web interface upgrade fails, you have to open
your device and attach serial console.

Instructions for serial console and recovery may be checked out in
commit 6d6f36ae78 ("ramips: add support for TP-Link RE200 v2") or on
the device's Wiki page.

Signed-off-by: Richard Fröhning <misanthropos@gmx.de>
[removed empty line, fix commit message formatting]
Signed-off-by: David Bauer <mail@david-bauer.net>
2020-10-20 03:01:13 +02:00
Felix Fietkau b59d5c8f0e mediatek: rewrite flow offload code
The code is now much cleaner and works better than the old code.
Preparation for submitting it upstream (though with a different API)
Also add back MT7621 support and fix flow table coherence issues on
MT7622

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-10-16 21:37:39 +02:00
Adrian Schmutzler f5cf408b76 ramips: drop kernel version switches
The ramips target only supports 5.4, so drop all kernel version
switches for older kernels there.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-09 22:24:04 +02:00
David Bauer 929e8f0f55 ramips: fix logic level for DIR-645 buttons
The D-Link DIR-645 currently uses an incorrect logic level for its
buttons.

Correct them in order to prevent unintentional activation of failsafe
mode.

Reported-by: Perry Melange <isprotejesvalkata@gmail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
2020-10-03 22:52:58 +02:00
Adrian Schmutzler 2230fe3922 ramips: remove set_wifi_led function in 01_leds
While we mostly use the ucidef_set_led_* functions directly in 01_leds
we still have the set_wifi_led function in parallel for several old
devices. This is not only inconsistent with the other definitions,
it also links to the wlan0 interface instead of using a phy trigger
which would be independent of the interface name (and is used for
all newer devices anyway). Apart from that, the standard names
"wifi" and "wifi-led" are not very helpful in a world with different
radio bands either.

Thus, this patch removes the set_wifi_led function and puts the
relevant commands into the cases explicitly. This makes the
mechanism used more evident and will hopefully lead to some future
improvements or at least prevent some copy-pasting of the old
setups.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-02 14:51:57 +02:00
Adrian Schmutzler ed5933beb6 ramips: remove option to set WiFi LED via aliases
In ramips, it's not common to use an alias for specifying the WiFi
LED; actually only one device uses this mechanism (TL-WR841N v14).

Particularly since the WiFi LEDs are typically distinguished between
2.4G and 5G etc. it is also not very useful for this target.

Thus, this patch removes the setup lines for this mechanism and
converts the TL-WR841N v14 to the normal setup.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-02 14:51:57 +02:00
Adrian Schmutzler c846dd91f0 ramips: remove model name from LED labels
Like in the previous patch for ath79 target, this will remove the
"devicename" from LED labels in ramips as well.

The devicename is removed in DTS files and 01_leds, consolidation
of definitions into DTSI files is done where (easily) possible,
and migration scripts are updated.

For the latter, all existing definitions were actually just
devicename migrations anyway. Therefore, those are removed and
a common migration file is created in target base-files. This is
actually another example of how the devicename removal makes things
easier.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-02 14:51:57 +02:00
Adrian Schmutzler 315904a459 ramips: merge ethernet setup for RT-AC51U/RT-AC54U
The ethernet setup/label MAC address for RT-AC51U and RT-AC54U are
the same, so move them into the shared DTSI.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-28 00:20:24 +02:00
Adrian Schmutzler 621297e867 ramips: move dts-v1 statement to top-level DTSI files
The "/dts-v1/;" identifier is supposed to be present once at the
top of a device tree file after the includes have been processed.

In ramips, we therefore requested to have in the DTS files so far,
and omit it in the DTSI files. However, essentially the syntax of
the parent mtxxxx/rtxxxx DTSI files already determines the DTS
version, so putting it into the DTS files is just a useless repetition.

Consequently, this patch puts the dts-v1 statement into the top-level
SoC-based DTSI files, and removes all other occurences.
Since the dts-v1 statement needs to be before any other definitions,
this also moves the includes accordingly where necessary.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-25 23:26:40 +02:00
J. Scott Heppler 620f9c7734 ramips: add support for Linksys EA7300 v2
This submission relied heavily on the work of
Santiago Rodriguez-Papa <contact at rodsan.dev>

Specifications:

*  SoC:            MediaTek  MT7621A            (880  MHz  2c/4t)
*  RAM:            Winbond W632GG6MB-12         (256M  DDR3-1600)
*  Flash:          Winbond W29N01HVSINA         (128M  NAND)
*  Eth:            MediaTek  MT7621A            (10/100/1000  Mbps  x5)
*  Radio:          MT7603E/MT7615N              (2.4  GHz  &  5  GHz)
                     4  antennae:  1  internal  and  3  non-deatachable
*  USB:            3.0  (x1)
*  LEDs:
          White    (x1  logo)
          Green    (x6  eth  +  wps)
          Orange   (x5,  hardware-bound)
*  Buttons:
          Reset    (x1)
          WPS      (x1)

Installation:

Flash factory image through GUI.

This might fail due to the A/B nature of this device. When flashing, OEM
firmware writes over the non-booted partition. If booted from 'A',
flashing over 'B' won't work. To get around this, you should flash the
OEM image over itself. This will then boot the router from 'B' and
allow you to flash OpenWRT without problems.

Reverting to factory firmware:

Hard-reset the router three times to force it to boot from 'B.' This is
where the stock firmware resides. To remove any traces of OpenWRT from
your router simply flash the OEM image at this point.

Signed-off-by: J. Scott Heppler <shep971@centurylink.net>
2020-09-23 12:17:32 +02:00
Adrian Schmutzler 0cfdc7d446 target: update SPDX license names
SPDX moved from GPL-2.0 to GPL-2.0-only and from GPL-2.0+ to
GPL-2.0-or-later. Reflect that in the SPDX license headers.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-22 20:58:26 +02:00
John Audia 770a9c6787 kernel: bump 5.4 to 5.4.66
All modifications made by update_kernel.sh/no manual intervention needed

Run-tested: ipq806x (R7800), ath79 (Archer C7v5), x86/64

No dmesg regressions, everything appears functional

Signed-off-by: John Audia <graysky@archlinux.us>
[add run test from PR]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-19 12:41:29 +02:00
Chuanhong Guo 2188ef954e ramips: mt7621: pbr-m1: fix firmware size
This board is equipped with Winbond W25Q256FV 32M SPI-NOR.
Fix partition size for that.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-09-13 19:15:06 +08:00
Chuanhong Guo 8126521e11 ramips: mt7621: pbr-m1: increase SPI clock to 50MHz
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-09-13 18:53:25 +08:00
Chuanhong Guo 6f2c95f0cf ramips: mt7621: pbr-m1: add pcie reset for asm1061
this board has a pcie to sata bridge connected to pcie2 with a
separated pcie reset on gpio7.
add reset-gpios and corresponding pinctrl nodes into dts.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-09-13 18:49:26 +08:00
John Audia bee76f1bfa kernel: bump 5.4 to 5.4.64
Remove upstreamed patches:
 generic-backport
  701-v5.5-net-core-use-listified-Rx-for-GRO_NORMAL-in-napi_gro.patch

Manually merged:
 mediatek/patches-5.4
  0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch

All other modifications made by update_kernel.sh

Build-tested: ipq806x, lantiq/xrx200, mvebu, x86/64
Run-tested: ipq806x (R7800), mvebu (mamba, rango),
  lantiq/xrx200 (Easybox 904 xDSL), x86/64

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[add community build/run tests to commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-12 01:28:50 +02:00
Adrian Schmutzler c4110a524e ramips: create common DTSI for Sunvalley Filehub devices
HooToo HT-TM05 and RAVPower RP-WD03 have almost identical hardware
(except for RAM size) and are from the same vendor (SunValley).

Create a common DTSI file for them.

Suggested-by: Russell Morris <rmorris@rkmorris.us>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-12 01:25:10 +02:00
Adrian Schmutzler b56b499948 ramips: fix baud rate for RAVPower RP-WD03
The baud rate for the RAVPower RP-WD03 is 57600, not 115200.

Since this is the default from mt7620n.dtsi, the chosen node can
simply be removed from the device DTS.

Fixes: 5ef79af4f8 ("ramips: add support for Ravpower WD03")

Suggested-by: Russell Morris <rmorris@rkmorris.us>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-12 01:24:43 +02:00
Adrian Schmutzler 3fc7860961 ramips: assign LEDs for RAVPower RP-WD03
According to the User Manual, there is a "Wi-Fi LED" with blue and
green colors, doing the following by default:

  Flashing Blue: System loading
  Solid Blue: System loaded
  Flashing Green: Connecting to the Internet
  Solid Green: Connected to the Internet

According to this vendor behavior, we keep refer to the LED as "wifi"
but implement the according default behavior as in OEM firmware.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-12 01:24:30 +02:00
Adrian Schmutzler 77825f3cfe ramips: fix MAC address assignment for RAVPower RP-WD03
MAC assignment based on vendor firmware:

  2.4 GHz    *:b4   (factory 0x04)
  LAN/label  *:b4   (factory 0x28)
  WAN        *:b5   (factory 0x2e)

The previously used location 0x4000 for ethernet is actually empty.

Therefore, fix the ethernet MAC address and set it as label-mac-address.

Fixes: 5ef79af4f8 ("ramips: add support for Ravpower WD03")

Suggested-by: Russell Morris <rmorris@rkmorris.us>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-12 01:24:02 +02:00
Adrian Schmutzler 07aa858a73 ramips: fix partitions and boot for RAVPower RP-WD03
The RAVPower RP-WD03 is a battery powered router, with an Ethernet and
USB port. Due due a limitation in the vendor supplied U-Boot bootloader,
we cannot exceed a 1.5 MB kernel size, as is the case with recent builds
(i.e. post v19.07). This breaks both factory and sysupgrade images.

To address this, use the lzma loader (loader-okli) to work around this
limitation.

The improvements here also address the "misplaced" U-Boot environment
partition, which is located between the kernel and rootfs in the stock
image / implementation. This is addressed by making use of mtd-concat,
maximizing space available in the booted image.
This will make sysupgrade from earlier versions impossible.

Changes are based on the recently supported HooToo HT-TM05, as the
hardware is almost identical (except for RAM size) and is from the same
vendor (SunValley). While at it, also change the SPI frequency
accordingly.

Installation:

 - Download the needed OpenWrt install files, place them in the root
   of a clean TFTP server running on your computer. Rename the files as,
   - openwrt-ramips-mt7620-ravpower_rp-wd03-squashfs-kernel.bin => kernel
   - openwrt-ramips-mt7620-ravpower_rp-wd03-squashfs-rootfs.bin => rootfs
 - Plug the router into your computer via Ethernet
 - Set your computer to use 10.10.10.254 as its IP address
 - With your router shut down, hold down the power button until the first
   white LED lights up.
 - Push and hold the reset button and release the power button. Continue
   holding the reset button for 30 seconds or until it begins searching
   for files on your TFTP server, whichever comes first.
 - The router (10.10.10.128) will look for your computer at 10.10.10.254
   and install the two files. Once it has finished installation, it will
   automatically reboot and start up OpenWrt.
 - Set your computer to use DHCP for its IP address

Notes:

 - U-Boot environment can be modified, u-boot-env is preserved on initial
   install or sysupgrade
 - mtd-concat functionality is included, to leave a "hole" for u-boot-env,
   combining the OEM kernel and rootfs partitions

Most of the changes in this commit are the work of Russell Morris (as
credited below), I only wrapped them up and added compat-version.
Thanks to @mpratt14 and @xabolcs for their help getting the lzma loader
to work!

Fixes: 5ef79af4f8 ("ramips: add support for Ravpower WD03")

Suggested-by: Russell Morris <rmorris@rkmorris.us>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-11 19:31:03 +02:00
Adrian Schmutzler a4e5b8897a ramips: use proper name for RAVPower RP-WD03
The proper model name is RP-WD03 (i.e. with the RP- prefix).

Adjust all names to that.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-11 19:18:54 +02:00
Adrian Schmutzler 4527f59428 ramips: move ravpower-wd009-factory recipe to mt76x8.mk
The recipe is only used for a single device, so put it in the
subtarget file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-11 18:40:44 +02:00
Adrian Schmutzler 2dda301d40 ramips: disable default build for Ravpower RP-WD03
This device has a 1.5M kernel size limit during boot and is
unbootable since February 2019 [1].

[1] https://forum.openwrt.org/t/ravpower-wd03-does-not-start-with-openwrt-master/49792

Reported-by: Szabolcs Hubai <szab.hu@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-09 14:12:14 +02:00
Adrian Schmutzler 38f6d5d217 treewide: revert sysupgrade adjustments for early DSA-adopters
The uci-default mechanism to update the compat-version was only
meant for early DSA-adopters, which should have updated by now.

Remove this workaround again in order to prevent the intended
experiences for all the other people.

This reverts:
a9703db720 ("mvebu: fix sysupgrade experience for early DSA-adopters")
86c89bf5e8 ("kirkwood: fix sysupgrade experience for early DSA-adopters")

Partially reverted:
1eac573b53 ("ramips: mt7621: implement compatibility version for DSA migration")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-08 19:27:15 +02:00
Adrian Schmutzler de4e57eaaa Revert "treewide: add sysupgrade comment for early DSA-adopters"
This reverts commit e81e625ca3.

This was meant just for early DSA-adopters. Those should have
updated by now, remove it so future updaters get the intended
experience.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-08 19:26:22 +02:00
John Audia 2c2fcbd2e0 kernel: bump 5.4 to 5.4.63
Manually merged:
 hack-5.4
  230-openwrt_lzma_options.patch
 bcm27xx
  950-0283-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch
 x86
  011-tune_lzma_options.patch

Remove upstreamed patches in collaboration with Ansuel Smith:
 ipq806x
  093-1-v5.8-ipq806x-PCI-qcom-Add-missing-ipq806x-clocks-in-PCIe-driver.patch
  093-2-v5.8-ipq806x-PCI-qcom-Change-duplicate-PCI-reset-to-phy-reset.patch
  093-3-v5.8-ipq806x-PCI-qcom-Add-missing-reset-for-ipq806x.patch

All other modifications made by update_kernel.sh

Build-tested: bcm27xx/bcm2708, ipq806x, x86/64
Run-tested: ipq806x (R7800), x86/64

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[update commit message/tested]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-06 19:55:19 +02:00
Josh Bendavid b5dd746cbb ramips: add support for D-Link DIR-2660 A1
This patch adds support for D-Link DIR-2660 A1.

Specifications:
* Board: AP-MTKH7-0002
* SoC: MediaTek MT7621AT
* RAM: 256 MB (DDR3)
* Flash: 128 MB (NAND)
* WiFi: MediaTek MT7615N (x2)
* Switch: 1 WAN, 4 LAN (Gigabit)
* Ports: 1 USB 2.0, 1 USB 3.0
* Buttons: Reset, WPS
* LEDs: Power (white/orange), Internet (white/orange), WiFi 2.4G (white),
        WiFi 5G (white), USB 3.0 (white), USB 2.0 (white)

Notes:
* WiFi 2.4G and WiFi 5G LEDs are wired directly to the wireless chips

Installation:
* D-Link Recovery GUI: power down the router, press and hold the reset
  button, then re-plug it. Keep the reset button pressed until the power
  LED starts flashing orange, manually assign a static IP address under
  the 192.168.0.xxx subnet (e.g. 192.168.0.2) and go to http://192.168.0.1

* Some modern browsers may have problems flashing via the Recovery GUI,
  if that occurs consider uploading the firmware through cURL:

    curl -v -i -F "firmware=@file.bin" 192.168.0.1

MAC addresses:

lan   factory 0xe000     *:a7 (label)
wan   factory 0xe006     *:aa
2.4   factory 0xe000 +1  *:a8
5.0   factory 0xe000 +2  *:a9

Seems like vendor didn't replace the dummy entries in the calibration data.

Signed-off-by: Josh Bendavid <joshbendavid@gmail.com>
[rebase onto already merged DIR-1960 A1, add MAC addresses to commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-06 19:09:45 +02:00
Russell Morris 45a81f7056 ramips: add support for HooToo HT-TM05
The HooToo HT-TM05 is a battery powered router, with an Ethernet and USB port.
Vendor U-Boot limited to 1.5 MB kernel size, so use lzma loader (loader-okli).

Specifications:

  SOC:     MediaTek MT7620N
  BATTERY: 10400mAh
  WLAN:    802.11bgn
  LAN:     1x 10/100 Mbps Ethernet
  USB:     1x USB 2.0 (Type-A)
  RAM:     64 MB
  FLASH:   GigaDevice GD25Q64, Serial 8 MB Flash, clocked at 50 MHz
           Flash itself specified to 80 MHz, but speed limited by mt7620 SPI
           fast-read enabled (m25p)
  LED:     Status LED (blue after boot, green with WiFi traffic
           4 leds to indicate power level of the battery (unable to control)
  INPUT:   Power, reset button

MAC assignment based on vendor firmware:

  2.4 GHz    *:b4   (factory 0x04)
  LAN/label  *:b4   (factory 0x28)
  WAN        *:b5   (factory 0x2e)

Tested and working:

 - Ethernet
 - 2.4 GHz WiFi (Correct MAC-address)
 - Installation from TFTP (recovery)
 - OpenWRT sysupgrade (Preserving and non-preserving), through the usual
   ways: command line and LuCI
 - LEDs (except as noted above)
 - Button (reset)
 - I2C, which is needed for reading battery charge status and level
 - U-Boot environment / variables (from U-Boot, and OpenWrt)

Installation:

 - Download the needed OpenWrt install files, place them in the root
   of a clean TFTP server running on your computer. Rename the files as,
   - ramips-mt7620-hootoo_tm05-squashfs-kernel.bin => kernel
   - ramips-mt7620-hootoo_tm05-squashfs-rootfs.bin => rootfs
 - Plug the router into your computer via Ethernet
 - Set your computer to use 10.10.10.254 as its IP address
 - With your router shut down, hold down the power button until the first
   white LED lights up.
 - Push and hold the reset button and release the power button. Continue
   holding the reset button for 30 seconds or until it begins searching
   for files on your TFTP server, whichever comes first.
 - The router (10.10.10.128) will look for your computer at 10.10.10.254
   and install the two files. Once it has finished installation, it will
   automatically reboot and start up OpenWrt.
 - Set your computer to use DHCP for its IP address

Notes:

 - U-Boot environment can be modified, u-boot-env is preserved on initial
   install or sysupgrade
 - mtd-concat functionality is included, to leave a "hole" for u-boot-env,
   combining the OEM kernel and rootfs partitions

I would like to thank @mpratt14 and @xabolcs for their help getting the
lzma loader to work!

Signed-off-by: Russell Morris <rmorris@rkmorris.us>
[drop changes in image/Makefile, fix indent and PKG_RELEASE in
uboot-envtools, fix LOADER_FLASH_OFFS, minor commit message facelift,
add COMPILE to Device/Default]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-03 14:15:30 +02:00
Chuanhong Guo b7013e9c4a ramips: image: add recipe for OKLI loader
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-09-03 14:15:30 +02:00
Chuanhong Guo cac9e3e2cb ramips: lzma-loader: make FLASH_START configurable
FLASH_START is supposed to point at the memory area where NOR flash are
mapped. We currently have an incorrect FLASH_START copied from ar71xx
back then and the loader doesn't work under OKLI mode.
On ramips, mt7621 has it's flash mapped to 0x1fc00000 and other SoCs
uses 0x1c000000. This commit makes FLASH_START a configurable value to
handle both cases.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-09-03 14:15:30 +02:00
Adrian Schmutzler 66ab1fb395 ramips: drop support for kernel 4.14
The target seems to be working on 5.4, so drop 4.14 support in
preparation for removing it from master entirely.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-02 16:29:23 +02:00
Felix Fietkau b5d425af23 mediatek/ramips: unify ethernet driver fixes and add performance optimizations
Increase DMA burst size and tx ring size and optimize tx processing

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-01 17:01:56 +02:00
Perry Melange 09faa73c53 ramips: rt3883: use lzma-loader for DIR-645
The DIR-645 fails to boot if the kernel is large.
Enabling lzma-loader resolves the issue.

Run-tested on D-Link DIR-645.

Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
2020-08-28 00:25:34 +02:00
Georgi Vlaev 51b653de94 ramips: add support for Wavlink WL-WN531A6
This patch adds support for Wavlink WL-WN531A6 (Quantum D6).

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

* SoC: Mediatek MT7621AT 2C2T, 880MHz
* RAM: 128MB DDR3, Nanya NT5CB64M16GP-EK
* Flash: 16MB SPI NOR flash, GigaDevice GD25Q127CSIG
* WiFi 5GHz: Mediatek MT7615N (4x4:4) on mini PCIE slot.
* WiFi 2.4GHz: Mediatek MT7603EN (2x2:2) on mini PCIE slot.
* Ethernet: MT7630, 5x 1000Base-T
* LED: Power, WAN, LAN(x4), WiFi, WPS, dual color
       "WAVLINK" LED logo on the top cover.
* Buttons: Reset, WPS, "Turbo", touch button on the top
           cover via RH6015C touch sensor.
* UART: UART1: serial console (57600 8n1) on the J4 header
               located below the top heatsink.
        UART2: J12 header, located on the right side of
               the board.
* USB: One USB3 port.
* I2C: J9 header, located below the top heatsink.

Backup the OEM Firmware:
-----------------------

There isn't any firmware released for the WL-WN531A6 on
the Wavlink web site. Reverting back to the OEM firmware is
not possible unless we have a backup of the original OEM
firmware.

The OEM firmware is stored on /dev/mtd4 ("Kernel").

  1) Plug a FAT32 formatted USB flash drive into the USB port.
  2) Navigate to "Setup->USB Storage". Under the "Available
     Network folder" you can see part of the mount point of
     the newly mounted flash drive filesystem - e.g "sda1".
     The full mount point is prefixed with "/media", so in
     this case the mount point becomes "/media/sda1".
  3) Go to http://192.168.10.1/webcmd.shtml .
  4) Type the following line in the "Command" input box:

     dd if=/dev/mtd4ro of=/media/sda1/firmware.bin

  5) Click "Apply"
  6) After few seconds, in the text area should appear this
     output:

        30080+0 records in
      30080+0 records out

  7) Type "sync" in the "Command" input box and click "Apply".
  8) At this point the OEM firmware is stored on the flash
     drive as "firmware.bin". The size of the file is 15040 KB.

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

* Flashing instructions (OEM web interface):
The OEM web interface accepts only files with names containing
"WN531A6". It's also impossible to flash the *-sysupgrade.bin
image, so we have to flash the *-initramfs-kernel.bin first and
use the OpenWrt's upgrade interface to write the sysupgrade
image.

  1) Rename openwrt-ramips-mt7621-wavlink_wl-wn531a6-initramfs-kernel.bin
     to WN531A6.bin.
  2) Connect your computer to the one of the LAN ports of the
     router with an Ethernet cable and open http://192.168.10.1
  3) Browse to Setup -> Firmware Upgrade interface.
  4) Upload the (renamed) OpenWrt image - WN531A6.bin.
  5) Proceed with the firmware installation and give the device
     a few minutes to finish and reboot.
  6) After reboot wait for the "WAVLINK" logo on the top cover
     to turn solid blue, and open http://192.168.1.1
  7) Use the OpenWrt's "Flash Firmware" interface to write the
     OpenWrt sysupgrade image:
     openwrt-ramips-mt7621-wavlink_wl-wn531a6-squashfs-sysupgrade.bin

* Flashing instructions (u-boot TFTP):
  1) Configure a TFTP server on your computer and set its IP
     to 192.168.10.100
  2) Rename the OpenWrt sysupgrade image to firmware.bin and
     place it in the root folder of the TFTP server.
  3) Power off the device and connect an Ethernet cable from
     one of its LAN ports your computer.
  4) Press the "Reset" button (and keep it pressed)
  5) Power on the device.
  6) After a few seconds, when the connected port LAN LED stops
     blinking fast, release the "Reset" button.
  7) Flashing OpenWrt takes less than a minute, system will
     reboot automatically.
  8) After reboot the WAVLINK logo on the top cover will indicate
     the current OpenWrt running status (wait until the logo tunrs
     solid blue).

Revert to the OEM Firmware:
--------------------------
* U-boot TFTP:
  Follow "Flashing instructions (u-boot TFTP)" and use the
  "firmware.bin" backup image.

* OpenWrt "Flash Firmware" interface:
  Upload the "firmware.bin" backup image and select "Force update"
  before continuing.

Notes:
-----
* The MAC address shown on the label at the back of the device
is assigned to the 2.4G WiFi adapter.

  MAC addresses assigned by the OEM firmware:
  2.4G: *:XX (label): factory@0x0004
    5G: *:XX + 1    : factory@0x8004
   WAN: *:XX - 1    : factory@0xe006
   LAN: *:XX - 2    : factory@0xe000

* The I2C bus and UART2 are fully functional. The headers are
not populated.

Signed-off-by: Georgi Vlaev <georgi.vlaev@konsulko.com>
2020-08-28 00:25:33 +02:00
Andrew Freeman ff5dd32164 ramips: add support for TP-Link TL-WR850N v2
This patch adds support for the TP-Link TL-WR850N v2. This device
is very similar to TP-Link TL-WR840 v4 and TP-Link TL-WR841 v13.

Specifications:
SOC: MediaTek MT7628NN
Flash: 8 MiB SPI
RAM: 64 MiB
WLAN: MediaTek MT7628NN
Ethernet: 5 ports (100M)

Installation Using the integrated tftp capability of the router:
1. Turn off the router.
2. Connect pc to one of the router LAN ports.
3. Set your PC IPv4 address to 192.168.0.66/24.
4. Run any TFTP server on the PC.
5. Put the recovery firmware on the root directory of TFTP server
   and name the file tp_recovery.bin
6. Start the router by pressing power button while holding the
   WPS/Reset button (or both WPS/Reset and WIFI buttons)
7. Router connects to your PC with IPv4 address 192.168.0.2,
   downloads the firmware, installs it and reboots. LEDs are
   flashing. Now you have OpenWrt installed.
8. Change your IPv4 PC address to something in 192.168.1.0/24
   network or use DHCP to get an address from your OpenWrt router.
9. Done! You can login to your router via ssh.

Forum link:
https://forum.openwrt.org/t/add-support-for-tp-link-tl-wr850n-v2/66899

Signed-off-by: Andrew Freeman <labz56@gmail.com>
[squash an tidy up commits, sort nodes]
Signed-off-by: Darsh Patel <darshkpatel@gmail.com>
[minor commit message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-27 16:36:18 +02:00
Adrian Schmutzler adf830a3a5 ramips: remove further mt7621 code from local ethernet driver
While commit 734a8c46e7 focussed on removing stuff directly
selected by the NET_RALINK_* symbols, this patch removes additional
unused mt7621-specific code from the ethernet driver.

As with the previous patch, the main reason is to reduce the amount
of code we have to maintain and care about.

Note that this patch still keeps a few lines with
IS_ENABLED(CONFIG_SOC_MT7621) in mtk_eth_soc.h/.c, as this file is
still selected for the mt7621 subtarget.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-26 23:58:01 +02:00
Rustam Gaptulin b2f19d3ef7 ramips: mt7621: use lzma-loader for ZBT-WG3526
The wg3526 fails to boot if the kernel is large.
Enabling lzma-loader resolves the issue on both the wg3526-16m
and wg3526-32m.

Fixes: FS#3143

Signed-off-by: Rustam Gaptulin <rascal6@gmail.com>
[commit message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-24 00:18:43 +02:00
Adrian Schmutzler 734a8c46e7 ramips: remove legacy ethernet driver components for mt7621
The mt7621 subtarget has been switched to DSA quite a while ago and
seems to run sufficiently fine. Build with older kernels than 5.4 has
been disabled directly during the kernel bump, so our local ethernet
driver is unused in master since then.

Therefore, let's remove the mt7621-specific parts of "our" ethernet
driver, so we don't have to maintain them and it's obvious to
everybody that they are not used anymore.

This also drops the offloading components as this was specifically
implemented to depend on mt7621.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-21 15:46:54 +02:00
Petr Štetiar a14f5bb4bd treewide: use wpad-basic-wolfssl as default
In order to support SAE/WPA3-Personal in default images. Replace almost
all occurencies of wpad-basic and wpad-mini with wpad-basic-wolfssl for
consistency. Keep out ar71xx from the list as it won't be in the next
release and would only make backports harder.

Build-tested (build-bot settings):
ath79: generic, ramips: mt7620/mt76x8/rt305x, lantiq: xrx200/xway,
sunxi: a53

Signed-off-by: Petr Štetiar <ynezz@true.cz>
[rebase, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-20 14:19:39 +02:00
John Audia da98603597 kernel: bump 5.4 to 5.4.58
This PR is a blend of several kernel bumps authored by ldir taken from his
staging tree w/ some further adjustments made by me and update_kernel.sh

Summary:
Deleted upstreamed patches:
  generic:
    742-v5.5-net-sfp-add-support-for-module-quirks.patch
    743-v5.5-net-sfp-add-some-quirks-for-GPON-modules.patch
  bcm63xx:
    022-v5.8-mtd-rawnand-brcmnand-correctly-verify-erased-pages.patch
    024-v5.8-mtd-rawnand-brcmnand-fix-CS0-layout.patch
  mediatek:
    0402-net-ethernet-mtk_eth_soc-Always-call-mtk_gmac0_rgmii.patch

Deleted patches applied differently upstream:
  generic:
    641-sch_cake-fix-IP-protocol-handling-in-the-presence-of.patch

Manually merged patches:
  generic:
    395-v5.8-net-sch_cake-Take-advantage-of-skb-hash-where-appropriate.patch
  bcm27xx:
    950-0132-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch
  layerscape:
    701-net-0231-enetc-Use-DT-protocol-information-to-set-up-the-port.patch

Build system: x86_64
Build-tested: ath79/generic, bcm27xx/bcm2708, bcm27xx/bcm2711,
  imx6, mvebu/cortexa9, sunxi/a53
Run-tested: Netgear R7800 (ipq806x)

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-By: Lucian Cristian <Lucian.cristian@gmail.com> [mvebu]
Tested-By: Curtis Deptuck <curtdept@me.com> [x86/64]
[do not remove 395-v5.8-net-sch_cake-Take-advantage-... patch,
adjust and refresh patches, adjust commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-By: John Audia <graysky@archlinux.us> [ipq806x]
2020-08-18 18:14:54 +02:00
Adrian Schmutzler 03cdbb2040 ramips: fix LED labels for Asus RT-AC65P
The leds block was copied over from the RT-AC85P DTS to the common
DTSI while keeping the device-specific model name in the label.

This moves the LEDs back to the DTS files and adjusts the names to
properly resemble the model name of the devices used at, just like
it is handled on most other devices.

Fixes: 7c5f712e4f ("ramips: add support for Asus RT-AC65P")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-17 15:00:43 +02:00
John Thomson 74438d5419 ramips: add support for MikroTik RouterBOARD 760iGS (hEX S)
This patch adds support for the MikroTik RouterBOARD 760iGS router.
It is similar to the already supported RouterBOARD 750Gr3.
The 760iGS device features an added SFP cage, and passive
PoE out on port 5 compared to the RB750Gr3.

https://mikrotik.com/product/hex_s

Specifications:

- SoC: MediaTek MT7621A
- CPU: 880MHz
- Flash: 16 MB
- RAM:  256 MB
- Ethernet: 5x 10/100/1000 Mbps
- SFP cage
- USB port
- microSD slot

Unsupported:

- Beeper (requires PWM driver)
- ZT2046Q (ADS7846 compatible) on SPI as slave 1 (CS1)
  The linux driver requires an interrupt, and pendown GPIO
  These are unknown, and not needed with the touchscreen
  only used for temperature and voltage monitoring.
  ads7846 hwmon:
  temp0 is degrees Celsius
  temp1 is voltage * 32

GPIOs:

- 07:  input passive PoE out (lan5) compatible (Mikrotik) device connected
- 17:  output passive PoE out (lan5) switch

Installation through RouterBoot follows the usual MikroTik method
https://openwrt.org/toh/mikrotik/common

To boot to intramfs image in RAM:

1. Setup TFTP server to serve intramfs image.
2. Plug Ethernet cable into WAN port.
3. Unplug power, hold reset button and plug power in.
   Wait (~25 seconds) for beep and then release reset button.
   The SFP LED will be lit in RouterBoot, but will not be lit in OpenWRT.
4. Wait for a minute. Router should be running OpenWrt,
   check by plugging in to port 2-5 and going to 192.168.1.1.

To install OpenWrt to flash:

1. Follow steps above to boot intramfs image in RAM.
2. Flash the sysupgrade.bin image with web interface or sysupgrade.
3. Once the router reboots you will be running OpenWrt from flash.

OEM firmware differences:

- RouterOS assigns a different MAC address for each port
- The first address (E01 on the sticker) is used for wan (ether1 in OEM).
- The next address is used for lan2.
- The last address (E06 on the sticker) is used for sfp.

[Initial port work, shared dtsi]
Signed-off-by: Vince Grassia <vincenzo.grassia@zionark.com>
[SFP support and GPIO identification]
Signed-off-by: Luka Logar <luka.logar@iname.com>
[Misc. fixes and submission]
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
[rebase, drop uart3 from state_default on 750gr3, minor commit
title/message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-13 12:47:45 +02:00
Adrian Schmutzler ddf3e5c22d ramips/mt7621: create common DTSI for Mikrotik devices
This moves some common definitions for Mikrotik devices, mainly
routerboot partitions and reset key, to a common DTSI file.

While at it, remove unused hard_config DT label.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-13 12:47:45 +02:00
John Thomson 2d9db93397 ramips: use gpio-export for Mikrotik RouterBOARD 750Gr3 beeper
This beeper hardware requires a PWM driver for frequency selection.
Since the GPIO driver does not provide that, revert the beeper
support to a simple gpio-export.

This effectively reverts the corresponding changes from
6ba58b7b02 ("ramips: cleanup the RB750Gr3 support")

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
[commit title/message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-13 02:12:12 +02:00
Hauke Mehrtens 2f3d7abccd kernel: Update kernel 4.14 to version 4.14.193
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2020-08-10 19:34:37 +02:00
Adrian Schmutzler d4ac0ad543 treewide: make dependency on kmod-usb-net selective
A bunch of kernel modules depends on kmod-usb-net, but does not
select it. Make AddDepends/usb-net selective, so we can drop
some redundant +kmod-usb-net definitions for DEVICE_PACKAGES.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-10 12:54:30 +02:00
Adrian Schmutzler 04b99d9539 ramips/mt7628: fix portmap based on board.d port assignment
When comparing to the port assignment in board.d/02_network, a few
devices seem to use the wrong setup of mediatek,portmap.

The corrects the values for mt76x8 subtarget based on the location
of the wan port.

A previous cleanup of obviously wrong values has already been done in
7a387bf9a0 ("ramips: mt76x8: fix bogus mediatek,portmap")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-10 12:33:38 +02:00
Adrian Schmutzler e81e625ca3 treewide: add sysupgrade comment for early DSA-adopters
Add a specific comment for early DSA-adopters that they can keep
their config when prompted due to compat-version increase.

This is a temporary solution, the patch should be simply reverted
before any release.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-08 20:56:12 +02:00
Adrian Schmutzler 1eac573b53 ramips: mt7621: implement compatibility version for DSA migration
This implements the newly introduced compat-version to prevent
broken upgrade between swconfig and DSA for ramips' mt7621 subtarget.

In order to make the situation more transparent for the user, and
to prevent large switch-cases for devices, it is more convenient to
have the entire subtarget 1.1-by-default. This means that new devices
will be added with 1.1 from the start, but in contrast we don't need
to switch them in board.d files. Apart from that, users that manually
backport devices to 19.07 with swconfig will have an equivalent
upgrade experience to officially supported devices.

Since DSA support on mt7621 is out for a while already, this applies
the same uci-defaults workaround for early adopters as already
done for kirkwood and mvebu in previous commits.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-08 16:13:51 +02:00
Sungbo Eo de78747de1 ramips: use lzma-loader for RT5350F-OLinuXino devices
The bootloader fails to extract a big kernel, e.g. v5.4 kernel image
with ALL_KMODS enabled. This can be fixed by using lzma-loader.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-08-08 16:13:51 +02:00
Sungbo Eo a40ddc2195 ramips: adjust LZMA_TEXT_START for 32MB RAM devices
Currently the lzma-loader is placed in RAM at 32MB offset, which does not
make sense for devices with only 32MB RAM. If we adjust LZMA_TEXT_START to
24MB offset, then the lzma-loader can be used on those devices and still
about 24MB memory will be available for uncompressed image, which should be
enough for most use cases.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-08-08 16:13:51 +02:00
Adrian Schmutzler 1634461bd2 ramips: switch rt288x subtarget to kernel 5.4
The sbutarget has testing support for kernel 5.4 for quite a while
and builds fine, however, only one devices there is > 4 MiB.

Since it's unlikely to get a Tested-by for that device, and the other
ralink subtargets appear to be working with 5.4 so far, let's set
this target to 5.4 by default as well.

That way, even if the device happens to break, we'll still have at
least usable SDK and IB for people to use.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-07 14:51:20 +02:00
Adrian Schmutzler 7c07a0f4c3 ramips/mt7620: fix portmap based on board.d port assignment
When comparing to the port assignment in board.d/02_network, many
devices seem to use the wrong setup of mediatek,portmap.

The corrects the values for mt7620 subtarget based on the location
of the wan port.

A previous cleanup of obviously wrong values has already been done in
d3c0a94405 ("ramips: mt7620/mt7621: remove invalid mediatek,portmap")

Cc: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-07 13:01:18 +02:00
Adrian Schmutzler 121c021989 ramips: invert wpad selection for mt7621
For ramips/mt7621, the wpad-basic package is not selected by default,
but added for every device individually as needed.

While this might be technically correct if the SoC does not come with
a Wifi module, only 18 of 97 devices for that platform are set up
_without_ wpad-basic currently.

Therefore, it seems more convenient to add wpad-basic by default for
the subtarget and then just remove it for the 18 mentioned devices,
instead of having to add it for about 60 times instead.

This would also match the behavior of the 5 other subtargets, where
wpad-basic/wpad-mini is added by default as well, and thus be more
obvious to developers without detailed SoC knowledge.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-07 12:02:19 +02:00
Adrian Schmutzler 7673df7994 ramips: switch rt3883 subtarget to kernel 5.4
The target has testing support for kernel 5.4 for quite a while,
compiles fine for all devices, and has been run-tested on Asus
RT-N56U successfully.

Let's set it to kernel 5.4 by default to increase the audience
before an 20.xx stable branch.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Eneas U de Queiroz <cotequeiroz@gmail.com> [Asus RT-N56U]
2020-08-06 23:52:57 +02:00
Shibajee Roy a673ac66fa ramips: add support for Netgear JWNR2010 v5
Specification:
 - CPU: MediaTek MT7620N (580 MHz)
 - Flash size: 4 MB NOR SPI
 - RAM size: 32 MB DDR1
 - Bootloader: U-Boot
 - Wireless: MT7620N 2x2 MIMO 802.11b/g/n (2.4 GHz)
 - Switch: MT7620 built-in 10/100 switch with vlan support
 - Ports: 4x LAN, 1x WAN
 - Others: 7x LED, Reset button, UART header on PCB (57600 8N1)

Flash instructions:
 1. Use ethernet cable to connect router with PC/Laptop, any router
    LAN port will work.
 2. To flash openwrt we are using nmrpflash[1].
 3. Flash commands:
      First we need to identify the correct Ethernet id.

        nmrpflash -L

        nmrpflash -i net* -f openwrt-ramips-mt7620-netgear_jwnr2010-v5-squashfs-factory.img

      This will show something like "Advertising NMRP server on net*..." (net*, *=1,2,3... etc.)

 4. Now remove the power cable from router back side and immediately connect it again.
    You will see flash notification in CMD window, once it says reboot the device just
    plug off the router and plug in again.

Revert to stock:
 1. Download the stock firmware from official netgear support[2].
 2. Follow the same nmrpflash procedure like above, this time just use the stock firmware.

        nmrpflash -i net* -f N300-V1.1.0.54_1.0.1.img

MAC addresses on stock firmware:
LAN = *:28 (label)
WAN = *:29
WLAN = *:28

On flash, the only valid MAC address is found in factory 0x4.

Special Note:
 This openwrt firmware will also support other netgear N300 routers like below as they
 share same stock firmware[3].
 JNR1010v2 / WNR614 / WNR618 / JWNR2000v5 / WNR2020 / WNR1000v4 / WNR2020v2 / WNR2050

[1] https://github.com/jclehner/nmrpflash
[2] https://www.netgear.com/support/product/JWNR2010v5.aspx
[3] http://kb.netgear.com/000059663

Signed-off-by: Shibajee Roy <ador250@protonmail.com>
[create DTSI, use netgear_sercomm_nor, disable by default, add MAC
addresses to commit message, add label MAC address]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 16:56:07 +02:00
Adrian Schmutzler a66449c608 ramips: drop remaining m25p,chunked-io from DTS
This option was a spi nor hack which is dropped in commit bcf4a5f474
("ramips: remove chunked-io patch and set spi->max_transfer_size instead")

Most of it has already been removed in
be2b61e4f1 ("ramips: drop m25p,chunked-io from dts")

It seems all current usages were added after that. Remove them.

Cc: Chuanhong Guo <gch981213@gmail.com>
Reported-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 16:56:07 +02:00
Adrian Schmutzler 3b89849b57 ramips: add common definition netgear_sercomm_nor
Like NAND-based devices, SPI-NOR based Netgear devices also share
a common setup for their images. This creates a common defition
for them in image/Makefile, so it can be reused across subtargets.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 16:56:06 +02:00
Adrian Schmutzler 77e850fe76 ramips: tidy up MAC address setup for Linkit Smart and Omega2
Linkit Smart 7688 and Onion Omega 2(+) are one-port devices, and
have their port set to LAN by default. Setting up a WAN MAC address
for them doesn't make any sense, as no wan interface will be created
in uci config. Despite, these devices also set lan_mac in 02_network,
although mtd-mac-address sets a different address for the ethernet
interface in DTS.

Clean this up by moving the lan_mac value into DTS and dropping the
entries in 02_network completely. That way, the effective address
on the LAN interface should stay the same, but we get rid of the
extra (re)assignments.

As I don't have access to the devices, this does not tell anything
about whether 0x2e is actually a good choice, it just preserves
the existing assignment.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 13:33:26 +02:00
Tobias Welz 633ea0db0f ramips: WizFi630S use macs from factory partion
WIZnet WizFi630s has three mac addresses in the factory partition:
0x04 (also on the label), 0x28 for wan mac and 0x2e as lan mac.
All three macadresses are sequential series of addresses.
This is making use of them.

While at it, also add the label MAC address to 02_network.

MAC addresses as verified by OEM firmware:

use      interface   source
WLAN     ra0         factory 0x04 (label)
WAN      eth0.2      factory 0x28 (label + 1)
LAN      eth0.1      factory 0x2e (label + 2)

Signed-off-by: Tobias Welz <tw@wiznet.eu>
[fix sorting in 02_network, commit message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 13:33:26 +02:00
Tobias Welz d0b229f553 ramips: correct WizFi630S pin mappings
WizFi630S had some pins changed in the release version of the board.
The run led, wps button and a slide switch where affected.
This patch is correcting this.
i2c is removed as it is sharing a pin with the run (system) led.
uart2 is enabled as it is also enabled in the OEM firmware.

Signed-off-by: Tobias Welz <tw@wiznet.eu>
2020-08-06 13:33:26 +02:00
Felix Fietkau b0f7ea2853 kernel: unify CONFIG_GPIO_SYSFS in kernel configs
Enable it for all platforms

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-08-06 12:37:04 +02:00