Commit Graph

1155 Commits

Author SHA1 Message Date
Sergey Ryazanov 7e89421a7c ramips: add support for Zbtlink ZBT-WG1602
Zbtlink ZBT-WG1602 is a Wi-Fi router intendent to use with WWAN
(UMTS/LTE/3G/4G) modems. The router board offsers a couple of miniPCIe
slots with USB and SIM only and another one pure miniPCIe slot as well
as five Gigabit Ethernet ports (4xLAN + WAN).

Specification:

* SoC: MT7621A
* RAM: 256/512 MiB
* Flash: 16/32 MiB (SPI NOR)
* external watchdog (looks like Torexsemi XC6131B)
* Eth: 10/100/1000 Mbps Ethernet x5 ports (4xLAN + WAN)
* WLAN 2GHz: MT7603EN (.11n, MIMO 2x2)
* WLAN 5GHz: MT7612EN (.11ac, MIMO 2x2)
* WLAN Ants: detachable x2, shared by 2GHz & 5GHz radios
* miniPCIe: 2x slots with USB&SIM + 1x slot with regular PCIe bus
* WWAN Ants: detachable x4
* External storage: microSD (SDXC) slot
* USB: 2.0 Type-A port
* LED: 11 (5 per Eth phy, 3 SoC controlled, 2 WLAN 2/5 controlled, 1
       power indicator)
* Button: 1 (reset)
* UART: console (115200 baud)
* Power: DC jack (12 V / 2.5 A)

Additional HW information:

* SoC USB port #1 is shared by internal miniPCIe slot and external
  Type-A USB port, USB D+/D- lines are toggled between ports using a
  GPIO controlled DPDT switch.
* Power of the USB enabled miniPCIe slots can be individually controlled
  using dedicated GPIO lines.
* Vendor firmware feeds the external watchdog with 1s pulses. GPIO
  watchdog driver is able to either generate a 1us pulses or toggle the
  output line. 1us is not enough for the external watchod timer, so
  the line toggling driver mode is utilized.

Installation:

Vendor's firmware is OpenWrt (LEDE) based, so the sysupgrade image can
be directly used to install OpenWrt. Firmware must be upgraded using the
'force' and 'do not save configuration' command line options (or
correspondig web interface checkboxes) since the vendor firmware is from
the pre-DSA era.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
2021-12-05 18:49:14 +01:00
Yuchan Seo c33eb0372e ramips: add support for ipTIME A3004NS-dual
ipTIME A3004NS-dual is a 2.4/5GHz band router, based on Mediatek MT7621.

Specifications:
- SoC: MT7621 (880MHz)
- RAM: DDR3 256M
- Flash: SPI NOR 16MB
- WiFi:
 - 2.4GHz: MT7602E
 - 5GHz : MT7612E
- Ethernet:
 - 4x LAN
 - 1x WAN
- USB: 1 * USB3.0 port
- UART:
  - 3.3V, TX, RX, GND / 57600 8N1

Installation via web interface:
- 1. Flash Initramfs image using OEM Firmware's web GUI
- 2. Boot into OpenWrt and perform Sysupgrade with sysupgrade image.

Revert to stock firmware:
- 1. Boot into OpenWrt and perform Sysupgrade with OEM Stock Firmware image.

Signed-off-by: Yuchan Seo <hexagonwin@disroot.org>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-12-04 09:39:11 +09:00
Pawel Dembicki a82fa5bcd4 ramips: mt7620: Enable PHY aneg of Lava LR-25G001
In 20b09a2125 Lava LR-25G001 router have problem with two inactive
ethernet ports. JBOOT bootloader didn't configure ethernet devices by default.
The same situation was there. It is required to enable all phy ports.
This is fragment of stock bootlog:

switch reg write_athr offset=90, value=2b0
switch reg write_athr offset=8c, value=2b0
switch reg write_athr offset=88, value=2b0
switch reg write_athr offset=84, value=2b0
switch reg write_athr offset=80, value=2b0

This patch adds proper registers configuration ar8337 initvals.
0x2b0 value causes force flow control configuration, 0x1200 was used
instead (flow control config auto-neg with phy). [1]

When switch is now ok, let's fix port numeration too.

Fixes: 20b09a2125 ("ramips: add support for Lava LR-25G001")

[1] https://github.com/openwrt/openwrt/pull/4806#issuecomment-982019858

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
2021-12-04 00:36:47 +01:00
Thomas Aldrian b28443f82e ramips: add support for Wavlink WL-WN576A2
This commit adds support for the Wavlink WL-WN576A2 wall-plug wireles
repeater / router. It is also sold under the name SilverCrest SWV 733 B1.

Device specs:

- CPU: MediaTek MT7628AN
- Flash: 8MB
- RAM: 64MB
- Bootloader: U-Boot
- Ethernet: 1x 10/100 Mbps
- 2.4 GHz: b/g/n SoC
- 5 GHz: a/n/ac MT7610EN
- Buttons: WPS, reset, sliding switch (ap/repeater)
- LEDs: 5x wifi status, 1x LAN/WAN, 1x WPS

Flashing:

U-Boot launches a TFTP client if WPS button is held during boot.

- Server IP: 192.168.10.100
- Firmware file name: firmware.bin

Device will reboot automatically. First boot takes about 90s.

Coelner (waenger@gmail.com) is the original author, but I have made some
fixes. He does not wish to sign off using his real name.

Signed-off-by: Thomas Aldrian <dev.aldrian@gmail.com>
2021-11-20 21:08:25 +01:00
Wout Bertrums 9a7e3d170c ramips: add broken-flash-reset for HLK-7621A EvB
This is needed because the HLK-7621 EvB has 32MB of flash,
so it will have to use 4B addressing and the
broken-flash-reset hack has to be used to be able to reboot.

Signed-off-by: Wout Bertrums <wout@wbnet.eu>
[copied github message into commit message]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos 8bc6654244 ramips: mt7621-dts: properly organize pcie node
Device tree pcie node for this SoC is using different
styles in its different properties. Hence properly
unify them to be able to write a a proper yaml schema
documentation.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210505121736.6459-11-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos 2bc659ee07 ramips: mt7621-dts: add missing device_type in pcie root ports
According to the YAML schema 'pci-bus.yaml' the 'device_type'
property is mandatory for all pcie root ports. Hence add it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210506170742.28196-3-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos 82f9d5ad0b ramips: mt7621-dts: remove 'bug-range' property
Property 'bus-range' when values are the default are
not necessary to be defined. Hence, remove all of them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210506170742.28196-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos e04130fc17 ramips: mt7621-dts: use standard 'syscon' string
Both 'memc' and 'sysc' nodes are not using 'syscon'
as a node string which is the standard one to be used.
Update both of them.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210505132154.8263-3-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos f1d154ec6c ramips: mt7621-dts: remove ethsys node
DT 'ethsys' node is being configured as a syscon
to get access to reset and other registers in the
'mediateķ,mt7621-eth' driver. Since the 'sysc' is also
a syscon, provides the clock and also is virtually
mapped from the same physical address 0x1e000000 we
can just use 'sysc' as the phandle for the syscon in
the ethernet node. Compatible string 'mediatek,mt7621-ethsys'
of the node is not being used anywhere inside the kernel
so, this node can be safely removed.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20210505132154.8263-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
DENG Qingfang 93da227798 ramips: mt7621-dts: remove obsolete switch node
This was for OpenWrt's swconfig driver, which never made it upstream,
and was also superseded by MT7530 DSA driver.

Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
Link: https://lore.kernel.org/r/20210108025155.31556-1-dqfext@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos 6e30692e99 ramips: mt7621-dts: properly define 'cpc' and 'mc' nodes
'cpc' and 'mc' nodes correspond with the MIPS 'Cluster Power Controller'
and 'MIPS Common Device Memory Map' which are present in some MIPS related
boards. There is already bindings documentation for these two located in:
- Documentation/devicetree/bindings/power/mti,mips-cpc.yaml
- Documentation/devicetree/bindings/bus/mti,mips-cdmm.yaml

Hence, properly update compatible strings and align nodes with already
mainlined bindings documentation. Also, move their definition to a proper
place since both of them are not related with the palmbus at all.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20211002060706.30511-1-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos 9b52b4e53f ramips: mt7621-dts: change some node hex addresses to lower case
Hexadecimal addresses in device tree must be defined using lower case.
There are some of them that are still in upper case. Change them all.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20211017070656.12654-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos e17f238f1d ramips: mt7621-dts: make use of 'IRQ_TYPE_LEVEL_HIGH' instead of magic numbers
Nodes 'gdma' and 'hsdma' are using magic number '4' in interrupts property.
Use 'IRQ_TYPE_LEVEL_HIGH' instead to align with the rest of the nodes in
the file.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20211019102915.15409-2-sergio.paracuellos@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-06 23:36:32 +01:00
Sergio Paracuellos eb00fb8f71 ramips: add support for HiLink HLK-7621A evaluation board
Specifications:
- SoC: MediaTek MT7621AT
- RAM: 256 MB (DDR3)
- Flash: 32 MB SPI NOR 44MHz
- Switch: 1 WAN, 4 LAN (Gigabit)
- LEDs: 1 WAN, 4 LAN (controlled by PHY)
- USB Ports: 1 x USB2, 1 x USB3
- WLAN: 1 x 2.4, 5 GHz 866Mbps (MT7612E)
- Button: 1 button (reset)
- UART Serial: UART1 as console : 57600 baud
- Power: 12VDC, 1A

Installation:
Update openWRT firmware using internal GNUBEE uboot:
https://github.com/gnubee-git/GnuBee-MT7621-uboot

By HTTP: Initial uboot address is http://10.10.10.123, your address
needs to be 10.10.10.x, and mask 255.255.255.0.
By TFTP: Uboot is in client mode, the address of the firmware must
be tftp://10.10.10.3/uboot.bin

Recovery:
Manufacturer provides MTK OpenWrt 14.07 source code, compile then
flash it by uboot.
HLK-7621A is a stamp hole package module for embedded development,
users have to design IO boards to use it.

MAC addresses:
- u-boot-env contains a placeholder address:
  > mtd_get_mac_ascii u-boot-env ethaddr
  03:17:73🆎cd:ef
- phy0 gets a valid-looking address:
  > cat /sys/class/ieee80211/phy0/macaddress
  f8:62:aa:**:**:a8
- Calibration data for &pcie2 contains a valid address, however the
  zeros in the right half look like it's not real:
  8c:88:2b:00:00:1b
- Since it's an evaluation board and there is no solid information
  about the MAC address assignment, the ethernet MAC address is left random.

Signed-off-by: Chen Yijun <cyjason@bupt.edu.cn>
[add keys and pcie nodes to properly support evaluation board]
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
[remove ethernet address, wrap lines properly]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-31 21:24:47 +01:00
Eduardo Santos 3c97fb4346 ramips: add support for Xiaomi MiWifi 3C
This commit adds support for Xiaomi MiWiFi 3C device.

Xiaomi MiWifi 3C has almost the same system architecture
as the Xiaomi Mi WiFi Nano, which is already officially
supported by OpenWrt.

The differences are:

 - Numbers of antennas (4 instead of 2). The antenna management
   is done via the µC. There is no configuration needed in the
   software code.
 - LAN port assignments are different. LAN1 and WAN are
   interchanged.

OpenWrt Wiki: https://openwrt.org/toh/xiaomi/mir3c

OpenWrt developers forum page:
https://forum.openwrt.org/t/support-for-xiaomi-mi-3c

Specifications:

 - CPU: MediaTek MT7628AN (575MHz)
 - Flash: 16MB
 - RAM: 64MB DDR2
 - 2.4 GHz: IEEE 802.11b/g/n with Integrated LNA and PA
 - Antennas: 4x external single band antennas
 - WAN: 1x 10/100M
 - LAN: 2x 10/100M
 - LED: 1x amber/blue/red. Programmable
 - Button: Reset

MAC addresses as verified by OEM firmware:

use address source
LAN *:92 factory 0x28
WAN *:92 factory 0x28
2g *:93 factory 0x4

OEM firmware uses VLAN's to create the network interface for WAN and LAN.

Bootloader info:
The stock bootloader uses a "Dual ROM Partition System".
OS1 is a deep copy of OS2.
The bootloader start OS2 by default.
To force start OS1 it is needed to set "flag_try_sys2_failed=1".

How to install:
1- Use OpenWRTInvasion to gain telnet, ssh and ftp access.
   https://github.com/acecilia/OpenWRTInvasion
   (IP: 192.168.31.1 - Username: root - Password: root)
2- Connect to router using telnet or ssh.
3- Backup all partitions. Use command  "dd if=/dev/mtd0 of=/tmp/mtd0".
   Copy /tmp/mtd0 to computer using ftp.
4- Copy openwrt-ramips-mt76x8-xiaomi_miwifi-3c-squashfs-sysupgrade.bin
   to /tmp in router using ftp.
5- Enable UART access and change start image for OS1.
```
nvram set uart_en=1
nvram set flag_last_success=1
nvram set boot_wait=on
nvram set flag_try_sys2_failed=1
nvram commit
```
6- Installing Openwrt on OS1 and free OS2.
```
mtd erase OS1
mtd erase OS2
mtd -r write /tmp/openwrt-ramips-mt76x8-xiaomi_miwifi-3c-squashfs-sysupgrade.bin OS1
```

Limitations: For the first install the image size needs to be less
than 7733248 bits.

Thanks for all community and especially for this device:
minax007, earth08, S.Farid

Signed-off-by: Eduardo Santos <edu.2000.kill@gmail.com>
[wrap lines, remove whitespace errors, add mediatek,mtd-eeprom to
 &wmac, convert to nvmem]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-31 21:24:47 +01:00
Jani Partanen e06aaba4e3 ramips: fix LAVA LR-25G001 broken wifi led triggers
LED labels for this device are different in 01_leds file and in device
DTS. Switch to DT triggers, which works on Telewell TW-4 (LTE) clone
device.

This has not been tested on the LR-25G001 itself, just on the clone
mentioned above.

Fixes: 20b09a2125 ("ramips: add support for Lava LR-25G001")

Signed-off-by: Jani Partanen <rtfm@iki.fi>
[rephrase commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-30 22:11:23 +02:00
Michal Kozuch c12ef2f760 ramips: add support for TP-Link RE305 v3
Specs (same as in v1):
- MT7628AN (575 MHz)
- 64MB RAM
- 8MB of flash (SPI NOR)
- 1x 10/100Mbps Ethernet (MT7628AN built-in switch with vlan)
- 1x 2.4GHz wifi (MT7628AN)
- 1x 5Ghz wifi (MT7612E)
- 4x LEDs (5 GPIO-controlled)
- 1x reset button
- 1x WPS button

The only and important difference between v1 & v3 is in flash memory
layout, so pls don't interchange these 2 builds!

Installation through web-ui (on OEM factory firmware):
1. Visit http://tplinkrepeater.net or the configured IP address of
   your RE305 v3 (default 192.168.0.254).
2. Log in with the password you've set during initial setup of the
   RE305 (there is no default password).
3. Go to Settings -> System Tools -> Firmware upgrade
4. Click Browse and select the OpenWRT image with factory.bin suffix
   (not sysupgrade.bin)
5. A window with a progress bar will appear. Wait until it completes.
6. The RE305 will reboot into OpenWRT and serve DHCP requests on the
   ethernet port.
7. Connect an RJ45 cable from the RE305 to your computer and access
   LuCI at http://192.168.1.1/ to configure (or use ssh).

Disassembly:
Just unscrew 4 screws in the corners & take off the back cover.
Serial is exposed to the right side of the main board (in the middle)
and marked with TX/RX/3V3/GND, but the holes are filled with solder.

Installation through serial:
1. connect trough serial (1n8, baudrate=57600)
2. setup the TFTP server and connect it via ethernet
   (ipaddr=192.168.0.254 of device, serverip=192.168.0.184 - your pc)
3. boot from a initramfs image first (choose 1 in the bootloader
   options)
4. test it a bit with that, then proceed to run sysupgrade build

MAC addresses as verified by OEM firmware:

  use  OpenWrt  address  reference
  LAN  eth0     *:d2     label
  2g   wlan0    *:d1     label - 1
  5g   wlan1    *:d0     label - 2

  The label MAC address can be found in config 0x2008.

Signed-off-by: Michal Kozuch <servitkar@gmail.com>
[redistribute WLAN node properties between DTS/DTSI, remove
 compatible on DTSI, fix indent/wrapping, split out firmware-utils
 change]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-10-30 22:05:25 +02:00
Bruno Randolf 2c3e8bed3f
ramips: minew g1-c: Allow dynamic RAM sizes
Allow RAM size to be passed thru U-Boot. There are 128MB and 64MB
versions of Minew G1-C. This is also in line with the behaviour of
most other RAMIPS boards.

Signed-off-by: Bruno Randolf <br1@einfach.org>
2021-10-26 13:59:30 +02:00
Rosen Penev 5b3d62247c ramips: fix dtc warnings for telco-electronics_x1
In all other dts files, the entire block is not edited like this.
They're edited separately.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-10-17 15:21:37 +02:00
David Bauer f82c93b93c ramips: fix USW-Flex reversed switch-port order
Switch port order was reversed due to reading the internal labling
(which mismatches the one on the case).

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-04 23:24:32 +02:00
Dale Hui 830c2e5378 ramips: add support for Netgear R7450
Netgear R7450 is a clone of Netgear R6700v2

Specifications
==============
SoC: MediaTek MT7621AT
RAM: 256M DDR3
FLASH: 128M NAND
WiFi: MediaTek MT7615N an+ac
MediaTek MT7615N bgn
ETH: MediaTek MT7621AT
BTN: 1x Connect (WPS), 1x WLAN, 1x Reset
LED: Power (white/amber), WAN(white/amber), 2.4G(white), 5G(white),
USB(white) , GuestWifi(white) 4x LAN(white/amber), Wifi Button(white),
WPS Button(white)

Flash Instructions
==================
Login to netgear webinterface and flash factory.img

Signed-off-by: Dale Hui <strokes-races0b@icloud.com>
[fix model/compatible in DTS]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-09-26 15:38:01 +02:00
Dale Hui 16fc409e7a ramips: add support for Netgear R6900v2
Netgear R6900v2 is a clone of Netgear R6700v2

Specifications
==============
SoC: MediaTek MT7621AT
RAM: 256M DDR3
FLASH: 128M NAND
WiFi: MediaTek MT7615N an+ac
MediaTek MT7615N bgn
ETH: MediaTek MT7621AT
BTN: 1x Connect (WPS), 1x WLAN, 1x Reset
LED: Power (white/amber), WAN(white/amber), 2.4G(white), 5G(white),
USB(white) , GuestWifi(white) 4x LAN(white/amber), Wifi Button(white),
WPS Button(white)

Flash Instructions
==================
Login to netgear webinterface and flash factory.img

Signed-off-by: Dale Hui <strokes-races0b@icloud.com>
2021-09-26 15:15:36 +02:00
Dale Hui af3104d25b ramips: make Netgear R7200 a separate device from R6700v2
With the various variants of Netgear R**** devices, make it more
obvious which image should be used for the R7200.

Signed-off-by: Dale Hui <strokes-races0b@icloud.com>
[provide proper commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-09-26 15:15:30 +02:00
David Bauer a983969789 ramips: add support for Ubiquiti USW-Flex
Hardware
--------
MediaTek MT7621AT
16M SPI-NOR Macronix MX25L12835FMI
Microchip PD69104B1 4-Channel PoE-PSE controller
TI TPS2373 PoE-PD controller

PoE-Controller
--------------

By default, the PoE outputs do not work with OpenWrt. To make them output
power, install the "poemgr" package from the packages feed.
This package can control the PD69104B1 PSE controller.

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

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

2. Add the uboot-envtools configuration file /etc/fw_env.config with the
   following content

   $ echo "/dev/mtd1 0x0 0x1000 0x10000 1" > /etc/fw_env.config

3. Update the bootloader environment.

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

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

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

   $ cat /proc/mtd

6. Set the bootselect flag to boot from kernel0

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

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

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

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

Restore to UniFi
----------------

To restore the vendor firmware, follow the Ubiquiti UniFi TFTP
recovery guide for access points. The process is the same for
the Flex switch.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-09-25 21:04:53 +02:00
INAGAKI Hiroshi 7ff0efa0b0 ramips: add support for I-O DATA WN-DX2033GR
I-O DATA WN-DX2033GR is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on
MT7621A.

Specification:

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

Flash instruction using initramfs image:

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

Notes:

- The hardware of WN-DX2033GR and WN-AX2033GR are almost the same, and
  it is certified under the same radio-wave related regulations in Japan

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

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

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

- There are 2x important flags in the flash:

  - bootnum   : select os partition for booting (persist, 0x4)

    - 0x01: firmware
    - 0x02: firmware_2

  - debugflag : allow interrupt kernel loader, it's named as "Z-LOADER"
    (Factory, 0xFE75)

    - 0x00: disable debug
    - 0x01: enable debug

MAC addresses:

LAN     : 50:41:B9:xx:xx:90 (Factory, 0xE000 (hex) / Ubootenv, ethaddr (text))
WAN     : 50:41:B9:xx:xx:92 (Factory, 0xE006 (hex))
2.4 GHz : 50:41:B9:xx:xx:90 (Factory, 0x4    (hex))
5 GHz   : 50:41:B9:xx:xx:91 (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2021-09-25 19:28:54 +02:00
Alan Luck 2c9a07ed28 ramips: add missing information to dlink headers
Add additional header information required for newer
bootloaders found on DIR-2660-A1 & A2.

Also remove the MTD splitter compatible from the second firmware
partition, as OpenWrt only supports handling of the first one.

Signed-off-by: Alan Luck <luckyhome2008@gmail.com>
[rephrase commit message, remove removal of read-only flags]
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-09-24 12:32:28 +02:00
Andrea Poletti de0c380a5f ramips: add support for Sitecom WLR-4100 v1 002
Sitecom WLR-4100 v1 002 (marked as X4 N300) is a wireless router
Specification:
SoC: MT7620A
RAM: 64 MB DDR2
Flash: MX25L6405D SPI NOR 8 MB
WIFI: 2.4 GHz integrated
Ethernet: 5x 10/100/1000 Mbps QCA8337
USB: 1x 2.0
LEDS: 2x GPIO controlled, 5x switch
Buttons: 1x GPIO controlled
UART: row of 4 unpopulated holes near USB port, starting count from
      white triangle on PCB:

    VCC 3.3V
    GND
    TX
    RX

    baud: 115200, parity: none, flow control: none

Installation

    Connect to one of LAN (yellow) ethernet ports,
    Open router configuration interface,
    Go to Toolbox > Firmware,
    Browse for OpenWrt factory image with dlf extension and hit Apply,
    Wait few minutes, after the Power LED will stop blinking, the router is
    ready for configuration.

Known issues
Some USB 2.0 devices work at full speed mode 1.1 only

MAC addresses

factory partition only contains one (binary) MAC address in 0x4.
u-boot-env contains four (ascii) MAC addresses, of which two appear
to be valid.

  factory     0x4       **:**:**:**:b9:84  binary
  u-boot-env  ethaddr   **:**:**:**:b9:84  ascii
  u-boot-env  wanaddr   **:**:**:**:b9:85  ascii
  u-boot-env  wlanaddr  00:AA:BB:CC:DD:12  ascii
  u-boot-env  iNICaddr  00:AA:BB:CC:DD:22  ascii

The factory firmware only assigns ethaddr. Thus, we take the
binary value which we can use directly in DTS.

Additional information
OEM firmware shell password is: SitecomSenao
useful for creating backup of original firmware.
There is also another revision of this device (v1 001), based on RT3352 SoC

Signed-off-by: Andrea Poletti <polex73@yahoo.it>
[remove config DT label, convert to nvmem, remove MAC address
 setup from u-boot-env, add MAC address info to commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-09-05 23:52:35 +02:00
Sungbo Eo f08b76b32f ramips: w2914ns-v2: consolidate leds nodes into dtsi
w2914ns-v2, 11acnas, and freezio use almost same board and thus share a
common dtsi file. Now that LED labels do not contain "devicename" since
commit c846dd91f0 ("ramips: remove model name from LED labels"), let's
move the leds nodes to dtsi and remove them from dts.

Note that freezio has only one USB 3.0 port and adding &ehci_port2 trigger
does not incur any visible changes.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-08-30 00:37:47 +02:00
David Bauer 90e167abaa ramips: add label-mac for TL-MR3020 v3
The TP-Link TL-MR3020 v3 only has a single MAC address assigned for
ethernet LAN as well as WiFi. This MAC address is also printed on the
casing.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-08-28 01:35:02 +02:00
David Bauer 9c965893ed ramips: enable fast-read for TL-MR3020 v3
The GigaDevices GD25Q64B found on the TL-MR3020 v3 supports the fast
read instruction. Add the required DT property in order to enable usage
of this property.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-08-28 01:31:45 +02:00
David Bauer db3545cd02 ramips: increase SPI frequency for TL-MR3020 v3
The GigaDevices GD25Q64B supports higher SPI clocks than 10 MHz. While
100 MHz do not work reliably, 50 MHz works without issues.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-08-28 01:31:36 +02:00
David Bauer 161ee85bbe ramips: fix input type for TL-MR3020 v3
The modec{1,2} keys are actually switches.

Add the respective DTS properties to avoid accidental activation of
failsafe mode.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-08-28 01:31:29 +02:00
David Yang 38cb500516 ramips: expose ephy leds for miwifi-mini
Give users more control by exposing ephy leds.

Signed-off-by: David Yang <mmyangfl@gmail.com>
[remove execute bit on 01_leds, add status for gpio2]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-25 01:42:17 +02:00
David Yang 5ed11012e7 ramips: lock u-boot partition and unlock u-boot-env for miwifi-mini
Generally u-boot should keep read-only to avoid mis-overwriting and
bricking the device, but u-boot-env could be safely modified with u-boot
setenv tool.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2021-08-25 01:42:17 +02:00
David Yang a6c410ae10 ramips: increase flash freq for miwifi-mini
The flash is Winbond 25Q128. As it has large rom, better to increase flash
frequency to 70MHz according to the flash spec and enable fast-read.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2021-08-25 01:42:17 +02:00
Giovanni Cascione d57ba86e48 ramips: add support for D-Link DAP-1325-A1
This patch adds support for D-Link DAP-1325-A1 (Range Extender Wi-Fi N300)

Specifications:
- SoC: 580Mhz MT7628NN
- RAM: 64MB, DDR2 SDRAM
- Storage: 8MB, SPI (W25Q64JVSSIQ)
- Ethernet: 1x 10/100 LAN port
- WIFI: 2.4 GHz 802.11bgn
- LED: Status (2x to provide 3 colors), Wi-Fi Signal Strength (4x)
- Buttons: Reset, WPS
- UART: Serial console (57600, 8n1)
Row of 4 holes near LAN port, starting from square hole:
3.3V, TX,RX,GND
- FCC ID: fccid.io/KA2AP1325A1/

Installation:

Failsafe UI
Firmware can be uploaded with Failsafe UI web page:
- turn device off
- press and hold reset button
- turn device on
- keep holding reset until red wifi strength led turns on (ab. 10sec)
- connect to device through LAN port
PC must be configured with static ip (192.168.0.x)
- connect to 192.168.0.50
- select image to be flashed and upload.
Device will reboot after successful update

Serial port/TFTP server
- Connect through serial connectors on PCB (e.g. with teraterm)
- Set up a TFTP server, and connect through LAN with static IP
- Put image file in the root of the server
- Boot the device and select '2' at U-Boot startup
- Set device IP, server IP and image file name
- Start upload and flash

Signed-off-by: Giovanni Cascione <ing.cascione@gmail.com>
[fix whitespaces in DTS, convert to nvmem, add mtd-eeprom]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-25 01:42:17 +02:00
Shiji Yang a73a8269e1 ramips: add support for DomyWifi DM202/DM203/DW22D
Specifications:
* SOC: MT7620A + MT7610E
* ROM: 16 MiB spi flash (W25Q128FVSG)
* RAM: 128 MiB DDR2 (W971GG6KB-25)
* WAN: 10/100M *1
* LAN: 10/100M *4
* USB: Type-A USB2.0 *1
* SD: MicroSD *1
* Button: Reset *1
* Antennas: 2.4 GHz *2 + 5 GHz *1
* TTL Baudrate: 57600
* U-Boot Recovery: IP: 10.10.10.123, Server: 10.10.10.3

Installation:
* Web UI Update
  1. Open http://192.168.10.1/upgrade.html in the browser.
  2. Rename firmware to a short name like firmware.bin and then upload it.
  3. Fill in the password column with the following content:
  password | mtd -x mIp2osnRG3qZGdIlQPh1 -r write /tmp/firmware.bin firmware
* TFTP + U-Boot
  1. Connect device with a TTL cable.
  2. Press "2" when booting to select "Load system code then write to Flash via TFTP".
  3. Upload firmware by tftpd64, it will boot when write instruction is executed.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2021-08-25 01:42:16 +02:00
Shiji Yang 09143282bd ramips: add support for Motorola MWR03
Specifications:
* SOC: MT7628AN + MT7612E
* ROM: 8 MiB Flash
* RAM: 64 MiB DDR2
* WAN: 10/100M *1
* LAN: 10/100M *3
* Button: Reset *1
* LEDs: orange *1, white *1
* Antennas: 2.4 GHz *2 + 5 GHz *2
* TTL Baudrate: 57600
* TFTP Upgrade: IP: 192.168.51.1, Server: 192.168.51.100

MAC addresses as verified by OEM firmware:

use   address   source
2g    *:d8      factory 0x0004 (label)
5g    *:d9      factory 0x8004
LAN   *:d7      factory $label -1
WAN   *:da      factory $label +2

Installation (TFTP + U-Boot):
 * Connect device with a TTL cable and open a serial session by
   PuTTY.
 * Press "2" when booting to select "Load system code then write
   to Flash via TFTP".
 * Configure the IP of local host server.
 * Upload firmware by tftpd64, it will boot when write instruction
   is executed.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[fix DTS line endings, fix label MAC address, adjust status LED
 names, convert mtd-mac-address-increment to mac-address-increment]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-25 01:41:35 +02:00
Shiji Yang 80e70be0ab ramips: add new flash layout support to Phicomm K2
Descriptions:
Phicomm K2 (PSG1218) got a new "permanent_config" partition after
update firmware to v22.5. This partition located in front of the
firmware partition, same as The Phicomm K2P and K2G. Due to this
change the new bootloader can't load previous firmware any more.
This commit is aimed at add support for Phicomm K2 which official
firmware version is 22.5.x or newer. For which runs old firmware
version, just update OpenWrt that has a prefix of "k2-v22.4".
For uniform naming, this commit also changed the model name
PSG1218 to a more recognizable name K2, refer to Phicomm K2G,
K2P K2T.

OpenWrt selection table:
official firmware version           OpenWrt
v22.4.x.x or older              phicomm_k2-v22.4
v22.5.x.x or newer              phicomm_k2-v22.5

Installation:
Same as Phicomm K2G, K2P, PSG1208.
a. TFTP + U-Boot
b. Open telnet by some web page vulnerability (Search Baidu by key
   words "K2 telnet"), and then we can upload firmware image to
   /tmp and write it to firmware partition with mtd instruction.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
[rebase, add/harmonize version in model variables, fix version typo
 in commit message, wrap commit message properly]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-24 20:26:00 +02:00
Adrian Schmutzler c4143505e0 ramips: mt7620: move Phicomm MAC address setup to DTSI
The setup is the same for all devices, so move it up one level.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-24 20:26:00 +02:00
Michael Siegenthaler 4b4fa2f9fe ramips: fix ethernet MAC address on Omega2
According to https://docs.onion.io/omega2-docs/mac-address.html, 0x28 is
the correct location to read the address on Onion Omega 2(+) devices.

This fixes a regression introduced by commit 77e850fe76 ("ramips: tidy up
MAC address setup for Linkit Smart and Omega2"), which was a cleanup that
intended to preserve existing behavior. In my testing with v19.07.7,
however, the MAC address determined from the device tree takes precedence
over the one set by 02_network, so the aforementioned commit actually
changed the behavior.

Signed-off-by: Michael Siegenthaler <msiegen@google.com>
[Adapt patch to nvmem usage]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2021-08-21 16:30:30 +02:00
Adrian Schmutzler 8a78d61299 ramips: convert mtd-mac-address to nvmem for UniElec devices
Convert this series by moving the definitions to the individual
devices.

Now all devices on ramips are converted.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-20 18:13:55 +02:00
Adrian Schmutzler f13c7a56f0 ramips: remove redundant nvmem definitions
Due to use of a script when migrating from mtd-mac-address, a few
of the definitions are redundant in DTSI and DTS files. Remove
those.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-20 18:13:50 +02:00
Adrian Schmutzler 9cb5853592 ramips: fix indent in DTS for GL.iNet VIXMINI/microuter-N300
Use correct indent.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-20 18:10:48 +02:00
Adrian Schmutzler 7f1b0f68f1 ramips: convert mtd-mac-address to nvmem for D-Link DIR-8xx
Convert this series by moving the definitions to the individual
devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-20 18:10:48 +02:00
Adrian Schmutzler ba3d92c5a0 ramips: convert most mtd-mac-address cases in DTSI to nvmem
Convert most of the cases from mtd-mac-address to nvmem where
MAC addresses are set in the DTSI, but the partitions are only
located in the device DTS. This posed some problems earlier, since
in these cases we are using partitions before they are defined,
and the nvmem system did not seem to like that.

There have been a few different resolution approaches, based on
the different tradeoffs of deduplication vs. maintainability:

 1. In many cases, the partition tables were identical except for
    the firmware partition size, and the firmware partition was
    the last in the table.
    In these cases, the partition table has been moved to the
    DTSI, and only the firmware partition's "reg" property has
    been kept in the DTS files. So, the updated nvmem definition
    could stay in the DTSI files as well.

 2. For all other cases, splitting up the partition table would
    have introduced additional complexity. Thus, the nodes to be
    converted to nvmem have been moved to the DTS files where the
    partitioning was defined.

 3. For Netgear EX2700 and WN3000RP v3, the remaining DTSI file
    was completely dissolved, as it was quite small and the name
    was not really nice either.

 4. The D-Link DIR-853 A3 was converted to nvmem as well, though
    it is just a plain DTS file not taken care of in the first
    wave.

In addition, some minor rearrangements have been made for tidyness.

Not covered (yet) by this patch are:

 * Various unielec devices
 * The D-Link DIR-8xx family

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-18 23:46:02 +02:00
David Yang efca67983d ramips: add WPS button for newifi d1
This device has a WPS button under WiFi antenna cover, add it to dts.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2021-08-17 18:41:17 +02:00
Adrian Schmutzler ad6b077049 ramips: mt7628: move mtd-eeprom out of root DTSI
The mt76x8 subtarget is the only one in ramips that stores the
mediatek,mtd-eeprom property directly in the "root" mt7628an.dtsi.

This is not optimal for a few different reasons:

 * If you don't really know it or are used to other (sub)targets,
   the property will be set somewhat magically.
 * The property is set based on &factory partition before (if at all)
   this partition is defined.
 * There are several devices that have different offset or even
   different partitions to read from, which will then be overwritten
   in the DTS files. Thus, definitions are scattered between root
   DTSI and individual files.

Based on these circumstances, the "root" definition is removed and
the property is added to the device-based DTS(I) files where needed
and applicable. This should be easier to grasp for unexperienced
developers and will move the property closer to the partition
definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-17 18:41:17 +02:00
Fabian Bläse c36e9f891b ramips: add missing label-mac-device for Xiaomi Mi Router 4A (100M)
As both the Mi Router 4A (100M) and the Mi Router 4C use the same
label-mac-device, the alias can be moved to the shared dtsi.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
2021-08-05 22:55:39 +02:00