Commit Graph

2639 Commits (d3c0a944059bb0d45c3b56278249100258378b0c)

Author SHA1 Message Date
Adrian Schmutzler a858d6d0e2 ramips: rt288x: 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.

This removes the wan_mac setup for ralink,v11st-fe as this device
does not set up a MAC address for ethernet in the first place.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
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 ed975a58e4 ramips: mt7621: 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 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
Adrian Schmutzler 757658f2ab ramips: create common DTSI for TP-Link Archer C20i/C20 v1/C50 v1
The TP-Link Archer C20i/C20 v1/C50 v1 seem to be almost the same,
so creating a common DTSI will reduce duplicate code.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler c4f6850efc ramips: remove unused DTS variable from DEVICE_VARS
The DTS variable has been removed in 402138d12d ("ramips: Derive
DTS name from device name in Makefile"), but the DEVICE_VARS entry
has been overlooked.

Remove it now since we are not using this variable.

This must _not_ be backported to 19.07, where the variable is still
in use.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Gabor Varga a283b1788a ramips: fix switch port numbering for RT-AC65P/RT-AC85P
The switch LAN port numbers are in reversed order with original config.
With this patch they are fixed.

Port order checked on both devices.

Signed-off-by: Gabor Varga <vargagab@gmail.com>
[merged definitions into appropriate block, extended commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler e00396d584 ramips: add label MAC address for TP-Link Archer C20i
Current OpenWrt MAC setup:
eth0             &rom 0xf100    :48
eth0.2           eth0+1         :49
wlan0 (5 GHz)    &radio 0x8004  different OUI
wlan1 (2.4 GHz)  &radio 0x4     same OUI as wlan0

Label MAC address corresponds to eth0 (&ethernet).

No additional addresses found in hexdump of rom/radio.

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

Altered patches:
- 400-mtd-add-rootfs-split-support.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Adrian Schmutzler 231dc26867 treewide: remove dts-v1 identifier from DTSI files
The "/dts-v1/;" identifier is supposed to be put once at the beginning
of a device tree file. Thus, it makes no sense to provide it a second
time in to-be-included DTSI files.

This removes the identifier from all DTSI files in /target/linux.

Most of the DTS files in OpenWrt do contain the "/dts-v1/;". It is
missing for most of the following targets, though:
mvebu, ipq806x, mpc85xx, ipq40xx

This does not touch ipq806x for now, as the bump to 4.19 is close.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 34abfb6e91 ramips: convert mediatek,mtd-eeprom from decimal to hex notation
A small subset of devices uses decimal notation for mediatek,mtd-eeprom
in DTS files. Convert to hexadecimal notation to be consistent with
all the rest.

Also change "0" to "0x0" in the same files for consistency.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Martin Schiller 3a55c7935d ramips: fix number of LAN Ports for Mikrotik RBM33G
The Mikrotik RBM33G has only 2 LAN ports.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
[moved node in 02_network to maintain alphabetic sorting]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 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
Koen Vandeputte 414b7c107a kernel: bump 4.14 to 4.14.156
Refreshed all patches.

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
David Bauer 6a76ea359b ramips: reorganize NETGEAR sercomm boards
This re-organizes the device-tree files for the Sercomm-manufactured
NETGEAR routers. They are now split into two different base-boards,
from which the respective model is extended.

This partially reverts commit c7842ceaaa ("ramips: reorganize DTSI
files for Netgear R devices"), which introduced inheritance between two
completely unrelated base-boards.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Koen Vandeputte d6aea46a50 kernel: bump 4.14 to 4.14.154
Refreshed all patches.

Altered patches:
- 902-debloat_proc.patch
- 040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch
- 807-usb-support-layerscape.patch
- 809-flexcan-support-layerscape.patch
- 816-pcie-support-layerscape.patch

Remove upstreamed:
- 150-MIPS-bmips-mark-exception-vectors-as-char-arrays.patch
- 303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch

New symbols:
X86_INTEL_MPX
X86_INTEL_MEMORY_PROTECTION_KEYS
X86_INTEL_TSX_MODE_OFF
X86_INTEL_TSX_MODE_ON
X86_INTEL_TSX_MODE_AUTO
SGL_ALLOC

Compile-tested on: cns3xxx, x86_64
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Sungbo Eo 19800ac095 ramips: set uImage name of WeVO 11AC NAS and W2914NS v2
The stock firmware and bootloader only accept uImage with names that
match certain patterns. This patch enables OpenWrt installation from
stock firmware without having to reflash the bootloader or access the
UART console.

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

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
5 years ago
Christian Lamparter ad65d9d7b2 ramips: assign correct key-code to wps buttons
The ASUS WL-330N(3G) and the Edimax RG21S had the
reset keycode assigned to the WPS button. This patch
changes all three devices to use KEY_WPS_BUTTON in
the hopes that this fixes unwanted restarts/
unexpected behavior from the users point of view.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Piotr Dymacz e68539aca4 ramips: add support for ALFA Network Quad-E4G
ALFA Network Quad-E4G is a universal Wi-Fi/4G platform, which offers
three miniPCIe (PCIe, USB 2.0, SIM) and a single M.2 B-key (dual-SIM,
USB 3.0) slots, RTC and five Gigabit Ethernet ports with PoE support.

Specification:

- MT7621A (880 MHz)
- 256/512 MB of RAM (DDR3)
- 16/32+ MB of FLASH (SPI NOR)
- optional second SPI flash (8-pin WSON/SOIC)
- 1x microSD (SDXC) flash card reader
- 5x 10/100/100 Mbps Ethernet, with passive PoE support (24 V) in LAN1
- optional 802.3at/af PoE module for WAN
- 3x miniPCIe slot (with PCIe and USB 2.0 buses, micro SIM and 5 V)
- 1x M.2/NGFF B-key 3042 (USB 3.0/2.0, mini + micro SIM)
- RTC (TI BQ32002, I2C bus) with backup battery (CR2032)
- external hardware watchdog (EM Microelectronic EM6324)
- 1x USB 2.0 Type-A
- 1x micro USB Type-B for system serial console (Holtek HT42B534)
- 11x LED (5 for Ethernet, 5 driven by GPIO, 1x power indicator)
- 3x button (reset, user1, user2)
- 1x I2C (4-pin, 2.54 mm pitch) header on PCB
- 4x SIM (6-pin, 2.00 mm pitch) headers on PCB
- 2x UART2/3 (4-pin, 2.54 mm pitch) headers on PCB
- 1x mechanical power switch
- 1x DC jack with lock (24 V)

Other:

- U-Boot selects default SIM slot, based on value of 'default_sim' env
  variable: '1' or unset -> SIM1 (mini), '2' -> SIM2 (micro). This board
  has additional logic circuit for M.2 SIM switching. The 'sim-select'
  will work only if both SIM slots are occupied. Otherwise, always slot
  with SIM inside is selected, no matter 'sim-select' value.
- U-Boot enables power in all three miniPCIe and M.2 slots before
  loading the kernel
- this board supports 'dual image' feature (controlled by 'dual_image'
  U-Boot environment variable)
- all three miniPCIe slots have additional 5 V supply on pins 47 and 49
- the board allows to install up to two oversized miniPCIe cards (vendor
  has dedicated MediaTek MT7615N/D cards for this board)
- this board has additional logic circuit controlling PERSTn pins inside
  miniPCIe slots. By default, PERSTn (GPIO19) is routed to all miniPCIe
  slots but setting GPIO22 to high allows PERSTn control per slot, using
  GPIO23-25 (value is inverted)

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 44d7a14a83 ramips: mt7621: refresh kernel config
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Piotr Dymacz fc0d0f5dfd ramips: provide label MAC for ALFA Network Tube-E4G
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
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
Sungbo Eo 261c746631 ramips: add usb-ledtrig-usbport to DEVICE_PACKAGES of CY-SWR1100
CY-SWR1100 has a USB LED but kmod-usb-ledtrig-usbport is missing
in default images. This commit adds it.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[changed commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Sungbo Eo fe6a04a8fe ramips: change status LED of Samsung CY-SWR1100
Use power LED for status indication and free WPS LED for other uses.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
5 years ago
Sungbo Eo aabdf6991c ramips: improve Samsung CY-SWR1100 support
This patch does the following:

- rename "devdata" flash partition and make it read-only
- switch from gpio-keys-polled to gpio-keys
- add missing power LED
- set correct PCI ID to compatible string in wifi node
- remove ralink,5ghz property in wifi node
- provide label MAC address

Rename devdata partition to devconf as indicated in the stock firmware
partition table:
00030000-00040000: "devdata"
00040000-00050000: "devconf"

Power LED can be controlled by SoC GPIO. Add it in the dts leds node.

RT3092L supports only bgn mode, so it is unnecessary to disable 5GHz band.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
5 years ago
Sungbo Eo 7231c1edd9 ramips: fix MAC address setup for Samsung CY-SWR1100
Ethernet MAC address setup has been broken since c3e420f28c. Restore
original setting.

Fixes: c3e420f28c ("ramips: Add support for D-Link DCH-M225")

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
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
David Bauer b16d76bf40 ramips: correct Netgear WNDR3700v5 button flag
This adjusts the GPIO state flag to ACTIVE_LOW as FCC pictures indicate
the base board is identical to the one of the R6220.

Fixes commit 3459013257 ("ramips: correct R6220 button flag")

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
David Bauer 3459013257 ramips: correct R6220 button flag
All buttons on the Netgear R6220 are active-low while they are flagged
as active-high.

The GPIO status reads the following for no buttons pressed:

root@64367-r6220:~# cat /sys/kernel/debug/gpio
gpio-7   (                    |wps                 ) in  hi
gpio-8   (                    |wifi                ) in  hi
gpio-14  (                    |reset               ) in  hi

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Adrian Schmutzler f098c612b6 ramips: create shared DTSI for Netgear EX2700 and WN3000RP v3
This moves shared code of the named devices into a common DTSI.

Remove setting status="okay" for &gpio0 as it's not disabled in
mt7620a.dtsi.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Frederik Noe-Sdun 4a904b8b76 ramips: increase max SPI frequency to 50 MHz for EX3700/EX6130
Based on Macronix MX25L3205DM2I datasheet this is maximum
supported speed.

Signed-off-by: Frederik Noe-Sdun <Frederik.Sdun@googlemail.com>
[rebased, improved commit title/message]
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 a921945773 ramips: rename keys node formerly named button
For some devices, the keys node is named "button". Change name to
match the rest of the target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Paul Spooren 9fa061a7d3 ramips, mt7620: reproducible elecom-header uid/gid
The elecom-header renames the firmware image to v_0.0.0.bin, stores its
MD5 sum as v_0.0.0.md5 and tars both files again.

Both v_0.0.0 files are created as the build user making it harder to
reproduce.

This commit sets the owner/group of both files to root by adding extra
options to the final tar command.

Before:
0 buildbot   (101) buildbot   (102)  3932164 2019-11-05 14:43:22.000000 v_0.0.0.bin
0 buildbot   (101) buildbot   (102)       33 2019-11-05 14:43:22.000000 v_0.0.0.md5

After:
0 root         (0) root         (0)  3932164 2019-11-05 23:43:08.000000 v_0.0.0.bin
0 root         (0) root         (0)       33 2019-11-05 23:43:08.000000 v_0.0.0.md5

Signed-off-by: Paul Spooren <mail@aparcar.org>
5 years ago
Adrian Schmutzler c7842ceaaa ramips: reorganize DTSI files for Netgear R devices
This reorganizes DTSI files for the Netgear R devices in mt7621
(and the WNDR3700 v5). It creates a common DTSI for all R (sercomm)
devices and distributes the remaining code in r6220.dtsi to R6220
and WNDR3700 v5.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Sungbo Eo 62b1559b56 ramips: improve support for WeVO 11AC NAS and W2914NS v2
- remove WAN port index
- load WAN MAC address directly from the flash
- provide label MAC address
- increase flash's SPI frequency to 80MHz
- add mt76 led nodes to make WiFi LEDs work
- drop unnecessary pinmux groups

The factory partition scheme for MAC addresses (verified on both devices):
0x4   : WiFi 2.4GHz (label_mac-9)
0x28  : unused
0x2e  : WAN (label_mac)
0x8004: WiFi 5GHz (label_mac-5)
0xe000: LAN (label_mac-1)
0xe006: unused

By improving flash speed,
`time dd if=/dev/mtdblock3 of=/dev/null bs=64k`
has been reduced from 14.51s to 3.11s.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[rebased]
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
Sungbo Eo 763914ef1b ramips: improve netis WF-2881 support
This patch does the following:

1. remove u-boot-env partition
   Stock bootloader saves env variables at 0x80000 in flash,
   and there is nothing stored at 0x30000.
   By merging the partition "u-boot-env" with "u-boot",
   the partition table becomes the same as used in stock firmware:
   00000000-00080000: "Bootloader"
   00080000-00100000: "Config"
   00100000-00140000: "Factory"
   00140000-07f80000: "Kernel"

2. fix LAN/WAN MAC addresses and provide label MAC address
   Ethernet MAC addresses are stored in factory partition at:
   0xe000: LAN (label_mac)
   0xe006: WAN (label_mac+1)

3. fix LAN port order
   WF-2881 LAN ports are in reverse order of switch ports.

4. fix WiFi LEDs
   mt76 led nodes are added to make WiFi LEDs work.
   On top of this, mt76 node names are changed to more generic ones,
   and compatible strings are also added.

5. fix pinmux groups
   uart3 and uart2 pins are used as button and led, but jtag pins are not.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
5 years ago
Sungbo Eo 6ea5f7d44c ramips: fix MTK_SOC for RT3662 devices
rt3883.mk contains both RT3662 and RT3883 device profiles, but commit
6a104ac772 set MTK_SOC to rt3883 for all devices. This patch fixes it,
and renames dts files accordingly. And SoC compatible strings are also
appended in the dts.

Fixes: 6a104ac772 ("ramips/rt288x,rt3883: Name DTS files based on scheme")

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
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
Adrian Schmutzler 65d76175a5 ramips: improve common definition for Netgear R6xxx in mt7621.mk
This patch renames and reassembles the common definition for
Netgear R6xxx devices in mt7621.mk. The following goals should be
achieved:
- Give the node a more generic name instead of adding devices to it
- Use the common definition in the (less) similar R6220 node
- Include/exclude settings into the common definition so the common
  node contains the common definitions
- Prepare for support of R6700 v2

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 0975c35b83 ramips: add newline for ASUS RT-ACx5P DTSes
Those files are missing the newline at the end.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Rosen Penev c36ef5970b ramips: ethernet: Replace random_ether_addr with eth_hw_addr_random
eth_hw_addr_random additionally sets addr_assign_type to NET_ADDR_RANDOM.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
5 years ago
Paul Fertser 522d5ff428 ramips: add support for Xiaomi Mi Wi-Fi Router 3G v2
- CMIIT ID: 2019AP2581
- SoC:      MediaTek MT7621
- Flash:    16MiB NOR SPI (GigaDevice GD25Q128B)
- RAM:      128MiB DDR3 (ESMT M15T1G1664A)
- Serial:   As marked on PCB, 3V3 logic, baudrate is 115200, 8n1
- Ethernet: 3x 10/100/1000 Mbps (switched, 2xLAN + WAN)
- WIFI0:    MT7603E 2.4GHz 802.11b/g/n
- WIFI1:    MT7612E 5GHz 802.11ac
- Antennas: 4x external (2 per radio), non-detachable
- LEDs:     Programmable "power" LED (two-coloured, yellow/blue)
            Non-programmable "internet" LED (shows WAN activity)
- Buttons:  Reset

INSTALLATION:

Bootloader won't accept any serial input unless "boot_wait" u-boot
environment variable is changed to "on". Vendor firmware (looks like
an illegal OpenWrt fork) won't accept any serial input unless
"uart_en" is set to "1". Tricks to force u-boot to use default
environment do not help as it's restricted in the same way.

With bootloader unlocked the easiest way would be to TFTP the
sysupgrade image or to sysupgrade after loading an initramfs one.

For porting the flash contents were changed externally with an SPI
programmer (after lifting Vcc flash IC pin away from the PCB).

Forum thread [0] indicates that this device is identical to "Xiaomi Mi
Router 4A Gigabit Edition".

[0] https://forum.openwrt.org/t/xiaomi-mi-router-4a-gigabit-edition-r4ag-r4a-gigabit-fully-supported-but-requires-overwriting-spi-flash-with-programmer/36685

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
5 years ago
Adrian Schmutzler 1abb473cea ramips: remove phy0tpt trigger from RT-AC65P/RT-AC85P power LED
This patch removes a phy0tpt trigger from the power LED, which
seems to have been added by mistake.

WiFi LEDs using phy0radio and phy1radio triggers are present and
used correctly.

Cc: Birger Koblitz <mail@birger-koblitz.de>

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler b6d53f1d02 ramips: remove redundant mtd-eeprom in mt76x8 DTS files
In mt7628an.dtsi, calibration data for wmac is already defined:
mediatek,mtd-eeprom = <&factory 0x0>;

Thus, this patch removes redundant entries of this property in
derived DTS files.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 547720fb48 ramips: remove redundant mtd-mac-address for WiFi
When caldata locations are defined with mediatek,mtd-eeprom the
MAC address is automatically read from offset +4. Thus, specifying
that location explicitly is redundant.

This patch removes those redundant definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Gabor Varga 7c5f712e4f ramips: add support for Asus RT-AC65P
The Asus RT-AC65P router is identical with the RT-AC85P, but better to make separate images for it.

On both routers the installation can be done also via SSH:

Note: The user/password for SSH is identical with the one used in the
Web-interface.

1. Complete the initial setup wizard.
2. Activate SSH under "Administration" -> "System".
3. Transfer the OpenWrt factory image via scp:
 > scp openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin admin@192.168.50.1:/tmp
4. Connect via SSH to the router.
 > ssh admin@192.168.50.1
5. Write the OpenWrt image to flash.
 > mtd-write -i
/tmp/openwrt-ramips-mt7621-asus_rt-ac65p-squashfs-factory.bin -d linux
6. Reboot the router
 > reboot

Changelog:

v3: removed [] from filename, rebased to latest master
v2: Rebased to latest master
v1: Initial release

Signed-off-by: Gabor Varga <vargagab@gmail.com>
5 years ago
Adrian Schmutzler fd1d03f853 ramips: fix LAN/WAN MAC addresses of Xiaomi MiWiFi Mini board
Based on stock firmware tests, both LAN and WAN ports use the
MAC address from 0x28 on factory partition.

In OpenWrt, this one is already set in DTS. This patch removes the
local bit set in 02_network previously, and adjusts LAN/WAN
addresses as on stock firmware.

Note that in tests we found a MAC address in 0x2e that is the one
in 0x28 plus 1. Since stock firmware does not use it though, we
do not use it either.

Thanks to Chih-Wei Chen for testing this on his device.

ref: https://github.com/openwrt/openwrt/pull/2497

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler e4155bcc45 ramips: fix TARGET_DEVICES after UniElec rename
Device node names were updated, but updating TARGET_DEVICES
was overlooked.

Fixes: 4408723d42 ("ramips: remove RAM size from device name
for UniElec devices")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 4408723d42 ramips: remove RAM size from device name for UniElec devices
UniElec devices are the last ones in ramips target still having
the RAM size in device name although RAM size is auto-detected.

Remove this from device name, compatible, etc., as it's not
required and might be misleading to users and developers adding
device support copying those devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 556ff09875 ramips/mt762x: convert devices to interrupt-driven gpio-keys
This converts all remaining devices to use interrupt-driven
gpio-keys compatible instead of gpio-keys-polled.
The poll-interval is removed.

While at it, add/remove newlines in keys and leds node where
necessary.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler e816c50993 ramips: fix whitespace issues in DTS files
This is the result of grepping/searching for several common
whitespace issues like double empty lines, leading spaces, etc.

This patch fixes them for the ramips target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler d1072096f4 ramips: fix WiFi MAC addresses for D-Link DIR-810L
So far, WiFi MAC addresses for this device have been set up from
caldata. However, this returns values which do not look like MAC
addresses. They also do not match stock firmware:

wlan0 (5.0): 00:11:22:00:17:D0 from 0x8004
wlan1 (2.4): 00:11:22:00:17:CD from 0x4 (and 0x2e)

It looks like the only valid MAC address on this device is at 0x28.

So, this patch changes setup to calculate addresses based on the
value at 0x28:

lan: *:0A (flash, label)
wan: *:0B (flash + 1)
wifi2: *:0A (flash)
wifi5: *:0C (flash + 2)

Thanks to Roger Pueyo Centelles <roger.pueyo@guifi.net> for
investigating this on his devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 2c60de0e3f treewide: move MAC address patch functions to common library
This unifies MAC address patch functions and moves them to a
common script. While those were implemented differently for
different targets, they all seem to do the same. The number of
different variants is significantly reduced by this patch.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 5b6a809092 treewide: move calibration data extraction function to library
This moves the almost identical calibration data extraction
functions present multiple times in several targets to a single
library file /lib/functions/caldata.sh.

Functions are renamed with more generic names to merge different
variants that only differ in their names.

Most of the targets used find_mtd_chardev, while some used
find_mtd_part inside the extraction code. To merge them, the more
abundant version with find_mtd_chardev is used in the common code.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[rebase on latest master; add mpc85xx]
Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Roger Pueyo Centelles ac36cca012 ramips: mt7621: Alternative name KE 2P for Phicomm K2P
The Phicomm KE 2P is identical to the already supported Phicomm K2P,
renamed for the European market. Use the ALT0 buildroot tags to show
both devices.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
5 years ago
Koen Vandeputte 9b04a7576b kernel: bump 4.14 to 4.14.147
Refreshed all patches.

Altered patches:
- 403-mtd_fix_cfi_cmdset_0002_status_check.patch (ar71xx)
- 403-mtd_fix_cfi_cmdset_0002_status_check.patch (ath79)

Compile-tested on: cns3xxx, imx6
Runtime-tested on: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Davide Fioravanti 67d019ac94 ramips: enable LED VCC for Asus RT-AC51U
Previously only the power LED was working.
With this patch all leds except 5GHz are working.

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
[rephrased commit title, drop status property]
Signed-off-by: David Bauer <mail@david-bauer.net>
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
Adrian Schmutzler 22e876fdb0 ramips: add label MAC address for Asus RT-AC85P
The label shows the MAC address of 2.4 GHz WiFi.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 400e56d22c ramips: apply consistent device name/compatible to ZBT-WE1026-5G
All Zbtlink ramips devices except the ZBT-WE1026-5G include the
zbt-/ZBT- prefix in their model name.

This changes ZBT-WE1026-5G to also follow that scheme.

The patch moves some block to keep alphatical order.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler b376818f97 ramips: harmonize device vendor Zbtlink
Spelling of Zbtlink varies across image definitions and DTS files.

This patch uses Zbtlink consistently and also updates the model
in DTS files to contain the vendor in all cases.

This patch is cosmetical, as there should be no dependencies on
device model name in ramips anymore.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 724875b8d0 ramips: merge cases in 02_network
This merges three cases with a single switch port.

6t@eth0 and 6@eth0 should be equivalent.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 7b8b4197d2 ramips: initialize youhua, wr1200js WAN MAC addresses from flash
This patch changes wan MAC address setup for youhua,wr1200js
from retrieving it by calculation to reading it from flash.

This has been checked on-device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
INAGAKI Hiroshi 12ab6ef5c3 ramips: add support for I-O DATA WNPR2600G
I-O DATA WNPR2600G is a 2.4/5 GHz band 11ac router, based on MediaTek
MT7621A.

Specification:

- SoC           : MediaTek MT7621A
- RAM           : DDR3 128 MiB
- Flash         : SPI-NOR 16 MiB
- WLAN          : 2.4/5 GHz 4T4R
  - 2.4 GHz     : MediaTek MT7615
  - 5 GHz       : MediaTek MT7615
- Ethernet      : 10/100/1000 Mbps
  - Switch      : MT7530 (SoC)
- LED/keys      : 4x/3x (2x buttons, 1x slide-switch)
- UART          : through-hole on PCB
  - J1: Vcc, RX, GND, TX from SoC side
  - 57600n8

Flash instruction using factory image:

1. Boot WNPR2600G normaly
2. Access to "http://192.168.0.1/" and open firmware update page
("ファームウェア")
3. Select the OpenWrt factory image and click update ("更新") button
to perform firmware update
4. Wait ~150 seconds to complete flashing

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years ago
INAGAKI Hiroshi c1394dabf6 ramips: move "elx-header" to Makefile from mt7620.mk and mt7621.mk
I-O DATA WNPR2600G has an "elx-header", so move this definition to
generic makefile to use it from mt7621 subtarget.
This definition is also added to mt7621.mk in
f285e8634c, so remove it from mt7621.mk.

And added a line to cleanup used header file.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years ago
INAGAKI Hiroshi 6c3ae072dc ramips: replace MAC address configuration for I-O DATA WN-AC-GR devices
following I-O DATA devices have a MAC address as "wanaddr" for WAN
interface in u-boot-env:

- WN-AC1167GR
- WN-AC733GR3

I replaced MAC address configuration in these devices to omit
address calculation in 02_network.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
5 years ago
Sungbo Eo b7ec6659a1 ramips: add support for ipTIME A3
ipTIME A3 is a 2.4/5GHz band AC1200 router, based on MediaTek
MT7628AN.

Specifications:
- SoC: MT7628AN
- RAM: DDR2 64MB
- Flash: SPI NOR 8MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7612EN
- Ethernet: 3x 10/100Mbps
  - Switch: SoC internal
- UART:
  - J1: 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>
5 years ago
Qi Jiang 93b6cc97ca ramips: add support for XiaoYu XY-C5
Hardware:
SoC:      MT7621A
Flash:    32 MiB
RAM:      512 MiB
Ethernet: built-in switch
USB:      1x USB3.0
SATA:     ASM1060, 1 SATA port

Flash instruction (TFTP):
1. Set PC to fixed ip address 192.168.173.22
2. Download *-sysupgrade.bin image and rename it to firmware.img
3. Start a tftp server with the image file in its root directory
4. Turn off the router
5. Turn on router,press the reset button and wait ~15 seconds
6. Release the reset button and after a short time
   the firmware should be transferred from the tftp server
7. Wait ~3 minutes to complete recovery.

Signed-off-by: Qi Jiang <rushx@live.cn>
[squash commits, add label-mac-device, fix sign-off style]
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Adrian Schmutzler 5b96421964 ramips: replace backticks by $(...)
This replaces deprecated backticks by more versatile $(...) syntax.

While at it, remove some useless cat commands and deprecated
egrep commands.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Nick Briggs 3df3bb0dae ramips: add support for EnGenius ESR600
The EnGenius ESR600 is a dual band wireless router with a 4-port gigabit
Ethernet switch, a gigabit Ethernet WAN port and a USB port.

Specification:

- Bootloader:	U-Boot
- SoC:		MediaTek MT7620A (600 MHz)
- Flash:	16MB, Macronix MX25L12845E
- RAM:		64MB, Nanya NT5TU32M16DG-AC
- Serial:	115200 baud, no header, 3.3V
  		J2: Vcc (arrow), Gnd, Tx, Rx
- USB:		USB 2, 5V
- Ethernet:	5 x 1 Gb/s 4 LAN 1 WAN, Atheros AR8327
- WiFi0:	5 GHz 802.11 b/g/n Ralink RT5592N
  		300 Mb/s, 2T2R
- WiFi1:	2.4 GHz 802.11 b/g/n integrated
  		300 Mb/s, 2T2R
- Antennas:	2 per radio, internal
- LEDs:		1 programmable power (amber)
  		2 programable radio (blue)
		1 programable WPS-5G (blue)
		1 non-programable WAN activity (blue)
		1 unconfigured WPS-2.4G (amber)
- Buttons:	GPIO: Reset, WPS

Installation:

Use the OEM web interface to install the ...-factory.dlf image.
Use the OpenWRT ...-sysupgrade.bin image for future upgrades.

The J2 serial port can be accessed either by soldering in a header,
standard 0.1" spacing, or by using pogo-pins against the back side.

As configured by the OEM, the U-Boot boot delay is short, however quickly
typing "1" leads to the U-Boot "System load Linux to SDRAM via TFTP"
prompt.  The TFTP client is configured by default with
     client:   192.168.99.9
     server:   192.168.99.8
     filename: uImageESR600
It will load an OpenWRT initramfs kernel with this method.

Known issues:

1) Only the ports externally labeled WAN, LAN3 and LAN4 are operational.
LAN1 and LAN2 do not appear to power up. This issue is also present
in the Lava LR25G001.

2) The amber WPS-2.4G LED, in the same lightguide as the blue WPS-5G LED,
is not configured in the Device Tree specification.

3) The blue WAN activity LED is not configured in the Device Tree
specification as this causes the AR8327 switch to fail to initialize.

Signed-off-by: Nick Briggs <nicholas.h.briggs@gmail.com>
[merge conflict in 02_network]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Daniel Danzberger 10c5d3dd5f ramips: mt7621: Add new device AsiaRF AP7621-NV1
SoC:    Mediatek MT7621A
CPU:    4x 880Mhz
Cache:  32 KB I-Cache and 32 KB D-Cach
        256 KB L2 Cache (shared by Dual-Core)
RAM:    DDR3 512MB 16bits BUS
FLASH:  16MB
Switch: Mediatek Gigabit Switch (2 x LAN, 1 x WAN)
POE:    (1x PD, 2x PSE)
USB:    1x 3.0
PCI:    3x Mini PCIe (3 USB2.0 + 2 x UIM interface)
GPS:    Quectel L70B
SIM:    2 Slots
BTN:    Reset
LED:    - Power
        - Ethernet
        - Wifi
        - USB
UART:  UART is present as Pads with throughholes on the PCB.
       They are located on left side.
       3.3V - RX - GND - TX / 57600-8N1
       3.3V is the square pad

Installation
------------
The stock image is a modified openwrt and can be overflashed via sysupgrade -F

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
[merge conflict in mt7621.mk]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Birger Koblitz fde8e2e035 ramips: add support for Asus RT-AC85P
SoC:	MediaTek MT7621AT dual-core @ 880MHz
RAM:	256M (Winbond W632GG6KB-1)
FLASH:	128MB (Macronix MX30LF1G18AC-TI)
WiFi:	- 2.4GHz MediaTek MT7615N bgn
	- 5GHz MediaTek MT7615N nac
Switch: SoC integrated Gigabit Switch (4 x LAN, 1 x WAN)
USB:	1 x USB 3.1 (Gen 1)
BTN:	Reset, WPS
LED:	- Power (blue)
	- 5Ghz (blue)
	- 2.4GHz (blue)
	- Internet (blue)
	- 4x LAN (blue)
	(LAN/WAN leds are not controllable by GPIOs)
UART: 	UART is present as Pads marked J4 on the PCB.
	3.3V - TX - RX - GND / 57600-8N1
	3.3V is the square pad
MAC:	The MAC address on the router-label matches the MAC of
	the 2.4 GHz WiFi.
	LAN and WAN MAC are identical: MAC_LABEL+4
	5 GHz WiFi MAC: also MAC_LABEL+4

Installation
------------
Via U-Boot tftpd:
Switch on device, within 2s press reset button and keep pressed
until power LED starts blinking slowly.
Upload factory image via tftp put, the router's ip is 192.168.1.1
and expects the client on 192.168.1.75.

The images also work on the Asus RT-AC65P models as tested by Gabor.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
Tested-by: Gabor Varga <vargagab@gmail.com>
[fixed Asus -> ASUS in DTS]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Birger Koblitz f285e8634c ramips: add support for Edimax RG21S
SoC:	MediaTek MT7621AT dual-core @ 880MHz
RAM:	256M (Nanya NT5CC128M)
FLASH:	16MB (Macronix MX25L12835F)
WiFi:	- 2.4GHz MediaTek MT7615N bgn
	- 5GHz MediaTek MT7615N nac
Switch: SoC integrated Gigabit Switch (4 x LAN, 1 x WAN)
USB:	No
BTN:	Reset, WPS
LED:	4 red LEDs, indistinguishable when casing closed
UART: 	UART is present as Pads marked J1 on the PCB.
	3.3V - RX - GND - TX / 57600-8N1
	3.3V is the square pad

Installation
------------
Update the factory image via the OEM web-interface
(by default:http://192.168.1.1)
The sysupgrade image can be installed via TFTP from
the U-Boot bootloader. Connect ethernet port 2.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
[flash node rename, EDIMAX -> Edimax, complete device model name]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Adrian Schmutzler 7140394903 ramips: provide label MAC address
This patch adds the label MAC address for several devices in
ramips.

Some devices require setting the MAC address in 02_network:

For the following devices, the netif device can be linked in
device tree, but the MAC address cannot be read:
- cudy,wr1000
- dlink,dir-615-d
- dlink,dir-615-h1
- dlink,dir-860l-b1
- glinet,gl-mt300a
- glinet,gl-mt300n
- glinet,gl-mt750
- vocore,vocore2
- vocore,vocore2-lite
- zbtlink,zbt-we1326
- zbtlink,zbt-wg3526

For the following devices, label MAC address is tied to lan or
wan, so no node to link to exists in device tree:
- dlink,dir-510l
- dlink,dwr-116-a1
- dlink,dwr-118-a1
- dlink,dwr-118-a2
- dlink,dwr-921-c1
- dlink,dwr-922-e2
- all hiwifi devices
- lava,lr-25g001
- xiaomi,mir3p

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Ivan Hörler c03a328b10 ramips: add SD-Card support for Linkit Smart 7688
The Linkit Smart 7688 has a SD-Card reader that does not work with the official build of openwrt. Adding kmod-sdhci-mt7620 makes it working.

Signed-off-by: Ivan Hörler <i.hoerler@me.com>
5 years ago
Daniel Golle 6364e03736 ramips: only add spidev node in for WrtNode2R (and not for 2P)
Only the 2R version got the STM32 uC connected as 2nd SPI device.
Hence move the spidev node from mt7628an_wrtnode_wrtnode2.dtsi to
mt7628an_wrtnode_wrtnode2r.dts.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Roger Pueyo Centelles e667d6f46b ramips: enable external amplifier for D-Link DIR-810L
The 2.4 GHz radio had very poor signal reception (-89 dBm for an AP
sitting 5 m away). By enabling the external amplifier, received signal
has improved to -50 dBm for the same AP.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
5 years ago
Adrian Schmutzler 869a0183b9 ramips: fix MAC address setup for Newifi Y1 and Y1S
So far, MAC address setup for those devices has been using local
addresses although additional MAC addresses are available on flash.

On device, we found the following situation:
position   Y1     Y1S
0x4        *:d4   *:e4
0x8004     *:d6   *:e8
0x28       *:d4   *:e4
0x2e       *:d7   *:eb

Since 0x4 and 0x28 yield the same address, the former was set for
&ethernet in DTS. However, the typical location on this
architecture is 0x28, so this patch changes that.

For further setup in 02_network, the local bit for lan_mac is
removed, so the address from &ethernet is used at all. For wan_mac,
instead of calculating an address with local bit set, this patch
exploits the previously unused address in 0x2e.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler aaf90d8808 ramips: initialize MAC addresses from flash where possible
This patch changes wan MAC address setup from retrieving it by
calculation to reading it from flash.

Changes are limited to cases where on-device check was possible.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[fix mac for newifi-d1; drop adslr,g7 because it's unlikely for
vendor to specifically use 2.4g mac as wan_mac]
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Adrian Schmutzler e35e4a996e ramips: fix duplicate network setup for dlink,dir-615-h1
In 555ca422d1 ("ramips: fix D-Link DIR-615 H1 switch port
mapping"), port setup for dir-615-h1 was changed without removing
the old one. This was working as the new one was triggered earlier
than the old one.

(In the meantine, changed sorting during ramips rename patches
actually inversed that order.)

Anyway, just remove the wrong case now.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler ad4eb2241b ramips: remove duplicate case for MAC setup of freestation5
ARC FreeStation5 is present twice in MAC address setup.

From older commits/changes, it is not possible to reconstruct
the correct choice only by reading the annotations.

Thus, remove the second case and keep the first one, so behavior
stays the same (as nobody seems to have complained about it).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Adrian Schmutzler 6640e1c368 ramips: clean and improve MAC address setup in 02_network
This patch removes unnecessary MAC address setup statements in
ramips' 02_network by doing several optimizations:

1. For the following devices, lan_mac was set up with
   mtd_get_mac_binary although the same address was set in DTS.
   The lan_mac statement is removed in 02_network, but
   wan_mac is kept:
   - mercury,mac1200r-v2
   - phicomm,k2g
   - skylab,skw92a
   - wiznet,wizfi630a

2. For the following devices, wan_mac was set up with
   mtd_get_mac_binary although the same address was set in DTS.
   The wan_mac statement is removed in 02_network, no
   lan_mac is present:
   - buffalo,whr-g300n
   - glinet,gl-mt300n-v2
   - zyxel,keenetic-start

3. For the following device, lan_mac and wan_mac were set up
   with mtd_get_mac_binary to the same address as set in DTS.
   Both statements are removed in 02_network:
   - buffalo,whr-600d

4. For some devices, it was possible to move setup from 02_network
   to DTS by introducing previously missing mtd_mac_address:
   - buffalo,whr-1166d
   - buffalo,whr-300hp2
   - buffalo,wsr-600dhp
   - ohyeah,oy-0001
   - planex,vr500

5. For one device, mtd_mac_address was just wrong and overwritten
   by 02_network. Put the correct value in DTS and remove redundant
   statement in 02_network:
   - asus,rt-ac57u

6. For one device, MAC address defined in DTS is exchanged together
   with lan_mac/wan_mac setup in 02_network, so that cases in
   02_network can be merged:
   - phicomm,k2p

For some devices, an empty case has to be used to prevent them
from falling into the default case and have
WAN address = eth0 address + 1 set to them.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
5 years ago
Chuanhong Guo 7a21c85f70 ramips: improve support for Xiaomi Miwifi Nano
This patch does the following things:
1. mark u-boot-env writable
2. add bootcount support
   Currently, u-boot has a flag_boot_success env variable to reset.
   Also reset it in our firmware to follow the behavior in vendor's
   firmware.
3. disable usb support
   This router doesn't have usb port at all.
4. increase spi clock to 40MHz
5. fix pinmux groups

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Christoph Krapp 6cea9688af ramips: add support for Netgear R6260 and R6850
As Netgear uses the same image for R6260, R6350 & R6850
we can merge device tree files and generate separate
images for each device.

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
[add missing WiFi compatible string, fix network
configuration]
Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Christoph Krapp 3c8df280a9 ramips: add factory image for Netgear R6350
This adds factory image generation for all three
devices. These images can be flashed via WebUI
for easy installation.

Thanks to David Bauer for the inspiration.

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
[altered commit to only include the R6350]
Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Christoph Krapp 9861fa7aba ramips: add mt7615e support to Netgear R6350
Signed-off-by: Christoph Krapp <achterin@googlemail.com>
5 years ago
David Bauer 13937a16d4 ramips: fix network setup for various NETGEAR boards
There are currently the following issues present for the Netgear R6220,
R6350 and WNDR3700 v5:

 - LAN and WAN MAC-addresses are inverted
 - WAN MAC-address is off. It are +2 compared to the LAN MAC-address
   (R6350 only)
 - Switchport order is inverted in LuCi

This commit fixes both these issues by assigning correct MAC-addresses
to LAN and WAN interfaces and defining the switchports with the correct
labels.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
David Bauer fa46c9b208 ramips: use phy trigger for various Netgear boards
This commit switches the default trigger for the WiFi LED from a netdev
trigger on "wlan0" to a wireless-phy based trigger. THis allows the LED
to work, even when the wireless interface is not named "wlan0" without
modifiying the LED settings.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
David Bauer 607dfdf211 ramips: add factory image for NETGEAR R6220
This adds an easy-installation factory image for the NETGEAR R6220
router. The factory image can either be flashed via the vendor Web-UI or
the bootloader using nmrpflash.

Tested with NETGEAR V1.1.0.86 firmware.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
David Bauer 527832e54b ramips: disable badblock shifting for MT7621 NAND
The MediaTek MT7621 NAND driver currently intransparently shifts NAND
pages when a block is marked as bad. Because of this, offsets for e.g.
caldata and MAC-addresses seem to be off.

This is, howeer, not a task for the mtd NAND driver, as the flash
translation layer is tasked with this.

This patch disables this badblock shifting. This fix was originally
proposed by Jo-Philipp Wich at
https://bugs.openwrt.org/index.php?do=details&task_id=1926

Fixes FS#1926 ("MTD partition offset not correctly mapped when bad
eraseblocks present")
Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Christian Lamparter 3dc5716b07 ramips: add NAS goodies on U25AWF-H1 + U35[N|W]F
These devices are sold as a "NAS HDD Enclousure"
and have a "NAS Media Streaming & File Server & AP" on
the box. That's why I think they should have some support
for the HDD right out-of-the-box.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Zhenjian Zhang fb3574f123 ramips: add support for ADSLR G7
SoC: MT7621AT
RAM: 256MB
Flash: 16M SPI
Ethernet: 5x GE ports
WiFi: 2.4G: MT7615N
5G: MT7615N

Flash instruction:
1.Modify the file to linux.bin
2.Set up FTP service
3.Computer settings fixed IP: 192.168.179.50 255.255.255.0
4.Turn on the power and press and hold the reset button until the indicator light is on for about 5 seconds.

Signed-off-by: Zhenjian Zhang <itdesk.zhang@gmail.com>
[fix mac location]
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago