Commit Graph

120 Commits (4c73c34ec4215deb690bf03faea2a0fe725476f0)

Author SHA1 Message Date
Alexey Dobrovolsky 4c73c34ec4 ramips: switch rt305x subtarget to kernel 5.4
RT3x5x seems to work fine with kernel 5.4. Set the default kernel
version to 5.4 to bring this to a broader audience.

Since 4 of 6 targets are on kernel 5.4 now, invert the kernel
version setup logic in Makefile/target.mk files.

Tested on ZyXEL Keenetic.

Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
[invert version setup logic]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer 9662b9d688 ramips: switch MT7620 subtarget to 5.4
MT7620 seems to work fine with kernel 5.4. Set the default kernel
version to 5.4 to bring this to a broader audience.

Tested on Archer C2 v1 / Archer C20i

Signed-off-by: David Bauer <mail@david-bauer.net>
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
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
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 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
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
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 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
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
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 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
Chuanhong Guo 8f6334eb94 ramips: explicitly disable built-in switch when needed
previously we rely on the failsafe setup in preinit scripts to disable
built-in switch implicitly for single-port devices. This doesn't work
anymore due to preinit script removal.
this patch explicitly disable built-in switch for needed devices.

Fixes: a8d62a4eb1 ("ramips: remove set_preinit_iface script")
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo e320435a6a ramips: refresh kernel config for 5.4
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 89bf2b18af ramips: copy kernel config for 5.4
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Chuanhong Guo 33d027c5b8 ramips: move and rename out-of-tree mtk eth driver
move the driver into shared 'files' directory and rename all symbols
from mediatek/mtk to ralink.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Pawel Dembicki 8b93a24208 ramips: mt7620: fix missplaced line in 01_leds
This patch adds missed line in 01_leds and fix error:

"/bin/board_detect: /etc/board.d/01_leds: line 93:
syntax error: unexpected ")" (expecting ";;")"

Fixes: c948a47 ("ramips: add support for D-Link DWR-960")

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Pawel Dembicki c948a4782b ramips: add support for D-Link DWR-960
The DWR-960 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 128 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7610 mpcie card)
- 4x 10/100 Mbps Ethernet (1 WAN and 3 LAN)
- 1x 10/100/1000 Mbps Ethernet (1 LAN) (AR8035)
- 2x internal, non-detachable antennas (Wifi 2.4G)
- 3x external, detachable antennas (2x LTE, 1x Wifi 5G)
- 1x LTE modem
- UART (J4) header on PCB (57600 8n1)
- 9x LED, 2x button
- JBOOT bootloader

Known issues:
- Flash is extremely slow.

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
DENG Qingfang dcf7fdbdbf ramips: move swconfig to subtargets except for MT7621
As MT7621 does not use swconfig anymore, move the package swconfig to
other subtargets.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
Christoph Krapp 2a18840cc7 ramips: add support for TP-Link RE210 v1
Hardware
--------

SoC:   MediaTek MT7620A
RAM:   64MB
FLASH: 8MB SPI
WLAN:  2G: MediaTek MT7620A
       5G: MediaTek MT7610EN
ETH:   1x 10/100/1000M (Atheros AR8035)
LED:   RSSI (orange/green)
       WiFi 2G (green)
       WiFi 5G (green)
       Power (green)
       System (red / green)
BTN:   Power
       Reset
       LED
       WPS

Serial
------

P1 - Tx
P2 - Rx
P3 - GND
P4 - VCC

Pin 4 is the one closest to the LAN port.

MAC overview
------------

WAN *:4c uboot 0x1fc00
2.4 *:4c uboot 0x1fc00
5   *:4e uboot 0x1fc00 +2

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

Web interface:
It is possible to upgrade to OpenWrt via the web interface. However, the
OEM firmware upgrade file is required and a tool to fix the MD5 sum of
the header. This procedure overwrites U-Boot and there is not failsafe /
recovery mode present! To prepare an image, you need to take the header
and U-Boot (i.e. 0x200 + 0x20000 bytes) from an OEM firmware file and
attach the factory image to it. Then fix the header MD5Sum1.

Serial/TFTP:
You can use initramfs for booting via RAM or flash the image directly.

Additional Notes:
If the web interface upgrade fails, you have to open your device and
attach serial console. Since the web upgrade overwrites the boot loader,
you might also brick your device.

In order to flash back to stock, the first header and U-Boot needs to be
stripped from the original firmware.

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
[change rssi LED labels]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer 1e7c6381f0 ramips: convert TP-Link MT7620 boards to tpt trigger
This converts all MediaTek MT7620 boards from TP-Link to use the now
supported WiFi throughput LED trigger. This way, the LED state now
covers all VAPs regardless of their name.

Also align all single-WiFi LEDs to represent the state of the 2.4GHz
radio. This was not always the case previously, as later-added support
for the MT7610 altered the phy probing order.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
DENG Qingfang a176f8d3ec ramips: mt7620: use throughput trigger on HiWiFi HC5x61
Throughput trigger support for MT7620 has been added, so switch to it

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
Andreas Böhler a3010a7f8d ramips: add support for TP-Link RE200 v1
TP-Link RE200 v1 is a wireless range extender with Ethernet and 2.4G and 5G
WiFi with internal antennas. It's based on MediaTek MT7620A+MT7610EN.

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

- MediaTek MT7620A (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; only 6 supported), 2x button

There are 2.4G and 5G LEDs in red and green which are controlled
separately. The 5G LED is currently not supported, since the GPIOs couldn't
be determined.

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

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

It is possible to upgrade to OpenWrt via the web interface. However, the
OEM firmware upgrade file is required and a tool to fix the MD5 sum of
the header. This procedure overwrites U-Boot and there is not failsafe /
recovery mode present! To prepare an image, you need to take the header
and U-Boot (i.e. 0x200 + 0x20000 bytes) from an OEM firmware file and
attach the factory image to it. Then fix the header MD5Sum1.

Serial console
--------------

Opening the case is quite hard, since it is welded together. Rename the
OpenWrt factory image to "test.bin", then plug in the device and quickly
press "2" to enter flash mode (no line feed). Follow the prompts until
OpenWrt is installed.

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. Since the web upgrade overwrites
the boot loader, you might also brick your device.

Additional notes
----------------

MAC address assignment is based on stock-firmware. For me, the device
assigns the MAC on the label to Ethernet and the 2.4G WiFi, while the 5G
WiFi has a separate MAC with +2.

*:88    Ethernet/2.4G    label, uboot 0x1fc00, userconfig 0x0158
*:89    unused           userconfig 0x0160
*:8A    5G               not present in flash

This seems to be the first ramips device with a TP-Link v1 header. The
original firmware has the string "EU" embedded, there might be some region-
checking going on during the firmware upgrade process. The original
firmware also contains U-Boot and thus overwrites the boot loader during
upgrade.
In order to flash back to stock, the first header and U-Boot need to be
stripped from the original firmware.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
4 years ago
Sungbo Eo 38bdfcdb87 ramips: add support for ipTIME A104ns
ipTIME A104ns is a 2.4/5GHz band AC750 router, based on MediaTek MT7620A.

Specifications:
- SoC: MT7620A
- RAM: DDR2 64MB
- Flash: SPI NOR 8MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7610EN
- Ethernet: 5x 10/100Mbps
  - Switch: SoC internal
- 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.

In contrast to to-be-supported A1004ns, the A104ns has no usable
value in 0x1fc40 (uboot), so wan_mac needs to be calculated.
Also note that GPIOs for the LEDs really are inverted compared to
the A1004ns.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[moved state_default to device DTS, reordered properties in wmac,
added comment about wan_mac and LED GPIOs]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 98d9158d2f ramips: mt7620: use flash location for wan_mac in 02_network
This uses the flash locations instead of eth0 MAC address to
calculate MAC address increments for WAN.

The change will make the MAC address setup of a particular device
more obvious and removes the dependency of 02_network on the eth0
initialization.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 38866f275d ramips: remove wan_mac setup for evaluation boards
The evaluation boards do not set up a MAC address for eth0
in the first place, so it does not make sense to calculate a WAN
address from the random MAC used there.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Walter Sonius a065cd29bf ramips: fix switch port order for TP-Link Archer C20i
Physical port order watched from the backside of the C20i
(from left to right) is: Internet / 1 / 2 / 3 / 4

Physical Port	Switch port
WAN             0
LAN 3           1
LAN 4           2
LAN 1           3
LAN 2           4
(not used)      5
CPU             6

Signed-off-by: Walter Sonius <walterav1984@gmail.com>
[commit message/title improvements]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Piotr Dymacz dfecf94c20 ramips: add support for ALFA Network R36M-E4G
ALFA Network R36M-E4G is a dual-SIM, N300 Wi-Fi, compact size platform
based on MediaTek MT7620A WiSoC. This product is designed for operation
with 4G modem (can be bought in bundle with Quectel EC25, EG25 or EP06)
but supports also Wi-Fi modules (miniPCIe slot has USB and PCIe buses).

Specification:

- MT7620A (580 MHz)
- 64/128/256 MB of RAM (DDR2)
- 16/32+ MB of FLASH (SPI NOR)
- 2x 10/100 Mbps Ethernet, with passive PoE support (24 V)
- 2T2R 2.4 GHz (MT7620A), with ext. LNA (RFFM4227)
- 1x miniPCIe slot (with PCIe and USB 2.0 buses and optional 5 V)
- 2x SIM slot (mini, micro) with detect and switch driven by GPIO
- 2x u.fl antenna connectors (for Wi-Fi)
- 8x LED (7 driven by GPIO)
- 2x button (reset, wifi)
- 2x UART (4-pin/2.54 mm pitch, 10-pin/1.27 mm pitch) headers on PCB
- 1x I2C (4-pin, 1.27 mm pitch) header on PCB
- 1x LED (8-pin, 1.27 mm pitch) header on PCB
- 1x DC jack with lock (12 V)

Other:

- there is a dedicated, 4-pin connector for optional RTC module (Holtek
  HT138x) with 'enable' input, not available at the time of preparing
  support for this board
- miniPCIe slot supports additional 5 V supply on pins 47 and 49 but a
  jumper resistor (R174) is not installed by default
- U-Boot selects default SIM slot, based on value of 'default_sim' env
  variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This will
  work only if both slots are occupied, otherwise U-Boot will always
  select slot with SIM card inside (user can override it later, in
  user-space)
- U-Boot resets the modem, using PERSTn signal, before starting kernel
- this board supports 'dual image' feature (controlled by 'dual_image'
  U-Boot environment variable)

Flash instruction:

You can use the 'sysupgrade' image directly in vendor firmware which is
based on OpenWrt (make sure to not preserve settings - use 'sysupgrade
-n -F ...' command). Alternatively, use web recovery mode in U-Boot:

1. Power the device with reset button pressed, the modem LED will start
   blinking slowly and after ~3 seconds, when it starts blinking faster,
   you can release the button.
2. Setup static IP 192.168.1.2/24 on your PC.
3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Piotr Dymacz bc173ddd83 ramips: support dual image feature on ALFA Network boards
New U-Boot version for MediaTek MT76x8/MT762x based ALFA Network boards
includes support for a 'dual image' feature. Users can enable it using
U-Boot environment variable 'dual_image' ('1' -> enabled).

When 'dual image' feature is enabled, U-Boot will modify DTB and divide
the original 'firmware' flash area into two, equal in size and aligned
to 64 KB partitions: 'firmware' and 'backup'. U-Boot will also adjust
size of 'firmware' area to match installed flash chip size.

U-Boot will load kernel from active partition which is marked with env
variable 'bootactive' ('1' -> first partition, '2' -> second partition)
and rename both partitions accordingly ('firmware' <-> 'backup').

There are 3 additional env variables used to control 'dual image' mode:
- bootlimit   - maximum number of unsuccessful boot tries (default: '3')
- bootcount   - current number of boot tries
- bootchanged - flag which informs that active partition was changed; if
                it is set and 'bootcount' reaches 'bootlimit' value,
                U-Boot will start web-based recovery which then updates
                both partitions with provided image

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Adrian Schmutzler f4c3cfc620 ramips: read label MAC address from flash instead of using phy0/phy1
This replaces all uses of $(cat /sys/class/ieee80211/phyX/macaddress)
by retrieval from the proper flash locations. This will make
02_network independent of WiFi setup again.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 1c321237c2 ramips: split further base-files across subtargets
As started in 19724e28c8 ("ramips: split base-files into
subtargets"), this moves some smaller left-over files to the
appropriate base-files folder of their subtarget:

- /etc/init.d/bootcount
- /etc/uci-defaults/04_led_migration

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Frederik Noe-Sdun 0cbd2c74d0 ramips: add support for Netgear EX6130
Specifications:
* SoC: MT7620A
* RAM: 64 MB DDR
* Flash: 8MB NOR SPI flash
* WiFi: MT7612E (5Ghz) and builtin MT7620A (2.4GHz)
* LAN: 1x100M

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

The device seems to use base PCB as EX3700/EX3800,
but supporting AC1200 using MT7612E.

MAC adresses:
5.0 GHz  0x8004  *:9a
2.4 GHz  0x4     *:9b
lan      0x28    *:9b
wan      0x2e    *:9c

Since this is a one-port device, although wan MAC address is
set in flash, it is not used in OpenWrt setup.

Signed-off-by: Frederik Noe-Sdun <Frederik.Sdun@googlemail.com>
[rebased, extended commit message, tiny DTS style fixes]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler d2b9333ea9 ramips: remove default case for MAC address assignment
So far, MAC address assignment in ramips has contained a default
case, which defined wan_mac = eth0 + 1 for _every_ device not
having an explicit case there.

This is not desirable, as many device supporters will just not
care or know about this definition, so another MAC address will be
introduced by accident. In some cases the wan_mac is assigned
although it is not needed, in other cases even addresses not
dedicated to the device will be used (e.g. wan_mac actually is
eth0 - 1, but during support nobody cared, so eth0 + 1 is used now,
which might actually belong to another device ...).

Thus, in this PR the former default case is converted to an
explicit case. This one comprises all devices not being accounted
for by other cases, reduced by those not having wan at all.
The big number of entries for this node might be another indication
that many of them wouldn't actually be there if there hadn't been
default wan_mac setup.

In exchange, the current "do nothing" case can be removed, as it
will be the new default case.

The devices being put in the newly created explicit case were
determined as follows:

1. Create a list of all devices based on the DTS files.

2. Remove all devices already having an explicit entry setting
   their address.

3. Remove all devices that only have lan set up in the first part
   of 02_network:

mt7620:
   - alfa-network,tube-e4g
   - asus,rp-n53
   - buffalo,wmr-300
   - comfast,cf-wr800n
   - edimax,ew-7476rpc
   - edimax,ew-7478ac
   - elecom,wrh-300cr
   - hnet,c108
   - kimax,u25awf-h1
   - kimax,u35wf
   - kingston,mlw221
   - kingston,mlwg2
   - microduino,microwrt
   - netgear,ex2700
   - netgear,ex3700
   - netgear,wn3000rp-v3
   - planex,cs-qr10
   - planex,mzk-ex300np
   - planex,mzk-ex750np
   - ravpower,wd03
   - sercomm,na930
   - yukai,bocco
   - zbtlink,zbt-cpe102
   - zte,q7

mt7621:
   - gnubee,gb-pc1
   - gnubee,gb-pc2
   - linksys,re6500
   - mikrotik,rbm11g
   - netgear,ex6150
   - thunder,timecloud
   - tplink,re350-v1
   - tplink,re650-v1

mt76x8:
   - alfa-network,awusfree1
   - d-team,pbr-d1
   - glinet,vixmini
   - vocore,vocore2-lite
   - tama,w06
   - tplink,tl-mr3020-v3
   - tplink,tl-wa801nd-v5
   - tplink,tl-wr802n-v4
   - tplink,tl-wr902ac-v3
   - vocore,vocore2
   - widora,neo-16m
   - widora,neo-32m

rt288x:
   - buffalo,wli-tx4-ag300n
   - dlink,dap-1522-a1

rt305x:
   - allnet,all0256n-4m
   - allnet,all0256n-8m
   - allnet,all5002
   - allnet,all5003
   - alphanetworks,asl26555-16m
   - alphanetworks,asl26555-8m
   - asus,wl-330n
   - aximcom,mr-102n
   - dlink,dcs-930
   - easyacc,wizard-8800
   - hame,mpr-a2
   - hootoo,ht-tm02
   - huawei,d105
   - intenso,memory2move
   - planex,mzk-dp150n
   - rt305x dlink,dcs-930l-b1
   - sparklan,wcr-150gn
   - tenda,3g150b
   - tenda,3g300m
   - tenda,w150m
   - trendnet,tew-638apb-v2
   - unbranded,a5-v11
   - vocore,vocore-16m
   - vocore,vocore-8m
   - wansview,ncs601w
   - zorlik,zl5900v2

rt3883:
   - loewe,wmdr-143n
   - omnima,hpm

4. Put the remaining devices in the new case.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Kristian Evensen 5f108bbc58 ramips: add support for ZBT WE1026-H
This commit adds support for the ZBT WE1026-H, an outdoor AP with
support for adding an internal LTE modem. The detailed specs are:

* CPU: MT7620A
* 2x 10/100Mbps Ethernet (LAN port has passive PoE support).
* 16/32 MB Flash.
* 128/256 MB RAM.
* 1x USB 2.0 port.
* 1x mini-PCIe slot (only USB2.0 bus).
* 1x SIM slot (standard size).
* 1x 2.4Ghz WIFI (rt2800).
* 1x button.
* 6x LEDS (4 GPIO-controlled).
* 1x micro-SD reader.

The following have been tested and working:
- Ethernet switch
- Wifi
- Mini-PCIe slot + SIM slot
- USB port
- microSD slot
- sysupgrade
- reset button

Installation and recovery:

In order to install OpenWRT the first time or ito recover the router,
you can use the web-based recovery system. Keep the reset button pressed
during boot and access 192.168.1.1 in your browser when your machine
obtains an IP address. Upload the firmware to start the recovery
process.

Notes:

* When binding the USB LED to a usbport, the LED is switched on all the
time due to the presence of an internal hub. Thus, it does not really
signal any USB-information.

* I only have the 32MB version and have only added support for this
device. However, the files are structured so that adding support for the
16MB version should be easy.

* Only the LAN port is accessible from the outside of the casing and LEDs
are not visible.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
[rebased onto base-files split, minor style fixes, removed use of
USB led as power LED]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Kristian Evensen a033f14fe9 ramips: update ZBT WE1026 DTS-files
This commit makes the following changes to the WE1026 DTS-files:

* The parts that are unique to the -5G-version (LED and 5GHz wifi)
are moved to a separate file, so that WE1026.dtsi can be referenced also
by the DTS for the -H version.
* Use the generic "flash"-name for the spi-nor node.
* Add label MAC.

All changes have been tested on the WE1026-5G-16M and work fine. I.e.,
the device works as before the DTS-changes.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Acked-by: Mathias Kresin <dev@kresin.me>
Acked-by: Alex Maclean <monkeh@monkeh.net>
Acked-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Acked-by: Petr Štetiar <ynezz@true.cz>
[minor style fixes, rebased onto base-files split, remove obsolete
gpio-keys comment]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Chih-Wei Chen 3e88ab79b0 ramips: fix Xiaomi MiWiFi Mini switch definition
Based on OpenWRT Table of Hardware > Xiaomi > Xiaomi Mi WiFi Mini

Switch Ports Defaults:
0, 1: LAN
4: WAN
6: CPU

Port in Web GUI (word printed on bottom of case)
WAN(Internet) map to switch port 4
LAN1(.) map to switch port 1
LAN2(..) map to switch port 0
CPU map to switch port 6

current setting is 1 WAN/ 4 LAN port, fix it.

Signed-off-by: Chih-Wei Chen <changeway@gmail.com>
[rebased after base-files split, fixed commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 19724e28c8 ramips: split base-files into subtargets
While most of the target's contents are split into subtargets, the
base-files are maintained for the target as a whole.

However, OpenWrt already implements a mechanism that will use (and
even prefer) files in the subtargets' directories. This can be
exploited to make several scripts subtarget-specific and thus save
some space.

In certain cases, keeping files in parent (=target) base-files was
more convenient, and thus no splitting was performed for those.

Note that this will increase overall code lines, but reduce code
per subtarget.

base-files ipk size reduction:
master (mt7621)   60958 B
split (mt7620)    46358 B (- 14.3 kiB)
split (mt7621)    48759 B (- 11.9 kiB)
split (mt76x8)    44948 B (- 15.6 kiB)
split (rt288x)    43508 B (- 17.0 kiB)
split (rt305x)    45616 B (- 15.0 kiB)
split (rt3883)    44176 B (- 16.4 kiB)

Run-tested on:
GL.iNet GL-MT300N-V2 (mt76x8)
D-Link DWR-116 (mt7620)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 794d4b6652 treewide: remove kmod-usb-core from DEVICE_PACKAGES
This removes _all_ occurrences of kmod-usb-core from
DEVICE_PACKAGES and similar variables.

This package is pulled as dependency by one of the following
packages in any case:
- kmod-usb-chipidea
- kmod-usb-dwc2
- kmod-usb-ledtrig-usbport
- kmod-usb-ohci
- kmod-usb2
- kmod-usb2-pci
- kmod-usb3

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[remove kmod-usb-core from EnGenius ESR600]
Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Chuanhong Guo 7a8d3432c7 ramips: use upstream RAW_APPENDED_DTB instead of our OWRTDTB
Upstream kernel added support for RAW_APPENDED_DTB on ralink arch
in the following commit:
02564fc89d3d ("ralink: Introduce fw_passed_dtb to arch/mips/ralink")

Use upstream solution and get rid of our OWRTDTB hack.
This commit set DEVICE_DTS to $$(DTS) instead of replacing DTS with
DEVICE_DTS in device profile because DTS variable will be dropped
in later commits.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
[Tested on mt7621/mt76x8]
Tested-by: Chuanhong Guo <gch981213@gmail.com>
[Tested on rt305x/mt7620]
Tested-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years ago
Kristian Evensen 52b59a984f ramips: Add support for Head Weblink HDRM200
Head Weblink HDRM200 is a dual-sim router based on MT7620A. The detailed
specifications are:

- MT7620A (580MHz)
- 64MB RAM
- 16MB of flash (SPI NOR)
- 6x 10/100Mbps Ethernet (MT7620A built-in switch)
- 1x microSD slot
- 1x miniPCIe slot (only USB2.0 bus). Device is shipped with a SIMCOM
SIM7100E LTE modem.
- 2x SIM slots (standard size)
- 1x USB2.0 port
- 1x 2.4GHz wifi (rt2800)
- 1x 5GHz wifi (mt7612)
- 1x reset button
- 1x WPS button
- 3x GPIO-controllable LEDs
- 1x 10 pin terminal block (RS232, RS485, 4 x GPIO)

Tested:
- Ethernet switch
- Wifi
- USB slot
- SD card slot
- miniPCIe-slot
- sysupgrade
- reset button

Installation instructions:

Installing OpenWRT for the first time requires a bit of work, as the
board does not ship with OpenWRT. In addition, the bootloader
automatically reboots when installing an image over tftp. In order to
install OpenWRT on the HDRM200, you need to do the following:

* Copy the initramfs-image to your tftp-root (default filename is
test.bin) and configure networking accordingly (default server IP is
10.10.10.3, client 10.10.10.123). Start your tftp server.
* Open the board and connect to UART. The pins are exposed and clearly
marked.
* Boot the board and press 1.
* Either use the default filename and client/server IP-addresses, or
specify your own.

The image should now be loaded to memory and board boot. If the router
reboots while the image is loading, you need to try again. Once the
board has booted, copy the sysupgrade-image to the router and run
sysupgrade in order to install OpenWRT to the flash.

Notes:

- You control which SIM slot to use by writing 0/1 to
/sys/class/gpio/gpio0/value. In order for the change to take
effect, you can either use AT-commands (AT+CFUN) or power-cycle the
modem (write 0/1 to /sys/class/gpio/gpio21/value).
- RS485 is available on /dev/ttyS0.
- RS232 is available on /dev/ttyS1.
- The name of the ioX-gpios map to the labels on the casing.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
[fixed whitespace issue and merge conflict in target.mk]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Deng Qingfang 367813b9b1 ramips: mt7620: fix dependencies
MT7620 integrated WMAC does not need RT2x00 PCI driver or firmware
Also corrected kmod-eeprom-93cx6 and kmod-lib-crc-itu-t dependencies
according to original Kconfig and lsmod output

This will remove some unnecessary packages from MT7620 target to
save some space

Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[75 characters per line in the commit message]
5 years ago
Mathias Kresin 8293aec943 ramips: disable CONFIG_MTD_SPLIT_FIRMWARE
It's no longer needed as all mt7621 devices use DT binding (supported by
upstream mtd code) for specifying "firmware" part format explicitly.

Signed-off-by: Mathias Kresin <dev@kresin.me>
5 years ago
Chen Minqiang 40692f0fb5 ramips: mt7620: select only the matching mt76 driver
Because every device has selected the corresponding mt76 driver, we can
now disable the mt76 metapackage by default to make sure that other
devices (those don't need mt76) avoid selecting unwanted packages.

We can find the hardware specifies and determine the dependencies on
these sites:
  https://wikidevi.com/wiki/
  https://openwrt.org/toh/hwdata/

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
6 years ago
Pawel Dembicki 20b09a2125 ramips: add support for Lava LR-25G001
The Lava LR-25G001 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 64 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7610EN)
- 5x 10/100/1000 Mbps AR8337 Switch (1 WAN AND 4 LAN)
- 2x external, detachable antennas
- 1x USB 2.0
- UART (J3) header on PCB (57600 8n1)
- 8x LED (3x GPIO-controlled), 2x button
- JBOOT bootloader

Known issues:
- Work only three Gigabit ports (3/5, 1 WAN and 2LAN)

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago
Mathias Kresin 80c61c161a treewide: use wpad-basic for not small flash targets
Add out of the box support for 802.11r and 802.11w to all targets not
suffering from small flash.

Signed-off-by: Mathias Kresin <dev@kresin.me>

Mathias did all the heavy lifting on this, but I'm the one who should
get shouted at for committing.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Cezary Jackiewicz 37af596593 ramips: add support for D-Link DWR-118-A2
The DWR-118-A2 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 128 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7612EN)
- 4x 10/100 Mbps Ethernet (1 WAN and 3 LAN)
- 1x 10/100/1000 Mbps Marvell Ethernet PHY (1 LAN)
- 2x external, non-detachable antennas
- 1x USB 2.0
- UART (J1) header on PCB (57600 8n1)
- 7x LED (5x GPIO-controlled), 2x button
- JBOOT bootloader

Known issues:
- GELAN not working
- flash is very slow

The status led has been assigned to the dwr-118-a2:green:internet led.
At the end of the boot it is switched off and is available for other
operation. Work correctly also during sysupgrade operation.

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago