Commit Graph

23383 Commits (fbd4214bb0727268aa535af5b600d38939ec8dbc)

Author SHA1 Message Date
Thibaut VARÈNE a874c87f4c generic: platform/mikrotik: add board_revision tag
Tag was discovered exploring the hard_config of a "r2" board.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 0217a9be0d generic: platform/mikrotik: graceful fallback for cpufreq_index
The current code would return an error on ath79 when the SoC isn't known
to the driver. Return the raw hex value instead, as happens with non
supported targets.
Also return the correctly incremented value from
sc_tag_cpufreq_ath79_arraysize()

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 2714a4faab generic: platform/mikrotik: match RouterBOOT nomenclature
RouterBOOT cpu frequency settings are letter-indexed. Follow the
same logic for the sysfs interface.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 5c4b431a3c generic: platform/mikrotik: fix routerboot_tag_show_u32s()
The routine would only accurately print out the first word.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Fixes: 5ecf7d96 ("generic: routerboot sysfs platform driver")
4 years ago
Davide Fioravanti 8c13ebd3ad ramips: add support for Edimax Gemini RE23S
Hardware
--------
SoC:   Mediatek MT7621AT (880 MHz, 2 cores 4 threads)
RAM:   128MB
FLASH: 16MB NOR (Macronix MX25L12805D)
ETH:   1x 10/100/1000 Mbps Ethernet (MT7530)
WIFI:
  - 2.4GHz: 1x MT7615 (4x4:4)
  - 5GHz:   1x MT7615 (4x4:4)
  - 4 antennas: 2 external detachable and 2 internal
BTN:
  - 1x Reset button
  - 1x WPS button
LEDS:
  - 1x Green led (Power)
  - 1x Green-Amber-Red led (Wifi)
UART:
  - 57600-8-N-1

Everything works correctly.

Installation
------------
Flash the factory image directly from OEM web interface.
(You can login using these credentials: admin/1234)

Restore OEM Firmware
--------------------
Flash the OEM "bin" firmware directly from LUCI.
The firmware is downloadable from the OEM web page.
Warning: Remember to not keep settings!
Warning2: Remember to force the flash.

Restoring procedure tested with RE23_1.08.bin

MAC addresses
-------------
factory 0x4     *:24
factory 0x8004  *:25
Cimage  0x07    *:24
Cimage  0x0D    *:24
Cimage  0x13    *:24
Cimage  0x19    *:25

No other addresses were found in factory partition.

Since the label contains both the 2.4GHz and 5GHz mac address I decided
to set the 5GHz one as label-mac-device. Moreover it also corresponds
to the lan mac address.

Notes
-----
The wifi led in the OEM firmware changes colour depending on the signal
strength. This can be done in OpenWrt but just for one interface.
So for now will not be any default action for this led.

If you want to open the case, pay attention to the antenna placed on
the bottom part of the front cover.
The wire is a bit short and it breaks easily. (I broke it)

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
[fix two typos and add extended MAC address section to commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Hauke Mehrtens 66e04abbb6 ar71xx: Fix mikrotik NAND compile problem
This Fixes the folowing compile error:
drivers/mtd/nand/rb91x_nand.c: In function 'rb91x_nand_remove':
drivers/mtd/nand/rb91x_nand.c:445:16: error: 'rbni' undeclared (first use in this function)
  nand_release(&rbni->chip);

Fixes: ce958dd88a ("kernel: Update kernel 4.14 to version 4.14.187")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Petr Štetiar ae2d249056 ath79: nand: disable images for glinet_gl-ar750s
Fixes following build failures:

 WARNING: Image file glinet_gl-ar750s-nor-kernel.bin is too big
 WARNING: Image file glinet_gl-ar750s-nor-nand-kernel.bin is too big

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Andrey Bondar 326e488c7b ath79: add support for 8devices Rambutan board
Rambutan is a Wifi module based on QCA9550/9557
http://www.8devices.com/products/rambutan

Specification:

- 720/600/200 MHz (CPU/DDR/AHB)
- 128 MB of DDR2 RAM
- 128 MB of NAND Flash
- 1x 100Mbps Ethernet
- 1x 1000Mbps Ethernet (PHY on dev-kit)
- 1x Wifi radio 2x2 MIMO, dualband 2.4 and 5 GHz
- 2x U.FL connectors on module, chip antennas on dev-kit
- 1x miniPCIe slot
- 2x USB2.0 host
- 2x UART
- SPI, I2C, GPIO

Flash instructions:

Upgrade from ar71xx target:
 sysupgrade -F /tmp/openwrt-ath79-nand-8dev_rambutan-squashfs-sysupgrade.tar
or upgrade from GUI (don't save config)

Use factory image to flash from U-Boot:
 tftpboot 80060000 openwrt-ath79-nand-8dev_rambutan-squashfs-factory.ubi
 nand erase.part ubi
 nand write 80060000 ubi ${filesize}

Signed-off-by: Petr Štetiar <ynezz@true.cz> [copy&pasted missing commit description]
Signed-off-by: Andrey Bondar <a.bondar@8devices.com>
4 years ago
Adrian Schmutzler 7cb721c03f ramips: use WiFi LED DT triggers for TP-Link RE650 v1
This moves WiFi LED triggers from 01_leds to device tree.

While at it, convert the labels there to lower case; this is
more commonly used and the change will actually remove competition
between DT trigger and leftover uci config on already installed
systems.

Suggested-by: Georgi Vlaev <georgi.vlaev@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer d8ab3216e6 ath79: switch to kernel 5.4
As the reported major bugs are ironed out, switch to the new kernel to
begin testing with a broader audience.

Signed-off-by: David Bauer <mail@david-bauer.net>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Aleksander Jan Bajkowski f496939f15 lantiq: set port numbers corresponding to reg value
Fix inconsistencies found in DTS files and sort ethernet ports based on
updated names.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
[squash two separate patches, rephrase commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Aleksander Jan Bajkowski 3866fefa38 lantiq: remove redundant includes from fritz736x DTS files
The removed lines are already included in vr9_avm_fritz736x.dtsi

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
[rephrase commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Christoph Krapp ba0f4f0cfd ramips: add support for TP-Link RE500 v1
This device uses the same hardware as RE650 v1 which got supported in
8c51dde.

Hardware specification:

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

Flash instructions:

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

TFTP recovery to stock firmware:

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

Signed-off-by: Christoph Krapp <achterin@googlemail.com>
[remove dts-v1 in DTSI, do not touch WiFi LEDs for RE650, keep
state_default in DTS files, fix label-mac-device, use lower case
for WiFi LEDs]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Martin Blumenstingl 982468de35 lantiq: dts: Move the &usb_vbus nodes out of &gpio
Move the USB VBUS regulator nodes out of the GPIO controller node. This
fixes a problem where the "regulator-fixed" driver wasn't probed for
these regulators because the GPIO driver doesn't scan the child-nodes
and based on the dt-bindings documentation it's not supposed to.

This fixed the following error reported by Luca Olivetti:
  ...
  dwc2 1e101000.usb: DWC OTG Controller
  dwc2 1e101000.usb: new USB bus registered, assigned bus number 1
  dwc2 1e101000.usb: irq 62, io mem 0x1e101000
  dwc2 1e101000.usb: startup error -517
  dwc2 1e101000.usb: USB bus 1 deregistered
  dwc2 1e101000.usb: dwc2_hcd_init() FAILED, returning -517

Fixes: FS#1634
Cc: Luca Olivetti <luca@ventoso.org>
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
4 years ago
Matthew Gyurgyik bb14d44039 kernel/pcengines-apu2: detect apuv4 board
Upstream commit 3d00da1de3 ("platform/x86: pcengines-apuv2: detect apuv4
board")

On 5.4, this module fails on APUv4 due to non-matching DMI data. With this
patch, the module will match DMI data for the APUv4.

Signed-off-by: Matthew Gyurgyik <matthew@gyurgyik.io>
[include upstream patch description]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Lars Wessels f855eb91b3 lantiq: added switch-config for ARV752DPW
Add missing switch config (4 LAN-Ports + CPU).

Grey WAN port (used for ADSL) is not part of the switch.

Signed-off-by: Lars Wessels <software@bytebox.org>
[rework commit message]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Lars Wessels 702366a30b lantiq: wifi mac fix for ARV752DPW
Set wifi mac from flash partition 'board_config' to
match the label on the device (Easybox 802).

Currently the wifi mac is always set to 00:0c:43:28:60:00.
eth0 and WiFi will now share the same mac (as in original firmware).

Signed-off-by: Lars Wessels <software@bytebox.org>
[improve commit message]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Sunguk Lee 2d378703f1 ramips: reduce spi-max-frequency for ipTIME A8004T
Reduce spi-max-frequency for ipTIME A8004T and disable
m25p,fast-read option.

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

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

Signed-off-by: Sunguk Lee <d3m3vilurr@gmail.com>
[minor commit title/message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 883250014d ipq806x: move serial0 to DTSI files
All device DTS files in the target set the serial0 property to the
same value (*). So, let's move the definitions to the DTSI files.

That's also where the kernel defines it (qcom-ipq8064-v1.0.dtsi).

* The only exception is ipq8064-db149, which defines
  "serial0 = &uart2;", but inside a block called "alias" instead of
  "aliases". It must be assumed that this is broken anyway, so we
  don't touch it here.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 74e339f118 ipq806x: move stdout-path to DTSI files
All device DTS files in the target set the stdout-path to the same
value. So, let's move the definitions to the DTSI files.

That's also where the kernel defines it (qcom-ipq8064-v1.0.dtsi).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler ed761344d2 ipq806x: disentangle and clean up SoC DTSI files
So far, the DTSI files on ipq806x had a linear inheritance:

  qcom-ipq8064.dtsi
  v
  qcom-ipq8064-v1.0.dtsi
  v
  qcom-ipq8064-v2.0.dtsi
  v
  qcom-ipq8065.dtsi

This poses problems when one wants to set something that is specific
to an architecture closer to the top of the tree.

In this patch, we remove the chain-like inheritance and have all
other files derived from qcom-ipq8064.dtsi (changing this name to
something more generic is not possible due to upstream use).

The removal of inheritance will require a few entries to be copied
from qcom-ipq8064-v2.0.dtsi to qcom-ipq8065.dtsi. However, it also
opens an opportunity for some clean-up:

- Many definitions can be improved by just using the innermost labels.

- Instead of disabling the CPU_SPC node for ipq8065, it is now off by
  default and enabled where needed.

- Instead of patching phy-tx0-term-offset into qcom-ipq8064.dtsi and
  then having it changed for qcom-ipq8064-v2.0/qcom-ipq8065, just have
  the appropriate settings done in the lower DTSI files directly.

- For the opp_table0 adjustments for ipq8065, just redefine what's
  changed, but don't add all the untouched properties again.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo 19c8f11d92 ipq806x: move common pinmux nodes to SoC DTSI
As almost same pinmux nodes are repeated in each device dts,
let's define them once in the ipq8064 dtsi and remove the rest.

* uart0_pins : Did not touch.
* i2c4_pins  : This node seems to be not used at all in dts.
               Added the most common form in the dtsi. Did not touch rpm_pins.
* spi_pins   : The common mux node is already present in the dtsi.
               Removed the duplicate nodes from dts.
* nand_pins  : Moved the entire node.
* mdio0_pins : Moved the common mux node.
* rgmii2_pins: Moved the common mux node. "pins" property is overrided in ap161.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Hauke Mehrtens 014d3f593a ar71xx: Fix mikrotik NAND compile problem
There is one closing bracket too much.

Fixes: ce958dd88a ("kernel: Update kernel 4.14 to version 4.14.187")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Scott Roberts d31bbe40e2 mvebu: config define i2c pxa slave
We are setting CONFIG_I2C_PXA is not set
If you do set pxa to y then you have issues if you do not have
CONFIG_I2C_PXA_SLAVE is not set

Fixes: dd13add3ce ("kernel: i2c-pxa: remove slave")
Signed-off-by: Scott Roberts <ttocsr@gmail.com>
4 years ago
Daniel González Cabanelas a902e6a657 mvebu: LS421DE: use automatic fan control with thermal zones
The Buffalo Linkstation LS421DE has a chassis fan for cooling two internal
hard drives. Currently there is no control over this fan, running always
at fixed medium speed.

With the recent jump to the kernel 5.4, now we can monitor the hard drive
temperature and control the fan with thermal zones.

Install the kmod-hwmon-drivetemp module and wire up a thermal zone on the
dts file to allow automatic fan control by the kernel.

Tested succesfully using a single Crucial BX500 SSD drive.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Hauke Mehrtens 68d9cb8214 kernel: Update kernel 5.4 to version 5.4.50
Run tested: ath79, ipq40xx
Build tested: ath79, ipq40xx

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Hauke Mehrtens 6062d85892 kernel: Update kernel 4.19 to version 4.19.131
Fixes:
- CVE-2020-10757

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

Run tested: ath79
Build tested: ath79

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Hauke Mehrtens ce958dd88a kernel: Update kernel 4.14 to version 4.14.187
Fixes:
- CVE-2020-10757

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

Build tested: ramips

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Hauke Mehrtens 4bb5e331a7 kernel: Fix ath79 DSP exception at bootup
This resolves a hazard between a mtc0 and a mfc0 instruction after
activating the DSP support. Without this fix the CPU could use the old
value again and the DSP support would not be active.

Fixes: FS#2928, FS#2899
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de> [ath79/tl-wdr3600; ath79/tl-wdr4300]
Tested-by: David Bauer <mail@david-bauer.net> [ocedo_koala/ocedo_raccoon]
4 years ago
Antti Seppälä a175bc8f36 ath79: add support for GL.iNet GL-MiFi
Add support for the ar71xx supported GL.iNet GL-MiFi to ath79.

Specifications:
 - Atheros AR9331
 - 64 MB of RAM
 - 16 MB of FLASH (SPI NOR)
 - 2x 10/100/1000 Mbps Ethernet
 - 2.4GHz (AR9330), 802.11b/g/n
 - 1x USB 2.0 (vbus driven by GPIO)
 - 4x LED, driven by GPIO
 - 1x button (reset)
 - 1x mini pci-e slot (vcc driven by GPIO)

Flash instructions:

Vendor software is based on openwrt so you can flash the sysupgrade
image via the vendor GUI or using command line sysupgrade utility.
Make sure to not save configuration over reflash as uci settings
differ between versions.

Note on MAC addresses:

Even though the platform is capable to providing separate MAC addresses
to the interfaces vendor firmware does not seem to take advantage of
that. It appears that there is only single unique pre-programmed
address in the art partition and vendor firmware uses that for
every interface (eth0/eth1/wlan0). Similar behaviour has also been
implemented in this patch.

Note on GPIOs:

In vendor firmware the gpio controlling mini pci-e slot is named
3gcontrol while it actually controls power supply to the entire mini
pci-e slot. Therefore a more descriptive name (minipcie) was chosen.
Also during development of this patch it became apparent that the
polarity of the signal is actually active low rather than active high
that can be found in vendor firmware.

Acknowledgements:

This patch is based on earlier work[1] done by Kyson Lok. Since the
initial mailing-list submission the patch has been modified to comply
with current openwrt naming schemes and dts conventions.

[1] http://lists.openwrt.org/pipermail/openwrt-devel/2018-September/019576.html

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
4 years ago
John Audia 472f5b1474 ipq806x: refresh config
Based on "make kernel_menuconfig CONFIG_TARGET=generic" and 5.4.49

CONFIG_LEDS_TRIGGER_DISK has been removed by the refresh and added
back manually in order to not revert f93fcf8923 ("ipq806x: enable
disk-activity LED trigger").

Signed-off-by: John Audia <graysky@archlinux.us>
[extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo 91472dc2ce kirkwood: support for button in Pogoplug V4
Pogoplug V4 has a reset button on a GPIO pin.
To use it, kmod-gpio-button-hotplug package needs to be installed.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Adrian Schmutzler b123ffdf6e ath79: drop redundant status for gpio target-wide
All definitions of gpio in SoC DTSI files do not set status, i.e.
have it enabled. This drops all remaining redundant "status = okay"
definitions in descendent files (mostly older ones).

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler dc1280ef65 ath79: enable gpio on ar933x by default
All other SoC DTSI files have gpio enabled by default, only
ar9330/ar9331 disable it by default, only to have it enabled again
afterwards for each individual device.

So, do not disable it in the first place, and drop all device-specific
status statements afterwards.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Leon M. George a0bb356612 ath79: add support for Compex WPJ344
Specifications:

SoC: AR9344
DRAM: 128MB DDR2
Flash: 16MB SPI-NOR
2 Gigabit ethernet ports
2×2 2.4GHz on-board radio
miniPCIe slot that supports 5GHz radio
PoE 48V IEEE 802.3af/at - 24V passive optional
USB 2.0 header

Installation:

To install, either start tftp in bin/targets/ath79/generic/ and use
the u-boot prompt over UART:

tftpboot 0x80500000 openwrt-ath79-generic-compex_wpj344-16m-squashfs-sysupgrade.bin
erase 0x9f030000 +$filesize
erase 0x9f680000 +1
cp.b $fileaddr 0x9f030000 $filesize
boot

The cpximg file can be used with sysupgrade in the stock firmware (add
SSH key in luci for root access) or with the built-in cpximg loader.
The cpximg loader can be started either by holding the reset button
during power up or by entering the u-boot prompt and entering 'cpximg'.
Once it's running, a TFTP-server under 192.168.1.1 will accept the image
appropriate for the board revision that is etched on the board.

For example, if the board is labelled '6A08':

tftp -v -m binary 192.168.1.1 -c put openwrt-ath79-generic-compex_wpj344-16m-squashfs-cpximg-6a08.bin

MAC addresses:

<&uboot 0x2e010>  *:99  (label)
<&uboot 0x2e018>  *:9a
<&uboot 0x2e020>  *:9b
<&uboot 0x2e028>  *:9c

Only the first two are used (for ethernet), the WiFi modules have
separate (valid) addresses. The latter two addresses are not used.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[minor commit message adjustments, drop gpio in DTS, DTS style fixes,
sorting, drop unused cpximg recipe]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo 736995ce19 ath79: rearrange nand node by register address
All other nodes in the DTS are placed in order of address space. Harmonize
the nand nodes as well.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
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
Kevin Darbyshire-Bryant d59dc14515 kernel: cake: backport upstream tweaks & fixes
From upstream:
b8392808eb3f sch_cake: add RFC 8622 LE PHB support to CAKE diffserv handling
3f608f0c4136 sch_cake: fix a few style nits
8c95eca0bb8c sch_cake: don't call diffserv parsing code when it is not needed
9208d2863ac6 sch_cake: don't try to reallocate or unshare skb unconditionally

From netdev not yet accepted:
sch_cake: fix IP protocol handling in the presence of VLAN tags

The VLAN tag handling is actually wider than just cake so upstream are
working out how to fix it generically.  We fix it here just for cake.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years ago
Kevin Darbyshire-Bryant 77cd8f64ca kernel: cake: backport unused var patch to 5.4
This was backported to 4.19 and I clearly expected it to land in 5.4 but
it didn't (5.5) so backport it to 5.4 for consistency.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years ago
Kevin Darbyshire-Bryant 4ca4c94267 kernel: cake: skb hash backport to 419
Commit 7b4877c204 backported to 5.4 only,
backport to 4.19 as well.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years ago
Kevin Darbyshire-Bryant 3fda01a51e kernel: cake: renumber backport patches
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years ago
David Bauer 5667ccbf16 ramips: remove duplicate MAC assignment case
Cudy WR1000 and Wavlink WL-WN577A2 store WAN as well as label MAC address
at the same position in flash.

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

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

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

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

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

1. Press and hold down the reset button.

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

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

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

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

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer f49063ba92 ath79: replace custom uImageArcher generation
The replaces the custom uImageArcher build step with the generic uImage
build step. The only different between these two is the difference in
the generated name.

Tested on: TP-Link Archer C59 v1

Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
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
Adrian Schmutzler 5234593462 mvebu: move definition of factory.img out of Device/Default
The Device/Default definition in mvebu defines an IMAGE/factory.img
which is not included in IMAGES, and only used twice in the
individual definitions. Move it out of the default definition
to keep it closer to the reassignment of IMAGES and make it more
consistent with respect to other values of IMAGE/factory.img

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 0127de9547 ipq806x: set IMAGES in Device/Default definition
The Device/Default definition sets a default IMAGE/sysupgrade.bin,
but does not enable it by setting IMAGES. This is not consistent,
and has led to IMAGES being defined at various other places in the
file.

Thus, this patch consolidates the default value for IMAGES by putting
it in Device/Default. Since it's still overwritten where necessary,
this patch is cosmetic.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler e8afeaabc0 ipq40xx: set IMAGES in Device/Default definition
The Device/Default definition sets a default IMAGE/sysupgrade.bin,
but does not enable it by setting IMAGES. This is not consistent,
and has led to IMAGES being defined at various other places in the
file.

Thus, this patch consolidates the default value for IMAGES by putting
it in Device/Default. Since it's still overwritten where necessary,
this patch is cosmetic.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 8819faff47 ath79: do not build TP-Link tiny images by default
For quite some time, the tiny (4M flash) TP-Link sysupgrade and
factory images cannot be built anymore by the buildbots, just
the initramfs-kernel.bin files are still there.

Disable these images for the buildbots and prevent useless builds.

Note that these devices still build fine with default settings,
even for kernel 5.4.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 89bb4ee450 mvebu: remove non-existant board name solidrun,clearfog-a1
In 02_network, the board name solidrun,clearfog-a1 is used in a
case, but it does not seem to be used/exist anywhere else in OpenWrt.

The valid strings are:
- solidrun,clearfog-pro-a1
- solidrun,clearfog-base-a1

Fixes: 12795ec9f1 ("mvebu: split interface configuration for
clearfog pro and base")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Leon M. George 9f261e36de ath79: build Compex WPJ531 cpximg files
Generate additional images that are compatible to the cpximg loader.
The cpximg loader can be started either by holding the reset button during
power up or by entering the u-boot prompt and entering 'cpximg'.
Once it's running, a TFTP-server under 192.168.1.1 will accept the image
appropriate for the board revision that is etched on the board.

For example, if the board is labelled '7A04':

tftp -v -m binary 192.168.1.1 -c put openwrt-ath79-generic-compex_wpj531-16m-squashfs-cpximg-7A04.bin

These files can also be used with the sysupgrade utility in stock images (add
SSH key in luci for root access).

Signed-off-by: Leon M. George <leon@georgemail.eu>
[fix sorting of definitions]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Leon M. George e10dd48360 ath79: add support for Compex WPJ531 (16M)
Specifications:

SoC: QCA9531
DRAM: 128MB DDR2
Flash: 16MB SPI-NOR
2 100MBit ethernet ports
2×2 2.4GHz on-board radio
miniPCIe slot that supports 5GHz radio
PoE 24V - 48V IEEE 802.3af optional
USB 2.0 header

Installation:

To install, start a tftp server in bin/targets/ath79/generic/ and use the
u-boot prompt over UART:

tftpboot 0x80500000 openwrt-ath79-generic-compex_wpj531-16m-squashfs-sysupgrade.bin
erase 0x9f030000 +$filesize
erase 0x9f680000 +1
cp.b $fileaddr 0x9f030000 $filesize
boot

The cpximg file can be used with sysupgrade in the stock firmware (add SSH key
in luci for root access).

Another way is to hold the reset button during power up or running 'cpximg' in
the u-boot prompt.
Once the last LED starts flashing regularly, a TFTP-server under 192.168.1.1
will accept the image appropriate for the board revision that is etched on the
board.

For example, if the board is labelled '7A04':

tftp -v -m binary 192.168.1.1 -c put openwrt-ath79-generic-compex_wpj531-16m-squashfs-cpximg-7A04.bin

MAC addresses:

<&uboot 0x2e010>  *:cb  (label)
<&uboot 0x2e018>  *:cc
<&uboot 0x2e020>  *:cd
<&uboot 0x2e028>  *:ce

Only the first two are used (for ethernet), the WiFi modules have
separate (valid) addresses. The latter two addresses are not used.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[commit title/message facelift, fix rssileds, add led aliases]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Jan Hoffmann b1d5ab1a69 ramips: add support for NETGEAR WAC124
The WAC124 hardware appears to be identical to R6260/R6350/R6850.

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

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

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

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

Specification:

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

Installation:

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

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
[rebase and adjust for 5.4]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Hauke Mehrtens 4c3b81b75d ath79: Fix ubnt_edgeswitch-8xp DEVICE_PACKAGES
switch-bcm53xx-mdio does not exists, use kmod-switch-bcm53xx-mdio
instead.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Tobias Schramm <tobleminer@gmail.com>
4 years ago
Daniel González Cabanelas 0cca96284a mvebu: LS421DE: dts file improvements
- Delete useless HDD presence inputs: they aren't buttons, and probably
  they are outputs in the stock firmware.
- Change the Function Button keycode: the current one isn't mapped by
  the kernel module.
- Use the recommended property names for the ethernet stuff.
- Add missing i2c pinmux.
- Minor cosmetic changes.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Aleksander Jan Bajkowski 58a6f06978 lantiq: remove unused PHY drivers on xrx200
All boards on xrx200 use builtin switch and there is no supported device
with external switch.
It was copy paste from xway subtarget and was added in commit 18b76c66fb.

Save 20.3 kB flash memory.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
4 years ago
Qin Wei cd6515c2e8 ramips: fix sd polling
This is fixed in 18.06, it appears again in 19.07.
Currently mt7628 sdcard driver do not support polling mode which is for
the device do not have card-detect pin to detect sd card insert. Without
this patch, device will not detect sdcard is inserted. This patch is a
fix of that.

Signed-off-by: Qin Wei <support@vocore.io>
4 years ago
Rogan Dawes 9c85153b87 sunxi: add text referencing Allwinner H3 and H5 CPUs
This makes it a little easier to figure out which options to choose.

Signed-off-by: Rogan Dawes <rogan@dawes.za.net>
4 years ago
Gregory L. Dietsche f3cb1636ab x86: Support Intel 10 Gigabit Ethernet Cards
Support Intel 10 Gigabit Ethernet Cards in x86/64 images by default.
This ensures that systems with cards such as the Intel x520 will work properly.

Signed-off-by: Gregory L. Dietsche <Gregory.Dietsche@cuw.edu>
4 years ago
Florian Eckert 5596452cd4 target/hack-5.4: platform/x86/pcengines: revert led simswich compromise
With this change the LED subsystem is abused in the kernel to switch the
simswap. This change will be reverted, so we could use again the gpio
subsystem.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
4 years ago
Florian Eckert f3c5c09e5a kernel: add pcengines-apu2 module description
Add a module description for the new pcengnies-apu2 device driver.
This driver supports the front button and LEDs on the PC Engines
APUv2/APUv3 boards.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
4 years ago
Adrian Schmutzler 635f111148 ath79: drop and consolidate redundant chosen/bootargs
In ath79, for several SoCs the console bootargs are defined to the
very same value in every device's DTS. Consolidate these definitions
in the SoC dtsi files and drop further redundant definitions elsewhere.

The only device without any bootargs set has been OpenMesh OM5P-AC V2.
This will now inherit the setting from qca955x.dtsi

Note that while this tidies up master a lot, it might develop into a
frequent pitfall for backports.

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Natalie Kagelmacher 8ff631feff ath79: add support for AVM FRITZ!WLAN Repeater DVB-C
This commit adds support for the AVM FRITZ!WLAN Repeater DVB-C

SOC:   Qualcomm Atheros QCA9556
RAM:   64 MiB
FLASH: 16 MB SPI-NOR
WLAN:  QCA9556 3T3R 2.4 GHZ b/g/n and
       QCA9880 3T3R 5 GHz n/ac
ETH:   Atheros AR8033 1000 Base-T
DVB-C: EM28174 with MaxLinear MXL251 tuner
BTN:   WPS Button
LED:   Power, WLAN, TV, RSSI0-4

Tested and working:
 - Ethernet (correct MAC, gigabit, iperf3 about 200 Mbit/s)
 - 2.4 GHz Wi-Fi (correct MAC)
 - 5 GHz Wi-Fi (correct MAC)
 - WPS Button (tested using wifitoggle)
 - LEDs
 - Installation via EVA bootloader (FTP recovery)
 - OpenWrt sysupgrade (both CLI and LuCI)
 - Download of "urlader" (mtd0)

Not working:
 - Internal USB
 - DVB-C em28174+MxL251 (depends on internal USB)

Installation via EVA bootloader (FTP recovery):
Set NIC to 192.168.178.3/24 gateway 192.168.178.1 and power on the device,
connect to 192.168.178.1 through FTP and sign in with adam2/adam2:

ftp> quote USER adam2
ftp> quote PASS adam2
ftp> binary
ftp> debug
ftp> passive
ftp> quote MEDIA FLSH
ftp> put openwrt-sysupgrade.bin mtd1

Wait for "Transfer complete" together with the transfer details.
Wait two minutes to make sure flash is complete (just to be safe).

Then restart the device (power off and on) to boot into OpenWrt.
Revert your NIC settings to reach OpenWrt at 192.168.1.1

Signed-off-by: Natalie Kagelmacher <nataliek@pm.me>
[fixed sorting - removed change to other board -
prettified commit message]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Edward Matijevic 6da3194127 bcm47xx: add support for NETGEAR R6200 V1
This patch adds supports for the NETGEAR R6200 V1
This device is mainlined in Linux as of 5.4

Specification:
   - SOC: Broadcom BCM4718A1 (480 MHz)
   - Flash: 16MB (Macronix MX25L128)
   - RAM: 128MB DDR2
   - SWITCH: BCM53125
   - Ethernet: 5x GE (1 WAN + 4 LAN, Inverted order)
   - WLAN 2.4G: In SOC
   - WLAN 5GHz: miniPCIe card, BCM4352 (ID: 4360)
   - USB: 1x USB 2.0 port (Type A)
   - Buttons: Reset, WLAN, WPS
   - LED: Amber for Power, others need a workaround
   - UART: 1x UART on PCB

LED Issues: They are controlled by a 74HC164 via bit banging(GPIO 6/7)

Firmware Install Instructions
=============================
Using the device specific .chk, use that file to perform
a normal device upgrade in the OEM admin page.

Signed-off-by: Edward Matijevic <motolav@gmail.com>
4 years ago
Alex Lewontin 2e47a05d87 ramips: clean up Netgear R6120 code formatting
This commit performs minor janitorial work to clean up some code
formatting for the Netgear R6120.

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

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

Signed-off-by: Alex Lewontin <alex.c.lewontin@gmail.com>
[merge case in 01_leds, slightly adjust commit message/title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 3c20bb0644 mvebu: consolidate DTS files
The DTS files in files-4.19 and files-5.4 are exactly identical
except for one file (armada-3720-uDPU.dts), which is only present
for 4.19, as it has been upstreamed before 5.4.

Since there is no point in maintaining all these identical files
twice, this patch moves them to the "files" directory, only keeping
the named exception to files-4.19.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler fa6d53261a ipq40xx: consolidate DTS files
The DTS files in files-4.19 and files-5.4 are exactly identical
except for one file (qcom-ipq4018-emr3500.dts), which is only
present for 5.4.

Since there is no point in maintaining all these identical files
twice, this patch moves them to the "files" directory.

If there ever was a new kernel with substantial DTS changes, a
new folder would need to be introduced anyway and could easily be
done.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Jose Olivera d0e8b8310f mvebu: fix default EU regdomain for Linksys WRT AC devices
The mwlwifi driver sets the default country code for EU (fi-
rmware region code 0x30) certified devices to FR (France),
not DE (Germany). Whilst this is a trivial fix, novice users
may not know how mwlwifi negatively reacts to a non-matching
country code and may leave the setting alone. Especially si-
nce it is under the advanced settings section in LuCI.

Relevant mwlwifi driver code:
0a550312dd

The mwlwifi driver readme states "Please don't change country
code and let mwlwifi set it for you." However, OpenWrt's current
behaviour does not adhere to this with its default, 'just flashed
from factory' setting for EU devices.

Signed-off-by: Jose Olivera <oliverajeo@gmail.com>
[rebase, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Petr Štetiar 472b8fc91b armvirt,x86: fix build breakage of crypto ccp module
Upstream in commit f9f8f0c24203 ("crypto: ccp -- don't "select"
CONFIG_DMADEVICES") removed dependency on CONFIG_DMADEVICES symbol which
leads to build breakage of ccp crypto module, so fix this by adding that
symbol back in the kernel config.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Daniel González Cabanelas 3f27a6e640 bcm63xx: AV4202N: add missing PCI pinmux
The ADB P.DG AV4202N device has a wifi chipset connected via PCI. But the
PCI pinmux is missing and without it the wifi won't work properly.

Add the pinctrl_pci to enable the missing PCI pins for this device.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Petr Štetiar e44e60b290 kernel: bump 5.4 to 5.4.48
Resolved merge conflict in the following patches:

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

Refreshed patches, removed upstreamed patch:

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

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Petr Štetiar ceeece9ffa ath79: image: fix initramfs for safeloader devices
Currently it's not possible to tftpboot initramfs image on archer-c7-v5
as the image contains tplink-v1-header which leads to:

 ath> bootm
 ## Booting image at 81000000 ...
 Bad Magic Number

as U-Boot expects uImage wrapped image. This is caused by following
inheritance issue:

  define Device/Init
    KERNEL_INITRAMFS = $$(KERNEL)

  define Device/tplink-v1
    KERNEL := kernel-bin | append-dtb | lzma
    KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | tplink-v1-header

  define Device/tplink-safeloader
    $(Device/tplink-v1)

  define Device/tplink-safeloader-uimage
    $(Device/tplink-safeloader)
    KERNEL := kernel-bin | append-dtb | lzma | uImageArcher lzma

  define Device/tplink_archer-c7-v5
    $(Device/tplink-safeloader-uimage)

where tplink-v1 defines KERNEL_INITRAMFS with tplink-v1-header and it's
then used by all devices inheriting from tplink-safeloader. Fix this by
overriding KERNEL_INITRAMFS to KERNEL variable again.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Adrian Schmutzler 340de1d154 lantiq: fritz7312: set maximum speed to 100 mbit on 5.4
The fritz 7312 does not support 1000 gbit. Advertising it makes it
worse. Some NIC will change to 1000 gibt and turn off and on again for
ever.

The previous patch in 36f628910b was only applied to the 4.19 file,
so let's just make it consistent with this patch.

Cc: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Lech Perczak 708c6772f6 ath79: fix input type for TP-Link TL-WR902AC v1 mode switch
Inputs assigned to "mode select" switch on the side of the device
were missing linux,input-type property.
This would cause them do incorrectly generate EV_KEY events.
Fix this by setting the linux,input-type = <EV_SW> property on them.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
4 years ago
INAGAKI Hiroshi 3a8d65010d ramips: add support for ELECOM WRC-2533GST2
ELECOM WRC-2533GST2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based
on MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 256 MiB
- Flash		: SPI-NOR 32 MiB
- WLAN		: 2.4/5 GHz 4T4R (2x MediaTek MT7615)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/keys	: 4x/6x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, GND, TX, RX from ethernet port side
  - 57600n8
- Power		: 12VDC, 1.5A

Flash instruction using factory image:

1. Boot WRC-2533GST2 normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~150 seconds to complete flashing

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

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

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

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
[WRC-1900GST]
Acked-by: NOGUCHI Hiroshi <drvlabo@gmail.com>
[split patch, adjust commit title/message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Andrew Cameron d93da0d016 ath79: add support for TP-Link CPE610 v2
TP-Link CPE610 v2 is an outdoor wireless CPE for 5 GHz with
one Ethernet port based on Atheros AR9344

Specifications:
 - 560/450/225 MHz (CPU/DDR/AHB)
 - 1x 10/100 Mbps Ethernet
 - 64 MB of DDR2 RAM
 - 8 MB of SPI-NOR Flash
 - 23dBi high-gain directional 2×2 MIMO antenna and a
   dedicated metal reflector
 - Power, LAN, WLAN5G green LEDs
 - 3x green RSSI LEDs

Flashing instructions:
 Flash factory image through stock firmware WEB UI
 or through TFTP
 To get to TFTP recovery just hold reset button while powering on for
 around 4-5 seconds and release.
 Rename factory image to recovery.bin
 Stock TFTP server IP:192.168.0.100
 Stock device TFTP adress:192.168.0.254

Signed-off-by: Andrew Cameron <apcameron@softhome.net>
4 years ago
Adrian Schmutzler 9a477b833a ath79: add support for TP-Link TL-WA801ND v3/v4
This ports support for these devices from ar71xx.

Specification:

- System-On-Chip: Qualcomm Atheros QCA9533
- CPU/Speed: v3: 560 MHz, v4: 650 MHz
- Flash: 4096 KiB
- RAM: 32 MiB
- Ethernet: 1 port @ 100M
- Wireless: SoC-integrated: QCA9533 2.4GHz 802.11bgn

In contrast to the implementation in ar71xx (reset and WiFi button),
the device actually features reset and WPS buttons.

Flashing instructions:

Upload the ...-factory.bin file via OEM web interface.

TFTP Recovery:

1. Set PC to fixed IP address 192.168.0.66
2. Download *-factory.bin image and rename it to
   wa801ndv3_tp_recovery.bin
3. Start a tftp server with the image file in its root directory
4. Turn off the router
5. Press and hold Reset button
6. Turn on router with the reset button pressed and wait ~15 seconds
7. Release the reset button and after a short time
   the firmware should be transferred from the tftp server
8. Wait ~30 second to complete recovery.

TFTP recovery has only been tested with v3, and the Wiki states
that the procedure won't work for v4, which cannot be verified
or falsified at the moment.

Tested by Tim Ward (see forum):
https://forum.openwrt.org/t/ath79-support-for-tp-link-tl-wa901nd-v3-v4-v5/61246/13

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Daniel González Cabanelas 583b3e4025 bcm63xx: DGND3700v1: fix port order
Fix the switch LAN labels for the DGND3700v1/DGND3800B router,
the order is reversed.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
[cut out of bigger patch, adjust commit title/message accordingly]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Daniel González Cabanelas 2c3bdef4bd bcm63xx: HG622: enable LAN LEDs
The Huawei Echolife HG622 has hardware controlled LAN LEDs.

Add the ephy led pinctrl to let the router show LAN activity on these
LEDs.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Adrian Schmutzler be56b29707 ath79: set &eth1 status for TP-Link CPE devices in parent DTSI
The status is set to "okay" for all devices on ar9344, so just move
this to the parent DTSI.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Hannu Nyman 9c16c46e58 ath79: define CONFIG_MFD_RB4XX_CPLD to fix build breakage
Define the kernel config symbol CONFIG_MFD_RB4XX_CPLD=n
to fix build breakage on non-mikrotik targets.

The driver was added for all ath79, but the symbol was only
defined for mikrotik subtarget.

Fixes: fa70b3a4bb ("ath79: add Mikrotik rb4xx series drivers")

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
[rearrange commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler ef9cee4980 lantiq: drop "CONFIG_HZ_100 is not set"
CONFIG_HZ_100 is not set to "y" in generic config anymore since
3a761c90af ("treewide: Don't diverge from upstream default HZ
settings on 4.19"), so we don't need to disable it anymore either.

This was the only remaining case in the entire tree.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Aleksander Jan Bajkowski 27724c2f54 lantiq: switch to 5.4
Runtime tested on BT Home Hub 5A and D-Link DWR-966.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
4 years ago
Petr Štetiar 90f930e0c2 kernel: bump 5.4 to 5.4.46
Refreshed patches.

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Petr Štetiar 014c101e0b mvebu: fix bootloader kernel commandline mangling
Currently I'm unable to boot initramfs image with `console=ttyS0,115200`
kernel commandline as the kernel commandline mangling resets kernel
commandline if there is no `root=` option provided, efectively clearing
whatever I pass to the kernel, making the `root=` option mandatory.

So if the kernel commandline mangling is not appropriate just leave the
kernel commandline as it is.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Sungbo Eo c4037a5b9e mediatek: mt7623: refresh kernel 5.4 config
By running make kernel_oldconfig and selecting relevant options.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Daniel González Cabanelas e3eaf52ba3 bcm63xx: use the generic nand upgrade on Sercomm devices
The Sercomm devices don't need the jffs2 cleanmarkers for the kernel
partition. With the stock firmware they are only added when the
bootloader partition is upgraded.

Furthermore, on the Sercomm H500-s, the specific cfe_jffs2_upgrade_tar
function causes OOB corruption. As a result of this, combined with the
nature of the mtdsplit driver, the upgrade procedure ends in a bricked
device.

Use the generic nand_do_upgrade provided by the OpenWrt common functions.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Adrian Schmutzler 636b62e8e2 mediatek: fix IPv4-only corner case and commit in 99-net-ps
The uci config section network.globals set up in /bin/config_generate
will only be created if /proc/sys/net/ipv6 exists.

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

Fix that by adding the setup there as well.

While at it, limit the uci commit to the network config file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 866ad46662 ath79: add support for the TP-Link WBS210 v1
Specifications:
- SoC: Atheros AR9344
- RAM: 64MB
- Storage: 8 MB SPI NOR
- Wireless: 2.4GHz N based built into SoC
- Ethernet: 1x 10/100 Mbps with 24V POE IN, 1x 10/100 Mbps

Installation:
Flash factory image through stock firmware WEB UI
or through TFTP
To get to TFTP recovery just hold reset button while powering on for
around 4-5 seconds and release.
Rename factory image to recovery.bin
Stock TFTP server IP:192.168.0.100
Stock device TFTP adress:192.168.0.254

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

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

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Christopher Hill b7a8a54542 ath79: add support for MikroTik RouterBOARD 493G (rb4xx series)
This patch adds support for the MikroTik RouterBOARD RB493G, ported
from the ar71xx target.

See https://routerboard.com/RB493G for details

Specification:
- SoC Qualcomm Atheros AR7161
- RAM: 256 MiB
- Storage: 128MiB NAND
- Ethernet: 9x 1000/100/10 Mbps
- USB 1x 2.0 / 1.0 type A
- PCIe: 3x Mini slot
- MicroSD slot

Working:
- Board/system detection
- Ethernet
- SPI
- NAND
- LEDs
- USB
- Sysupgrade

Enabled (but untested due to lack of hardware):
- PCIe - ath79_pci_irq struct has the slot/pin/IRQ mappings if needed

Installation methods:
- tftp boot initramfs image, scp then flash via "sysupgrade -n"
- nand boot existing OpenWrt, scp then flash via "sysupgrade -n"

Notes:
- initramfs image will not work if uncompressed image size over ~8.5Mb
- The "rb4xx" drivers have been enabled

Signed-off-by: Christopher Hill <ch6574@gmail.com>
4 years ago
Christopher Hill fa70b3a4bb ath79: add Mikrotik rb4xx series drivers
This adds 3 Mikrotik rb4xx series drivers as follows:

rb4xx-cpld: This is in the mfd subsystem, and is the parent CPLD device
that interfaces between the SoC SPI bus and its two children below.
rb4xx-gpio: This is the GPIO expander.
rb4xx-nand: This is the NAND driver.

The history of this code comes in three phases.

1. The first is a May 2015 attempt to push the equivalient ar71xx rb4xx
drivers upstream. See https://lore.kernel.org/patchwork/patch/940880/.

Module-author: Gabor Juhos <juhosg@openwrt.org>
Module-author: Imre Kaloz <kaloz@openwrt.org>
Module-author: Bert Vermeulen <bert@biot.com>

2. Next several ar71xx patches were applied bringing the code current.

commit 7bbf4117c6
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

commit af79fdbe4a
commit 889272d92d
commit e21cb649a2
commit 7c09fa4a74
Signed-off-by: Felix Fietkau <nbd@nbd.name>

3. Finally a heavy refactor to split the driver into the three new
subsystems, and updated to work with the device tree configuration, plus
updates and review feedback incorporated

Reviewed-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Christopher Hill <ch6574@gmail.com>
4 years ago
Christopher Hill 344e75eb2b ath79: patch upstream Mikrotik rb4xx-spi driver to be device tree aware
Backport upstream patches that make drivers/spi/spi-rb4xx.c device tree
aware, plus a null pointer fix.

Signed-off-by: Christopher Hill <ch6574@gmail.com>
4 years ago
Daniel González Cabanelas d64d5ed142 bcm63xx: a226m-fwb: fix linux partition offset
The Pirelli A226M-FWB has a wrong linux partition offset, caused
by a copy-paste error. As of result of this, OpenWrt is currently
broken in this unit.

Fix it.

While at it, also use generic node names and fix the addresses
there as well.

Fixes: a27d59bb42 ("brcm63xx: switch to new partition layout
specification")

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
[also fix/update node names, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
David Bauer fa412c9354 ath79: ag71xx: don't warn on RGMII_RXID and RGMII_TXID
Currently, ag71xx will trigger a warning when TX xor RX-Delay modes are
enabled.

Handle them identical to the already implemented RGMII modes, as they
are only different for the attached PHY.

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

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

Fix that by adding the setup there as well.

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Pawel Dembicki 1461eabda3 Revert "kirkwood: disable image for Linksys EA3500 (Audi)"
This reverts commit d9ff499671.

At this moment kernel can be fitted in EA3500 image.

Tested by onefreeman (OpenWrt forum user)
Tested-by: Jacks <jack338c@gmail.com> (Github user @jack338c)
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Pawel Dembicki 28f4ae2e4b kirkwood: refresh kernel config
It was made by running "make kernel_oldconfig".

Suggested-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Pawel Dembicki 987292b20a kirkwood: move ext4 support to modules
Ext4 support is built in kirkwood kernel.

This patch moves ext4 support to modules and enables it for devices
with SATA interface.

Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[rebase]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Pawel Dembicki e53ec043ba kirkwood: move usb support to modules
USB support built in kernel isn't required for booting.
This patch move USB support to modules.

CONFIG_USB_STORAGE is removed because it can be found in kmod-usb-storage
and all usb support for this targed is moved to kmods.

Tested-by: Cezary Jackiewicz <cezary@eko.one.pl> [nsa310]
Tested-by: Alberto Bursi <bobafetthotmail@gmail.com> [nsa325, ea4500]
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[keep CONFIG_SCSI]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Pawel Dembicki c5356d10c0 kirkwood: move mmc/sd features to modules
All devices are using nand images. Built-in MMC/SD modules are not needed
anymore.

Run tested: pogo v4

Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Pawel Dembicki 73c3ba23a4 kirkwood: move sata features to modules
All devices are using nand images. Built-in SATA modules are not needed
anymore.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[only move CONFIG_SATA_MV]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Pawel Dembicki <paweldembicki@gmail.com> [pogo v4]
4 years ago
Pawel Dembicki bbe7124945 kirkwood: move led triggers to dts
This patch moves led trigger settings from 01_leds file to dts.

Now "linux,default-trigger" property is used.

Tested-by: Alberto Bursi <bobafetthotmail@gmail.com> [nsa310,nsa325]
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
David Bauer 373f446049 ipq40xx: check kernel-size for NBG6617
The ZyXEL NBG6617 has a separate kernel partition which is 4MiB large.

Add the kernel size to validate the kernel won't be bigger than this
fixed limit.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer 5b50895a63 ipq40xx: add image size checks for several devices
This adds image size checks for various devies using an automatic
mtdsplit.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer b8ed898f1b ipq40xx: use zImage for EX6100v2 and EX6150v2
The NETGEAR EX61500v2 and EX6150v2 U-Boot does not support booting LZMA
compressed images. Currently, they are using GZIP compressed kernels,
which results in ledd flash being available to the root and overlay
filesystems.

Using a zImage results in a smaller kernel and therefore increases
available space for rootfs and overlayfs.

Size reduced: ~1.1 MiB

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
DENG Qingfang 752cee796d ipq40xx: disable DSA and Switchdev
ipq40xx is still using swconfig based switch management. This might
change in he future, however disable the DSA and Switchdev support for
now.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[rephrased commit message]
Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Yen-Ting-Shen 3f61e5e1b9 ipq40xx: add support for EnGenius EMR3500
SOC:     IPQ4018 / QCA Dakota
CPU:     Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:    256 MiB
NOR:     32 MiB
ETH:     Qualcomm Atheros QCA8072 (2 ports)
USB:     1 x 2.0 (Host controller in the SoC)
WLAN1:   Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:   Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:   RESET Button
LEDS:    White, Blue, Red, Orange

Flash instruction:

From EnGenius firmware to OpenWrt firmware:

In Firmware Upgrade page, upgrade your openwrt-ipq40xx-generic-engenius_emr3500-squashfs-factory.bin directly.

From OpenWrt firmware to EnGenius firmware:

1. Setup a TFTP server on your computer and configure static IP to 192.168.99.8
   Put the EnGenius firmware in the TFTP server directory on your computer.
2. Power up EMR3500. Press 4 and then press any key to enter u-boot.
3. Download EnGenius firmware
   (IPQ40xx) # tftpboot 0x84000000 openwrt-ipq40xx-emr3500-nor-fw-s.img
4. Flash the firmware
   (IPQ40xx) # imgaddr=0x84000000 && source 0x84000000:script
5. Reboot
   (IPQ40xx) # reset

Signed-off-by: Yen-Ting-Shen <frank.shen@senao.com>
[squashed update patch, updated to 5.4, dropped BOARD_NAME,
migrated to SOC]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
4 years ago
Sven Eckelmann 6785695056 ipq40xx: essedma: Disable TCP segmentation offload for IPv6
It was noticed that the the whole MAC can hang when transferring data from
one ar40xx port (WAN ports) to the CPU and from the CPU back to another
ar40xx port (LAN ports). The CPU was doing only NATing in that process.

Usually, the problem first starts with a simple data corruption:

  $ wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.4.0-amd64-netinst.iso -O /dev/null
  ...
  Connecting to saimei.ftp.acc.umu.se (saimei.ftp.acc.umu.se)|2001:6b0:19::138|:443... connected.
  ...
  Read  error at byte 48807936/352321536 (Decryption has failed.). Retrying.

But after a short while, the whole MAC will stop to react. No traffic can
be transported anymore from the CPU port from/to the AR40xx PHY/switch and
the MAC has to be resetted.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: John Crispin <john@phrozen.org>
4 years ago
Adrian Schmutzler 5549b84388 ramips: drop useless label-mac-device for RouterBOARD 750Gr3
With the new driver, MAC addresses are not set up in DTS anymore,
and therefore label-mac-device will be useless there.

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

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

Suggested-by: John Thomson <git@johnthomson.fastmail.com.au>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 1226113fe2 bcm47xx: move device definitions to subfiles
With several subtargets, the image/Makefile becomes crowded after a
while. Many targets have moved their device definitions to $subtarget.mk
files to have them more organized, let's do this here as well.

Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
J. Scott Heppler feb55fd3ec ramips: fix port display for TRENDnet TEW-810DR
This updates the display port order for the TEW-810DR to be in line
with the DIR-810L. Both share the same board and pictures on the
vendors' pages indicate the same external numbering scheme as well.

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

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

Installation:

Login to netgear webinterface and flash factory.img

Back to stock:

Use nmrpflash to revert stock image.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Stijn Tintel cd09f26660 ath79: add support for D-Link DAP-2695-A1
Hardware:
* SoC: Qualcomm Atheros QCA9558
* RAM: 256MB
* Flash: 16MB SPI NOR
* Ethernet: 2x 10/100/1000 (1x 802.3at PoE-PD)
* WiFi 2.4GHz: Qualcomm Atheros QCA9558
* WiFi 5GHz: Qualcomm Ahteros QCA9880-2R4E
* LEDS: 1x 5GHz, 1x 2.4GHz, 1x LAN1(POE), 1x LAN2, 1x POWER
* Buttons: 1x RESET
* UART: 1x RJ45 RS-232 Console port

Installation via stock firmware:
* Install the factory image via the stock firmware web interface

Installation via bootloader Emergency Web Server:
* Connect your PC to the LAN1(PoE) port
* Configure your PC with IP address 192.168.0.90
* Open a serial console to the Console port (115200,8n1)
* Press "q" within 2s when "press 'q' to stop autoboot" appears
* Open http://192.168.0.50 in a browser
* Upload either the factory or the sysupgrade image
* Once you see "write image into flash...OK,dest addr=0x9f070000" you
  can power-cycle the device. Ignore "checksum bad" messages.

Setting the MAC addresses for the ethernet interfaces via
/etc/board.d/02_network adds the following snippets to
/etc/config/network:

config device 'lan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr 'xx:xx:xx:xx:xx:xx'

config device 'wan_eth1_2_dev'
        option name 'eth1.2'
        option macaddr 'xx:xx:xx:xx:xx:xx'

This would result in the proper MAC addresses being set for the VLAN
subinterfaces, but the parent interfaces would still have a random MAC
address. Using untagged VLANs could solve this, but would still leave
those extra snippets in /etc/config/network, and then the device VLAN
setup would differ from the one used in ar71xx. Therefore, the MAC
addresses of the ethernet interfaces are being set via preinit instead.

The bdcfg partition contains 4 MAC address labels:
 - lanmac
 - wanmac
 - wlanmac
 - wlanmac_a

The first 3 all contain the same MAC address, which is also the one on
the label.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Stijn Tintel 7e287ff89d ath79: enable wrgg MTD splitter
This is required for the D-Link DAP-2695-A1.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
4 years ago
INAGAKI Hiroshi 8f3b176e86 kernel: rtl8367b: fix external interface modes
The interface mode number of RGMII_33V is 7 on RTL8367, but it's 9 on
RTL8367B.

the external interface modes for RTL8367 are follows:

- 0, Disabled
- 1, RGMII
- 2, MII_MAC
- 3, MII_PHY
- 4, TMII_MAC
- 5, TMII_PHY
- 6, GMII
- 7, RGMII_33V

the external interface modes for RTL8367B are follows:

- 0, Disabled
- 1, RGMII
- 2, MII_MAC
- 3, MII_PHY
- 4, TMII_MAC
- 5, TMII_PHY
- 6, GMII
- 7, RMII_MAC
- 8, RMII_PHY
- 9, RGMII_33V

But the driver in U-Boot of RT-N56U GPL tar blocks using RGMII_33V (9)
mode and it seems to be unsupported on RTL8367B, so drop it from
switch-case in rtl8367b_extif_set_mode.

ref (RTL8367):

- TL-WR2453ND v1

ref (RTL8367B):

- ASUS RT-N56U
- TP-Link Archer C2 v1

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
4 years ago
Paul Spooren 941ec28b35 imagebuilder: Remove json_info_files/ before build
The folder `json_info_files` contains multiple JSON files which describe
created firmware images. The folder is not removed between builds as the
ImageBuilder does not use `image.mk`.

Not removing the JSON files result in a merged `profiles.json` file
containing entries for outdated or non-existing images.

This commit adds the `json_info_files/` cleanup step to the ImageBuilder
Makefile.

Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Paul Spooren 4f38063640 imagebuilder: pass IB=1 on checking requirements
The patch 4a1a58a3  build, imagebuilder: Do not require libncurses-dev
was supposed to remove libncurses as a requirement for the ImageBuilder.
However as the IB=1 is only exported during building, not for checking
requirements, it did never actually work.

This commit export IB=1 to the requirement check.

Signed-off-by: Paul Spooren <mail@aparcar.org>
4 years ago
Adrian Schmutzler efde716d14 ramips: fix port display for D-Link DIR-810L
The port order displayed in LuCI is currently inverted for this
devices:

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

Fix it.

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

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

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

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

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

Reported-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net> [DIR-810L]
Tested-by: J. Scott Heppler <shep971@centurylink.net> [TEW-810DR]
4 years ago
Adrian Schmutzler 11db48f89a apm821xx: move device definitions to subfiles
With several subtargets, the image/Makefile becomes crowded after a
while. Many targets have moved their device definitions to $subtarget.mk
files to have them more organized, let's do this here as well.

While at it, also move subtarget-specific build recipes.

Cc: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Christian Lamparter <chunkeey@gmail.com>
4 years ago
Adrian Schmutzler bb39fea11a treewide: simplify inclusion of subtarget image files
Many target use a repetitive if-include scheme for their subtarget
image files, though their names are consistent with the subtarget
names.

This patch removes these redundant conditions and just uses the
variable for the include where the target setup allows it.

For sunxi, this includes a trivial rename of the subtarget image
Makefiles.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Renaud Lepage 108df3eabb ath79: add support for the Netgear WNDRMAC v1
The Netgear WNDRMAC v1 is a hardware variant of the Netgear WNDR3700 v2

Specifications
==============
* SoC: Atheros AR7161
* RAM: 64mb
* Flash on board: 16mb
* WiFi: Atheros AR9220 (a/n), Atheros AR9223 (b/g/n)
* Ethernet: RealTek RTL8366SR (1xWAN, 4xLAN, Gigabit)
* Power: 12 VDC, 2.5 A
* Full specs on [openwrt.org](https://openwrt.org/toh/hwdata/netgear/netgear_wndrmac_v1)

Flash Instructions
==================
It is possible to use the OEM Upgrade page to install the `factory`
variant of the firmware.

After the initial upgrade, you will need to telnet into the router
(default IP 192.168.1.1) to install anything. You may install LuCI
this way. At this point, you will have a web interface to configure
OpenWRT on the WNDRMAC v1.

Please use the `sysupgrade` variant for subsequent flashes.

Recovery Instructions
=====================
A TFTP-based recovery flash is possible if the need arises. Please refer
to the WNDR3700 page on openwrt.org for details.

https://openwrt.org/toh/netgear/wndr3700#troubleshooting_and_recovery

Signed-off-by: Renaud Lepage <root@cybikbase.com>
[update DTSI include name]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Renaud Lepage 7f297e740b ath79: add support for the Netgear WNDRMAC v2
The Netgear WNDRMAC v2 is a hardware variant of the Netgear WNDR3800

Specifications
==============
* SoC: Atheros AR7161
* RAM: 128mb
* Flash on board: 16mb
* WiFi: Atheros AR9220 (a/n), Atheros AR9223 (b/g/n)
* Ethernet: RealTek RTL8366SR (1xWAN, 4xLAN, Gigabit)
* Serial console: Yes, 115200 / 8N1 (JTAG)
* USB: 1x2.0
* Power: 12 VDC, 2.5 A
* Full specs on [openwrt.org](https://openwrt.org/toh/hwdata/netgear/netgear_wndrmac_v2)

Flash Instructions
==================
It is possible to use the OEM Upgrade page to install the `factory`
variant of the firmware.

After the initial upgrade, you will need to telnet into the router
(default IP 192.168.1.1) to install anything. You may install LuCI
this way. At this point, you will have a web interface to configure
OpenWRT on the WNDRMAC v2.

Please use the `sysupgrade` variant for subsequent flashes.

Recovery Instructions
=====================
A TFTP-based recovery flash is possible if the need arises. Please refer
to the WNDR3800 page on openwrt.org for details.

https://openwrt.org/toh/netgear/wndr3800#recovery_flash_in_failsafe_mode

Signed-off-by: Renaud Lepage <root@cybikbase.com>
[do not add device to uboot-envtools, update DTSI name]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler bc75954cca ath79: rename DTSI for Netgear WNDR devices based on ar7161
This renames the DTSI for Netgear WNDR devices based on ar7161 to
indicate that the file is not limited to WNDR3700 models.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 2c198ea162 ramips: limit uci commit to the changed config file
Since 01_enable_packet_steering only touches the network config,
limit the uci commit to this as well.

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

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

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

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

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

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

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

Tested by Mathias Buchwald.

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

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Felix Fietkau 2c82862068 kernel: backport upstream DSA GRO support
Should improve performance

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

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Christian Lamparter 61307544d1 ath79: wndr3700 series: fix wifi range & throughput
This patch adds ar71xx's GPIO setup for the 2.4GHz and 5GHz antennae
demultiplexer:

| 158         /* 2.4 GHz uses the first fixed antenna group (1, 0, 1, 0) */
| 159         ap9x_pci_setup_wmac_gpio(0, (0xf << 6), (0xa << 6));
| 160
| 161         /* 5 GHz uses the second fixed antenna group (0, 1, 1, 0) */
| 162         ap9x_pci_setup_wmac_gpio(1, (0xf << 6), (0x6 << 6));

This should restore the range and throughput of the 2.4GHz radio
on all the derived wndr3700 variants and versions with the AR7161 SoC.
A special case is the 5GHz radio. The original wndr3700(v1) will
benefit from this change. However the wndr3700v2 and later revisions
were unaffected by the missing bits, as there is no demultiplexer
present in the later designs.

This patch uses gpio-hogs within the device-tree for all
wndr3700/wndr3800/wndrmac variants.

Notes:

Based on the PCB pictures, the WNDR3700(v1) really had eight
independent antennae. Four antennae for each radio and all of
those were printed on the circut board.

The WNDR3700v2 and later have just six antennae. Four of those
are printed on the circuit board and serve the 2.4GHz radio.
Whereas the remaining two are special 5GHz Rayspan Patch Antennae
which are directly connected to the 5GHz radio.

Hannu Nyman dug pretty deep and unearthed a treasure of information
regarding the history of how these values came to be in the OpenWrt
archives: <https://dev.archive.openwrt.org/ticket/6533.html>.

Mark Mentovai came across the fixed antenna group when he was looking
into the driver:

    fixed_antenna_group 1, (0, 1, 0, 1)
    fixed_antenna_group 2, (0, 1, 1, 0)
    fixed_antenna_group 3, (1, 0, 0, 1)
    fixed_antenna_group 4, (1, 0, 1, 0)

Fixes: FS#3088

Reported-by: Luca Bensi
Reported-by: Maciej Mazur
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
Debugged-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
4 years ago
Daniel Golle fd0cc72d9c oxnas: build with 8021Q VLAN support
CONFIG_VLAN_8021Q was explicitely disabled in oxnas kernel config.
Don't do that, so VLANs can be used on the target.

Fixes: dcc34574ef ("oxnas: bring in new oxnas target")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years ago
Petr Štetiar e5aa498acb kernel: bump 5.4 to 5.4.45
Fixes CVE-2020-10757 via upstream commit df4988aa1c96 ("mm: Fix mremap
not considering huge pmd devmap").

Resolved merge conflict in the following patches:

 bcm27xx: 950-0128-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch

Refreshed patches, removed upstreamed patch:

 generic: 751-v5.8-net-dsa-mt7530-set-CPU-port-to-fallback-mode.patch
 generic: 754-v5.7-net-dsa-mt7530-fix-roaming-from-DSA-user-ports.patch

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

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

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

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

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

Fixes: 5acd1ed0be ("ramips: mt7621: fix Ubiquiti ER-X ports names and MAC addresses")
Signed-off-by: Perry Melange <isprotejesvalkata@gmail.com>
[commit subject and description tweaks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
John Crispin c37487a63d mediatek: fix image/mt7622.mk
Signed-off-by: John Crispin <john@phrozen.org>
4 years ago
Álvaro Fernández Rojas 6fca1646dd bcm63xx: bcm6328: switch to upstream boot sel patch
BCM6328 boot selection fix has been upstreamed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Daniel González Cabanelas ff2c96333f bcm63xx: add support for the Sercomm H500-s
Sercomm H500-s is an xDSL dual band wireless router based on Broadcom
BCM63167 SoC.

Hardware:
   SoC:          Broadcom BCM63167
   CPU:          BMIPS4350 V8.0, 400 MHz, 2 cores
   Flash:        NAND 128 MiB
   RAM:          DDR3 128 MiB
   Ethernet:     4x 10/100/1000 Mbps
   Switch:       BCM53134S
   Wireless:     802.11b/g/n: BCM435f (integrated)
                 802.11ac:    Quantenna QT3740BC (onboard SoC)
   USB:          1x 2.0
   LEDs/Buttons: 11x / 2x

Flash instruction, web UI:
  1. Reset to defaults using the reset button if the admin password is
     unknown
  2. Login into the web UI as admin.
     Address:  http://192.168.0.1
     User:     admin
     Password: VF-ESVodafone-H-500-s or l033i-h500s
  3. Go to Settings -> Firmware Update, and select the Openwrt factory
     firmware
  4. Update the firmware.
  5. Wait until it finish, the device will reboot with Openwrt installed
     on the alternative image partitions keeping the stock firmware in
     the former.

Notes:
  - The patch also adds support for the lowi version. Only the factory
    firmware is different.
  - The integrated Wifi in the Broadcom Soc isn't still supported.
  - The Quantenna 802.11ac wifi works ok, but needs to be configured with
    the Quantenna client application. It can't be configured with Luci
    nor any iw command since it's a separated subsystem linked via
    ethernet.
  - The BCM53134S external switch is managed via MDIO which isn't
    supported in this target. Therefore it will behave as a dumb switch.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Álvaro Fernández Rojas 9eb9d0baa0 bcm63xx: image: support device-specific load address
Some CFEs are located at the address currently used for relocation and lzma
loader load address, so we need to provide a way to override it.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Daniel González Cabanelas 27c20a1ef5 bcm63xx: image: don't add the CFE to the sercomm factory
There is no need to include the CFE bootloader in the Sercomm factory
images.

There might be a case when this could be useful:
  - We are running the stock firmware on the first Sercomm image
  - The second partition storing the botloader was erased (unlikely)
Even in this case flashing an image without a bootlader is harmless.

Don't include the bootloader in the factory image creation and rid of the
risk of flashing factory images with an untested bootloader partition.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Daniel González Cabanelas 598ba5b169 bcm63xx: kernel: add BCM63167 cpuid variant
The BCM63167 is a BCM63268 SoC with a different physical packaging.

Add the CPU ID to allow supporting routers with this SoC (i.e Sercomm
H500-s)

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
4 years ago
Álvaro Fernández Rojas 66f7062160 bcm63xx: vr-3032u: add missing compatible property
SoC is a BCM63168.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 57dce7c8f3 bcm63xx: vg-8050: add missing compatible property
SoC is a BCM63169.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
John Crispin ad39d06df7 mediatek: add mt7531 DSA support
Signed-off-by: John Crispin <john@phrozen.org>
4 years ago
John Crispin f72a2b004c mediatek: add bpi-r64 emmc support
Signed-off-by: John Crispin <john@phrozen.org>
4 years ago
John Crispin 55b97b6885 mediatek: make emmc image generation work on mt7622
Signed-off-by: John Crispin <john@phrozen.org>
4 years ago
John Crispin 127ad76311 mediatek: switch over to extended upstream eip97 driver
Signed-off-by: John Crispin <john@phrozen.org>
4 years ago
Sungbo Eo 3559b46b62 mediatek: tidy up image subtarget Makefiles
- sort device recipes alphabetically
- adjust board name of ELECOM WRC-2533GENT
- harmonize line wrapping

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[rebased]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Stijn Tintel 050c31fa26 bcm27xx: fix unmounting /boot after sysupgrade
Due to a typo, /boot is not properly unmounted after copying the backup
file to it. Fix the typo to solve this.

Fixes: 246916ddf4 ("brcm2708: use x86's upgrade scripts for all rpi targets")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
4 years ago
Kevin Darbyshire-Bryant 7b4877c204 kernel: sch_cake: use skb hash improve wireguard compatibility
While the other fq-based qdiscs take advantage of skb->hash and doesn't
recompute it if it is already set, sch_cake does not.

This was a deliberate choice because sch_cake hashes various parts of the
packet header to support its advanced flow isolation modes. However,
foregoing the use of skb->hash entirely loses a few important benefits:

- When skb->hash is set by hardware, a few CPU cycles can be saved by not
  hashing again in software.

- Tunnel encapsulations will generally preserve the value of skb->hash from
  before the encapsulation, which allows flow-based qdiscs to distinguish
  between flows even though the outer packet header no longer has flow
  information.

It turns out that we can preserve these desirable properties in many cases,
while still supporting the advanced flow isolation properties of sch_cake.
This patch does so by reusing the skb->hash value as the flow_hash part of
the hashing procedure in cake_hash() only in the following conditions:

- If the skb->hash is marked as covering the flow headers (skb->l4_hash is
  set)

AND

- NAT header rewriting is either disabled, or did not change any values
  used for hashing. The latter is important to match local-origin packets
  such as those of a tunnel endpoint.

The immediate motivation for fixing this was the recent patch to WireGuard
to preserve the skb->hash on encapsulation. As such, this is also what I
tested against; with this patch, added latency under load for competing
flows drops from ~8 ms to sub-1ms on an RRUL test over a WireGuard tunnel
going through a virtual link shaped to 1Gbps using sch_cake. This matches
the results we saw with a similar setup using sch_fq_codel when testing the
WireGuard patch.

Fixes: 046f6fd5daef ("sched: Add Common Applications Kept Enhanced (cake) qdisc")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
4 years ago
DENG Qingfang 898969636d mvebu: remove ClearFog Pro SUPPORTED_DEVICES
A direct upgrade from previous swconfig version with
incompatible settings to DSA will break the internet.
Remove SUPPORTED_DEVICES so users cannot upgrade directly.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[rebase after Linksys rename, adjust title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Paul Spooren df6f3090c4 mvebu: rename Linksys devices based on their common names
The Linksys devices in mvebu target feature a mixed naming,
where parts are based on the official product name (device
node, image; e.g. WRT3200ACM) and parts are based on the
internal code name (DTS file name, compatible, LED labels;
e.g. rango). This inconsistent naming has been perceived
as quite confusing.

A recent attempt by Paul Spooren to harmonize this naming
in kernel has been declined there. However, for us it still
makes sense to apply at least a part of these changes
locally.

Primarily, this patch changes the compatible in DTS and thus
the board name used in various scripts to have them in line
with the device, model and image names. Due to the recent
switch from swconfig to DSA, this allows us to drop
SUPPORTED_DEVICES and thus prevent seamless upgrade between
these incompatible setups.

However, this does not include the LED label rename from
Paul's initial patch: I don't think it's worth keeping the
enormous diff locally for this case, as we can implement
this much easier in 01_leds if we have to live with the
inconsistency anyway.

Signed-off-by: Paul Spooren <mail@aparcar.org>
[rebase, extend to all devices, drop DT LED changes]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Rafał Miłecki 8c31afb978 kernel: b53: fix compilation with kernels 5.5+
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
4 years ago
DENG Qingfang 5b9ba4a93e generic: mt7530: support adjusting EEE
Add support for adjusting EEE with ethtool

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 7c47f6601d generic: mt7530: fix roaming from DSA user ports
When a client moves from a DSA user port to a software port in a bridge,
it cannot reach any other clients that connected to the DSA user ports.
That is because SA learning on the CPU port is disabled, so the switch
ignores the client's frames from the CPU port and still thinks it is at
the user port.

Fix it by enabling SA learning on the CPU port.

To prevent the switch from learning from flooding frames from the CPU
port, set skb->offload_fwd_mark to 1 for unicast and broadcast frames,
and let the switch flood them instead of trapping to the CPU port.
Multicast frames still need to be trapped to the CPU port for snooping,
so set the SA_DIS bit of the MTK tag to 1 when transmitting those frames
to disable SA learning.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang dc4ffaa5ab generic: fix DSA VLAN filtering
Currently enabling VLAN filtering blocks all traffic in the bridge
immediately. That is because DSA ignores all VLAN setup when VLAN
filtering is disabled, and when it is enabled, there is no VLAN entry
in the VLAN table, causing all traffic to be blocked.

Add patches to allow VLAN setup even if VLAN filtering is disabled.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang d56d05f01f generic: mt7530: set CPU port to fallback mode
Currently, setting a bridge's self PVID to other value and deleting
the default VID 1 renders untagged ports of that VLAN unable to talk to
the CPU port:

	bridge vlan add dev br0 vid 2 pvid untagged self
	bridge vlan del dev br0 vid 1 self
	bridge vlan add dev sw0p0 vid 2 pvid untagged
	bridge vlan del dev sw0p0 vid 1
	# br0 cannot send untagged frames out of sw0p0 anymore

That is because the CPU port is set to security mode and its PVID is
still 1, and untagged frames are dropped due to VLAN member violation.

Set the CPU port to fallback mode so untagged frames can pass through.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
Felix Fietkau 81b59efefd ramips/mediatek: select kmod-mt7615-firmware where kmod-mt7615e is selected
The new mt76 version splits out the firmware, because the driver can also be
used for MT7663/MT7613

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
Felix Fietkau 2dd26fda16 kernel: fix portability issue with perf on linux 5.4
Remove dependencies on core kernel headers in host tools used to build perf,
which break on any non-linux system

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years ago
DENG Qingfang 712e00877d mvebu: rename Linksys Mamba WAN port
Rename it to wan to match Linksys Armada 385 series

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 5a49cbf6c4 mvebu: remove swconfig package
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 24410595e9 generic: backport mv88e6xxx port mirroring support
Backport port mirroring support for mv88e6xxx

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang be309bfd74 mvebu: drop 06_set_iface_mac preinit script
MAC address is set in board.d script
Interface swapping is not needed anymore as switching to DSA breaks
previous configuration anyway

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 9b34ea4f62 mvebu: use ucidef to set up MAC address
Use ucidef to set up MAC address instead of preinit script

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 4149d2b91c mvebu: use eth0 as DSA CPU port for Linksys WRT
eth0 has HW MAC address while eth2 does not.
Use eth0 instead so we don't have to set LAN MAC manually.
Disable unused eth2, until multi CPU port is supported.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang f799c65946 mvebu: update default config for DSA
Update network/LED configuration for DSA driver.
sysupgrade from images prior to this commit with config preserved
will break the ethernet.

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang 6058035e37 mvebu: remove swconfig symbols from kernel config
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
DENG Qingfang a2bca5c922 mvebu: drop swconfig patches
Drop swconfig patches for Clearfog and Linksys WRT

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
4 years ago
Adrian Schmutzler 5fcb0723a3 mvebu: switch to kernel 5.4
Last reports with kernel 5.4 have all been positive [1], so let's open
this to a wider range of testers.

[1] https://github.com/openwrt/openwrt/pull/2804

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Álvaro Fernández Rojas 8421ea7de1 bcm63xx: vg-8050: fix WFI partition size
Each image can take up to 0x3d60000, which means 128k more per image.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas e8aac7013a bcm63xx: vr-3032u: fix WFI partition size
Each image can take up to 0x3d60000, which means 128k more per image.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 6c7cbf1420 kernel: mtdsplit: bcm_wfi: always add img partitions
This is useful when booting OpenWrt from ramdisks in order to have both
images partitions defined.
Furthermore, instead of always using img2 for the inactive image, let's use
img1 or img2 accordingly.

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

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
4 years ago
Sungbo Eo 6ea87d35c6 bcm47xx: fix brcm-wl module loading
_dma_cache_wback_inv needs to be exported to load wl module successfully.

root@OpenWrt:/# insmod wl
[  363.867779] wl: Unknown symbol _dma_cache_wback_inv (err -2)
failed to insert /lib/modules/5.4.40/wl.ko

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Cc: Rafał Miłecki <rafal@milecki.pl>
4 years ago
Tim Harvey 0cf101d6b3 octeontx: fix mcp251x can controller
Update the can-mcp251x-convert-to-half-duplex-SPI patch to fix reception

Some SPI host controllers such as the Cavium Thunder TX do not support
full-duplex SPI. Using half-duplex transfers allows the driver to work
with those host controllers.

This patch fixes the fact that mcp251x_hw_rx_frame was still relying on
a full-duplex transfer where bits were being shifted on MOSI at the same time
as MISO. After splitting the transaction into a spi_write_then_read() care
must be taken to ignore the first byte.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years ago
Tim Harvey 3fd8e86079 octeontx: fix gpio irq request
This fixes a regression in 5.4 that causes a crash when a driver requests
an ARM GPIO for an IRQ.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years ago
Tim Harvey c3f9598339 octeontx: refresh kernel 5.4 config
refresh kernel config by running make kernel_menuconfig and saving changes

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years ago
Tim Harvey 0562037c3b imx6: image: increase max ubifs file-system size
The latest 2GiB NAND flash parts used by Gateworks ventana are 2K page-size.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years ago
Tim Harvey 3b1e99d23e imx6: backport v5.8 imx6qdl-gw dt patches
- add fxos8700 support to GW52xx/GW53xx/GW54xx
- add USB_OTG support to GW552x
- add LSM9DS1 IMU support to GW560x
- add LSM9DS1 IMU support to GW5904
- add CC1352 UART to GW5910
- add BCM4330 support to GW5910
- fix wlan regulator for GW5910

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
4 years ago
Florian Eckert 0b3e1205df kernel: add gpio-it87
Since commit 910df3f06c we have build in
on all X86/64 platforms the gpio-it87 driver.

Since this change I am getting the following error message on boot.
 > kern.err kernel: [    1.009416] gpio_it87: no device

I do not have this device on my system. To prevent the nonsensical
message and the loading of the module I have added this as a package, so
that it can be installed later or during image building.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
4 years ago
Johann Neuhauser 1d9812f48a ath79: phy-ar7200-usb: do not print error on defered init
This is only a cosmetic correction, as the driver works as expected.
However, the error message confuses users about a missing reset definition.

On a defered init we don't see the following error message now:
[    0.078292] ar7200-usb-phy usb-phy: phy reset is missing

Tested-by: Lech Perczak <lech.perczak@gmail.com>
Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
4 years ago
Tomasz Maciej Nowak cf69472fb1 mvebu: espressobin: fix SATA and USB 3.0 ports detection
This commit removes changes from upstream commits:
8e18c8e58da6 arm64: dts: marvell: armada-3720-espressobin: declare SATA
PHY property
bd3d25b07342 arm64: dts: marvell: armada-37xx: link USB hosts with their
PHYs
For most boards which have factory bootloader this caused that devices
connected to USB 3.0 and SATA port were not detected. For them to
function users would need to upgrade the bootloader to version with ARM
Trusted Firmware 2.1 or later. Unfortunately there is no official
bootloader image with updated ATF component, therefore drop these
properties from nodes. This change was also tested briefly with
bootloader with updated ATF and the ports functioned properly.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
4 years ago
Thomas Albers f93fcf8923 ipq806x: enable disk-activity LED trigger
Enable the disk-activity LED trigger for ipq806x, since this SoC has an
onboard SATA controller.

Signed-off-by: Thomas Albers <thomas.gameiro@googlemail.com>
[split into separate commit]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Thomas Albers e23859765c linux/generic: remove obsolete config option LEDS_TRIGGER_IDE_DISK
Kernel config option LEDS_TRIGGER_IDE_DISK was renamed in kernel 4.8 to
CONFIG_LEDS_TRIGGER_DISK in upstream commit eb25cb9956cc ("leds: convert
IDE trigger to common disk trigger").

Removing it as it should be added only on targets which has usage for
this trigger.

Signed-off-by: Thomas Albers <thomas.gameiro@googlemail.com>
[commit description facelift]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Alexey Dobrovolsky 0a182fcba6 ramips: add kmod-usb-dwc2 to ZyXEL Keenetic image
ZyXEL Keenetic has a USB port. Thus, DWC2 USB controller driver should
be in the default image for this device.

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

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

Fixes: FS#2738
Fixes: FS#2964

Signed-off-by: Alexey Dobrovolsky <dobrovolskiy.alexey@gmail.com>
4 years ago
Adrian Schmutzler 04373e20cb apm821xx: set DEVICE_TYPE to "nas" for sata subtarget
Since DEVICE_TYPE cannot be set per device, just set DEVICE_TYPE
to "nas" for the entire subtarget, which only contains this single
device.

Note that while this looks like a cosmetic change in combination
with the previous patches, this particular patch actually changes
the packages for the device.

Suggested-by: Christian Lamparter <chunkeey@gmail.com>
Cc: Christian Lamparter <chunkeey@gmail.com>
Cc: Sungbo Eo <mans0n@gorani.run>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 057e5f6ede treewide: provide consistent basic DEVICE_TYPE
While the effective "default" based on frequent use is "router", the
DEVICE_TYPE variable actually provides a "basic" configuration without
selecting any additional packages.

This is currently set up with the identifier "bootloader", which seems
to be not used at all. However, the only targets not using "router" or
"nas" are actually archs38 and arc770, which use their own value
"developerboard" for DEVICE_TYPE which seems to have been invented when
these targets where added. The latter is not implemented in target.mk,
though, and will fall back to the "basic" set of packages then.

So, to clean this up and make it more readable, let's just define a
DEVICE_TYPE "basic" and use it for the aforementioned cases.

Cc: Christian Lamparter <chunkeey@gmail.com>
Cc: Sungbo Eo <mans0n@gorani.run>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 64ebf74c05 treewide: drop DEVICE_TYPE when used as device variable
DEVICE_TYPE is a target/subtarget variable, and it does not have
any effect when set in a device definition. It can only be set
in a target's or subtarget's Makefile.

Consequently, having it set anyway is misleading, so this drops
all cases.

This effectively reverts the following commits:
7a1497fd60 ("apm821xx: MBL: set DEVICE_TYPE to NAS")
5b4765c93a ("gemini: Classify Raidsonic NAS IB-4220-B as a NAS")
cdc6de460b ("gemini: D-Link DNS-313 is a NAS")

For the following commit, the variable was set when adding device
support:
27b2f0fc0f ("kirkwood: add support for Iomega Storcenter ix2-200")

Cc: Christian Lamparter <chunkeey@gmail.com>
Cc: Sungbo Eo <mans0n@gorani.run>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Álvaro Fernández Rojas 6dc01cdee8 bcm63xx: lzma-loader: allow bigger ramdisks
Some (older) CFEs are loaded at 0x80401000 and ramdisks are loaded at
0x80010000, which means that ramdisk size limit is 0x3F1000 (almost 4M).
Therefore, current ramdisks (~4MB) are overwritting CFE in these devices,
which results in a crash.

This commit changes the address where ramdisks are loaded to 0x80a00000,
which is the same address where kernel is loaded when booting from the flash.
Therefore, lzma-loader will now be loaded at 0x80a00000, but it will still
decompress the kernel at 0x80010000.

Tested with huawei,hg556a-b, which has its CFE loaded at 0x80401000.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Daniel Golle 646bfe0842 malta: add missing symbols for kernel 5.4
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
4 years ago
Álvaro Fernández Rojas 231f728f69 bcm63xx: ad1018: remove cfe.bin image support
Apparently, Sercomm allows loading a BCM WFI image via CFE, but this image
destroys "serial" and "protect" nand partitions, which is wrong.
It will also set both bootflags to the same value, which causes booting
issues with cferam (cferom will alternatively boot from cferam1 or cferam2
each time the device is rebooted).
Now that OEM Sercomm images are supported it's time to remove this hacky
cfe.bin image support.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 39f44be1dc bcm63xx: ad1018: add missing partitions
This partitions were missing when support for this device was added.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas b302a44206 bcm63xx: stop using legacy lzma for all devices
BCM6368 and newer devices are compatible with any lzma compression parameters.
Add a new legacy device definition and use it on BCM6358 and older devices.

Compressed kernel size is reduced by ~1.35%.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas e73c61a978 bcm63xx: vg-8050: switch to bcm-wfi-split
Allows to keep a backup firmware in case active firmware is corrupted.
Also fix hsspi address warning.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas b1d375b744 bcm63xx: vr-3032u: switch to bcm-wfi-split
Allows to keep a backup firmware in case active firmware is corrupted.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 82cf488819 bcm63xx: nand: order devices alphabetically
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 824cb78cf3 bcm63xx: nand: add CFE_WFI_VERSION values for each device
CFE_WFI_VERSION should be defined per device instead of using a generic value.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 18d2eeab8e kernel: mtdsplit: support Broadcom WFI bootflags
When firmware is flashed, cferam.000 extension is renamed to the next number.
When booting, CFE scans the NAND and picks the partition with the highest
cferam extension and ignores the other one.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 1fd3dabfaf kernel: mtdsplit: improve JFFS2 scan
Allow retrieving full file name and length by parameters.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas eed8a927ee kernel: mtdsplit: bcm_wfi: refactor code
Create new parse_bcm_wfi function with common code from current parsers.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Petr Štetiar 392c64d8fd kernel: bump 5.4 to 5.4.43
Refreshed patches, removed upstreamed patch:

 bcm27xx: 950-0642-component-Silence-bind-error-on-EPROBE_DEFER.patch

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Álvaro Fernández Rojas e238c85e57 bcm63xx: nand: sercomm: switch to sercomm-load script
xxd is not a valid dependency and shouldn't be used.
Fixes buildbot failure.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas a47acae319 bcm63xx: ad1018: support Sercomm factory images
This images can be flashed from the official firmware, as opposed to CFE
images, which can only be flashed from CFE and require opening the case.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas f263a0f9ff bcm63xx: nand: support Sercomm firmwares
Add support for Sercomm factory firmwares (AES 256 CBC encrypted).

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 4b2fe12953 kernel: mtdsplit: bcm_wfi: remove brcm,wfi-sercomm compatibility
The only Sercomm WFI user has been migrated to a dedicated firmware parser.
Keep support for no cferam partition based on a boolean DT property.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 80d8114802 bcm63xx: ad1018: switch to Sercomm WFI
Support Sercomm firmware partition split.
WFI partition must be defined after bootflag partitions in order for the
parser to properly find bootflag1 and bootflag2 partitions.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas fce7380e0e kernel: mtdsplit: bcm_wfi: support Sercomm bootflags
Sercomm uses 2 bootflag partitions and boots the firmware with the highest
bootflag. Support splitting the firmware partition while keeping support for
unsplitted layout.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas cd81d105d5 kernel: mtdsplit: bcm_wfi: code refactoring
- Rename master to mtd.
- Pass mtd size as an argument.
- Rename of_match_table.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
David Bauer b017a016cc ar71xx: correct button type for TL-MR3020 mode slider
The TP-Link TL-MR3020 has a three-state mode slider which was previously
integrated as a button (EV_KEY). This led to spurious activations of
failsafe mode.

Set the type for the button to switch (EV_SW), to avoid unintended
activations of failsafe mode.

Related: commit 27f3f493de ("gpio-button-hotplug: unify polled and
interrupt code")

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Adrian Schmutzler 91b1a625f4 ath79: add label MAC address for TP-Link RE450 v2/v3
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Andreas Wiese c764c512ac ath79: add support for TP-Link RE450 v3
TP-Link RE450 v3 is a dual band router/range-extender based on
Qualcomm/Atheros QCA9563 + QCA9880.

This device is nearly identical to RE450 v2 besides a modified flash
layout (hence I think force-flashing a RE450v2 image will lead to at
least loss of MAC address).

Specification:

- 775 MHz CPU
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 1x 10/100/1000 Mbps Ethernet (AR8033 PHY)
- 7x LED, 4x button-
- possible UART header on PCB¹

Flash instruction:
Apply factory image in OEM firmware web-gui.

¹ Didn't check to connect as I didn't even manage to connect on
  RE450v2 (AFAIU it requires disconnecting some resistors, which I was
  too much of a coward to do).  But given the similarities to v2 I
  think it's the same or very similar procedure (and most likely also
  the only way to debrick).

Signed-off-by: Andreas Wiese <aw-openwrt@meterriblecrew.net>
[remove dts-v1 and compatible in DTSI]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Lech Perczak 7e513136c6 ath79: add support for TP-Link TL-WR802N V1 and V2
Specification:
- SoC: Qualcomm Atheros QCA9533 (560 MHz, MIPS 24Kc)
- RAM: 32 MiB
- Storage: 4 MiB of Flash on board
- Wireless: Built into QCA9533 (Honey Bee), PHY modes b/g/n
- Ethernet: 1x100M (port0)

Installation through OEM Web Interface:
- Connect to TL-WR802N by Ethernet or Wi-Fi
- Go to web interface:
  [V1] http://192.168.0.1
  [V2] http://192.168.0.254
  Default user is "admin" & password is "admin".
  On V2, there is no DHCP server running by default, so remember to set
  IP manually.
- Go to "System Tools -> Firmware Upgrade"
- Browse for firmware:
  [V1] "*.factory.bin"
  [V2] "*.factory-us.bin" or  "*.factory-eu.bin" for eu model
  Web interface may complain if filename is too long. In such case,
  rename .bin to something shorter.
- Click upgrade

Installation through tftp:
Note: T_OUT, T_IN and GND on the board must be connected to USB TTL
      Serial Configuration 115200 8n1

- Boot the TL-WR802N
- When "Autobooting in 1 seconds" appears type "tpl" followed by enter
- Connect to the board Ethernet port
    (IPADDR: 192.168.1.1, ServerIP: 192.168.1.10)
- tftpboot 0x80000000 <Firmware Image Name>
- Record the result of "printenv bootcmd"
- Enter "erase <Result of 'printenv bootcmd'> +0x3c0000"
    (e.g erase 0x9f020000 +0x3c0000)
- Enter "cp.b 0x80000000 <Result of 'printenv bootcmd'> 0x3c0000"
    (e.g cp.b 0x80000000 0x9f020000 0x3c0000)
- Enter "bootm <Result of 'printenv bootcmd'>"
    (e.g bootm 0x9f020000)

Notes:

When porting from ar71xx target to ath79, I found out that on V2,
reset button is on GPIO12 and active low, instead of GPIO11 and
active high. By cross-flashing V1 firmware to V2, I confirmed
the same is true for V1.
Also according to manual of V1, this one also has green
LED instead of blue - both of those issues were fixed accordingly.

The MAC address assignment has been checked with OEM firmware.

Installation manual based on ar71xx support by Thomas Roberts

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[slightly adjust commit message, add MAC address comment]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Lech Perczak f841e70640 ar71xx: fix reset key for TP-Link TL-WR802N V1/V2
During porting support for this router to ath79 target
it was discovered that GPIO mapping was incorrect (GPIO11 active high).
Correct mapping for both V1 and V2 is GPIO12 active low.

Default configuration from GPL source for V2 explicitly states this, and
this was confirmed experimentally on ath79 by looking on
/sys/kernel/debug/gpio. Correctness of this was also validated for V1 by
cross-flashing vendor firmware for V1 on V2 hardware, in which reset
button also worked.

Fix it.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
[slightly adjust commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Roger Pueyo Centelles 95caa3436d ath79: update WA/XC devices UBNT_VERSION to 8.5.3
Ubiquiti WA devices with newer hw version 2011K require UBNT_VERSION
to be at least 8.5.3, otherwise the image is rejected:

   New ver: WA.ar934x.v8.5.0-42.OpenWrt-r10947-65030d81f3
   Versions: New(525568) 8.5.0, Required(525571) 8.5.3
   Invalid version 'WA.ar934x.v8.5.0-42.OpenWrt-r10947-65030d81f3'

For consistency, also increase version number for XC devices.

Tested-by: Pedro <pedrowrt@cas.cat>
Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
4 years ago
Samantha Collard 0f910a8c4c ipq806x: EA8500 fix boot partition detection
Remove extraneous code that disabled boot partition detection.

Fixes: b3770eaca3 ("mtd: base-files: Unify dual-firmware devices (Linksys)")
Signed-off-by: Samantha Collard <sammyrc34@gmail.com>
4 years ago
Adrian Schmutzler 705fe43522 ath79: fix LEDs for GL.inet GL-AR150
Since the wireless LED was used for boot and set up with a DT
trigger, the WiFi indication hasn't worked on ath79 at all.

In addition, a look into the manual revealed that the OEM
configuration is as follows:

LED 1 (green): power
LED 2 (green): configurable
LED 3 (red): wireless

So, let's just keep the WiFi trigger and convert the rest to its
"intended" use.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler c3742ce38c bcm53xx: remove support for kernel 4.14
We currently support three kernel versions on this target, let's
just get rid of the oldest one.

Cc: Rafał Miłecki <rafal@milecki.pl>
Cc: John Crispin <john@phrozen.org>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 06feb09e54 bcm47xx: remove support for kernel 4.14
We currently support three kernel versions on this target, let's
just get rid of the oldest one.

Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler a7b07f8ba8 ar71xx: fix splitting firmware partition for TL-WR902AC v1
The -O option for the tplink-v1-header was missing for the TP-Link
TL-WR902AC v1, while safeloader and MTDPARTS where set up with a
single firmware partition.

This led to bootloops after using sysupgrade.

Fixes: FS#3118

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Álvaro Fernández Rojas 77e97abf12 bcm27xx: update to latest patches from RPi foundation
Also removes random module and switches to new bcm2711 thermal driver.
Boot tested on RPi 4B v1.1 4G.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Jakov Petrina 3dbb658d26 linux: mvebu: backport mvneta XDP support fixes
This patch backports additional fixes for XDP support in the mvneta driver. These
changes are found upstream as commits:

b37fa92e20ef2 net: mvneta: fix build skb for bm capable devices
f383b2950070c net: mvneta: rely on page_pool_recycle_direct in mvneta_run_xdp
79572c98c554d mvneta driver disallow XDP program on hardware buffer management
44efc78d0e464 net: mvneta: fix XDP support if sw bm is used as fallback

Signed-off-by: Jakov Petrina <jakov.petrina@sartura.hr>
4 years ago
Jakov Petrina 76f9aa6f4b linux: mvebu: backport mvneta XDP support
This patch backports XDP support in the mvneta driver used by Marvell ARMADA 37x,
38x and 37xx series SoCs. Supported actions are:

- XDP_DROP
- XDP_PASS
- XDP_REDIRECT
- XDP_TX

Patches are present upstream as following commits:

* b0a43db9087a net: mvneta: add XDP_TX support
* 9e58c8b41065 net: mvneta: make tx buffer array agnostic
* fa383f6b77a2 net: mvneta: move header prefetch in mvneta_swbm_rx_frame
* 0db51da7a8e9 net: mvneta: add basic XDP support
* 8dc9a0888f4c net: mvneta: rely on build_skb in mvneta_rx_swbm poll routine
* 568a3fa24a95 net: mvneta: introduce page pool API for sw buffer manager
* ff519e2acd46 net: mvneta: introduce mvneta_update_stats routine

Signed-off-by: Jakov Petrina <jakov.petrina@sartura.hr>
4 years ago
Thibaut VARÈNE f10da7cb4d packages/boot: remove rbcfg
The new sysfs soft_config driver makes buggy rbcfg obsolete and
entirely replaces it.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 48b14b9cbe generic: routerboot sysfs: soft_config support for ath79 cpufreq
This commit introduces support for R/W access to the CPU frequency
setting of routerboot on ath79 hardware.

On unsupported hardware, the sysfs attribute will expose the raw tag
value (read-only) to help with reverse engineering its meaning.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 89226b8666 generic: routerboot sysfs: move tag_show_u32()
This routine will be shared between hard and soft config drivers.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE f36e710e2d generic: routerboot sysfs: add support for soft_config
This driver exposes the data encoded in the "soft_config" flash segment
of MikroTik RouterBOARDs devices. It presents the data in a sysfs folder
named "soft_config" through a set of human-and-machine-parseable
attributes. Changes can be discarded by writing 0 to the 'commit'
attribute, or they can be committed to flash storage by writing 1.

This driver does not reuse any of the existing code previously found in
the "rbcfg" utility and makes this utility obsolete by providing a clean
sysfs interface.

Like "rbcfg", this driver requires 4K_SECTORS support since the flash
partition in which these parameters are stored is typically 4KB in size.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE dac18f66fb generic: routerboot sysfs: move tag_show_string()
This routine will be shared between hard and soft config drivers.
Also use scnprintf() instead of snprintf().

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 39ec3c5986 generic: platform/mikrotik: rb_hardconfig.c minor fixes
For the sake of strictly typed code, add a missing const qualifier.
Add a missing return value in error path.
Check the return value of mtd_read(), for good measure.
Also demote the error printks of failed sysfs file creation to warn
level since they are not fatal in the init() sequence.
Finally, add a note regarding PAGE_SIZE and clarify a comment.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 429fbc96a4 generic: platform/mikrotik: reorder Kconfig
The depends and select should apply to the sysfs driver, not the meta
config.

Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Álvaro Fernández Rojas 584d4bf1d3 bcm27xx: update patches from RPi foundation
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 745c447579 bcm27xx: remove linux 4.19 support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Pavel Balan ad84c09502 ath79: add support for COMFAST CF-E130N v2
This patch adds support for the COMFAST CF-E130N v2, an outdoor wireless
CPE with a single Ethernet port and a 802.11bgn radio.

Specifications:

 - QCA9531 SoC
 - 1x 10/100 Mbps Ethernet with PoE-in support
 - 64 MB of RAM (DDR2)
 - 16 MB of FLASH
 - 5 dBi built-in antenna
 - POWER/LAN/WLAN green LEDs
 - 4x RSSI LEDs (2x red, 2x green)
 - UART (115200 8N1) and GPIO (J9) headers on PCB

Flashing instructions:

 The original firmware is based on OpenWrt so a sysupgrade image can be
 installed via the stock web GUI.

 The U-boot bootloader also contains a backup TFTP client to upload the
 firmware from. Upon boot, it checks its ethernet network for the IP
 192.168.1.10. Host a TFTP server and provide the image to be flashed as
 file firmware_auto.bin.

MAC address setup:

The art partition contains four consecutive MAC addresses:

0x0    aa:bb:cc:xx:xx:c4
0x6    aa:bb:cc:xx:xx:c6
0x1002 aa:bb:cc:xx:xx:c5
0x5006 aa:bb:cc:xx:xx:c7

However, the manufacturer in its infinite wisdom decided that one address
is enough and both eth0 and WiFi get the MAC address from 0x0 (yes, that's
overwriting the existing and valid address in 0x1002). This is obviously
also the address on the device's label.

Signed-off-by: Pavel Balan <admin@kryma.net>
[fix configs partition, fix IMAGE_SIZE, add MAC address comment, rename
ATH_SOC to SOC]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 2b92ee36ae ath79: replace tab after DT label by space
The common separator in this case is a single space.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler e8fbb98c6d ramips: fix LED DT label for Zyxel Keenetic Start
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sebastian Schaper 64d088d8f9 ath79: increase spi clock for D-Link DIR-842
AHB is 258 MHz for this device (CPU_PLL / 3), but there is no difference
between 64 MHz and 50 MHz for spi-max-frequency, thus increase to 50 MHz.

Tested on revisions C1 and C3.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
4 years ago
Sebastian Schaper 8643c0b53d ath79: define switch reset-gpios for D-Link DIR-842
GPIO 11 needs to be pulled high for the external gigabit switch to work,
this is currently solved via gpio-hog. Replace with phy0 reset-gpios.

Tested on revisions C1 and C3. Reset button is still working for reboot,
to enter failsafe, and to enter bootloader http recovery.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
4 years ago
Sebastian Schaper 6ce1e299be ath79: fix LEDs for D-Link DIR-842
The device has a total of 8 LEDs, 5 of which are controlled by the switch
(LAN 1-4, WAN). Only power, wifi and wps are controlled by the SoC.

 * led_power is on GPIO 5 (not 15), boot flashing sequence is now visible
 * remove led 'internet', since it is only connected to the switch
 * remove ucidef_set_led_switch for WAN from 01_leds, as it has no effect

Tested on revisions C1 and C3.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
[adjust commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 0225018d8b ramips: create shared DTSI for DIR-810L and TEW-810DR
These devices seem to have the same board, so let's have a common
file.

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

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

Installation:

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

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

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

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

Notes:

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

Signed-off-by: J. Scott Heppler <shep971@centurylink.net>
[remove "link rx tx" in 01_leds, format and extend commit message,
fix DTS led node names]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Roger Pueyo Centelles 8383e63808 ath79/mikrotik: add missing kernel config symbol for 5.4
The UBIFS_FS_ZSTD is exposed when UBIFS is enabled.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
[adjust commit title]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 4661b05390 kernel: properly insert local mtd partition parsers
Between 4.19 and 5.4, the kernel moved the partition parsers into
the parsers subdirectory. This led to some necessary rebasing of
our local patches for parsers, which partially has been performed
without caring about where the code was inserted.

This commit tries to adjust our local patches so that parsers are
inserted at the "proper" positions with respect to alphabetic sorting
(if possible). Thus, the commit is cosmetic.

While this might look useless now, it will make life easier when
adding other parsers in the future or for rebasing on kernel changes.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago