Commit Graph

24161 Commits

Author SHA1 Message Date
Bjørn Mork 01a1e21863 kernel: mtdsplit_uimage: replace "openwrt, okli" parser
The only difference between the "openwrt,okli" and the generic
parser is the magic.  Set this in device tree for all affected
devices and  remove the "openwrt,okli" parser.

Tested-by: Michael Pratt <mcpratt@protonmail.com> # EAP300 v2, ENS202EXT and ENH202
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork ed39f7ec1a kernel: mtdsplit_uimage: add "openwrt, ih-magic" device-tree property
Many devices use uimages with non-standard magic values. Let
device tree override the default magic.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 5ab5bacda2 kernel: mtdsplit_uimage: replace "fonfxc" and "sge" parsers
Convert users of the "fonfxc" and "sge" parsers to the generic
"openwrt,uimage", using device specific "openwrt,padding" properties.

Tested-by: Stijn Segers <foss@volatilesystems.org> [DIR-878 A1]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork 76ea7a91cf kernel: mtdsplit_uimage: read extralen from device tree
An "openwrt,padding" property in device tree can replace two device
specific parsers.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Bjørn Mork dd5ac0546c dt-bindings: mtd: partitions: add OpenWrt defined U-Boot Image
Add devicetree bindings for vendor specific variants of U-Boot
Images, as defined by OpenWrt.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2021-01-22 21:03:11 +01:00
Rafał Miłecki 20b4f77bb6 kernel: add parser finding rootfs after CFE bootfs
It's required for BCM4908. It cannot use "bcm-wfi-fw" parser because
that one requires *two* JFFS2 partitions which is untested / unsupported
on the BCM4908 architecture. With a single JFFS2 partition "bcm-wfi-fw"
parser will:
1. Fail to find "vmlinux.lz" as it doesn't follow "1-openwrt" file
2. Create partitions that don't precisely match bootfs layout

The new parser is described in details in the MTD_SPLIT_CFE_BOOTFS
symbol help message.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-22 20:14:39 +01:00
Rafał Miłecki 6ba3a0e889 bcm4908: build valid Asus GT-AC5300 firmware image
Insert Asus specific tail that is required for image identification.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-22 20:11:24 +01:00
Sieng Piaw Liew 1d6f422e34 bcm63xx: sync ethernet driver with net-next
Sync ethernet driver code with upstream Linux kernel:
-Reduce xmit_more code changes.
-Combine rx cleanup code into a function.
-Convert to build_skb.
-Improve rx loop by optimizing loop tracking.

https://lore.kernel.org/netdev/20210106144208.1935-1-liew.s.piaw@gmail.com/
Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com>
[Amend commit description, move patches to the top since they are going to be
upstreamed]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-01-22 12:42:30 +01:00
Álvaro Fernández Rojas 2d8422842c bcm63xx: nand: fix OOB R/W for non Hamming ECC
Hamming ECC devices do not cover OOB data, as opposed to BCH ECC devices.
Therefore, disabling ECC for all devices is preventing BCH devices from
correctly reading and writing the OOB data.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-01-22 11:36:49 +01:00
Adrian Schmutzler b3eccbca7c ramips: fix port labels for Xiaomi Mi Router 4
The OEM assignment of LAN ports is swapped.

Fixes: c2a7bb520a ("ramips: mt7621: add support for Xiaomi Mi Router 4")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:56:43 +01:00
Dmytro Oz c2a7bb520a ramips: mt7621: add support for Xiaomi Mi Router 4
Xiaomi Mi Router 4 is the same as Xiaomi Mi Router 3G, except for
the RAM (256Mib→128Mib), LEDs and gpio (MiNet button).

Specifications:

Power: 12 VDC, 1 A
Connector type: barrel
CPU1: MediaTek MT7621A (880 MHz, 4 cores)
FLA1: 128 MiB (ESMT F59L1G81MA)
RAM1: 128 MiB (ESMT M15T1G1664A)
WI1 chip1: MediaTek MT7603EN
WI1 802dot11 protocols: bgn
WI1 MIMO config: 2x2:2
WI1 antenna connector: U.FL
WI2 chip1: MediaTek MT7612EN
WI2 802dot11 protocols: an+ac
WI2 MIMO config: 2x2:2
WI2 antenna connector: U.FL
ETH chip1: MediaTek MT7621A
Switch: MediaTek MT7621A

UART Serial
[o] TX
[o] GND
[o] RX
[ ] VCC - Do not connect it

MAC addresses as verified by OEM firmware:

use   address   source
LAN   *:c2      factory 0xe000 (label)
WAN   *:c3      factory 0xe006
2g    *:c4      factory 0x0000
5g    *:c5      factory 0x8000

Flashing instructions:

1.Create a simple http server (nginx etc)
2.set uart enable
To enable writing to the console, you must reset to factory settings
Then you see uboot boot, press the keyboard 4 button (enter uboot command line)
If it is not successful, repeat the above operation of restoring the factory settings.
After entering the uboot command line, type:

setenv uart_en 1
saveenv
boot

3.use shell in uart
cd /tmp
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin
wget http://"your_computer_ip:80"/openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-kernel1.bin kernel1
mtd write openwrt-ramips-mt7621-xiaomi_mir4-squashfs-rootfs0.bin rootfs0
nvram set flag_try_sys1_failed=1
nvram commit
reboot
4.login to the router http://192.168.1.1/

Installation via Software exploit
Find the instructions in the https://github.com/acecilia/OpenWRTInvasion

Signed-off-by: Dmytro Oz <sequentiality@gmail.com>
[commit message facelift, rebase onto shared DTSI/common device
definition, bump uboot-envtools]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:53:19 +01:00
Adrian Schmutzler 93be5926a2 ramips: mt7621: create DTSI for Xiaomi NAND devices
This creates a DTSI for Xiaomi devices with 128M NAND.

This allows to consolidate the partitions and a few other nodes for
AC2100 family and Mi Router 3G.

Note that the Mi Router 3 Pro has 256M NAND and differently sized
partitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Adrian Schmutzler 5a46b71826 ramips: mt7621: reorganize shared device definitions for Xiaomi
This creates a shared device definition for Xiaomi devices with
NAND and "separate" images, i.e. kernel1.bin and rootfs0.bin.

This allows to consolidate similar/duplicate code for AC2100 family
and Mi Router 3G.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-21 22:52:02 +01:00
Robert Marko 36347d003a ipq40xx: fix boards being shown twice
Since generic images have been split to their own
Makefile boards are showing up twice in menuconfig
as $(eval $(call BuildImage)) was not dropped from
the new generic.mk.

Hence $(eval $(call BuildImage)) was being called
twice.

So, lets simply drop it from generic.mk.

Fixes: 378c7ff282 ("ipq40xx: split generic images into own file")

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2021-01-21 17:08:16 +01:00
Rafał Miłecki 3bd8f660a4 bcm4908: workaround NAND controller #WP issue
There seems to be a problem with setting #WP. On the other hand ignoring
the #WP seems to work. rootfs_data UBI volume seems to persist changes.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:30:20 +01:00
Rafał Miłecki e78d3e44dd bcm4908: append UBI with rootfs to device images
Also enable UBI kernel support.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:25:34 +01:00
Rafał Miłecki 4e1e18af65 bcm4908: build flashable & bootable firmware images
BCM4908 bootloader requires firmware with JFFS2 image containing:
1. cferam.000
2. 94908.dtb
3. vmlinux.lz
4. device custom files

cferam.000 can be obtained from the bcm63xx-cfe repository.
device custom files are stored in images dir.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 13:18:42 +01:00
Rafał Miłecki 095ed5e8e1 bcm4908: set console in the CONFIG_CMDLINE
procd doesn't work with just serial specified in the DT (using chosen &
stdout-path). It requires tty device to be explicitly specified in the
cmdline.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-21 09:18:31 +01:00
Rafał Miłecki e6fb4d08a1 bcm4908: add DTS patches for USB PHY and partitions
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:22 +01:00
Rafał Miłecki bc3dbd68c4 bcm4908: use backported brcmstb soc stubs patch
Final version differs slightly - uses IS_ENABLED()

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:18 +01:00
Rafał Miłecki 707ad89f06 bcm4908: use backported switch & PMB DTS patches
Final versions differ slightly from what was used initially.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 22:00:15 +01:00
Rafał Miłecki 20a0d435d8 bcm4908: add pending mtd patches for BCM4908 partitioning
BCM4908 can have multiple firmware partitions. MTD needs to detect which
one is currently used.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 07:47:29 +01:00
Rafał Miłecki 7495acb555 kernel: backport mtd commit converting partitions doc syntax
1. It's useful for developing & validating DTS files inside OpenWrt
2. This will allow backporting later changes that depend on it

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-20 07:47:23 +01:00
John Audia 1bd005ea53 kernel: bump 5.4 to 5.4.91
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-20 01:57:05 +01:00
Sven Eckelmann 0988e03f0e ath79: Add support for OpenMesh MR1750 v2
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi (11n)
* 3T3R 5 GHz Wi-Fi (11ac)
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:26 +01:00
Sven Eckelmann ae7680dc4b ath79: Add support for OpenMesh MR1750 v1
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi (11n)
* 3T3R 5 GHz Wi-Fi (11ac)
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, apply shared DTSI/device node, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:26 +01:00
Adrian Schmutzler 847cda16eb ath79: make OpenMesh MR900 DTSI more general
The OpenMesh MR900 and to-be-added MR1750 family are very similar.
Make the existing MR900 DTSI more general so it can be used for
the MR1750 devices as well.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:25 +01:00
Adrian Schmutzler bcb311497d ath79: consolidate common definitions for OpenMesh devices
The shared image definitions for OpenMesh devices are currently
organized based on device families. This introduces some duplicate
code, as the image creation code is mostly the same for those.

This patch thus derives two basic shared definitions that work for
all devices and only requires a few variables to be moved back to
the device definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 21:41:25 +01:00
Sven Eckelmann 4fbdadc0bf ath79: apply Engenius ECB1750 style to OpenMesh MR900 RGMII cfg
The OpenMesh MR900 is a modified version of the Exx900/Exx1750 family.
These devices are shipped with an AR803x PHY and had various problems with
the delay configuration in ar71xx. These problems are now in the past [1]
and parts of the delay configuration should now be done in the PHY only.

Just switch to the configuration of the ECB1750 to have an already well
tested configuration for ath79 with the newer kernel versions.

[1] https://github.com/openwrt/openwrt/pull/3505#issuecomment-716050292

Reported-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 31172e53f9 ath79: Add support for OpenMesh MR900 v2
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi
* 3T3R 5 GHz Wi-Fi
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann e06c9eec5d ath79: Add support for OpenMesh MR900 v1
Device specifications:
======================

* Qualcomm/Atheros QCA9558 ver 1 rev 0
* 720/600/240 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 3T3R 2.4 GHz Wi-Fi
* 3T3R 5 GHz Wi-Fi
* 6x GPIO-LEDs (2x wifi, 2x status, 1x lan, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 7b772e07ea ath79: apply Engenius EAP600 style to OpenMesh MR600 RGMII cfg
The OpenMesh MR600 is a modified version of the EAP600 family. These
devices are shipped with an AR803x PHY and had various problems with the
delay configuration in ar71xx. These problems are now in the past [1] and
parts of the delay configuration should now be done in the PHY only.

Just switch to the configuration of the EAP600 to have an already well
tested configuration for ath79 with the newer kernel versions.

[1] https://github.com/openwrt/openwrt/pull/3505#issuecomment-716050292

Reported-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
2021-01-19 15:39:36 +01:00
Sven Eckelmann d9a3af46d8 ath79: Add support for OpenMesh MR600 v2
Device specifications:
======================

* Qualcomm/Atheros AR9344 rev 2
* 560/450/225 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi
* 2T2R 5 GHz Wi-Fi
* 8x GPIO-LEDs (6x wifi, 1x wps, 1x power)
* 1x GPIO-button (reset)
* external h/w watchdog (enabled by default))
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
Sven Eckelmann 4b35999588 ath79: Add support for OpenMesh MR600 v1
Device specifications:
======================

* Qualcomm/Atheros AR9344 rev 2
* 560/450/225 MHz (CPU/DDR/AHB)
* 128 MB of RAM
* 16 MB of SPI NOR flash
  - 2x 7 MB available; but one of the 7 MB regions is the recovery image
* 2T2R 2.4 GHz Wi-Fi
* 2T2R 5 GHz Wi-Fi
* 4x GPIO-LEDs (2x wifi, 1x wps, 1x power)
* 1x GPIO-button (reset)
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 1x ethernet
  - AR8035 ethernet PHY (RGMII)
  - 10/100/1000 Mbps Ethernet
  - 802.3af POE
  - used as LAN interface
* 12-24V 1A DC
* internal antennas

Flashing instructions:
======================

Various methods can be used to install the actual image on the flash.
Two easy ones are:

ap51-flash
----------

The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be
used to transfer the image to the u-boot when the device boots up.

initramfs from TFTP
-------------------

The serial console must be used to access the u-boot shell during bootup.
It can then be used to first boot up the initramfs image from a TFTP server
(here with the IP 192.168.1.21):

   setenv serverip 192.168.1.21
   setenv ipaddr 192.168.1.1
   tftpboot 0c00000 <filename-of-initramfs-kernel>.bin && bootm $fileaddr

The actual sysupgrade image can then be transferred (on the LAN port) to the
device via

  scp <filename-of-squashfs-sysupgrade>.bin root@192.168.1.1:/tmp/

On the device, the sysupgrade must then be started using

  sysupgrade -n /tmp/<filename-of-squashfs-sysupgrade>.bin

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[rebase, make WLAN LEDs consistent, add LED migration]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-19 15:39:36 +01:00
John Audia 38bdff29aa kernel: bump 5.4 to 5.4.90
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-19 15:39:36 +01:00
David Bauer 99f50a7535 ath79: rename UniFi AC kernel1 partition
These devices do not run Ubiquiti AirOS. Rename the partition to the
name used by other UniFi devices with vendor dualboot support.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-18 17:33:00 +01:00
David Bauer a8a17fd223 rockchip: use stable MAC-address for NanoPi R2S
The NanoPi R2S does not have a board specific MAC address written inside
e.g. an EEPROM, hence why it is randomly generated on first boot.

The issue with that however is the lack of a driver for the PRNG.
It often results to the same MAC address used on multiple boards by
default, as urngd is not active at this early stage resulting in low
available entropy.

There is however a semi-unique identifier available to us, which is the
CID of the used SD card. It is unique to each SD card, hence we can use
it to generate the MAC address used for LAN and WAN.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-18 17:32:52 +01:00
Robert Marko f4fdd8609c
ipq40xx: mikrotik: enable MikroTik platform driver
This enables the MikroTik platform driver, it enables us to parse
valuable info from hard_config including WLAN calibration data
extraction from sysfs.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:31:56 +01:00
Robert Marko 0184889088 ipq40xx: mikrotik: enable MikroTik NOR parser
Needed for SPI-NOR based MikroTik IPQ40xx devices like hAP ac2.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Robert Marko 30a92f55de ipq40xx: mikrotik: enable CONFIG_MTD_ROUTERBOOT_PARTS
This enables the new MikroTik specific partition parser.

This avoids manually specifying the MikroTik specific partitions as they
can be detected by their magic values.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Robert Marko b779da27ef ipq40xx: add MikroTik subtarget
MikroTik devices require the use of raw vmlinux out of the self
extracting compressed kernels.

They also require 4K sectors, kernel2minor, partition parser as well as
RouterBoard platform drivers.

So in order to not add unnecessary code to the generic sub target lets
introduce a MikroTik sub target.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
John Thomson 10d057f84a ipq40xx: kernel compressed boot: reset watchdog countdown
If the watchdog is enabled, set the timeout to 30 seconds before
decompress is started.

Mikrotik ipq40xx devices running with RouterBoot have the SoC watchdog
enabled and running with a timeout that does not allow time for the
kernel to decompress and manage the watchdog.

On ipq40xx RouterBoot TFTP boot the watchdog countdown is reset before:
Jumping to kernel

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
2021-01-17 14:23:05 +01:00
Robert Marko b6461e4654 ipq40xx: arm: compressed: add appended DTB section
This adds a appended_dtb section to the ARM decompressor
linker script.

This allows using the existing ARM zImage appended DTB support for
appending a DTB to the raw ELF kernel.

Its size is set to 1MB max to match the zImage appended DTB size limit.

To use it to pass the DTB to the kernel, objcopy is used:

objcopy --set-section-flags=.appended_dtb=alloc,contents \
	--update-section=.appended_dtb=<target>.dtb vmlinux

This is based off the following patch:
c063e27e02

Signed-off-by: Robert Marko <robimarko@gmail.com>
2021-01-17 14:23:05 +01:00
Alexander Couzens 378c7ff282
ipq40xx: split generic images into own file
In preparation of the new mikrotik subtarget split the generic images
into generic.mk

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2021-01-17 07:16:23 +01:00
Rui Salvaterra 41b096b448 ramips: mt7621: refresh the kernel config
The removed config symbols are already enabled by the generic kernel
configuration (or by default), while the added ones are forcefully
enabled by the specific architecture.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-01-15 19:12:57 +01:00
Adrian Schmutzler 3bbdc72b53 ath79: remove USB port definition for TP-Link TL-WR810N v1
The USB port definition is only needed when it is linked to a USB
LED. Since there is none for this device, we might as well remove
the port definition.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-15 19:00:15 +01:00
Russell Senior 591a4c9ed3 ath79: Add support for Ubiquiti Bullet AC
CPU:         Atheros AR9342 rev 3 SoC
RAM:         64 MB DDR2
Flash:       16 MB NOR SPI
WLAN 2.4GHz: Atheros AR9342 v3 (ath9k)
WLAN 5.0GHz: QCA988X
Ports:       1x GbE

Flashing procedure is identical to other ubnt devices.
https://openwrt.org/toh/ubiquiti/common

Flashing through factory firmware
1. Ensure firmware version v8.7.0 is installed.
   Up/downgrade to this exact version.
2. Patch fwupdate.real binary using
   `hexdump -Cv /bin/ubntbox | sed 's/14 40 fe 27/00 00 00 00/g' | \
    hexdump -R > /tmp/fwupdate.real`
3. Make the patched fwupdate.real binary executable using
   `chmod +x /tmp/fwupdate.real`
4. Copy the squashfs factory image to /tmp on the device
5. Flash OpenWrt using `/tmp/fwupdate.real -m <squashfs-factory image>`
6. Wait for the device to reboot
(copied from Ubiquiti NanoBeam AC and modified)

Flashing from serial console
1. Connect serial console (115200 baud)
2. Connect ethernet to a network with a TFTP server, through a
   passive PoE injector.
3. Press a key to obtain a u-boot prompt
4. Set your TFTP server's ip address, with:
   setenv serverip <tftp-server-address>
5. Set the Bullet AC's ip address, with:
   setenv ipaddr <bullet-ac-address>
6. Set the boot file, with:
   setenv bootfile <name-of-initramfs-binary-on-tftp-server>
7. Fetch the binary with tftp:
   tftpboot
8. Boot the initramfs binary:
   bootm
9. From the initramfs, fetch the sysupgrade binary, and flash it with
   sysupgrade.

The Bullet AC is identified as a 2WA board by Ubiquiti. As such, the UBNT_TYPE
must match from the "Flashing through factory firmware" install instructions
to work.

Phy0 is QCA988X which can tune either band (2.4 or 5GHz). Phy1 is AR9342,
on which 5GHz is disabled.  It isn't currently known whether phy1 is
routed to the N connector at all.

Signed-off-by: Russell Senior <russell@personaltelco.net>
2021-01-15 18:32:38 +01:00
Sungbo Eo 583e39e3d5 kernel: drop empty kmod-ledtrig-* packages
The following four led triggers are enabled in generic config.

* kmod-ledtrig-default-on
* kmod-ledtrig-heartbeat
* kmod-ledtrig-netdev
* kmod-ledtrig-timer

Drop the packages and remove them from DEVICE_PACKAGES.
There's no other package depending on them in this repo.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:24:31 +01:00
Sungbo Eo 8451f47b1e treewide: do not disable LED triggers in target config
Those targets have already enabled some other LED triggers, so enabling
a few more won't be a big problem.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:22:45 +01:00
Sungbo Eo 22061b2880 kernel: enable CONFIG_LEDS_TRIGGER_HEARTBEAT
The heartbeat trigger is used by luci-mod-system, which is installed
as a part of the standard luci package set. It seems the LED trigger
will be required quite often, so let's enable it by default.

This increases uncompressed kernel size by about 100 bytes on ath79/generic.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-15 18:20:55 +01:00
Jan Alexander 05707e6460 ipq806x: fix Ubiquiti UniFi AC HD partition map
This fixes a typo in the previously committed partition map that led to
the extension of the read-only mtd partition "SSD" into the following
partitions.

Fixes: 4e46beb313 ("ipq806x: add support for Ubiquiti UniFi AC HD")

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-15 17:34:04 +01:00
John Audia 945a704fab kernel: bump 5.4 to 5.4.89
All modification made by update_kernel.sh in a fresh clone without
existing toolchains.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Curtis Deptuck <curtdept@me.com> [x86/64]
2021-01-15 17:29:41 +01:00
Rafał Miłecki c40006e0af bcm4908: prepend kernel images with a custom header
It's required for CFE to accept kernel.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-15 07:45:19 +01:00
Rafał Miłecki 6c90999e2e bcm4908: backport brcmstb USB PHY driver changes
This includes BCM4908 support

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-14 12:34:20 +01:00
Etan Kissling 39add246c1 nf-conntrack: allow querying conntrack info in nfqueue
This allows libnetfilter_queue to access connection tracking information
by requesting NFQA_CFG_F_CONNTRACK. Connection tracking information is
provided in the NFQA_CT attribute.
CONFIG_NETFILTER_NETLINK_GLUE_CT enables the interaction between
nf_queue and nf_conntrack_netlink. Without this option, trying to access
connection tracking information results in "Operation not supported".

Signed-off-by: Etan Kissling <etan_kissling@apple.com>
2021-01-14 00:52:49 +00:00
Jan Alexander 6738b5e2ac uboot-envtools: add support for Aruba AP-303 and AP-365
Both devices use u-boot env variables to boot OpenWrt from its flash
partition. Using u-boot envtools, it is possible to change the bootcmd
back to the stock firmware partition directly from OpenWrt without
attaching a serial cable or even physically accessing the device.

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-14 01:04:02 +01:00
Jan Alexander 4e46beb313 ipq806x: add support for Ubiquiti UniFi AC HD
Hardware
--------

SoC:   Qualcomm IPQ8064
RAM:   512MB DDR3
Flash: 256MB NAND (Micron MT29F2G08ABBEAH4)
       32MB SPI-NOR (Macronix MX25U25635F)
WLAN:  Qualcomm Atheros QCA9994 4T4R b/g/n
       Qualcomm Atheros QCA9994 4T4R a/n/ac
ETH:   eth0 - SECONDARY (Atheros AR8033)
       eth1 - MAIN (Atheros AR8033)
USB:   USB-C
LED:   Dome (white / blue)
BTN:   Reset

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

Copy the OpenWrt sysupgrade image to the /tmp directory of the device
using scp. Default IP address is 192.168.1.20 and default username and
password are "ubnt".

SSH to the device and write the bootselect flag to ensure it is booting
from the mtd partition the OpenWrt image will be written to. Verify the
output device below matches mtd partition "bootselect" using /proc/mtd.

> dd if=/dev/zero bs=1 count=1 seek=7 conv=notrunc of=/dev/mtd11

Write the OpenWrt sysupgrade image to the mtd partition labeled
"kernel0". Also verify the used partition device using /proc/mtd.

> dd if=/tmp/sysupgrade.bin of=/dev/mtdblock12

Reboot the device.

Back to stock
-------------

Use the TFTP recovery procedure with the Ubiquiti firmware image to
restore the vendor firmware.

Signed-off-by: Jan Alexander <jan@nalx.net>
2021-01-14 01:03:54 +01:00
Rafał Miłecki 7e4f055990 bcm4908: backport BCM4908 integrated switch initial support
Upstream driver supports bridging ports. There is no support for
crossbar setup or CPU port(s) yet.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-13 11:28:41 +01:00
Rafał Miłecki 56d64d8b5a bcm4908: backport PMB (Power Management Bus) driver
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-13 07:44:04 +01:00
Rafał Miłecki 524b9aeb4c bcm4908: add simple PCIe reset controller support
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-12 23:27:29 +01:00
Rafał Miłecki 712258b772 bcm4908: backport upstream DTS patches
1. Netgear R8000P DTS file
2. NAND fix
3. PCIe reset block
4. Integrated switch
5. PMB block

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-12 23:07:10 +01:00
Rafał Miłecki c578fdfc29 bcm4908: initial work on the Broadcom BCM4908 target
BCM4906, BCM4908 and BCM49408 are SoCs with 64 bit ARMv8 B53 CPUs.
Upstream Linux is slowly getting support for that SoCs family so it
makes sense to add target for it.

This prepares initial support for:

1. Asus GT-AC5300
BCM4908 based device (4 CPUs) with 1024 MiB RAM, NAND, 8 LAN ports.

2. Netgear R8000P
BCM4906 based device (2 CPUs) with 512 MiB RAM, NAND, 4 LAN ports.

Flashing info will come later as we learn how to generate proper images.

It isn't usable yet (it only produces a bootable kernel) so "source-only"
is used.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2021-01-12 21:10:51 +01:00
Nick Hainke a1a7f3274e kernel: enable SRv6 support by enabling lwtunnel
Enable the ability to use segment routing based on IPv6. It allows the
packet to specify a path that the packet should take through the
network.

Lwtunnel allow an easy encapsulation of a package. You can just install
ip-full package and use it:

  ip -6 route add  2003::/64 dev eth0 encap seg6 mode encap \
    segs 2001::1,2002::2

An IPv6 package looks like this:
  [IPv6 HDR][IPv6 RH][IPv6 HDR][Data...]

Netifd support:
  https://git.openwrt.org/?p=project/netifd.git;
     a=commit;h=458b1a7e9473c150a40cae5d8be174f4bb03bd39

Increases imagesize by 24.125 KiB. Therefore, only enable for devices
with enough flash.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2021-01-11 11:09:05 -10:00
David Bauer b1150de9e4 rockchip: add missing Kconfig symbols
When compiling with CONFIG_ALL_KMODS enabled, compilation might stall
due to unset rockchip-specific config symbols. Disable these to avoid
stalling this step.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-11 06:00:49 +01:00
John Audia 4ebec0b3e2 kernel: bump 5.4 to 5.4.87
All modification by update_kernel.sh.

Build system: x86_64
Build-tested: ipq806x/R7800, bcm27xx/bcm2711
Run-tested: ipq806x/R7800

No dmesg regressions, everything functional

Compile-tested [*]: ath79/{generic,tiny}, ipq40xx, octeon,
                    ramips/mt7621, realtek, x86/64.
Run-tested [*]:     ramips/mt7621 (DIR-878 A1, R6800, RT-AC57U),
                    octeon (EdgeRouter Lite).

Signed-off-by: John Audia <graysky@archlinux.us>
Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
2021-01-08 21:09:17 +01:00
Stijn Segers c4bfe68c83 realtek: add support for ZyXEL GS1900-8HP v1 and v2
The ZyXEL GS1900-8HP is an 8 port gigabit switch with PoE+ support.
There are two versions on the market (v1 & v2) which share similar
specs (same flash size and flash layout, same RAM size, same PoE+ power
envelope) but have a different case and board layout that they each
share with other GS1900 siblings.

The v1 seems to share its PCB and case with non-PoE GS1900-8; as such,
adding support for the GS1900-8 would probably be trivial. The v2 seems
to share its casing and platform with its already supported bigger
brother, the GS1900-10HP - its board looks the same, except for two
holes where the GS1900-10 has its SFP ports.

Like their 10 port sibling, both devices have a dual firmware layout.
Both GS1900-8HP boards have the same 70W PoE+ power budget. In order to
manipulate the PoE+, one needs the rtl83xx-poe package [1].

After careful consideration it was decided to go with separate images
for each version.

Specifications (v1)
-------------------
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L12835F 16 MiB
* RAM:       Nanya NT5TU128M8HE-AC 128 MiB DDR2 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* PoE+:      Broadcom BCM59111KMLG (IEEE 802.3at-2009 compliant, 2x)
* UART:      1 serial header with populated standard pin connector on the
             left side of the PCB, towards the bottom. Pins are labeled:
             + VCC (3.3V)
             + TX
             + RX
             + GND

Specifications (v2)
-------------------
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L12835F 16 MiB
* RAM:       Samsung K4B1G0846G 128 MiB DDR3 SDRAM
* Ethernet:  8x 10/100/1000 Mbit
* PoE+:      Broadcom BCM59121B0KMLG (IEEE 802.3at-2009 compliant)
* UART:      1 angled serial header with populated standard pin connector
             accessible from outside through the ventilation slits on the
             side. Pins from top to bottom are clearly marked on the PCB:
             + VCC (3.3V)
             + TX
             + RX
             + GND

Serial connection parameters for both devices: 115200 8N1.

Installation
------------
Instructions are identical to those for the GS1900-10HP and apply both
to the GS1900-8HP v1 and v2 as well.

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).
* Set up a TFTP server on your client and make it serve the initramfs
  image.
* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:
  > rtk network on
* Since the GS1900-10HP is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot off the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:
  > setsys bootpartition 0
  > savesys
* Download the image onto the device and boot from it:
  > tftpboot 0x84f00000 192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-8hp-v{1,2}-initramfs-kernel.bin
  > bootm
* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:
  > sysupgrade /tmp//tmp/openwrt-realtek-generic-zyxel_gs1900-8hp-v{1,2}-squashfs-sysupgrade.bin

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
[merge PoE case, keep device definitions separate, change all those
hashes in the commit message to something else so they don't get
removed when changing the commit ...]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-08 20:48:22 +01:00
Adrian Schmutzler 40ea2fea4f realtek: remove model prefix from LED label for ZyXEL GS1900
This is used as fixed status LED, so no migration is needed.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-08 20:39:02 +01:00
Stijn Segers 0542cb6a2b realtek: introduce shared DTSI for GS1900 series
The ZyXEL GS1900-8HP v1, v2 and GS1900-10HP are all built on a similar
Realtek RTL8380M platform. Create a common DTSI in preparation for
GS1900-8HP support, and switch to the macros defined in rtl838x.dtsi.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
[drop redundant includes, use &mdio directly, do not replace SFP
ports]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-08 20:39:02 +01:00
Leon M. George 211fed5f49 ramips: remove trailing whitespace in Makefiles
Remove trailing whitespaces in two *.mk files.

Signed-off-by: Leon M. George <leon@georgemail.eu>
[fix title, add message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-07 19:51:50 +01:00
Stijn Segers e1f5ffa48c realtek: ZyXEL: spell as done by manufacturer
ZyXEL spells its own name all uppercase with just the Y lowercase. Adapt
the realtek target to follow this (other OpenWrt targets already do so).

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2021-01-07 19:51:50 +01:00
Stijn Segers 5bdf50d13b realtek: move memory node to device DTS
Move the memory out of the rtl838x.dtsi and into the device family DTSI
or device DTS if applicable. This aligns with upstream practice.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
[add missing block for dgs-1210-10p, move block below chosen node]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-07 19:51:50 +01:00
Adrian Schmutzler 5f958cb21f realtek: remove duplicate '/dts-v1/;' identifier
The identifier is already present in rtl838x.dtsi, and adding it
twice is not only redundant but actually wrong.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-07 19:51:50 +01:00
Stijn Segers ac16e6b2ea realtek: set PoE power budget for ZyXEL GS1900-10HP
As per the manufacturer's specifications, set the GS1900-10HP PoE power
budget to 77W.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
2021-01-07 19:51:50 +01:00
Michael Pratt 51360a913b ath79: make Engenius fakeroot partitions read-only
For:

 - ENH202 v1
 - ENS202EXT v1

These boards were committed before it was discovered
that for all Engenius boards with a "failsafe" image,
forcing the failsafe image to load next boot
can be achieved by editing the u-boot environment like:

  `fw_setenv rootfs_checksum 0`

So it's not necessary to delete a partition to boot to failsafe image.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
2021-01-07 19:51:50 +01:00
Michael Pratt 0070650df4 ath79: move small-flash Engenius boards to tiny
This moves some of the Engenius boards from generic to tiny:

 - EAP350 v1
 - ECB350 v1
 - ENH202 v1

For these, factory.bin builds are already failing on master
branch because of the unique situation for these boards:

 - 8 MB flash
 - an extra "failsafe" image for recovery
 - TFTP does not work (barely possible with 600 MTU)
 - bootloader loads image from a longer flash offset
 - 1 eraseblock each needed for OKLI kernel loader and fake rootfs
 - using mtd-concat to make use of remaining space...

The manual alternative would be removing the failsafe partition.
However this comes with the risk of extremely difficult recovery
if a flash ever fails because TFTP on the bootloader is bugged.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
[improve commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-07 19:51:50 +01:00
Koen Vandeputte ecded5bf09 imx6: disable unrequired pcie host driver
imx6 has it's own pcie host driver so we do
not need the one from DW.

This fixes following boot error:

[    0.156913] dw-pcie 1ffc000.pcie: IRQ index 1 not found

Fixes: 6d5291ff72 ("imx6: add support for kernel 5.4")
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2021-01-07 12:08:31 +01:00
Koen Vandeputte 87bd940536 imx6: refresh kernel config
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2021-01-07 12:08:31 +01:00
Koen Vandeputte 7b3dd33c20 imx6: gw52xx: fix duplicate regulator naming
2 regulator descriptions carry identical naming.

This leads to following boot warning:
[    0.173138] debugfs: Directory 'vdd1p8' with parent 'regulator' already present!

Fix this by renaming the one used for audio.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2021-01-07 12:08:31 +01:00
Adrian Schmutzler 849d4b3940 ipq806x: add space before SPDX identifier (again)
Strictly, an SPDX identifier requires a space between the comment
marker and the identifier itself. This has been addressed in
b69c21738e ("treewide: add space before SPDX identifier"), but
some new malformatted identifiers were merged recently.

This could have been prevented by using checkpatch.pl earlier.

Fixes: 1a775a4fd0 ("ipq806x: add support for TP-Link Talon AD7200")
Fixes: 8ddaeaf642 ("ipq806x: create DTSI for TP-Link AD7200 and C2600")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-06 23:53:25 +01:00
Adrian Schmutzler b039f76f35 ipq806x: improve model name and revision for TP-Link AD7200
The TP-Link AD7200 appears with and without the "Talon" model name
prefix. Let's use both variants for 'make menuconfig' so everybody
can locate the device.

Concerning the revision, the TP-Link page lists v1 and v2 with the
device currently marked as "End of Life". However, the v2 and latest
v1 firmware are byte-identical. Thus, we only need one image for
this device and do not need to include the revision in the image name.

While at it, remove the useless BOARD_NAME variable which only makes
sense in combination with upgrade from legacy stable versions or when
custom upgrade scripts are involved.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-06 14:43:12 +01:00
Adrian Schmutzler 8ddaeaf642 ipq806x: create DTSI for TP-Link AD7200 and C2600
Both devices share most of their setup except buttons and LEDs,
so having a common DTSI removes a lot of duplicate code.

In order to have a shared partitioning scheme, device-id and
product-info from AD7200 have been merged into a single
product-info partition like for C2600.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-06 14:43:12 +01:00
Adrian Schmutzler 8050b70514 ipq806x: clean up DTS file for TP-Link AD7200
This does several cosmetic adjustments for AD7200's DTS:

 - Make node name, DT label and label property consistent
 - Drop wrong and unused spi4 label
 - Use generic flash@0 node name

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-06 14:43:12 +01:00
David Bauer b4c0d377f6 ramips: limit 5GHz channels for UniFi 6 Lite
The MT7915 radio currently advertises 2.4GHz channels while the antenna
path only supports 5 GHz. Limit the radio to 5GHz channels to prevent
users from configuring non-supported channels.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-06 00:00:01 +01:00
Birger Koblitz 89f71ebb35 realtek: fix build issues
This fixes the build problems for the REALTEK target by adding a proper
configuration option for the phy module.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
2021-01-05 22:43:40 +01:00
Daniel Golle f4c64937cf ipq806x: fix LED names of TP-Link Talon AD2700
While the underscore in the name of the USB LEDs was removed from DTS,
/etc/board.d/01_leds also has to reflect that change.

Fixes: 28fd279e5d ("ipq806x: some corrections for TP-Link Talon AD7200")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-01-05 16:26:44 +00:00
David Bauer fb4d7a9680 ramips: add support for Ubiquiti UniFi 6 Lite
Hardware
--------
MediaTek MT7621AT
256M DDR3
32M SPI-NOR
MediaTek MT7603 2T2R 802.11n 2.4GHz
MediaTek MT7915 2T2R 802.11ax 5GHz

Not Working
-----------
 - Bluetooth (connected to UART3)

UART
----

UART is located in the lower left corner of the board. Pinout is

0 - 3V3 (don't connect)
1 - RX
2 - TX
3 - GND

Console is 115200 8N1.

Boot
----

1. Connect to the serial console and connect power.

2. Double-press ESC when prompted

3. Set the fdt address

   $ fdt addr $(fdtcontroladdr)

4. Remove the signature node from the control FDT

   $ fdt rm /signature

5. Transfer and boot the OpenWrt initramfs image to the device.
   Make sure to name the file C0A80114.img and have it reachable at
   192.168.1.1/24

   $ tftpboot; bootm

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

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

2. Update the bootloader environment.

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

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

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

   $ cat /proc/mtd

5. Set the bootselect flag to boot from kernel0

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

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

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

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

Below are the original installation instructions prior to the discovery
of "devmode=TRUE". They are not required for installation and are
documentation only.

The bootloader employs signature verification on the FIT image
configurations. This way, booting unauthorized image without patching
the bootloader is not possible. Manually configuring the bootcmd in the
U-Boot envronment won't work, as this is restored to the default value
if modified.

The bootloader is made up of three different parts.

1. The SPL performing early board initialization and providing a XModem
   recovery in case the PBL is missing

2. The PBL being the primary U-Boot application and containing the
   control FDT. It is LZMA packed with a uImage header.

3. A Ubiquiti standalone U-Boot application providing the main boot
   routine as well as their recovery mechanism.

In a perfect world, we would only replace the PBL, as the SPL does not
perform checks on the PBLs integrity. However, as the PBL is in the same
eraseblock as the SPL, we need to at least rewrite both.

The bootloader will only verify integrity in case it has a "signature"
node in it's control device-tree. Renaming the signature node to
something else will prevent this from happening.

Warning: These instructions are based on the firmware intially
shipped with the device and potentially brick your device in a way it
can only be recovered using a SPI flasher.

Only (!) proceed if you understand this!

1. Extract the bootloader from the U-Boot partition using the OpenWrt
   initramfs image.

2. Split the bootloader into it's 3 components:

   $ dd if=bootloader.bin of=spl.bin bs=1 skip=0 count=45056
   $ dd if=bootloader.bin of=pbl.uimage bs=1 skip=45056 count=143360
   $ dd if=bootloader.bin of=ubnt.uimage bs=1 skip=188416

3. Strip the uImage header from the PBL

   $ dd if=pbl.uimage of=pbl.lzma bs=64 skip=1

4. Decompress the PBL

   $ lzma -d pbl.lzma --single-stream

   The decompressed PBL sha256sum should be
   d8b406c65240d260cf15be5f97f40c1d6d1b6e61ec3abed37bb841c90fcc1235

5. Open the decompressed PBL using your favorite hexeditor. Locate the
   control FDT at offset 0x4CED0 (0xD00DFEED). At offset 0x4D5BC, the
   label for the signature node is located. Rename the "signature"
   string at this offset to "signaturr".

   The patched PBL sha256sum should be
   d028e374cdb40ba44b6e3cef2e4e8a8c16a3b85eb15d9544d24fdd10eed64c97

6. Compress the patched PBL

   $ lzma -z pbl --lzma1=dict=67108864

   The resulting pbl.lzma file should have the sha256sum
   7ae6118928fa0d0b3fe4ff81abd80ecfd9ba2944cb0f0a462b6ae65913088b42

7. Create the PBL uimage

   $ SOURCE_DATE_EPOCH=1607909492 mkimage -A mips -O u-boot -C lzma
     -n "U-Boot 2018.03 [UniFi,v1.1.40.71]" -a 84000000 -e 84000000
     -T firmware -d pbl.lzma patched_pbl.uimage

   The resulting patched_pbl.uimage should have the sha256sum
   b90d7fa2dcc6814180d3943530d8d6b0d6a03636113c94e99af34f196d3cf2ce

8. Reassemble the complete bootloader

   $ dd if=patched_pbl.uimage of=aligned_pbl.uimage bs=143360 count=1
     conv=sync
   $ cat spl.bin > patched_uboot.bin
   $ cat aligned_pbl.uimage >> patched_uboot.bin
   $ cat ubnt.uimage >> patched_uboot.bin

   The resulting patched_uboot.bin should have the sha256sum
   3e1186f33b88a525687285c2a8b22e8786787b31d4648b8eee66c672222aa76b

9. Transfer your patched bootloader to the device. Also install the
   kmod-mtd-rw package using opkg and load it.

   $ insmod mtd-rw.ko i_want_a_brick=1

   Write the patched bootloader to mtd0

   $ mtd write patched_uboot.bin u-boot

10. Erase the kernel1 partition, as the bootloader might otherwise
    decide to boot from there.

    $ mtd erase kernel1

11. Transfer the OpenWrt sysupgrade image to the device and install
    using sysupgrade.

FIT configurations
------------------

In the future, the MT7621 UniFi6 family can be supported by a single
OpenWrt image.

config@1: U6 Lite
config@2: U6 IW
config@3: U6 Mesh
config@4: U6 Extender
config@5: U6 LR-EA (Early Access - GA is MT7622)

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-01-05 16:25:13 +01:00
Daniel Golle 28fd279e5d ipq806x: some corrections for TP-Link Talon AD7200
Address most comments made by Adrian Schmutzler on the mailing list.
The device name is kept as 'TP-Link Talon AD7200' as that seems to be
the marketing name TP-Link chose for that device, it also matches the
naming scheme for other TP-Link devices (e.g. 'TP-Link Archer C7').

Fixes: 1a775a4fd0 ("ipq806x: add support for TP-Link Talon AD7200")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-01-05 12:58:43 +00:00
Gary Cooper 1a775a4fd0 ipq806x: add support for TP-Link Talon AD7200
Device hardware: https://deviwiki.com/wiki/TP-LINK_AD7200_(Talon)

The Talon AD7200 is basically an Archer C2600 with a third PCIe lane
and an 802.11ad radio. It looks like the Archers C2600/5400 but the
housing is slightly larger.

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

  - IPQ8064 dual-core 1400MHz
  - QCA9988 2.4GHz WiFi
  - QCA9990 5GHz WiFi
  - QCA9500 60GHz WiFi
  - 32MB SPI Flash
  - 512MiB RAM
  - 5 GBit Ports (QCA8337)

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

Installation is possible from the OEM web interface.
Sysupgrade is possible.
TFTP recovery is possible.
  - Image: AD7200_1.0_tp_recovery.bin

Notes
  - This will be the first 802.11ad device supported by mainline.

Signed-off-by: Gary Cooper <gaco@bitmessage.de>
2021-01-05 02:16:24 +00:00
Adrian Schmutzler acdf07cd3e ath79: keep DTSI files for D-Link SoC-specific
It is good practice to define device tree files based on specific
SoCs. Thus, let's not start to create files that are used across
different architectures.

Duplicate the DTSI file for D-Link DAP-2xxx in order to have one
for qca953x and one for qca955x, respectively.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-04 01:09:32 +01:00
Sebastian Schaper d7d87cedcf ath79: Fix 02_network setup for D-Link DAP-2660 A1
The device is a one-port, but was set up as two-port by the
default case in 02_network. Fix it.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
[commit title/message facelift]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-04 01:09:32 +01:00
Sebastian Schaper 8ae2ee99c6 ath79: add support for D-Link DAP-3320 A1
Specifications:
 * QCA9533, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R
 * 10/100 Ethernet Port, 802.11af PoE
 * IP55 pole-mountable outdoor case

Installation:
 * Factory Web UI is at 192.168.0.50
   login with 'admin' and blank password, flash factory.bin
 * Recovery Web UI is at 192.168.0.50
   connect network cable, hold reset button during power-on and keep it
   pressed until uploading has started (only required when checksum is ok,
   e.g. for reverting back to oem firmware), flash factory.bin

After flashing factory.bin, additional free space can be reclaimed by
flashing sysupgrade.bin, since the factory image requires some padding
to be accepted for upgrading via OEM Web UI.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
2021-01-04 01:09:32 +01:00
Sebastian Schaper 5b58710fad ath79: add support for D-Link DAP-2680 A1
Specifications:
 * QCA9558, 16 MiB Flash, 256 MiB RAM, 802.11n 3T3R
 * QCA9984, 802.11ac Wave 2 3T3R
 * Gigabit LAN Port (AR8035), 802.11at PoE

Installation:
 * Factory Web UI is at 192.168.0.50
   login with 'admin' and blank password, flash factory.bin
 * Recovery Web UI is at 192.168.0.50
   connect network cable, hold reset button during power-on and keep it
   pressed until uploading has started (only required when checksum is ok,
   e.g. for reverting back to oem firmware), flash factory.bin

After flashing factory.bin, additional free space can be reclaimed by
flashing sysupgrade.bin, since the factory image requires some padding
to be accepted for upgrading via OEM Web UI.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
2021-01-04 01:09:32 +01:00
Sebastian Schaper b077accb9c ath79: add support for D-Link DAP-2230 A1
Specifications:
 * QCA9533, 16 MiB Flash, 64 MiB RAM, 802.11n 2T2R
 * 10/100 Ethernet Port, 802.11af PoE

Installation:
 * Factory Web UI is at 192.168.0.50
   login with 'admin' and blank password, flash factory.bin
 * Recovery Web UI is at 192.168.0.50
   connect network cable, hold reset button during power-on and keep it
   pressed until uploading has started (only required when checksum is ok,
   e.g. for reverting back to oem firmware), flash factory.bin

After flashing factory.bin, additional free space can be reclaimed by
flashing sysupgrade.bin, since the factory image requires some padding
to be accepted for upgrading via OEM Web UI.

Signed-off-by: Sebastian Schaper <openwrt@sebastianschaper.net>
2021-01-04 01:09:32 +01:00
Sungbo Eo cbccc2560c ipq806x: consolidate DTS files directory
Commit 29ca10e537 ("ipq806x: remove support for kernel 4.19") moved
DTS files to "files" directory, but after that a new DTS file was added
to the former "files-5.4" directory. Move it to the new directory.

Fixes: 98b86296e6 ("ipq806x: add support for ASRock G10")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2021-01-03 15:50:55 +01:00
Sungbo Eo 2eb336b79d mediatek: remove unnecessary execute permission bit
Kernel config does not need to be executable. 644 is enough.

Fixes: 25d9df670b ("mediatek: add v5.4 support")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[split by targets]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-03 15:48:25 +01:00
Sungbo Eo aad3d9c710 ipq40xx: remove unnecessary execute permission bit
DTS files do not need to be executable. 644 is enough.

Fixes: 0fbdb51f76 ("ipq40xx: add Edgecore OAP-100 support")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[split by targets]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-03 15:48:18 +01:00
Adrian Schmutzler 9aeaea471e ath79: fix ethernet-phy label for dlink,dap-2660-a1
The phy label/node name should correspond to the reg property.

While at it, use more common decimal notation for reg property itself.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-01-03 13:55:50 +01:00
Pawel Dembicki ac25b64350 ipq806x: reenable CONFIG_CMDLINE_OVERRIDE and ASRock G10
This reverts commit 57e4cc8261.

Cmdline override patch was fixed. It's time for reenable
Asrock G10 support.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Tested-by: Hannu Nyman <hannu.nyman@iki.fi> (run-tested for R7800)
2021-01-01 22:10:20 +01:00
Pawel Dembicki 6230b235b2 ipq806x: fix 900-arm-add-cmdline-override.patch
900-arm-add-cmdline-override.patch have missplaced entry in
arch/arm/Kconfig file. It causes problem with other cmdline
patches. This patch put Kconfig entry in correct place.

Fixes: 98b86296e6 ("ipq806x: add support for ASRock G10")

Suggested-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
Tested-by: Hannu Nyman <hannu.nyman@iki.fi> (run-tested for R7800)
2021-01-01 22:10:20 +01:00
Rui Salvaterra de09355f74 kernel/hack-5.4: make UDP tunneling user-selectable
UDP tunneling support isn't user-selectable, but it's required by WireGuard
which is, for the time being, an out-of-tree module. We currently work around
this issue by selecting an unrelated module which depends on UDP tunnelling
(VXLAN). This is inconvenient, as it implies this unrelated module needs to be
built-in when doing a monolithic build.

Fix this inconvenience by making UDP tunneling user-selectable in the kernel
configuration.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2021-01-01 19:55:59 +01:00