Commit Graph

2901 Commits (121c021989929c33036cc75ab9a8363200e8da0c)

Author SHA1 Message Date
Christoph Krapp ba0f4f0cfd ramips: add support for TP-Link RE500 v1
This device uses the same hardware as RE650 v1 which got supported in
8c51dde.

Hardware specification:

- SoC 880 MHz - MediaTek MT7621AT
- 128 MB of DDR3 RAM
- 16 MB - Winbond 25Q128FVSG
- 4T4R 2.4 GHz - MediaTek MT7615E
- 4T4R 5 GHz - MediaTek MT7615E
- 1x 1 Gbps Ethernet - MT7621AT integrated
- 7x LEDs (Power, 2G, 5G, WPS(x2), Lan(x2))
- 4x buttons (Reset, Power, WPS, LED)
- UART header (J1) - 2:GND, 3:RX, 4:TX
  Serial console @ 57600,8n1

Flash instructions:

Upload
openwrt-ramips-mt7621-tplink_re500-v1-squashfs-factory.bin
from the RE500 web interface.

TFTP recovery to stock firmware:

Unfortunately, I can't find an easy way to recover the RE
without opening the device and using modified binaries. The
TFTP upload will only work if selected from u-boot, which
means you have to open the device and attach to the serial
console. The TFTP update procedure does *not* accept the
published vendor firmware binaries. However, it allows to
flash kernel + rootfs binaries, and this works if you have
a backup of the original contents of the flash. It's probably
possible to create special image out of the vendor binaries
and use that as recovery image.

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
[remove dts-v1 in DTSI, do not touch WiFi LEDs for RE650, keep
state_default in DTS files, fix label-mac-device, use lower case
for WiFi LEDs]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sunguk Lee 2d378703f1 ramips: reduce spi-max-frequency for ipTIME A8004T
Reduce spi-max-frequency for ipTIME A8004T and disable
m25p,fast-read option.

A8004T uses `en25qh128` for the MTD.
This flash memory would allow 80MHz, sometimes kernel received
wrong id value in initramfs installed router.
(kernel expected `1c 70 18 1c 70 18`, but one of cases, it
was `9c 70 18 1c 70 18`)

In this case, openwrt can't detect the partition information,
it would write the inccorect data to the firmware partition and
also it would occur the bootlooping after sysupgrade.

Signed-off-by: Sunguk Lee <d3m3vilurr@gmail.com>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Hauke Mehrtens ce958dd88a kernel: Update kernel 4.14 to version 4.14.187
Fixes:
- CVE-2020-10757

The "mtd: rawnand: Pass a nand_chip object to nand_release()" commit was
backported which needed some adaptations to other code.

Build tested: ramips

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Rowan Border 33fae8421e ramips: add support for TP-Link RE220 v2
TP-Link RE220 v2 is a wireless range extender with Ethernet and 2.4G and 5G
WiFi with internal antennas. It's based on MediaTek MT7628AN+MT7610EN.

This port of OpenWRT leverages work done by Andreas Böhler <dev@aboehler.at>
for the TP-Link RE200 v2 as both devices share the same SoC, flash layout
and GPIO pinout.

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
UART header on PCB (57600 8n1)
8x LED (GPIO-controlled), 2x button
There are 2.4G and 5G LEDs in red and green which are controlled separately.

Web Interface Installation

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.

Signed-off-by: Rowan Border <rowanjborder@gmail.com>
4 years ago
David Bauer 5667ccbf16 ramips: remove duplicate MAC assignment case
Cudy WR1000 and Wavlink WL-WN577A2 store WAN as well as label MAC address
at the same position in flash.

Suggested-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer 1ba0466d43 package: add ravpower-mcu package
This package allows to read battery status information and control the
power state of the RAVPower RP-WD009 power management IC.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer e959048c12 ramips: add support for RAVPower RP-WD009
The RAVPower RP-WD009 is a batter-powered pocket sized router with SD
card lot and USB port.

Hardware
--------
CPU:   MediaTek MT7628AN
RAM:   64M DDR2
FLASH: 16M GigaDevices SPI-NOR
WLAN:  MediaTek MT7628AN 2T2R b/g/n
       MediaTek MT7610E  1T1R n/ac
ETH:   1x FastEthernet
SD:    SD Card slot
USB:   USB 2.0

Custom PMIC on the I2C bus (address 0x0a).

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

1. Press and hold down the reset button.

2. Power up the Device. Keep pressing the reset button for 10
   more seconds until the Globe LED lights up.

3. Attach your Computer to the Ethernet port. Assign yourself the
   address 10.10.10.1/24.

4. Access the recovery page at 10.10.10.128 and upload the OpenWrt
   factory image.

5. The flashing will take around 1 minute. The device will reboot
   automatically into OpenWrt.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Lars Wessels dbaf0d20bb ramips: add support for WAVLINK WL-WN577A2
This commit adds support for the Wavlink WL-WN577A2 (black case) dual-band
wall-plug wireless router. In Germany this device is sold under the brand
name Maginon WL-755 (white case):

Device specifications:

- CPU: MediaTek MT7628AN (580MHz)
- Flash: 8MB
- RAM: 64MB
- Bootloader: U-Boot
- Ethernet: 2x 10/100 Mbps (Ralink RT3050)
- 2.4 GHz: 802.11b/g/n SoC
- 5 GHz: 802.11a/n/ac MT7610E
- Antennas: internal
- 4 green LEDs: 1 programmable (WPS) + LAN, WAN, POWER
- Buttons: Reset, WPS
- Small sliding power switch

Flashing instructions (U-boot):

- Configure a TFTP server on your PC/Laptop and set its IP
  to 192.168.10.100

- Rename the OpenWrt image to firmware.bin and place it in the
  root folder of the TFTP server

- Power off (using the small sliding power switch on the left
  side) the device and connect an ethernet cable from its LAN
  or WAN port to your PC/Laptop

- Press the WPS button (and keep it pressed)

- Power on the device (using the small power switch)

- After a few seconds, when the WAN/LAN LED stops blinking
  very fast, release the WPS button

- Flashing OpenWrt takes less than a minute, system will
  reboot automatically

- After reboot the WPS LED will indicate the current OpenWrt
  running status

Signed-off-by: Lars Wessels <software@bytebox.org>
[removed unused labels - fix whitespace errors - wrap commit message]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Jan Hoffmann b1d5ab1a69 ramips: add support for NETGEAR WAC124
The WAC124 hardware appears to be identical to R6260/R6350/R6850.

SoC:   MediaTek MT7621AT
RAM:   128M DDR3
FLASH: 128M NAND (Macronix MX30LF1G18AC)
WiFI:  MediaTek MT7603 bgn 2T2R
       MediaTek MT7615 nac 4T4R
ETH:   SoC Integrated Gigabit Switch (1x WAN, 4x LAN)
USB:   1x USB 2.0
BTN:   Reset, WPS
LED:   Power, Internet, WiFi, USB (all green)

Installation:
The factory image can be flashed from the stock firmware web interface
or using nmrpflash. With nmrpflash it is also possible to revert to
stock firmware.

Signed-off-by: Jan Hoffmann <jan@3e8.eu>
4 years ago
Alex Lewontin bd49f2c984 ramips: add support for Netgear R6080
This adds support for the Netgear R6080, aka Netgear AC1000.

The R6080 has almost the same hardware as the Netgear R6120,
aka Netgear AC1200, but it lacks the USB port, has only 8 MiB flash and
uses a different SERCOMM_HWID.

Specification:

SoC: MediaTek MT7628 (580 MHz)
Flash: 8 MiB
RAM: 64 MiB
Wireless: 2.4Ghz (builtin) and 5Ghz (MT7612E)
LAN speed: 10/100
LAN ports: 4
WAN speed: 10/100
WAN ports: 1
UART (57600 8N1) on PCB

Installation:

Flashing OpenWRT from stock firmware requires nmrpflash. Use an ethernet
cable to connect to LAN port 1 of the R6080, and power the R6080 off.
From the connected workstation, run
`nmrpflash -i eth0 -f openwrt-ramips-mt76x8-netgear_r6080-squashfs-factory.img`,
replacing eth0 with the appropriate interface (can be identified by
running `nmrpflash -L`). Then power on the R6080. After flashing has finished,
power cycle the R6080, and it will boot into OpenWRT. Once OpenWRT has been
installed, subsequent flashes can use the web interface and sysupgrade files.

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
[rebase and adjust for 5.4]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Qin Wei cd6515c2e8 ramips: fix sd polling
This is fixed in 18.06, it appears again in 19.07.
Currently mt7628 sdcard driver do not support polling mode which is for
the device do not have card-detect pin to detect sd card insert. Without
this patch, device will not detect sdcard is inserted. This patch is a
fix of that.

Signed-off-by: Qin Wei <support@vocore.io>
4 years ago
Adrian Schmutzler 54b19e213a ramips: drop redundant chosen/bootargs
chosen/bootargs are defined to the same value in device DTS files
that is already set in the SoC DTSI. Remove the redundant definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Alex Lewontin 2e47a05d87 ramips: clean up Netgear R6120 code formatting
This commit performs minor janitorial work to clean up some code
formatting for the Netgear R6120.

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
4 years ago
Alex Lewontin 888afe7c69 ramips: move Netgear R6120 LED trigger to DTS
This moves the trigger for the Netgear R6120's wlan2g_green LED from
base-files/etc/board.d/01_leds to the device-tree file.

This has been applied to R6120 based on findings for the very similar
Netgear R6080.

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
[merge case in 01_leds, slightly adjust commit message/title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Petr Štetiar e44e60b290 kernel: bump 5.4 to 5.4.48
Resolved merge conflict in the following patches:

 layerscape: 701-net-0213-dpaa2-eth-Add-CEETM-qdisc-support.patch
 ramips: 0013-owrt-hack-fix-mt7688-cache-issue.patch

Refreshed patches, removed upstreamed patch:

 bcm63xx: 020-v5.8-mtd-rawnand-brcmnand-fix-hamming-oob-layout.patch

Run tested: qemu-x86-64
Build tested: x86/64

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
INAGAKI Hiroshi 3a8d65010d ramips: add support for ELECOM WRC-2533GST2
ELECOM WRC-2533GST2 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 4T4R (2x MediaTek MT7615)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/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		: 12VDC, 1.5A

Flash instruction using factory image:

1. Boot WRC-2533GST2 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

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
INAGAKI Hiroshi 39f2f9b1bf ramips: add MT7615 wireless support for ELECOM WRC-GST devices
ELECOM WRC-1900GST and WRC-2533GST have two MT7615 chips for 2.4/5 GHz
wireless.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[WRC-1900GST]
Acked-by: NOGUCHI Hiroshi <drvlabo@gmail.com>
4 years ago
INAGAKI Hiroshi b5ae70d053 ramips: increase SPI frequency for ELECOM WRC-GST devices
Increase the SPI frequency for ELECOM WRC-1900GST and WRC-2533GST
to 40 MHz by updating the common DTSI file.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[WRC-1900GST]
Acked-by: NOGUCHI Hiroshi <drvlabo@gmail.com>
[split patch, adjust commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
INAGAKI Hiroshi 5aae0c7862 ramips: add label-mac-device for ELECOM WRC-GST devices
Update the dtsi for ELECOM WRC-1900GST and WRC-2533GST to add
label-mac-device alias.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[WRC-1900GST]
Acked-by: NOGUCHI Hiroshi <drvlabo@gmail.com>
[split patch, adjust commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Petr Štetiar 90f930e0c2 kernel: bump 5.4 to 5.4.46
Refreshed patches.

Run tested: qemu-x86-64, wrt3200acm
Build tested: x86/64, imx6, mvebu/cortexa9, sunxi/a53

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Adrian Schmutzler 48c1fdd046 treewide: drop shebang from non-executable target files
This drops the shebang from all target files for /lib and
/etc/uci-defaults folders, as these are sourced and the shebang
is useless.

While at it, fix the executable flag on a few of these files.

This does not touch ar71xx, as this target is just used for
backporting now and applying cosmetic changes would just complicate
things.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 03a0b7b7e5 ramips: fix IPv4-only corner case in 01_enable_packet_steering
The uci config section network.globals set up in /bin/config_generate
will only be created if /proc/sys/net/ipv6 exists.

Correspondingly, lacking IPv6 support, the command
uci set network.globals.packet_steering=1
will fail with "uci: Invalid argument" as the network.globals config
has not been set up.

Fix that by adding the setup there as well.

Fixes: dfd62e575c ("ramips: enable packet steering by default on mt7621")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 5549b84388 ramips: drop useless label-mac-device for RouterBOARD 750Gr3
With the new driver, MAC addresses are not set up in DTS anymore,
and therefore label-mac-device will be useless there.

Setup is done properly in 02_network, so this just removes the
obsolete alias.

Fixes: 5e50515fa6 ("ramips/mt7621: mikrotik: don't use
mtd-mac-address in DTS")

Suggested-by: John Thomson <git@johnthomson.fastmail.com.au>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
J. Scott Heppler feb55fd3ec ramips: fix port display for TRENDnet TEW-810DR
This updates the display port order for the TEW-810DR to be in line
with the DIR-810L. Both share the same board and pictures on the
vendors' pages indicate the same external numbering scheme as well.

Signed-off-by: J. Scott Heppler <shep971@centurylink.net>
[replace commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Pawel Dembicki 221d8a1c60 ramips: mt7621: add support for NETGEAR WAC104
NETGEAR WAC104 is an AP based on castrated R6220, without WAN
port and USB.

SoC: MediaTek MT7621ST
RAM: 128M DDR3
FLASH: 128M NAND
WiFi: MediaTek MT7612EN an+ac
MediaTek MT7603EN bgn
ETH: MediaTek MT7621ST (4x LAN)
BTN: 1x Connect (WPS), 1x WLAN, 1x Reset
LED: 7x (3x GPIO controlled)

Installation:

Login to netgear webinterface and flash factory.img

Back to stock:

Use nmrpflash to revert stock image.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Adrian Schmutzler efde716d14 ramips: fix port display for D-Link DIR-810L
The port order displayed in LuCI is currently inverted for this
devices:

LuCI - Device
LAN1 - LAN4
LAN2 - LAN3
LAN3 - LAN2
LAN4 - LAN1

Fix it.

Strangely, the owner of a TRENDnet TEW-810DR reports that the
initial port order is correct, while both devices share the
same board and look similar from the outside. Since I cannot
investigate this without having any of the devices, this does
only touch the DIR-810L for now.

While at it, also merge in the case for zbtlink,zbt-we2026, as
the display port specified for WAN there won't have any effect
anyway.

Reported-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler e6d4744f9a ramips: fix WAN LED for D-Link DIR-810L/TRENDnet TEW-810DR
The WAN LED on DIR-810L was actually blinking on LAN1 port
activity. This has already been improved for the TEW-810DR, where
the GPIO has been set up explicitly rather than having it controlled
by the switch.

This patch also applies this setup to the DIR-810L.

In addition, the trigger in 01_leds is set up with
ucidef_set_led_switch for both devices now, so state changes should
be displayed correctly as well.

Reported-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> [DIR-810L]
Tested-by: J. Scott Heppler <shep971@centurylink.net> [TEW-810DR]
4 years ago
Adrian Schmutzler 2c198ea162 ramips: limit uci commit to the changed config file
Since 01_enable_packet_steering only touches the network config,
limit the uci commit to this as well.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 338c64937f ramips: use amber LED for boot/failsafe on Netgear EX3700/EX6130
According to the manual, the amber power LED is used to indicate boot,
while the green LED is meant to indicate a running system.

While at it, also adjust the DT node names for all LEDs.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler fbb46b7bcc ramips: add support for Netgear EX6120
Specifications:
* SoC: MT7620A
* CPU: 580 MHz
* RAM: 64 MB DDR
* Flash: 8MB NOR SPI flash
* WiFi: MT7612E (5GHz) and builtin MT7620A (2.4GHz)
* LAN: 1x100M

The device is identical to the EX6130 except
for the mains socket and the hardware ID.

Installation:
The -factory images can be flashed from the
device's web interface or via nmrpflash.

Notes:
MAC addresses were set up based on the EX6130 setup.

This is based on prior work of Adam Serbinski and Mathias Buchwald.

Tested by Mathias Buchwald.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Felix Fietkau 69f6fc7b15 ramips: add mt7621 ethernet driver improvements
- Speed up MDIO bus access
- Improve performance on tx completion

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Felix Fietkau dfd62e575c ramips: enable packet steering by default on mt7621
It provides a significant performance boost, especially with flow offloading
enabled

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Perry Melange 22468cc40c ramips: erx and erx-sfp: fix missing WAN interface
This partially reverts commit 5acd1ed0be ("ramips: mt7621: fix
Ubiquiti ER-X ports names and MAC addresses"), this change was discussed
in https://github.com/openwrt/openwrt/pull/2901#discussion_r407238452

With commit 5acd1ed0be ("ramips: mt7621: fix Ubiquiti ER-X ports names
and MAC addresses"), all the ports were put into the LAN bridge, with
the argument that the OEM firmware does not have a WAN port enabled.  In
the default OEM setup, all of the ports except eth0 are dead and eth0 is
set to a static IP address without providing DHCP services when
connected.  It is only after the wizard has been run that eth0 becomes
the WAN port and all the rest of the ports belong to LAN with DHCP
enabled.

Having all of the ports set to the LAN bridge does not mirror the default
OEM setup.  To accomplish that, then only eth0 would be in the LAN bridge.
But this is not the expected behaviour of OpenWrt.

Therefore this proposal to set eth0 to WAN and eth1-N to LAN provides
the expected behaviour expected from OpenWrt, maintains the current
documentation as up-to-date, and does not require the user to manually
detach eth0 from the LAN bridge, create the WAN(6) interface(s), and set
eth0 to the WAN(6) interface(s).

Fixes: 5acd1ed0be ("ramips: mt7621: fix Ubiquiti ER-X ports names and MAC addresses")
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
[commit subject and description tweaks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Felix Fietkau 81b59efefd ramips/mediatek: select kmod-mt7615-firmware where kmod-mt7615e is selected
The new mt76 version splits out the firmware, because the driver can also be
used for MT7663/MT7613

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Tobias Schramm 2f5a242f67 ramips: mt7621: use higher SPI clock speed on Mikrotik rbm11g and rbm33g
Previously the dts were using a value determined by empirical testing,
because of a spi driver/clock bug. The bug was fixed quite some time
ago. 33 MHz is the default clock frequency used by RouterBOOT and thus
safe.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
4 years ago
Alexey Dobrovolsky 0a182fcba6 ramips: add kmod-usb-dwc2 to ZyXEL Keenetic image
ZyXEL Keenetic has a USB port. Thus, DWC2 USB controller driver should
be in the default image for this device.

Fixes: a7cbf59e0e ("ramips: add new device ZyXEL Keenetic as kn")
Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
[fixed whitespace issue]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Alexey Dobrovolsky ab841b4393 ramips: remove patches for USB-dwc2
In FS#2738 we can see that patch first introduced in
e8ebcff ("ramips: add a explicit reset to dwc2")
breaks USB functionality since 18.06. Thus, this patch should be removed.

Removed:
- 0032-USB-dwc2-add-device_reset.patch

Fixes: FS#2738
Fixes: FS#2964

Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
4 years ago
Adrian Schmutzler e8fbb98c6d ramips: fix LED DT label for Zyxel Keenetic Start
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 0225018d8b ramips: create shared DTSI for DIR-810L and TEW-810DR
These devices seem to have the same board, so let's have a common
file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
J. Scott Heppler 168e4c91d8 ramips: add support for TRENDnet TEW-810DR
Specifications:

* MediaTek MT7620A (580 Mhz)
* 8 MB of FLASH
* 64 MB of RAM
* 2.4Ghz and 5.0Ghz radios
* 5x 10/100 Mbps Ethernet (1 WAN and 4 LAN)
* UART header on PCB (57600 8n1)
* Green/Orange Power LEDs illuminating a Power-Button Lens
* Green/Orange Internet LEDs GPIO controlled illuminating a Globe/Internet Lens
* 3x button - wps, power and reset
* U-boot bootloader

Installation:

The sysupgrade.bin image is reported to be OEM web flashed with an ncc_att_hwid
appended.  ncc_att_hwid is a 32bit binary in the GPL Source download for either
the TEW-810DR or DIR-810L and is located at
source/user/wolf/cameo/ncc/hostTools.

The invocation is: ncc_att_hwid -f tew-810dr-squashfs-factory.bin -a -m "TEW-810DR" -H "1.0R" -r "WW" -c "1.0"

This may need to be altered if your hardware version is "1.1R".

The image can also be directly flashed via serial tftp:
1.  Load *.sysupgrade.bin to your tftp server directory and rename for
    convenience.
2.  Set a static ip 192.168.10.100.
3.  NIC cable to a lan port.
4.  Serial connection parameters 57600,8N1
5.  Power on the TEW-810 and press 4 for a u-boot command line prompt.
6.  Verify IP's with U-Boot command "printenv".
7.  Adjust tftp settings if needed per the tftp documentation
8.  Boot the tftp image to test the build.
9.  If the image loads, reset your server ip to 192.168.1.10 and restart network.
10. Log in to Luci, 192.168.1.1, and flash the *sysupgrade.bin image.

Notes:

The only valid MAC address is found in 0x28 of the factory partition.
Other typical offsets/caldata only contain example data: 00:11:22:00:0f:xx

Signed-off-by: J. Scott Heppler <shep971@centurylink.net>
[remove "link rx tx" in 01_leds, format and extend commit message,
fix DTS led node names]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
INAGAKI Hiroshi 7b01567976 ramips: add alternative name for Buffalo WSR-2533DHP
Buffalo WSR-2533DHP is identical to the WSR-2533DHPL, Buffalo sold it
with renaming.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
Ernst Spielmann c3dc52e39a ramips: add support for Asus RT-N10P V3 / RT-N11P B1 / RT-N12 VP B1
Specifications:

- MT7628NN @ 580 MHz
- 32 MB RAM
- 8 MB Flash
- 5x 10/100 Mbps Ethernet (built-in switch)
- 2.4 GHz WLAN
- 2x external, non-detachable antennas (1x for RT-N10P V3)

Flash instructions:

1. Set PC network interface to 192.168.1.75/24.
2. Connect PC to the router via LAN.
3. Turn router off, press and hold reset button, then turn it on.
4. Keep the button pressed till power led starts to blink.
5. Upload the firmware file via TFTP. (Any filename is accepted.)
6. Wait until the router reboots.

Signed-off-by: Ernst Spielmann <endspiel@disroot.org>
[fix node/property name for state_default]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Russell Senior fe9a2beecb ramips: fix 04_led_migration case syntax for mt7621
Commit f761f4052c had bogus case syntax, the uci-defaults script threw
errors as a result and exited non-zero, probably didn't do what was
intended, but tried over and over since the non-zero exit prevents the
script from being deleted.

Fixes: f761f4052c ("ramips: mt7621: harmonize naming scheme for Mikrotik")

Signed-off-by: Russell Senior <russell@personaltelco.net>
[extend commit title, add Fixes]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Richard Huynh f3792690c4 ramips: Add support for Xiaomi Redmi Router AC2100 (RM2100)
Specification:
- CPU: MediaTek MT7621A
- RAM: 128 MB DDR3
- FLASH: 128 MB ESMT NAND
- WIFI: 2x2 802.11bgn (MT7603)
- WIFI: 4x4 802.11ac (MT7615)
- ETH: 3xLAN+1xWAN 1000base-T
- LED: Power, WAN, in Amber and White
- UART: On board near ethernet, opposite side from power
- Modified u-boot

Installation:

1. Run linked exploit to get shell, startup telnet and wget the files over
2. mtd write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-kernel1.bin kernel1
3. nvram set uart_en=1
4. nvram set bootdelay=5
5. nvram set flag_try_sys1_failed=1
6. nvram commit
7. mtd -r write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-rootfs0.bin rootfs0

Restore to stock:

1. Setup PXE and TFTP server serving stock firmware image
(See dhcp-boot option of dnsmasq)
2. Hold reset button down before powering on and wait for flashing amber led
3. Release reset button
4. Wait until status led changes from flashing amber to white

Notes:
This device has dual kernel and rootfs slots like other Xiaomi devices currently
supported (mir3g, etc.) thus, we use the second slot and overwrite the first
rootfs onwards in order to get more space.

Exploit and detailed instructions:

https://openwrt.org/toh/xiaomi/xiaomi_redmi_router_ac2100

An implementation of CVE-2020-8597 against stock firmware version 1.0.14

This requires a computer with ethernet plugged into the wan port and an active
PPPoE session, and if successful will open a reverse shell to 192.168.31.177
on port 31337.

As this shell is somewhat unreliable and likely to be killed in a random amount
of time, it is recommended to wget a static compiled busybox binary onto the
device and start telnetd with it.

The stock telnetd and dropbear unfortunately appear inoperable.
(Disabled on release versions of stock firmware likely)
Ie. wget https://yourip/busybox-mipsel -O /tmp/busybox
chmod a+x /tmp/busybox
/tmp/busybox telnetd -l /bin/sh

Tested-by: David Martinez <bonkilla@gmail.com>
Signed-off-by: Richard Huynh <voxlympha@gmail.com>
4 years ago
Sungbo Eo 31697f92a2 ramips: fix MAC address setup for RT5350F-OLinuXino devices
Olimex RT5350F-OLinuXino devices do not have a default MAC address, and there is
nothing at the 0x4 offset in the factory partition. Using a local address, which
is randomly generated by the kernel, would be a better choice.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo f7112a180f ramips: 5.4: handle ERR_PTR properly
of_get_mac_address can return ERR_PTR since 5.2, so the return pointer should be
checked before used. Otherwise it might cause an oops during boot.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
INAGAKI Hiroshi 0a05d71f6f ramips: fix initramfs image for I-O DATA mt7621 devices
This is additional fix of c998ae7f0e.

The sysupgrade image of I-O DATA MT7621 devices manufactured by MSTC
(MitraStar Technology Corp.) faced to the booting issue. This was caused
by imcomplete extraction of large kernel image by U-Boot, and this issue
is occurred in initramfs image after fixing of sysupgrade image.
So, use lzma-loader for initramfs image to fix the issue.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Co-developed-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Tested-by: Yanase Yuki <dev@zpc.sakura.ne.jp> [wn-ax2033gr]
4 years ago
Chuanhong Guo a43cbfe2e3 ramips: remove default switch setup in 02_network
ramips images now relies on explicit switch setup for proper failsafe
functionality. Remove default cases where it relies on vlan setup in
dts and add switch setup for devices affected.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Adrian Schmutzler 74ff0773b5 ramips: remove leading zeros from MAC address location
Cosmetic adjustment to match the rest of the target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler be9eab9bca ramips: set WAN address in DTS for ASUS RT-AC51U/RT-AC54U
The location 0x28 in factory partition is the common one used for
ethernet address on this architecture. Despite, it contains the label
MAC address for the devices at hand.

Consequently, this patch moves 0x28 to the &ethernet node in DTS files
(setting the WAN MAC address there) and sets up the lan_mac from 0x22
in 02_network. As a benefit, this allows to use label-mac-device in
DTS instead of ucidef_set_label_macaddr.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler a1f0fd8cba ramips: use DT trigger for 2G WiFi on ASUS RT-AC51U
Like for the RT-AC54U, this uses a DT trigger for WiFi also at the
RT-AC51U. While at it, rename node and label to wifi2g.

Note that the 5g WiFi LED still isn't supported (see PR #3017 for
further details: https://github.com/openwrt/openwrt/pull/3017 )

Tested-by: Davide Fioravanti <pantanastyle@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 0b34a36da9 ramips: fix MAC address assignment for ASUS RT-AC51U
The current MAC address assignment for the ASUS RT-AC51U is "wrong",
it actually should be the same as for the RT-AC54U. Fix it.

MAC assignment based on vendor firmware:

  2g    0x4	label
  5g    0x8004	label +4
  lan   0x22	label +4
  wan   0x28	label

Thanks to Davide Fioravanti for checking this on his device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Fabian Bläse 33b2078528 mt7621: Make ER-X-SFP factory image compatible with EP-R6
The version inside the compat file determines, if a firmware supports
a specific device. I have not yet fully understood, how this is checked,
but it only seems to indicate which devices are supported by a specific
version of the combined vendor firmware. Devices assume that subsequent
versions, starting with the version that initially added support for a
specific device, are always compatible.

The first compat version that added support for the EP-R6 was '21001:7',
but OpenWrt did use '21001:6' before. This is why the factory image could
not be flashed using the vendor software, but only using TFTP.

The compat version has been bumped by the vendor a few times, but more
devices have been added since (e.g. ER-10X). Because OpenWrt currently
only supports the ER-X, ER-X-SFP and EP-R6, the compat version is
incremented to the version that first supported the EP-R6, which is
'21001:7'.

This allows the factory image to be flashed on EP-R6 without TFTP.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
4 years ago
Adrian Schmutzler 30cc7f3510 ramips: increase SPI frequency for ASUS RT-AC51U/RT-AC54U
This increases the SPI frequency for both ASUS RT-AC51U and RT-AC54U.

Speed comparison tests have been performed on RT-AC54U:

- 10Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    4m 37.78s
user    0m 0.02s
sys     2m 43.92s

- 50Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 28.34s
user    0m 0.03s
sys     0m 46.96s

- 50Mhz fast read
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 11.94s
user    0m 0.01s
sys     0m 46.94s

- 80Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 12.31s
user    0m 0.04s
sys     0m 46.96s

- 80Mhz fast read
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 12.15s
user    0m 0.02s
sys     0m 46.97s

Based on that, we took 50 MHz with fast-read, as higher frequencies
didn't yield further improvements.

For the RT-AC51U, only the final configuration was tested.

Tested-by: Zhijun You <hujy652@gmail.com> [RT-AC54U]
Tested-by: Davide Fioravanti <pantanastyle@gmail.com> [RT-AC51U]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Davide Fioravanti 31b49f02ca ramips: add support for Linksys EA7500 v2
The Linksys EA7500 v2 is advertised as AC1900, but its internal
hardware is AC2600 capable.

Hardware
--------
SoC:   Mediatek MT7621AT (880 MHz, 2 cores 4 threads)
RAM:   256M (Nanya NT5CC128M16IP-DI)
FLASH: 128MB NAND (Macronix MX30LF1G18AC-TI)
ETH:   5x 10/100/1000 Mbps Ethernet (MT7530)
WIFI:
  - 2.4GHz: 1x MT7615N (4x4:4)
  - 5GHz:   1x MT7615N (4x4:4)
  - 4 antennas: 3 external detachable antennas and 1 internal
USB:
  - 1x USB 3.0
  - 1x USB 2.0
BTN:
  - 1x Reset button
  - 1x WPS button
LEDS:
  - 1x White led (Power)
  - 6x Green leds (link lan1-lan4, link wan, wps)
  - 5x Orange leds (act lan1-lan4, act wan) (working but unmodifiable)

Everything works correctly.

Installation
------------
The “factory” openwrt image can be flashed directly from OEM stock
firmware. After the flash the router will reboot automatically.

However, due to the dual boot system, the first installation could fail
(if you want to know why, read the footnotes).
If the flash succeed and you can reach OpenWrt through the web
interface or ssh, you are done.
Otherwise the router will try to boot 3 times and then will
automatically boot the OEM firmware (don’t turn off the router.
Simply wait and try to reach the router through the web interface
every now and then, it will take few minutes).

After this, you should be back in the OEM firmware.

Now you have to flash the OEM Firmware over itself using the OEM web
interface (I tested it using the FW_EA7500v2_2.0.8.194281_prod.img
downloaded from the Linksys website).

When the router reboots flash the “factory” OpenWrt image and this
time it should work.

After the OpenWrt installation you have to use the sysupgrade image
for future updates.

Restore OEM Firmware
--------------------
After the OpenWrt flash, the OEM firmware is still stored in the
second partition thanks to the dual boot system.
You can switch from OpenWrt to OEM firmware and vice-versa failing
the boot 3 times in a row:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

If you want to completely remove OpenWrt from your router, switch to
the OEM firmware and then flash OEM firmware from the web interface
as a normal update.
This procedure will overwrite the OpenWrt partition.

Footnotes
---------
The Linksys EA7500-v2 has a dual boot system to avoid bricks.
This system works using 2 pair of partitions:
 1) "kernel" and "rootfs"
 2) "alt_kernel" and "alt_rootfs".
After 3 failed boot attempts, the bootloader tries to boot the other
pair of partitions and so on.

This system is managed by the bootloader, which writes a bootcount in
the s_env partition, and if successfully booted, the system add a
"zero-bootcount" after the previous value.

A system update performed from OEM firmware, writes the firmware on the
other pair of partitions and sets the bootloader to boot the new pair
of partitions editing the “boot_part” variable in the bootloader vars.
Effectively it's a quick and safe system to switch the selected boot
partition.

Another way to switch the boot partition is:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

In this OpenWrt port, this dual boot system is partially working
because the bootloader sets the right rootfs partition in the cmdline
but unfortunately OpenWrt for ramips platform overwrites the cmdline
so is not possible to detect the right rootfs partition.

Because all of this, I preferred to simply use the first pair of
partitions and set read-only the other pair.

However this solution is not optimal because is not possible to know
without opening the case which is the current booted partition.
Let’s take for example a router booting the OEM firmware from the first
pair of partitions. If we flash the OpenWrt image, it will be written
on the second pair. In this situation the router will bootloop 3 times
and then will automatically come back to the first pair of partitions
containg the OEM firmware.
In this situation, to flash OpenWrt correctly is necessary to switch
the booting partition, flashing again the OEM firmware over itself.
At this point the OEM firmware is on both pair of partitions but the
current booted pair is the second one.
Now, flashing the OpenWrt factory image will write the firmware on
the first pair and then will boot correctly.

If this limitation in the ramips platform about the cmdline will be
fixed, the dual boot system can also be implemented in OpenWrt with
almost no effort.

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
Co-Developed-by: Jackson Lim <jackcolentern@gmail.com>
Signed-off-by: Jackson Lim <jackcolentern@gmail.com>
4 years ago
Sungbo Eo a4e9c8f14b ramips: add support for netis WF2770
netis WF2770 is a 2.4/5GHz band AC750 router, based on MediaTek MT7620A.

Specifications:
- SoC: MT7620A
- RAM: DDR2 64MB
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7610EN
- Ethernet: 5x 10/100/1000Mbps
  - Switch: MT7530BU
- UART:
  - J2: 3.3V, RX, TX, GND (3.3V is the square pad) / 57600 8N1

MAC addresses in factory partition:
0x0004: LAN, WiFi 2.4GHz (label_mac-6)
0x0028: not used (label_mac-1)
0x002e: WAN (label_mac)
0x8004: WiFi 5GHz (label_mac+2)

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Reviewed-by: Pawel Dembicki <paweldembicki@gmail.com>
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Zhijun You 46674723e1 ramips: add support for ASUS RT-AC54U
Specification:

- CPU: MTK MT7620A
- RAM: 64MB
- ROM: 16MB SPI Flash Macronix MX25L12835E
- WiFi1: MediaTek MT7620A
- WiFi2: MediaTek MT7612E
- Button: reset, wps
- LED: 9 LEDs:Power, WiFi 2.4G,WiFi 5G, USB, LAN1, LAN2, LAN3, LAN4, WAN
- Ethernet: 5 ports, 4 LAN + 1 WAN
- Other: 1x UART 1x USB2.0

Installation:

   Update using ASUS Firmware Restoration Tool:

1. Download the ASUS Firmware Restoration Tool but don't open it yet
2. Unplug your computer from the router
3. Put the router into Rescue Mode by: turning the power off, using a pin
   to press and hold the reset button, then turning the router back on while
   keeping the reset button pressed for ~5 secs until the power LED starts
   flashing slowly (which indicates the router has entered Rescue Mode)
4. Important (if you don't do this next step the Asus Firmware
   Restoration Tool will wrongly assume that the router is not in Rescue Mode
   and will refuse to flash it): go to the Windows Control Panel and
   temporarily disable ALL other network adapters except the one you will use
   to connect your computer to the router
5. For the single adapter you left enabled, temporarily give it the
   static IP 192.168.1.10 and the subnet mask 255.255.255.0
6. Connect a LAN cable between your computer (make sure to use the
   Ethernet port of the adapter you've just set up) and port 1 of the router
   (not the router's WAN port)
7. Rename sysupgrade.bin to factory.trx
8. Open the Asus Firmware Restoration Tool, locate factory.trx and click
   upload (if Windows shows a compatibility prompt, confirm that the tool worked fine)
9. Flashing and reboot is finished when the power LED stops blinking and
   stays on

MAC assignment based on vendor firmware:

2g    0x4	label
5g    0x8004	label +4
lan   0x22	label +4
wan   0x28	label

Signed-off-by: Zhijun You <hujy652@gmail.com>
[rebased due to DTSI patch, minor commit message adjustments, fix
label MAC address (lan->wan), do spi frequency increase separately]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 685cc66c2a ramips: create DTSI for ASUS RT-AC51U and RT-AC54U
This creates a DTSI for the ASUS RT-AC51U and the upcoming RT-AC54U,
as they are quite similar.

White at it, drop the unneeded "status = okay" for ethernet.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler c00b2df6c8 ramips: drop non-existant ralink,port-map for Ravpower WD03
The property "ralink,port-map" has been obsolete long before
this device was added, and the device is a one-port anyway.
Just remove it.

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler d7a28e8ed2 ramips: mt7620: tidy up ethernet node in DTS files
This tidies up the ethernet node in mt7620 DTS files by:

- removing unnecessary status as it is not disabled
- reordering properties consistently
- adding empty lines to enhance readability

This should make comparison and reviewing new PRs based on C/P easier.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Koen Vandeputte ef2d5a2ab4 kernel: bump 4.14 to 4.14.180
Refreshed all patches.

Fixes:
- CVE-2020-12114
- CVE-2020-11669

Compile-tested on: pistachio
Runtime-tested on: none

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Pawel Dembicki 426fb8cf84 ramips: add support for LB-Link BL-W1200
The BL-W1200 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7612E)
- 5x 10/100/1000 Mbps Ethernet (MT7530)
- 2x external, non-detachable antennas (Wifi 2.4G/5G)
- 1x USB 2.0
- UART (R2) on PCB (57600 8n1)
- 9x LED (1 GPIO controlled), 1x button
- u-Boot bootloader

Known issues:
- No status LED. Used WPS LED during boot/failsafe/sysupgrade.

Installation:
1. Apply initramfs image via factory web-gui.
2. Install sysupgrade image.

How to revert to OEM firmware:
- sysupgrade -n -F stock_firmware.bin

Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Sungbo Eo 0cdf7bc4fb ramips: dts: fix incorrect flash reg property
Most work was done in commit 021c893658 ("ramips: fix size-cells on spi
nodes"), but a few more DTS files using the old reg style have been added
since then. This commit fixes them.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo 1eceab3fc0 ramips: dts: use generic node name for flash
In DTS Checklist[1] we're now demanding proper generic node names, as
the name of a node should reflect the function of the device and use
generic name for that[2]. Everybody seems to be copy&pasting from DTS
files available in the repository today, so let's unify that naming
there as well and provide proper examples.

While at it, remove unused m25p80 label.

Tested on rt5350 (for spi-nor) and rt3662 (for cfi-flash).

1. https://openwrt.org/submitting-patches#dts_checklist
2. https://github.com/devicetree-org/devicetree-specification/blob/master/source/devicetree-basics.rst#generic-names-recommendation

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo a5720d3276 ramips: tidy up image subtarget Makefiles
- use tab indent in image build recipes for consistency
- harmonize line wrapping

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[use different line wrapping for one recipe]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo c5fdab84ed ramips: tidy up image Makefile
- sort recipes alphabetically
- simplify subtarget include directives

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo fa9e7ca466 ramips: simplify palmbus/{i2c,spi} in device DTS files
As the node is already defined and labeled in SoC DTSI file, we can refer to it
outside of root node and reduce redundancy.

While at it, remove unused pcf8563 label.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo 22a21b0c18 ramips: use hex notation for *-mtd-eeprom property
Change "0" to "0x0" for consistency. This is an extension of commit 34abfb6e91
("ramips: convert mediatek,mtd-eeprom from decimal to hex notation").

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Thibaut VARÈNE 5e50515fa6 ramips/mt7621: mikrotik: don't use mtd-mac-address in DTS
As evidenced here[1] the device MAC address can be stored at a random
offset in the hard_config partition. Rely on sysfs to update the MAC
address correctly.

Adjust config so that WAN is base MAC and LAN is base MAC +1 to better
match label and vendor OS.

[1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 97337d3e5d ramips/mt7621: enable mikrotik platform driver
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 21869e8f80 ramips: mikrotik: use routerbootpart partitions
Enable routerbootpart partitions on MikroTik devices.

Tested-by: Tobias Schramm <t.schramm@manjaro.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 274221a836 ramips/mt7621: enable CONFIG_MTD_ROUTERBOOT_PARTS
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Petr Štetiar 5ea3ea154f kernel: bump 5.4 to 5.4.36
Refreshed patches, removed upstreamed patch:

 generic/hack: 551-loop-Better-discard-support-for-block-devices.patch

Added generic config symbol `ARM64_ERRATUM_1542419` due to Fixes:
f2791551cedb ("arm64: errata: Hide CTR_EL0.DIC on systems affected by
Neoverse-N1 #1542419").

Run tested: qemu-x86-64, apalis, nbg6617
Build tested: x86/64, imx6, ipq40xx, sunxi/a53

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Adrian Schmutzler 03e742dcd8 Revert "ramips: explicitly disable built-in switch for lan-only devices"
This reverts commit a1693bf626.

The rt288x and rt3883 devices in question don't have switches.
Only keep the merged case for rt305x.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
DENG Qingfang a10537f674 ramips: fix MikroTik 750Gr3 ports MAC addresses
According to a user in OpenWrt forum, on RouterOS the MAC addresses are
ether1(WAN) = MAC
ether2(LAN2) = MAC+1
ether3(LAN3) = MAC+2
etc.

Fix the MAC addresses in OpenWrt.

Ref: https://forum.openwrt.org/t/few-dumb-question-about-mt7530-rb750gr3-dsa/61608
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[remove label_mac in 02_network]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler f0435d5343 ramips: rt3883: remove swconfig from individual DEVICE_PACKAGES
In rt3883 subtarget, several devices add swconfig to their DEVICE_PACKAGES.
This is redundant as the package is already provided via DEFAULT_PACKAGES.

Remove the redundant inclusions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 40325abe52 ramips: remove (kmod-)swconfig DEVICE_PACKAGES for Sitecom WL-351
These definitions are not required since swconfig is selected for
the target anyway and kmod-swconfig is pulled as dependency by
kmod-switch-rtl8366rb.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo a1693bf626 ramips: explicitly disable built-in switch for lan-only devices
Commit 8f6334eb94 ("ramips: explicitly disable built-in switch when needed")
did not fix rt288x and rt3883 devices. This patch deals with them.

While at it, consolidate duplicate cases in interface setup.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Adrian Schmutzler 1553f58a98 ramips: create common definition for I-O DATA NAND devices
Three of the I-O DATA devices with NAND flash share a lot of
variables. Create a common definition for them to reduce duplicate
code.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
INAGAKI Hiroshi c998ae7f0e ramips: use lzma-loader for I-O DATA mt7621 devices
The official sysupgrade images for I-O DATA devices manufactured by
MSTC (MitraStar Technology Corp.) cannot be booted normally and the
kernel panics after switching to kernel 5.4.

This commit fixes the issue by using lzma-loader.

Note:
  These devices use Z-LOADER to read the kernel from NAND flash and boot
  it. Z-LOADER cannot load and start plain lzma-loader, so additional
  lzma-compression is needed.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Co-developed-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Tested-by: Yanase Yuki <dev@zpc.sakura.ne.jp> [wn-ax2033gr]
4 years ago
INAGAKI Hiroshi a25bb8610f ramips: use lzma-loader for Japanese mt7621 devices
In several Japanese routers with MT7621 SoC, the official sysupgrade
image cannot be booted properly after switching to kernel 5.4.

This commit fixes the issue by using lzma-loader.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
Szabolcs Hubai ce19571004 ramips: mt7621: use lzma-loader for D-Link DIR-860L B1
This device has trouble extracting big kernel from flash,
and supports LZMA compressed kernels only.

Using OpenWrt kernel loader saves us 64 KB compared to the dictionary
size limiting workaround.

Factory image sizes (commit: 5f126c541a) with "CONFIG_ALL_KMODS=y":
- original ("-d23", default): 4784188 bytes, LZMA ERROR 1
- with "-d19": 4915260, LZMA ERROR 1
- with "-d18": 4915260, diff to original: +128 KB
- with "-d17": 4980796, diff to original: +192 KB
- with this patch: 4849724, diff to original: +64 KB

To save some CPU cycle, use minimal compression ("-a0") for the LZMA
compressed uImage.

The most robust solution would use a different loader,
which reads the compressed kernel directly from the flash.
See the thread at [0] for more details!

[0] http://lists.infradead.org/pipermail/openwrt-devel/2020-April/022926.html

Signed-off-by: Szabolcs Hubai <szab.hu@gmail.com>
Tested-by: Stijn Segers <foss@volatilesystems.org>
[fixed identation]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Sungbo Eo 1dedad2a00 ramips: remove unnecessary DEVICE_PACKAGES for Belkin F7C027
kmod-usb-dwc2 and kmod-usb-ledtrig-usbport are not target default packages, and
Belkin F7C027 does not have a USB port anyway. Just drop it.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo d16a486766 ramips: fix SUPPORTED_DEVICES for Mercury MAC1200R v2
Currently SUPPORTED_DEVICES only contains the old device string. Fix it by
removing the first assignment.

Fixes: c2334ad60d ("ramips/mt76x8: Synchronize Makefiles with DTS compatible")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
René van Dorst 4c70bb4f90
ramips: enable SFP port for Ubiquiti ER-X-SFP
SFP cage of this device is connected via a AT8031 phy to port 5 of the switch.
This phy act as a RGMII-to-SerDes converter.

Also a I2C clock gate needs to be enabled in order to access the SFP module via I2C bus.
SFP cage also has module detect pin which is connected to I2C gpio expander.

With this patch the kernel/PHYLINK now can detect, readout and use the SFP module/port.

NOTE: SFP cage / AT8033 PHY only support 1000base-X encoding!
This means that some SGMII modules can work and only at forced 1GBit/full-duplex!

Signed-off-by: René van Dorst <opensource@vdorst.com>
4 years ago
René van Dorst ec2f7a47d3 kernel: add module to support SFP cages
Enables kernel SFP case support.

Signed-off-by: René van Dorst <opensource@vdorst.com>
4 years ago
DENG Qingfang 6d924706a6 ramips: phy: at803x: support RGMII-to-SerDes and SFP support
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
Signed-off-by: René van Dorst <opensource@vdorst.com>
4 years ago
Adrian Schmutzler 58bec0d172 ramips: remove config-4.14 for mt7621/mt76x8
mt7621 and mt76x8 subtargets have been moved to kernel 5.4 and their
DTS(I) files are incompatible to kernel 4.14.

Remove the corresponding kernel config files to signal that more
boldly and to prevent accidentally patching the wrong kernel when
pulling in older config patches.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Petr Štetiar faf668be35 kernel: bump 5.4 to 5.4.34
Refreshed patches.

Run tested: qemu-x86-64, apalis, a64-olinuxino
Build tested: x86/64, imx6, sunxi/a53

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Pawel Dembicki 08f5cac6fb ramips: mt7621: add NETGEAR R7200 as DEVICE_ALT1
Netgear R7200 is another clone of Netgear R6700v2, introduced in:
6e80df5 ("ramips: add support for NETGEAR R6700v2/AC2400")

Reported-by: Joel Pinsker, github user @joelp64
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Sungbo Eo 45e2b7763f ramips: replace pinctrl property names for ipTIME A1004ns
The pinctrl driver had been replaced with the upstream one in b756ea2a90
("ramips: replace pinctrl property names"), but the initial A1004ns support
patch did not reflect the changes. This commit updates its pinctrl property
names.

Fixes: 9169482f64 ("ramips: add support for ipTIME A1004ns")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Chuanhong Guo 19d9db5a96 ramips: mt7621: use lzma-loader for newifi d1/d2/thunder timecloud
These devices failed to properly extract kernel. enable lzma loader
for them.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 1e5d014ba2 ramips: don't reuse KERNEL_DTB for lzma-loader
mt7621 overrides KERNEL_DTB to limit dictionary size, which isn't needed
for our lzma loader.
This saves 15KB on mt7621 devices using uimage-lzma-loader.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 51c6b14092 ramips: mt7621: backport more pcie driver fixes
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Sungbo Eo 13a185bf8a ramips: increase spi-max-frequency for ipTIME mt7620 devices
This commit increases the hardware SPI frequency from 24.2MHz to 48.3MHz.

[    5.314163] m25p80 spi0.0: speed: 24166666/40000000, rate: 8, prescal: 2, loops: 226
[    5.076323] m25p80 spi0.0: speed: 48333333/50000000, rate: 4, prescal: 1, loops: 162

`time cat /dev/mtd2 >/dev/null` is reduced from 5.64s to 4.36s on A104ns,
and from 11.39s to 8.81s on A1004ns.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo 9169482f64 ramips: add support for ipTIME A1004ns
ipTIME A1004ns is a 2.4/5GHz band AC750 router, based on MediaTek MT7620A.

Specifications:
- SoC: MT7620A
- RAM: DDR2 128MB
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7610EN
- Ethernet: 5x 10/100/1000Mbps
  - Switch: MT7530BU
- USB: 1x 2.0
- UART:
  - J2: 3.3V, TX, RX, GND (3.3V is the square pad) / 57600 8N1

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
René van Dorst d682dcc939 ramips: mt7621: Ubiquiti ER-X-SFP: fix gpio numbers for POE enable gpios
With v5.4 kernel a new gpio driver is used.
GPIO numbering has changed so update 03_gpio_switches too.

Signed-off-by: René van Dorst <opensource@vdorst.com>
4 years ago
René van Dorst 2fac1322f7 ramips: mt7621: Ubiquiti ER-X: fix gpio number for POE enable gpio
With v5.4 kernel a new gpio driver is used.
GPIO numbering has changed so update 03_gpio_switches too.

Signed-off-by: René van Dorst <opensource@vdorst.com>
4 years ago
DENG Qingfang d74fb0088c ramips: use all reserved space for HiWiFi HC5962
These stock partitons: "backup", "hw_panic", "overly", firmware_backup", "opt"
do not contain any device-specific data and can be used for /overlay, resulting in
121M space

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 7dc82528a2 ramips: increase HiWiFi HC5962 kernel partition to 4M
Increase kernel partition because 2M is insufficient for 5.4
Because the partition changes, previous version of OpenWrt cannot upgrade
to this version, and requires a new installation

Recovery to stock instruction:
1. Download stock firmware at
   http://ur.ikcd.net/HC5962-sysupgrade-20171221-b00a04d1.bin
2. Power off the router
3. Press and hold the reset button for 4~6 sec while power it back on
4. Connect a PC to router's LAN
5. Visit http://192.168.2.1 and upload the firmware

Then repeat the instruction in edae3479e6 to install OpenWrt

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago