Commit Graph

28 Commits (77e850fe76e3585a0d5094dbb8ea11be7d150aa8)

Author SHA1 Message Date
Adrian Schmutzler 77e850fe76 ramips: tidy up MAC address setup for Linkit Smart and Omega2
Linkit Smart 7688 and Onion Omega 2(+) are one-port devices, and
have their port set to LAN by default. Setting up a WAN MAC address
for them doesn't make any sense, as no wan interface will be created
in uci config. Despite, these devices also set lan_mac in 02_network,
although mtd-mac-address sets a different address for the ethernet
interface in DTS.

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

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

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

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

MAC addresses as verified by OEM firmware:

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

Signed-off-by: Tobias Welz <tw@wiznet.eu>
[fix sorting in 02_network, commit message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Richard Fröhning 009e62c92c ramips: add support for TP-Link RE200 v3
TP-Link RE200 v3 is a wireless range extender with Ethernet and 2.4G and 5G
WiFi with internal antennas. It's based on MediaTek MT7628AN+MT7610EN like the v2.

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

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

Unverified:
- UART header on PCB (57600 8n1)

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

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

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

The label MAC address matches the OpenWrt ethernet address.

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

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

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

Recovery
--------

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

The device has not been opened for adding support. However, it is expected
that the behavior is similar to the RE200 v2. Instructions for serial console
and recovery may be checked out in commit 6d6f36ae78 ("ramips: add support
for TP-Link RE200 v2") or on the device's Wiki page.

Signed-off-by: Richard Fröhning <misanthropos@gmx.de>
[adjust commit title/message, sort support list]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Robinson Wu 84cb0f7ace ramips: add support for JS76x8 series DEV boards
This commit adds support for the Jotale JS76x8 series development boards.
These devices have the following specifications:

- SOC: MT7628AN/NN, MT7688AN, MT7628DAN
- RAM of MT7628AN/NN and MT7688AN: 64/128/256 MB (DDR2)
- RAM of MT7628DAN: 64 MB (DDR2)
- FLASH:8/16/32 MB (SPI NOR)
- Ethernet:3x 10/100 Mbps ethernet ports (MT76x8 built-in switch)
- WIFI:1x 2T2R 2.4 GHz Wi-Fi
- LEDs:1x system status green LED, 1x wifi green LED,
       3x ethernet green LED
- Buttons:1x reset button
- 1x microSD slot
- 4x USB 2.0 port
- 1x mini-usb debug UART
- 1x DC jack for main power (DC 5V)
- 1x TTL/RS232 UART
- 1x TTL/RS485 UART
- 13x GPIO header
- 1x audio codec(wm8960)

Installation via OpenWrt:

The original firmware is OpenWrt, so both LuCI and sysupgrade can be used.

Installation via U-boot web:

1. Power on board with reset button pressed, release it
   after wifi led start blinking.
2. Setup static IP 192.168.1.123/4 on your PC.
3. Go to 192.168.1.8 in browser and upload "sysupgrade" image.

Installation via U-boot tftp:
1. Connect to serial console at the mini usb, which has been connected to UART0
   on board (115200 8N1)
2. Setup static IP 192.168.1.123/4 on your PC.
3. Place openwrt-firmware.bin on your PC tftp server (192.168.1.123).
3. Connect one of LAN ports on board to your PC.
4. Start terminal software (e.g. screen /dev/ttyUSB0 115200) on PC.
5. Apply power to board.
6. Interrupt U-boot with keypress of "2".
7. At u-boot prompts:
   Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) Y
   Input device IP (192.168.1.8) ==:192.168.1.8
   Input server IP (192.168.1.123) ==:192.168.1.123
   Input Linux Kernel filename (root_uImage) ==:openwrt-firmware.bin
8. board will download file from tftp server, write it to flash and reboot.

Signed-off-by: Robinson Wu <wurobinson@qq.com>
[add license to DTS files, fix state_default and reduce to the mimimum,
move phy0tpt trigger to DTS, drop ucidef_set_led_timer, fix network ports]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer 612d5282b5 ramips: don't create switch config for VIXMINI
Don't create UCI switch config for the GL.iNet microuter-N300 and
VIXMINI. These devices only have a single LAN port.
Creating the switch config makes usage of VLANs more complicated,
as they would have to be configured on the MAC as well as the "switch".

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Tim Thorpe edbc8e5512 ramips: add support for Netgear R6020
This adds support for the Netgear R6020, aka Netgear AC750.

The R6020 appears to be the same hardware as the Netgear R6080,
aka Netgear AC1000, but it has a slightly different flash layout,
and no USB ports.

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

MAC addresses based on vendor firmware:
LAN      *:88   0x4
WAN      *:89
WLAN2    *:88   0x4
WLAN5    *:8a   0x8004

The factory partition might have been corrupted beforehand. However,
the comparison of vendor firmware and OpenWrt still allowed to retrieve
a meaningful assignment that also matches the other similar devices.

Installation:

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

Signed-off-by: Tim Thorpe <timfthorpe@gmail.com>
[slightly extend commit message, fix whitespaces in DTS, align From:
with Signed-off-by]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.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 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
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
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
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
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
Sungbo Eo 6410c30dc7 ramips: add support for TOTOLINK A3
TOTOLINK A3 is a clone of ipTIME A3. The only difference is the model name.

Specifications:
- SoC: MT7628AN
- RAM: DDR2 64MB
- Flash: SPI NOR 8MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7612EN
- Ethernet: 3x 10/100Mbps
  - Switch: SoC internal

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.

Tested on device by JasonHCH <hsuan670629@gmail.com>

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
DENG Qingfang 8590e70fab ramips: fix HiWiFi HC5761A switch settings
HC5761A has only 2 LAN ports

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

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.

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

The MAC address assignment matches stock firmware, i.e.:
LAN : *:0D
2.4G: *:0E
5G  : *:0F

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

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

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

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.

Additonal notes
---------------

It is possible to flash back to stock by using tplink-safeloader to create
a sysupgrade image based on a stock update. After the first boot, it is
necessary upgrade to another stock image, otherwise subsequent boots
fail with LZMA ERROR 1 and you have to attach serial to recover the device.

Signed-off-by: Andreas Böhler <dev@aboehler.at>
[remove DEVICE_VARS change]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer b30f2281cc ramips: add support for GL.iNet microuter-N300
The GL.iNet microuter-N300 (internally referred as MT300N-v4) is a
pocket-size travel router. It is essentially identical to the VIXMINI
(internally referred as MT300N-v3) but with double the RAM and
SPI-flash.

Additionally, set the label-mac for both the VIXMINI as well as the
microuter-N300.

Hardware
--------
SoC:   MediaTek MT7628NN
RAM:   128M DDR2
FLASH: 16M
LED:   Power - WLAN
BTN:   Reset
UART:  115200 8N1
       TX and RX are labled on the board as pads next to the SoC

Installation via web-interface
------------------------------
1. Visit the web-interface at 192.168.8.1
   Note: The ethernet port is by default WAN. So you need to connect to
   the router via WiFi

2. Navigate to the Update tab on the left side.

3. Select "Local Update"

4. Upload the OpenWrt sysupgrade image.
   Note: Make sure you select not to preserve the configuration.

Installation via U-Boot
-----------------------
1. Hold down the reset button while powering on the device.
   Wait for the LED to flash 5 times.

2. Assign yourself a static IPv4 in 192.168.1.0/24

3. Upload the OpenWrt sysupgrade image at 192.168.1.1.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Steffen Förster 93a4c8afbf ramips: add support for TP-Link RE305 v1
Specification:

SoC: MediaTek MT7628AN
RAM: 64MiB
Flash: 8MiB
Wifi:
  - 2.4GHz: MT7628AN
  - 5GHz: MT7612EN
LAN: 1x 10/100 Mbps

Flash instructions:
Flash factory image through stock firmware WEB UI.
Back to stock is possible by using TFTP and stripping down the Firmware
provided by TP-Link to a initramfs.

The flash space between 0x650000 and 0x7f0000
is blank in the stock firmware so I left it out as well.

Signed-off-by: Steffen Förster <nemesis@chemnitz.freifunk.net>
4 years ago
Maxim Anisimov 86e7353bff ramips: add support for TP-Link Archer C20 v5
TP-Link Archer C20 v5 is a router with 5-port FE switch and
non-detachable antennas. It's based on MediaTek MT7628N+MT7610EN.

Specification:
- MediaTek MT7628N/N (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 2T2R 2.4 GHz and 1T1R 5 GHz
- 5x 10/100 Mbps Ethernet
- 3x external, non-detachable antennas
- UART (J1) header on PCB (115200 8n1)
- 7x LED (GPIO-controlled*), 2x button, power input switch

* WAN LED in this devices is a dual-color, dual-leads type which isn't
  (fully) supported by gpio-leds driver. This type of LED requires both
  GPIOs state change at the same time to select color or turn it off.
  For now, we support/use only the green part of the LED.

Create Factory image
--------------------
As all installation methods require a U-Boot to be integrated into the
Image (and we do not ship one with the image) we are not able to create
an image in the OpenWRT build-process.

Download a TP-Link image from their Website and a OpenWRT sysupgrade
image for the device and build yourself a factory image like following:

TP-Link image:             tpl.bin
OpenWRT sysupgrade image:  owrt.bin

 > dd if=tpl.bin of=boot.bin bs=131584 count=1
 > cat owrt.bin >> boot.bin

Installing via Web-UI
---------------------
Upload the boot.bin via TP-Links firmware upgrade tool in the
web-interface.

Installing via Recovery
-----------------------
Activate Web-Recovery by beginning the upgrade Process with a
Firmware-Image from TP-Link. After starting the Firmware Upgrade,
wait ~3 seconds (When update status is switching to 0%), then
disconnect the power supply from the device. Upgrade flag (which
activates Web-Recovery) is written before the OS-image is touched and
removed after write is succesfull, so this procedure should be safe.

Plug the power back in. It will come up in Recovery-Mode on 192.168.0.1.
When active, all LEDs but the WPS LED are off.
Remeber to assign yourself a static IP-address as DHCP is not active in
this mode.

The boot.bin can now be uploaded and flashed using the web-recovery.

Installing via TFTP
-------------------
Prepare an image like following (Filenames from factory image steps
apply here)

 > dd if=/dev/zero of=tp_recovery.bin bs=196608 count=1
 > dd if=tpl.bin of=tmp.bin bs=131584 count=1
 > dd if=tmp.bin of=boot.bin bs=512 skip=1
 > cat boot.bin >> tp_recovery.bin
 > cat owrt.bin >> tp_recovery.bin

Place tp_recovery.bin in root directory of TFTP server and listen on
192.168.0.66/24.

Connect router LAN ports with your computer and power up the router
while pressing the reset button. The router will download the image via
tftp and after ~1 Minute reboot into OpenWRT.

U-Boot CLI
----------
U-Boot CLI can be activated by holding down '4' on bootup.

Dual U-Boot
-----------
This is TP-Link MediaTek device with a split-uboot feature design like
a TP-Link Archer C50 v4. The first (factory-uboot) provides recovery via
TFTP and HTTP, jumping straight into the second (firmware-uboot) if no
recovery needs to be performed. The firmware-uboot unpacks and executed
the kernel.

Web-Recovery
------------
TP-Link integrated a new Web-Recovery like the one on the Archer C7v4 /
TL-WR1043v5 / Archer C50v4. Stock-firmware sets a flag in the "romfile"
partition before beginning to write and removes it afterwards. If the
router boots with this flag set, bootloader will automatically start
Web-recovery and listens on 192.168.0.1. This way, the vendor-firmware
or an OpenWRT factory image can be written.

By doing the same while performing sysupgrade, we can take advantage of
the Web-recovery in OpenWRT.

It is important to note that Web-Recovery is only based on this flag. It
can't detect e.g. a crashing kernel or other means. Once activated it
won't boot the OS before a recovery action (either via TFTP or HTTP) is
performed. This recovery-mode is indicated by an illuminated WPS-LED on
boot.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
[adjust some node names for LEDs in DTS]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo 7a3c9e557a ramips: fix switch setup for Xiaomi MiWiFi Nano
MiWiFi Nano has two LAN ports, which are in reverse order. Add port numbers
to them, and disable unused ports.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Adrian Schmutzler 09d38a3bc3 ramips: remove bogus ralink,mtd-eeprom with offset 0x4
Several devices in mt76x8 subtarget use the following line to set
up wmac in their DTS(I) files:

ralink,mtd-eeprom = <&factory 0x4>

This is strange for several reasons:
- They should use mediatek,mtd-eeprom on this SOC
- The caldata is supposed to start at 0x0
- The parent DTSI mt7628an.dtsi specifies mediatek,mtd-eeprom anyway,
  starting from 0x0
- The offset coincides with the default location of the MAC address
  in caldata

Based on the comment in b28e94d4bf ("ramips: MiWiFi Nano fixes"),
it looks like the author for this device wanted to actually use
mtd-mac-address instead of ralink,mtd-eeprom. A check on the same
device revealed that actually the MAC address start at offset 4 there,
so the correct caldata offset is 0x0.

Based on these findings, and the fact that the expected location on
this SOC is 0x0, we remove the "ralink,mtd-eeprom = <&factory 0x4>"
statement from all devices in ramips (being only mt7628an anyway).

Thanks to Sungbo Eo for finding and researching this.

Reported-by: Sungbo Eo <mans0n@gorani.run>
Fixes: b28e94d4bf ("ramips: MiWiFi Nano fixes")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo ea5cf7c0dd ramips: fix MAC address setup for Xiaomi MiWiFi Nano
MAC addresses are stored in factory partition at:
0x0004: WiFi 2.4GHz (label_mac +1)
0x0028: LAN, WAN (label_mac)

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Adrian Schmutzler fef1810897 ramips: mt76x8: 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.

While at it, change the partition label for zyxel,keenetic-extra-ii
to factory to be consistent with node label and all the other devices.

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
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 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
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