Commit Graph

3794 Commits (f5b3cd15395c2617585e36b4acf40999616cc60c)

Author SHA1 Message Date
Koen Vandeputte e9d92bf1e1 kernel: bump 4.14 to 4.14.72
Refreshed all patches.

Removed upstreamed:
- 203-MIPS-ath79-fix-restart.patch
- 0013-MIPS-ath79-fix-system-restart.patch
- 180-earlycon-initialize-port-uartclk-based-on-clock-frequency-property.patch
- 181-earlycon-remove-hardcoded-port-uartclk-initialization-in-of_setup_earlycon. patch
- 700-1-6-e1000e-Remove-Other-from-EIAC.patch
- 700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.patch
- 700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.patch
- 700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.patch

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 3caf940cc6 kernel: bump 4.9 to 4.9.129
Refreshed all patches.

Removed upstreamed:
- 203-MIPS-ath79-fix-restart.patch

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
David Bauer cd02d4faf9 ar71xx: flag FritzBox 4020 buttons as active low
Buttons of AVM FritzBox 4020 are incorrectly flagged as active high.

This was an oversight as RFKill button was working as expected even
with incorrectly flagged GPIO.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Koen Vandeputte 0dbdb476f3 kernel: bump 4.14 to 4.14.71
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 42f158314e ar71xx: fix switch probing on kernel 4.14
The bump to 4.14 changed the way mdio probes behind switches.

While the board_info is added to the list, the code that actually inserted
the list info into the phydev structure was missing.

This resulted in non-working ethernet ports.

Re-add it to fix switch probing.
This mimics the exact behaviour as it was in kernel 4.9.

Before:

[    1.066007] switch0: Atheros AR8327 rev. 4 switch registered on ag71xx-mdio.0
[    1.073409] Atheros AR8216/AR8236/AR8316: probe of ag71xx-mdio.0:00 failed with error -22
[    1.102455] libphy: ag71xx_mdio: probed
[    1.737938] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd034, driver=Generic PHY]
[    1.747994] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    2.377642] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.429938] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII

After:

[   11.163357] libphy: Fixed MDIO Bus: probed
[   11.319898] libphy: ag71xx_mdio: probed
[   11.360844] switch0: Atheros AR8327 rev. 4 switch registered on ag71xx-mdio.0
[   12.447398] libphy: ag71xx_mdio: probed
[   13.077402] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
[   13.088989] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[   13.717716] ag71xx-mdio.1: Found an AR934X built-in switch
[   13.769990] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 079871983c kernel: bump 4.14 to 4.14.68
Refreshed all patches.

Remove upstream accepted:
- 330-Revert-MIPS-BCM47XX-Enable-74K-Core-ExternalSync-for.patch

Altered:
- 303-v4.16-netfilter-nf_tables-remove-multihook-chains-and-fami.patch
- 308-mips32r2_tune.patch

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 01793e8752 kernel: bump 4.14 to 4.14.67
Refreshed all patches.

Removed upstreamed patches:
- 037-v4.18-0008-ARM-dts-BCM5301x-Fix-i2c-controller-interrupt-type.patch

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 22f899c6dd kernel: bump 4.9 to 4.9.124
Refreshed all patches.

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
David Bauer 8e9a59a6b9 build: add mkrasimage
The current make-ras.sh image generation script for the ZyXEL NBG6617
has portability issues with bash. Because of this, factory images are
currently not built correctly by the OpenWRT buildbots.

This commit replaces the make-ras.sh by C-written mkrasimage.

The new mkrasimage is also compatible with other ZyXEL devices using
the ras image-format.
This is not tested with the NBG6616 but it correctly builds the
header for ZyXEL factory image.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Michal Cieslakiewicz 2e3e0fd94c ar71xx: WNR612v2: fix kernel panic due to wrong Wifi LED init
Netgear WNR612v2 flashed with recent OpenWrt builds suffers from kernel
panic at boot during wireless chip initialization, making device
unusable:

 ath: phy0: Ignoring endianness difference in EEPROM magic bytes.
 ath: phy0: Enable LNA combining
 CPU 0 Unable to handle kernel paging request at virtual address 1000fee1, epc == 801d08f0, ra == 801d0d90
 Oops[#1]:
 CPU: 0 PID: 469 Comm: kmodloader Not tainted 4.9.120 #0
 [ ... register dump etc ... ]
 Kernel panic - not syncing: Fatal exception
 Rebooting in 1 seconds..

This simple patch fixes above error. It keeps LED table in memory after
kernel init phase for ath9k driver to operate correctly (__initdata
removed).

Also, another bug is fixed - correct array size is provided to function
that adds platform LEDs (this device has only 1 connected to Wifi chip)
preventing code from going outside array bounds.

Fixes: 1f5ea4eae4 ("ar71xx: add correct named default wireless led by using platform leds")

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
[trimmed commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Matthias Schiffer a4f4ddba61
ar71xx/generic: enable Zyxel NBG6616 in kernel config again
The NBG6616 shares a config symbol with the NBG6716. It was accidentally
removed from the config when the ar71xx-tiny target was split off.

Fixes: 0cd5e85e7a ("ar71xx: create new ar71xx/tiny subtarget for 4MB flash devices")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Koen Vandeputte 6100655c8c ar71xx: fix typo in rb91x nand source
Fixes: 3b1ea0996f ("ar71xx: fix build error due to bad include")

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 6b4ba118ac kernel: bump 4.14 to 4.14.66
Refreshed all patches

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 3b1ea0996f ar71xx: fix build error due to bad include
While "rawnand.h" is available in kernel 4.14,
the default for this target is kernel 4.9 in which "nand.h" should be used.

Add an extra check to include the correct file depending on kernel version

Fixes these build errors:

drivers/mtd/nand/ar934x_nfc.c:16:10: fatal error: linux/mtd/rawnand.h: No such file or directory
 #include <linux/mtd/rawnand.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Fixes: 318e19ba67 ("ar71xx: add v4.14 support")

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte 743654f30d ar71xx: add missing include for checking kernel version
Fixes these build errors:

arch/mips/ath79/mach-rb2011.c:20:5: error: "LINUX_VERSION_CODE" is not defined, evaluates to 0 [-Werror=undef]
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
     ^~~~~~~~~~~~~~~~~~
arch/mips/ath79/mach-rb2011.c:20:26: error: "KERNEL_VERSION" is not defined, evaluates to 0 [-Werror=undef]
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
                          ^~~~~~~~~~~~~~
arch/mips/ath79/mach-rb2011.c:20:40: error: missing binary operator before token "("
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)
                                        ^

Fixes: 318e19ba67 ("ar71xx: add v4.14 support")

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
John Crispin 318e19ba67 ar71xx: add v4.14 support
adds v4.14 patches for testing but leaves v4.9 as default for now.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Koen Vandeputte 21a229317f kernel: bump 4.9 to 4.9.119
Refreshed all patches.

Delete upstreamed patch:
- 100-tcp-add-tcp_ooo_try_coalesce-helper.patch

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
INAGAKI Hiroshi 23519edbca ath79: add support for Buffalo BHR-4GRV2
Buffalo BHR-4GRV2 is a wired router, based on Qualcomm Atheros
QCA9558.
Ported from ar71xx target.

Specification:

- Qualcomm Atheros QCA9558
- 64 MB of RAM
- 16 MB of Flash
- 5x 10/100/1000 Ethernet
  - QCA8337N
- 4x LEDs, 2x keys
- UART header on PCB
  - Vcc, TX, RX, GND from LED side
  - 115200n8

Flash instruction using factory image:

1. Connect the computer to the LAN port of BHR-4GRV2
2. Connect power cable to BHR-4GRV2 and turn on it
3. Access to "http://192.168.12.1/" and open firmware update
page ("ファームウェア更新")
4. Select the OpenWrt factory image and click update ("更新実行")
button
5. Wait ~120 seconds to complete flashing

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
6 years ago
David Bauer 4e39e213af ar71xx: allow to override at803x sgmii aneg status
When checking the outcome of the PHY autonegotiation status, at803x
currently returns false in case the SGMII side is not established.

Due to a hardware-bug, ag71xx needs to fixup the SoCs SGMII side, which
it can't as it is not aware of the link-establishment.

This commit allows to ignore the SGMII side autonegotiation status to
allow ag71xx to do the fixup work.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
David Bauer f4f99ec973 ar71xx: fix QCA955X SGMII link loss
The QCA955X is affected by a hardware bug which causes link-loss of the
SGMII link between SoC and PHY. This happens on change of link-state or
speed.

It is not really known what causes this bug. It definitely occurs when
using a AR8033 Gigabit Ethernet PHY.

Qualcomm solves this Bug in a similar fashion. We need to apply the fix
on a per-device base via platform-data as performing the fixup work will
break connectivity in case the SGMII interface is connected to a Switch.

This bug was first proposed to be fixed by Sven Eckelmann in 2016.
 https://patchwork.ozlabs.org/patch/604782/

Based-on-patch-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Koen Vandeputte f7036a34ac kernel: bump 4.9 to 4.9.118
Refreshed all patches.

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Andrew Cameron bae927c551 ar71xx: add support for TP-LINK CPE510 V2.0
Adds Support for the TP-LINK CPE510 V2.0 by TP-Link.
The hardware is almost the same as the CPE510 V1.0
Follow the same processes as for the CPE510 V1.0

Signed-off-by: Andrew Cameron <apcameron@softhome.net>
6 years ago
Jo-Philipp Wich b9bd3285c7 Revert "ar71xx: ag71xx: Prevent kernel oops for board def"
This reverts commit 7a3e133751.

This change reportedly breaks connectivity on some ar71xx devices, so
revert it for now.

Ref: https://github.com/openwrt/openwrt/pull/1217#issuecomment-409708087
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Jo-Philipp Wich 33dbe2c55d Revert "ar71xx: ag71xx: Add connect message: fixed phy"
This reverts commit 0b9f4e8808.

This change reportedly breaks connectivity on some ar71xx devices, so
revert it for now.

Ref: https://github.com/openwrt/openwrt/pull/1217#issuecomment-409708087
Reported-by: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Jo-Philipp Wich 9ebf596386 Revert "ar71xx: ag71xx_phy: Fix compilation for debug messages"
This reverts commit 2655fbe8ef.

The patch introduces syntax errors, revert it for now.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Daniel F. Dickinson 0b7a9688ce ar71xx: cr3000: cleanup board definition
1) Add comments so it's clear why we did things; this may prevent
   someone (e.g. me) from sinking time into fixing things that
   aren't broken and/or were done for reason.

2) Drop mdio 0 probe/register; we don't use ag1xx mdio bus 0.

3) Cosmetic reording of some code (tested) that makes the defintion
   more clear.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson b6c8bc0981 ar71xx: cr3000: Use correct company name
It's 'PowerCloud Systems' not 'PowerCloud'.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson e38520cd50 ar71xx: cr3000: Drop support for defunct cloud
The CR3000 stock firmware is now irrelevant as it required a now defunct
cloud service.  Therefore only build images that use the entire flash
(overwriting stock firwmare-specific partitions that no longer matter),
previously called 'nocloud' images.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Koen Vandeputte fec8fe8069 kernel: bump 4.9 to 4.9.116
Refreshed all patches

Remove upstreamed patches.
- 103-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
- 403-mtd_fix_cfi_cmdset_0002_status_check.patch
- 001-4.11-01-mtd-m25p80-consider-max-message-size-in-m25p80_read.patch
- 001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
- 001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
- 900-gen_stats-fix-netlink-stats-padding.patch

Introduce a new backported patch to address ext4 breakage, introduced in 4.9.112
- backport-4.9/500-ext4-fix-check-to-prevent-initializing-reserved-inod.patch

This patch has been slightly altered to compensate for a new helper function
introduced in later kernels.

Also add ARM64_SSBD symbol to ARM64 targets still running kernel 4.9

Compile-tested on: ar71xx, bcm2710
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Daniel Golle a497e47762 kernel: re-add patch for AT8032 Ethernet PHY
The patch was wrongly removed by a kernel version bump to 4.9.105 in
the believe that it was merged upstream thow it wasn't. This lead to
unrecoverable link losses on devices which use those PHYs such as
many ubnt single-port CPEs.

Fixes: 7dca1bae82 (kernel: bump to 4.9.105)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Thibaut VARÈNE c6ee683d64 ar71xx: define switch for rb-952ui-5ac2nd
QCA9533 built-in switch can be configured

Tested-by: Thibaut VARÈNE <hacks@slashdirt.org>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years ago
John Crispin eddf4eae97 ar71xx: fix TL-WR1043N v5 port mapping
fixes 5660c8fb20 ("ar71xx: TL-WR1043N v5: fix mapping of LAN ports to labels on housing.")

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Tim Thorpe 5660c8fb20 ar71xx: TL-WR1043N v5: fix mapping of LAN ports to labels on housing.
Reversed the numbering of the LAN ports in Luci so as to match the port numbers on the housing.

Signed-off-by: Tim Thorpe <tim@tfthorpe.net>
6 years ago
Tim Thorpe d834ad9ac3 ar71xx: TL-WR1043N v4/v5: add orange WAN LED support
Add missing definitions for the orange WAN LED on the
TL-WR1043N(D) v4 and v5.

Change the name of a MAC address offset constant to
make it consistent with the format of the
existing constants.

Signed-off-by: Tim Thorpe <tim@tfthorpe.net>
6 years ago
Keith Maika 4caab80830 ar71xx: add support for TP-Link Archer C59 v2
TP-Link Archer C59v2 is a dual-band AC1350 router based on
Qualcomm/Atheros QCA9561+QCA9886 chips.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- USB 2.0 port
- UART header on PCB

Flash instruction:
  - via web UI:
    1. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
    2. Login to router and open the Advanced tab
    3. Navigate to System Tools -> Firmware Upgrade
    4. Upload firmware using the Manual Upgrade form
  - via TFTP:
    1. Set PC to fixed ip address 192.168.0.66
    2. Download openwrt-ar71xx-generic-archer-c59-v2-squashfs-factory.bin
       and rename it to tp_recovery.bin
    3. Start a tftp server with the file tp_recovery.bin 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.

Signed-off-by: Keith Maika <keithm@aoeex.com>
6 years ago
张鹏 53a4502013 ar71xx:add support for E750G v8
Qxwlan E750G v8 is based on Qualcomm QCA9344.

Specification:

 - 560/450/225 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 2.4G GHz (AR9344)
 - 2x 10/100 Mbps Ethernet (PoE support)
 - 2x 10/100/1000 Mbps Ethernet
 - 7x LED (6 driven by GPIO)
 - 1x button (reset)
 - 1x DC jack for main power input (9-48 V)
 - UART (J23) and LEDs (J2) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
6 years ago
张鹏 ac03d51a3f ar71xx:add support for E750A v4
Qxwlan E750A v4 is based on Qualcomm QCA9344.

Specification:

 - 560/450/225 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 5G GHz (AR9344)
 - 2x 10/100 Mbps Ethernet (one port with PoE support)
 - 1x miniPCIe slot (USB 2.0 bus only)
 - 7x LED (6 driven by GPIO)
 - 1x button (reset)
 - 1x DC jack for main power input (9-48 V)
 - UART (J23) and LEDs (J2) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
6 years ago
张鹏 b74f63f81d ar71xx:add support for E558 v2
Qxwlan E558 v2 is based on Qualcomm QCA9558 + AR8327.

Specification:

 - 720/600/200 MHz (CPU/DDR/AHB)
 - 128 MB of RAM (DDR2)
 - 8/16 MB of FLASH (SPI NOR)
 - 2T2R 2.4 GHz (QCA9558)
 - 3x 10/100/1000 Mbps Ethernet (one port with PoE support)
 - 4x miniPCIe slot (USB 2.0 bus only)
 - 1x microSIM slot
 - 5x LED (4 driven by GPIO)
 - 1x button (reset)
 - 1x 3-pos switch
 - 1x DC jack for main power input (9-48 V)
 - UART (JP5) and LEDs (J8) headers on PCB

Flash instruction (using U-Boot CLI and tftp server):

 - Configure PC with static IP 192.168.1.10 and tftp server.
 - Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
 - Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
 - Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

 - Configure PC with static IP 192.168.1.xxx(2-254)/24.
 - Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
 - Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: 张鹏 <sd20@qxwlan.com>
6 years ago
Daniel F. Dickinson 7a3e133751 ar71xx: ag71xx: Prevent kernel oops for board def
The driver is written in such a way that with a board defintion that
connects a fixed phy, mdio, and switch in a certain way, a kernel oops could
result because of lack of previously probed mdio bus.

This commit allows for easier debugging in this case by casting the
correct blame with serial console messages.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 0b9f4e8808 ar71xx: ag71xx: Add connect message: fixed phy
It's a little noisier but makes it obvious when the ar7240 switch was
connected to the MDIO bus, and to which phy device (or the failure
to do so).

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 2655fbe8ef ar71xx: ag71xx_phy: Fix compilation for debug messages
NB: Error only appears with ag71xx debug messages and dynamic printk
enabled.  This is probably why no one has caught it before.

Previously phy probe debug messages used old (now wrong) functions
to get the phy name for printing.  There was also the chance of
a NULL pointer in the event no phy_device was found.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 098267db4c ar71xx: cap324: Drop support for defunct cloud
Only build images for straight OpenWrt (using all flash; wipes out
partitions that contain information only important for accessing a
now defunct cloud service with the stock firmware) since the stock
firmware is now irrelevant.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 37ab944ac5 ar71xx: cap324: Use correct company name
It's 'PowerCloud Systems' not just 'PowerCloud'

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 739eaae9ca ar71xx: cap324: Use correct MAC addresses
The wrong MAC addresses (from the point of view of the physical device
label) were being assigned to the wrong interfaces.  Fix that.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson d2f7dba309 ar71xx: cap324: Use standard eth as static lan
While the stock firmware and previous ar71xx versions of openwrt used the
single ethernet port as a DHCP client, for unmodified openwrt usage it
makes more sense to do the standard openwrt thing and make the ethernet
port a static lan with known address so that users can find the device on
the network more easily.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson fedc826c32 ar71xx: cr5000: use correct company name
It's 'PowerCloud Systems' not just 'PowerCloud'

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson 50caf9d452 ar71xx: cr5000: Drop support for defunct cloud
The Skydog cloud service no longer exists hence supporting going back
to stock firmware with cloud support is no longer applicable.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson c666851ce7 ar71xx: cr5000: Tweak switch LED settings
This is basically cosmetic and sets the Port 1-4 LEDs to blink on
10/100/1000M.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson ffc71cd2d0 ar71xx: cr5000: Fix the reset button as KEY_RESTART
The reset button was incorrectly returning KEY_WPS_BUTTON as the key
code.  We want KEY_RESTART., so make that fix.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Daniel F. Dickinson a208e07790 ar71xx: cr5000: board data: Use better macro name
The PCIe wireless MAC address address is better labelled as WMAC
than MAC to emphasize that it is for a wireless interface.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
6 years ago
Thibaut VARÈNE 091e915d99 ar71xx: improve MikroTik wAP R support
81d446b045 introduced incomplete
support for this device.

This patch attempts to correct the situation based on OEM source
code.

LED1-3 are GSM mode on OFW (2G/3G/4G) hence unassigned here.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Tested-by: David Ehrmann <ehrmann@gmail.com>
6 years ago
Thibaut VARÈNE 5c2419b6f8 ar71xx: add missing diag LED support for RB wAP 2nD
3b15eb06c3 did not include diag.sh
edit

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years ago
Thibaut VARÈNE e76c048d34 ar71xx: rbspi: mark rb911L user led as active low
The active_low flag was missing for the user LED. This LED is open drain
(confirmed in OEM source) and open drain only makes sense for active low
GPIOs.

The two wireless LEDs mentioned in the comments are also #defined for
future reference.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Tested-by: Ryan Mounce <ryan@mounce.com.au>
6 years ago
Thibaut VARÈNE e99f760235 ar71xx: rbspi: fix RB wAP AC gpio conflict and LED
e15c63a375 introduced code that was trying
to register GPIO 1 as both an LED and a button. The OEM source makes it
clear that LED1 is not wired to the SoC GPIOs. GPIO 1 is the reset button.

Furthermore the (green) power led default state should also be defined,
(matching OEM source), and it should be used by diag.sh since it's
currently the only software-controllable LED.

This patch fixes these issues and renames the corresponding #defines for
clarity

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years ago
Thibaut VARÈNE 03562bfcdb ar71xx: rbspi: clarify USB power gpios action
The gpios that control power toggle for USB on the RouterBOARD devices
are active low _off_ switches.

When they are active (low), power is off. When they are inactive
(high), power is on.

Rename GPIO defines, set gpios to GPIOF_ACTIVE_LOW for consistency and
reflect their true action in the display name. This brings openwrt code
in line with OEM.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Tested-by: Ryan Mounce <ryan@mounce.com.au>
6 years ago
Kin Chan 18b87b10a9 ar71xx: Move F9K1115v2 under ar71xx tiny target
F9K1115v2 has a kernel partition size of 1408 kB.

Since kernel 4.9.x+ the kernel image for this device compiled had exceeded
the kernel partition size limit and thus failing size check.

The kernel image generated for this device
under ar71xx tiny target is 1329.67 kB < 1408 kB.

Signed-off-by: Kin Chan <kcchan1@outlook.com>
6 years ago
Thibaut VARÈNE c2d2647c09 ar71xx: add support for MikroTik RB931-2nD
This patch adds support for the MikroTik RB931-2nD (hAP mini):
https://mikrotik.com/product/RB931-2nD

Specifications:
  * SoC: Qualcomm QCA9533 (650MHz)
  * RAM: 32MiB
  * Storage: 16MiB SPI NOR flash
  * Ethernet: 3x100M
  * Wireless: QCA9533 built-in, dual-chain 802.11b/g/n

Installation:

1. Setup a DHCP/BOOTP Server with the following parameters:
   * DHCP-Option 66 (TFTP server name): pointing to a local TFTP
     server within the same subnet of the DHCP range
   * DHCP-Option 67 (Bootfile-Name): matching the initramfs filename
     of the to be booted image. The usable intramfs files are:
       - openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
       - openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf
       - openwrt-ar71xx-mikrotik-rb-nor-flash-16M-initramfs-kernel.bin

2. Press the reset button on the board and keep that pressed.

3. Connect the board to your local network via its Internet port.

4. Release the button after the LEDs on the board are turned off.
   Now the board should load and start the initramfs image from
   the TFTP server.

5. Now connect the board via either of its LAN ports (2 or 3).

6. Upload the sysupgrade image to the board with scp:
     $ scp openwrt-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/fw.bin

7. Log in to the running system listening on 192.168.1.1 via ssh
   as root (without password):
     $ ssh root@192.168.1.1

8. Flash the uploaded firmware file from the ssh session via the
   sysupgrade command:
     root@OpenWrt:~# sysupgrade /tmp/fw.bin

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
6 years ago
Mathias Kresin 621fa91a82 ar71xx: move boards to tiny subtarget
Move boards to the tiny subtarget which break the build if the kernel is
set to "Optimize for performance".

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a28d686fb6 ar71xx: factor out safe loader image build code
Add a template for safeloader images and include it instead of
overwriting variables defined in the common tp-link build commands.

Split the existing tp-link templates to proper implement the safeloader
template.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin b908c82f49 ar71xx: drop unnecessary LOADER_TYPE variables
Drop the LOADER_TYPE variables in case no loader is used at all or move
the variable to devices which are using a loader.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a0ec632f8d ar71xx: get rid of copy-file
Use the provided image build variables to point the kernel-bin build
command to the kernel we are interested in.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 5260c1003c ar71xx: mikrotik: cleanup nand image build code
Use the LOADER_TYPE variable to specify that we need the elf preloader
and append the loader via the corresponding build recipe. It allows to
enable initramfs images again for mikrotik NAND images, which caused a
build error before.

Add the minor header only to the kernel of the sysupgrade images, as it
is only required for the bootloader to find the kernel on flash.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte 8e622aae58 kernel: bump 4.9 to 4.9.110
Refreshed all patches

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Lucian Cristian 4ec9763ee9 firmware-utils: tplink-safeloader: switch tl-wr1043nd-v4 to dynamic partitions
Use the new dynamic partition split in tplink-safeloader so we no longer
have to worry about kernel size increases.

Signed-off-by: Lucian Cristian <lucian.cristian@gmail.com>
6 years ago
Adrian Schmutzler 5c5bf8b865
ar71xx: Add support for TP-Link CPE210 v2
This PR adds support for a popular low-cost 2.4GHz N based AP

Specifications:
 - SoC: Qualcomm Atheros QCA9533 (650MHz)
 - RAM: 64MB
 - Storage: 8 MB SPI NOR
 - Wireless: 2.4GHz N based built into SoC 2x2
 - Ethernet: 1x 100/10 Mbps, integrated into SoC, 24V POE IN

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

Notes:
TP-Link does not use bootstrap registers so without this patch reference
clock detects as 40MHz while it is actually 25MHz.
This is due to messed up bootstrap resistor configuration on the PCB.
Provided GPL code just forces 25MHz reference clock.
That causes booting with completely wrong clocks, for example, CPU tries
to boot at 1040MHz while the stock is 650MHz.
So this PR depends on PR #672 to remove 40MHz reference clock.
Thanks to Sven Eckelmann <sven@narfation.org> for properly patching that.

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
6 years ago
Adrian Schmutzler 2524febf79
ar71xx: Add TP-Link Pharos v2 board detection
Add support for detecting TP-Link Pharos v2 boards.
They use different format in product-info partition than v1 boards.

Code was written mostly by Alexander Couzens <lynxis@fe80.eu>

Signed-off-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
6 years ago
Arvid E. Picciani bf39d5594b ar71xx: add support for TP-LINK Archer C7 v5
TP-Link Archer C7 v5 is a dual-band AC1750 router, based on Qualcomm/Atheros
QCA9563+QCA9880.

Specification:

- 750/400/250 MHz (CPU/DDR/AHB
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 3T3R 5 GHz
- 5x 10/100/1000 Mbps Ethernet
- 10x LED, 2x button
- UART header on PCB

Flash instruction:
1. Upload lede-ar71xx-generic-archer-c7-v5-squashfs-factory.bin via Web interface

Flash instruction using TFTP recovery:
1. Set PC to fixed ip address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c7-v5-squashfs-factory.bin
and rename it to ArcherC7v5_tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin 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.

Signed-off-by: Arvid E. Picciani <aep@exys.org>
6 years ago
David Ehrmann 81d446b045 ar71x: add support for Mikrotik Routerboard wAP R
This commit adds support for the Mikrotik wAP R (RBwAPR-2nD). The change
is based on 3b15eb0 which added support for the wAP 2nD. This change lacks
LED support.

Specifications:

- SoC: Qualcomm QCA9531 (650 MHz)
- RAM: 64 MB
- Storage: 16 MB NOR SPI flash
- Wireless: built-in QCA9531, 802.11b/g/n 2x2:2
- Ethernet: 1x100Mbps
- Power: 9-30V Passive PoE, 9-30V DC jack, 9-30V automotive jack
- SIM card slot
- Mini-PCIe slot

Installation:

1. Login to the Mikrotik WebUI to backup your licence key
2. Change the following settings in System->Routerboard->Settings:
  - Boot device: try ethernet once then NAND
  - Boot protocol: DHCP
  - Force Backup Booter: checked
3. Setup a DHCP/BOOTP server with:
  - DHCP-Option 66 (TFTP server name) pointing to a local TFTP
    server within the same subnet of the DHCP range
  - DHCP-Option 67 (Bootfile-Name) matching the initramfs filename
    of the to be booted image, e.g.
    openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
4. Power off the device
5. If this is the second attempt to boot OpenWRT or the boot device isn't
   "try ethernet once then NAND," press and hold the reset button while
   powered off. If this is the first attempt, this step isn't necessary.
6. Power on the device, holding the reset button for 15-20s if already
   pressed from the previous step.

The board should load and start the initramfs image from the TFTP
server. Login as root/without password to the started OpenWRT via SSH
listing on IPv4 address 192.168.1.1. Use sysupgrade to install OpenWRT.

Revert to RouterOS

Use the "rbcfg" package on in OpenWRT:
- rbcfg set boot_protocol bootp
- rbcfg set boot_device ethnand
- rbcfg apply

Open Netinstall and reboot routerboard. Now Netinstall sees RouterBOARD
and you can install RouterOS. If NetInstall gets stuck on Sending offer
just wait for it to timeout and then close and open Netinstall again.

Click on install again.

In order for RouterOS to function properly, you need to restore license
for the device. You can do that by including license in NetInstall.

Signed-off-by: David Ehrmann <ehrmann@gmail.com>
6 years ago
David Bauer b4bf43c667 ar71xx: add support for Fritz!WLAN Repeater 450E
This commit adds support for the AVM Fritz!WLAN Repeater 450E

SOC:    Qualcomm QCA9556 (Scorpion) 560MHz MIPS74Kc
RAM:    64MB Zentel A3R12E40CBF DDR2
FLASH:  16MiB Winbond W25Q128 SPI NOR
WLAN1:  QCA9556 2.4 GHz 802.11b/g/n 3x3
INPUT:  WPS button
LED:    Power, WiFi, LAN, RSSI indicator
Serial: Header Next to Black metal shield
        Pinout is 3.3V - RX - TX - GND (Square Pad is 3.3V)
        The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet
 - 2.4GHz WiFi (correct MAC)
 - Installation via EVA bootloader
 - OpenWRT sysupgrade
 - Buttons
 - Most LEDs

Not working:
 - 2 RSSI LEDs
   AVM used for RSSI{0,1} two of the Ethernet PHYs LEDs which they
   control over MDIO. Our driver doesn't expose these LEDs as GPIOs.
   While it is possible to implement this feature, it would require an
   additional kernel patch for a minor functionality.

Installation via EVA:
In the first seconds after Power is connected, the bootloader will
listen for FTP connections on 192.168.178.1. Firmware can be uploaded
like following:

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

Note that this procedure might take up to two minutes.
You need to powercycle the Device afterwards to boot OpenWRT.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
David Bauer abb4ab076f ar71xx: fix incorrect speed setting on QCA9556
The QCA9556 only has a SGMII interface. However the speed on the
ethernet link is set for the non-existant xMII interface.

This commit fixes this behavior.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Thomas Nixon bb71a3f27e ar71xx: add kmod-usb-ehci to fix USB on RB hAP AC
Signed-off-by: Thomas Nixon <tom@tomn.co.uk>
6 years ago
Kevin Darbyshire-Bryant f60301db74 kernel: bump 4.9 to 4.9.107
Refresh patches.

Compile-tested for: ar71xx
Run-tested on: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
David Bauer daeab36c1b ar71xx: use Power-LED as Diag-LED on FRITZBox 4020
This commit makes use of the Power-LED as Diag-LED, allowing the LED to
work as a status indicator.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
David Bauer 9ec117c5be ar71xx: fix AVM package selection
The AVM package selection partially broke with the addition of the
FRITZ!Box 4020. This commit restores the intended behavior.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Sven Eckelmann 4f6320704f ar71xx: Fix offset to WMAC address for 8devices Lima
The ART partition of the Lima board stores exactly three mac addresses:

* 0x0: eth0
* 0x6: eth1
* 0x1002: wmac

The first two are correctly assigned in the mach file but the latter points
to 0x800. But this position is set to ff:ff:ff:ff:ff:ff. Luckily, the
driver falls back in ath9k_hw_init_macaddr to the EEPROM mac address when
it doesn't find a valid mac address in the platform_data.

Remove this bogus offset to the ART partition to directly load the wmac via
the EEPROM data in the ART partition.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
6 years ago
Koen Vandeputte 55b4b1eba0 ar71xx: fix USB switch to mPCIE for Mikrotik rb91x boards
Some devices like the Mikrotik RB912 only have 1 USB port
which is shared between an USB A type port, and the mini PCIe socket.

Toggling a gpio selects the output to which USB is connected.

Since kernel 4.9, gpio base is rounded up to a value of 32.

Commit 65da6f9ca1 ("ar71xx: fix secondary gpio controller base values") accounts correctly for that.
In this commit, rb912 sees it's value changed from AR934X_GPIO_COUNT (23) to 32
This means that the USB toggle gpio number actually also changes from 52 to 61.

But ..
Some of these GPIO numbers are also used in other locations, like the boardfile.
The author forgot to also change them over there.

Switching the USB port to mPCIe now shows my modem is correctly discovered again:

[ 2863.864471] usb 1-1: new high-speed USB device number 4 using ehci-platform
[ 2864.055303] usb 1-1: config 1 has an invalid interface number: 8 but max is 3
[ 2864.062728] usb 1-1: config 1 has no interface number 1
[ 2864.074567] qcserial 1-1:1.0: Qualcomm USB modem converter detected
[ 2864.081474] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB0
[ 2864.111960] qcserial 1-1:1.2: Qualcomm USB modem converter detected
[ 2864.118976] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB1
[ 2864.139808] qcserial 1-1:1.3: Qualcomm USB modem converter detected
[ 2864.146777] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB2
[ 2864.165276] qmi_wwan 1-1:1.8: cdc-wdm0: USB WDM device
[ 2864.171879] qmi_wwan 1-1:1.8 wwan0: register 'qmi_wwan' at usb-ehci-platform-1, WWAN/QMI device, 02:00:44:ed:3b:11

Fixes: 65da6f9ca1 ("ar71xx: fix secondary gpio controller base values")

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Cc: Robin Leblon <robin.leblon@ncentric.com>
Cc: Felix Fietkau <nbd@nbd.name>
6 years ago
David Bauer e36f8b3f39 ar71xx: add support for OCEDO Koala
This commit adds support for the OCEDO Koala

SOC:	Qualcomm QCA9558 (Scorpion)
RAM:    128MB
FLASH:  16MiB
WLAN1:  QCA9558 2.4 GHz 802.11bgn 3x3
WLAN2:  QCA9880 5 GHz 802.11nac 3x3
INPUT:  RESET button
LED:    Power, LAN, WiFi 2.4, WiFi 5, SYS
Serial: Header Next to Black metal shield
        Pinout is 3.3V - GND - TX - RX (Arrow Pad is 3.3V)
        The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet
 - 2.4 GHz WiFi
 - 5 GHz WiFi
 - TFTP boot from ramdisk image
 - Installation via ramdisk image
 - OpenWRT sysupgrade
 - Buttons
 - LEDs

Installation seems to be possible only through booting an OpenWRT
ramdisk image.

Hold down the reset button while powering on the device. It will load a
ramdisk image named 'koala-uImage-initramfs-lzma.bin' from 192.168.100.8.

Note: depending on the present software, the device might also try to
pull a file called 'koala-uimage-factory'. Only the name differs, it
is still used as a ramdisk image.

Wait for the ramdisk image to boot. OpenWRT can be written to the flash
via sysupgrade or mtd.

Due to the flip-flop bootloader which we not (yet) support, you need to
set the partition the bootloader is selecting. It is possible from the
initramfs image with

 > fw_setenv bootcmd run bootcmd_1

Afterwards you can reboot the device.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Matthias Schiffer 0c0bb62999
ar71xx: switch CPE/WBS 210/510 to okli-loader
We recently increased the kernel partition size of the CPE/WBS 210/510.
This works fine for new installations of the factory image, but on
sysupgrades, the partition table read by the bootloader is not adjusted.
This limits the maximum size of the kernel loaded by the bootloader to the
old partition size.

While adjusting the partition table would be a cleanest solution, such a
migration would have to happen before an upgrade to a new version with a
newer kernel. This is error-prone and would require a two-step upgrade, as
we mark the partition table partition read-only.

Instead, switch from the lzma-loader with embedded kernel to the
okli-loader, so only the tiny lzma-loader is loaded by the bootloader as
"kernel", and the lzma-loader will then load the rest of the kernel by
itself.

Fixes: e39847ea2f ("ar71xx: increase kernel partition size for CPE/WBS 210/510")
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 108a6f6792
ar71xx: make loader-okli build step more generic
Add support for different loader types.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 9968dcedb4
ar71xx: lzma-loader: constify kernel argv array
By making the kernel argv array const, the .data section can always be
omitted from the laoder binary.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 8d851a95b7
ar71xx: lzma-loader: set page size to 4KB
The text section in the ELF loader is aligned to the maximum page size,
which defaults to 64KB. Reduce it to the actual page size to avoid wasting
flash space for this alignment.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer a28e46b7cc
ar71xx: lzma-loader: move padding workaround to gzip step
Some devices (TP-Link TL-WR1043ND v1) don't boot reliably when the
uncompressed loader is too small. This was workarounded in the loader by
adding 512KB of padding to the .data section of the loader binary.

This approach had two issues:

- The padding was only working when .data was non-empty (otherwise the
  section would become NOBITS, omitting it in the binary). .data was only
  empty when no CMDLINE was set, leading to further workarounds like
  fe594bf90d ("ath79: fix loader-okli, lzma-loader"), and this
  workaround was only effective because a missing "const" led to the kernel
  argv being stored in .data instead of .rodata
- The padding was not only added to the compressed .gz loader, but also
  uncompressed .bin and .elf loaders. The prevented embedding the kernel
  cmdline in the loader for non-gz loader types.

To fix both issues, move the creation of the padding from the linker script
to the gzip step.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Kevin Darbyshire-Bryant 7dca1bae82 kernel: bump to 4.9.105
Refresh patches.

Drop patches that have been upstreamed:
target/linux/ar71xx/patches-4.9/106-01-MIPS-ath79-fix-AR724X_PLL_REG_PCIE_CONFIG-offset.patch
target/linux/generic/backport-4.9/095-v4.12-ipv6-Need-to-export-ipv6_push_frag_opts-for-tunnelin.patch
target/linux/generic/pending-4.9/180-net-phy-at803x-add-support-for-AT8032.patch
target/linux/generic/pending-4.9/181-net-usb-add-lte-modem-wistron-neweb-d18q1.patch
target/linux/generic/pending-4.9/182-net-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch

Compile & run tested: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Luo chongjun 312d7a4a5a ar71xx: add support for GL.iNet GL-AR750S
This patch adds supports for GL-AR750S.

Specification:
- SOC: QCA9563 (775MHz)
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR2
- Ethernet: 2x 1Gbps LAN + 1x 1Gbps WAN
- Wireless: 2.4GHz (bgn) and 5GHz (ac)
- USB: 1x USB 2.0 port
- Button: 1x switch button, 1x reset button
- LED: 3x LEDS (green)

Flash instruction:
Apply factory image via web-gui.

Signed-off-by: Luo chongjun <luochongjun@gl-inet.com>
6 years ago
Jo-Philipp Wich 3b749d4acc ar71xx: fix bad "proto" references in default network configuration
This change was originally meant to go along with the ucidef_set_interface()
fixup.

Fixes: 7e664b7c2d ("base-files: fix ucidef_set_interface() protocol selection")
Fixes: 85048a9c1f ("base-files: rework _ucidef_set_interface to be more generic")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
John Crispin f7aa08595d kernel: add reset control support to rtl8366 driver
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Roman Yeryomin 85048a9c1f base-files: rework _ucidef_set_interface to be more generic
This is a rework of previously submitted patch reworking
ucidef_set_interface_raw [1]. Here, keep the idea but instead
make _ucidef_set_interface more generic and use it instead of
ucidef_set_interface_raw.
Also change the users like ucidef_set_interface_lan and others.

[1] https://patchwork.ozlabs.org/patch/844961/

Signed-off-by: Roman Yeryomin <roman@advem.lv>
6 years ago
Chuanhong Guo a789c0f491 ar71xx: Add support for PISEN TS-D084
PISEN TS-D084 is an wireless router with a battery and integrated power supply based on Atheros AR9331.

Specification:

- 400/400/200 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 1x 10/100 Mbps Ethernet
- 1T1R 2.4 GHz (AR9331)
- 1x USB 2.0

Flash instruction:
The manufacturer are using exactly the same firmware header as TP-LINK TL-WR703N (including device ID!). Simply upload the factory firmware into WebUI and flashing is done.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Hauke Mehrtens ae8ff1c65c ar71xx: Fix build for dap-1330-a1 board
Using a version number of 16 character causes a buffer overflow in the
version number overwriting the first bit of the signature in the
mkdapimg2 tool.
I am not sure if the version number should be null terminated or not.
This patch reduces the size of the version number by removing the number
of private commits from it.

This was the original version number which caused problems:
OpenWrt-r6727+10
Now it uses this version number:
OpenWrt-r6727

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Michal Cieslakiewicz 45dc530334 ar71xx: WNDR3700: enable RFKILL function for Wifi button
Wifi button for WNDR3700 dual band routers has been renamed to "rfkill"
and its emitted keycode changed to KEY_RFKILL. This allows OpenWrt/LEDE
to support it 'out of the box' without additional tweaking.

Until this patch, button had been sending BTN_2 keycode which was
ignored by default (no action script present). To get expected behaviour
of switching radios on and off, user had to manually rename/link
'rfkill' script to name 'BTN_2' in /etc/rc.button directory.

This patch follows similar changes for other Netgear ar71xx routers,
for example WNR2000v3. It applies cleanly to both latest trunk and 17.01
branch. Tested on WNDR3700v1.

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
6 years ago
Koen Vandeputte 12f44b83a8 kernel: bump 4.9 to 4.9.100
Refreshed all patches

Added new ARM64 symbol: ARM64_ERRATUM_1024718

Compile-tested on: ar71xx
Runtime-tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Piotr Dymacz ce4d2fb5cc ar71xx: fix and improve ALFA Network Tube2H support
Fix ART offset (make it universal for 8/16 MB versions of the board) and
while at it, include also GPIO setup for h/w watchdog (EM6324QYSP5B).

Fixes: FS#1532

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
David Bauer b6a4c67468 ar71xx: add support for Fritz!Box 4020
This commit adds support for the AVM Fritz!Box 4020 WiFi-router.

SoC:   Qualcomm Atheros QCA9561 (Dragonfly) 750MHz
RAM:   Winbond W971GG6KB-25
FLASH: Macronix MX25L12835F
WiFi:  QCA9561 b/g/n 3x3 450Mbit/s
USB:   1x USB 2.0
IN:    WPS button, WiFi button
OUT:   Power LED green, Internet LED green, WLAN LED green,
       LAN LED green, INFO LED green, INFO LED red
UART:  Header Next to Black metal shield
       Pinout is 3.3V - RX - TX - GND (Square Pad is 3.3V)
       The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet (LAN + WAN)
 - WiFi (correct MAC)
 - Installation via EVA bootloader
 - OpenWRT sysupgrade
 - Buttons
 - LEDs

Not working:
 - USB port

Installation via EVA:
In the first seconds after Power is connected, the bootloader will
listen for FTP connections on 169.254.157.1 (Might also be 192.168.178.1). Firmware can be uploaded
like following:

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

Note that this procedure might take up to two minutes. After transfer is
complete you need to powercycle the device to boot OpenWRT.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Simon Paterson 264feab1e7 ar71xx: Add userspace support for Mikrotik rb-2011iLS
Kernel support already present.
Patch adds userspace for the 'iLS' suffix model of the RB2011 family.
Enables correct initial switch settings, sysupgrade, etc.

https://mikrotik.com/product/RB2011iLS-IN

Signed-off-by: Simon Paterson <simon.paterson.nz@gmail.com>
6 years ago
Matthias Schiffer d168c2cf81
ar71xx: Ubiquiti Airmax M: add relocate-kernel to invalidate cache
Some Ubiquiti U-boot versions, in particular the "U-Boot 1.1.4.2-s956
(Jun 10 2015 - 10:54:50)" found with AirOS 5.6, do not correctly flush the
caches for the whole kernel address range after decompressing the kernel
image, leading to hard to debug boot failures, depending on kernel version
and configuration.

As a workaround, prepend the relocate-kernels loader, which will invalidate
the caches after moving the kernel to the correct load address.

Reported-by: Andreas Ziegler <dev@andreas-ziegler.de>
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Kevin Darbyshire-Bryant 9aa196e0f2 kernel: bump 4.9 to 4.9.96
Refresh patches, following required reworking:

ar71xx/patches-4.9/930-chipidea-pullup.patch
layerscape/patches-4.9/302-dts-support-layercape.patch
sunxi/patches-4.9/0052-stmmac-form-4-12.patch

Fixes for CVEs:
CVE-2018-1108
CVE-2018-1092

Tested on: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Arjen de Korte <build+openwrt@de-korte.org>
6 years ago
Matthias Schiffer e39847ea2f
ar71xx: increase kernel partition size for CPE/WBS 210/510
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 5bfb344106
ar71xx: sysupgrade: improve CPE/WBS 210/510 validation, add new metadata offset
Previously, tplink_pharos_check_image() would accept any image with ELF
magic and only non-printable data in the support-list, as in this case the
while-read loop would not run at all. Add the new support-list offset and
ensure an image is only accepted when the model string is actually found.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer d3f96fedec
ar71xx: increase kernel partition size for UniFi AP Pro and Outdoor+, enable devices again
Tested on UAP Outdoor+.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer f8f6fa11c0
ar71xx: limit Ethernet speed of UBNT Airmax M (XM) devices to 100Mbit/s
Some Airmax devices can establish a Gigabit link even though the MAC only
supports 10/100 MBit/s, leading to broken connectivity. Prevent this from
happening by limiting the speed to 100MBit/s.

Fixes: FS#296
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Henryk Heisig c0742307a1 ar71xx: add support for TP-Link Archer C60 v2
TP-Link Archer C60 v2 is a dual-band AC1350 router, based on
Qualcomm/Atheros QCA9561 + QCA9886.

Specification:

- 775/650/258 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 8 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz
- 2T2R 5 GHz
- 5x 10/100 Mbps Ethernet
- 7x LED, 2x button
- UART header on PCB

Flash instruction (web):

Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin and use
OEM System Tools - Firmware Upgrade site.

Flash instruction (recovery):

1. Set PC to fixed IP address 192.168.0.66
2. Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin and
   rename it to tp_recovery.bin
3. Start a tftp server with the file tp_recovery.bin 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

Flash instruction (under U-Boot, using UART):

tftp 0x81000000 lede-ar71xx-...-sysupgrade.bin
erase 0x9f030000 +$filesize
cp.b $fileaddr 0x9f030000 $filesize
reset

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years ago
Robert Marko b834487203 ar71xx: add support for TP-Link TL-WR940N v6
Add support for TL-WR940N v6 board. It is pretty much the same as v5
except they only left WAN LED and removed other ones.

Installation: flash factory image through WEB UI or use TFTP.

Signed-off-by: Robert Marko <robimarko@gmail.com>
6 years ago
Piotr Dymacz 6148c46556 ar71xx: drop kernel 4.4 support
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Peng Zhang bbc2e1d919 ar71xx: change brand name WHQX to Qxwlan
Signed-off-by: Peng Zhang <sd20@qxwlan.com>
6 years ago
Piotr Dymacz 57c641ba6e ar71xx: rework chipidea controller support, add QCA9531
Rework (again) platform support for dual-role chipidea USB controller:

- include support for QCA9531
- use correct EHCI block size
- drop ar933x_usb_setup_ctrl_config() function
- simplify code after previous "register chipidea only in device mode"
  change (fa22714181)

Reworked patch was tested on devices with below QCA WiSOCs (signal/GPIO
name with required bootstrap state for USB bus 0 in device mode):

- AR9331  (GPIO13 pull-down)
- AR9342  (RGMII_TXD1/ETXD1 pull-up)
- AR9344  (GPIO20 pull-up)
- QCA9531 (GPIO13 pull-up)
- QCA9558 (GPIO13 pull-up)

The only way to select device mode for bus 0 is to change SOC bootstrap
configuration which is sampled only once, at hard reset. Likely, other
models, like QCA9556 or AR9341, should also support dual-role USB mode
but they were not tested.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
David Bauer f8dbafb234
ar71xx: add model detection for UBNT AC-Mesh
This commit adds correct model detection for UniFi
AC-Mesh. Previously said device was incorrectly detected
as UniFi AC-Lite.

The Information about the device is stored at 0xC in the EEPROM
partition. It corresponds to the sysid in /etc/board.info of the
Ubiquiti stock firmware.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Nicolò Veronese d265a8f2ca
ar71xx: Add support for D-Link DAP-1330 a1
D-Link DAP-1330 rev. A1 is a wall-plug N300 Wi-Fi range extender,
based on Qualcomm/Atheros QCA9533 v2.

Short specification:

- 650/393/216 MHz (CPU/DDR/AHB)
- 1x 10/100 Mbps Ethernet
- 64 MB of RAM (DDR1)
- 8 MB of FLASH
- 2T2R 2.4 GHz
- 2x external antennas
- 6x LED (2 are bi-color), 2x button
- 4 pin on pcb (looking from eth port and from left to right tx,rx,gnd,vcc)

Flash instruction: use "factory" image directly in vendor GUI.

This device has a recovery system that assign the ip addr of env
variable "serverip" via dhcp to a pc, and the "ipaddr" value to itself.
The recovery it's triggered by a not bootable firmware,
or pressing the reset button during the bootloader startup (first 30 seconds).
The recovery uses a http page to restore the firmware, and it's checking
the firmware image header, so use the "factory" image to
restore or the original firmware.

You can access vendor firmware over serial using:
- login: root
- password: linuxrocks

Image was tested only in EU version of the device, but should work
also with the same device version sold in other countries.

Signed-off-by: Nicolò Veronese <nicveronese@gmail.com>
6 years ago
Reto Schneider 58fe527931 ar71xx: Fix typo in wan LED color of gl-mifi
It was wrong from the beginning and the trigger for the wan led was
never set due to the typo.

Signed-off-by: Reto Schneider <code@reto-schneider.ch>
[add commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Felix Fietkau d7ca4c6d3e ar71xx: fix ar934x usb controller resource conflict
Use the right size for the EHCI block

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Mathias Kresin 26a9f01fc6 ar71xx: fix Fritz 300e initramfs image
Create an initramfs that can be used with the EVA bootloader.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte 895ea64a76 kernel: bump 4.4 to 4.4.121
- Refreshed all patches
- Only compile-tested

Compile tested on: Gemini

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Koen Vandeputte fa8e99c51d kernel: bump 4.9 to 4.9.87
- Refreshed all patches

Compile tested on: ar71xx
Runtime tested on: ar71xx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Arne Zachlod d0988235dd
ar71xx: add support for Ubiquiti Litebeam M5
Specification:
- SoC: Atheros AR9342
- Flash: 8 MiB
- RAM: 64 MiB
- UART: 1x UART on PCB - 115200 8N1
- Ethernet: 1 x 100 Mbit with passive PoE (24V/0.2A)

Doesn't work:
* Flash via TFTP with Ubiquiti Uboot

Installation via vendor firmware:
- upload factory image via webinterface

Signed-off-by: Arne Zachlod <arne@nerdkeller.org>
6 years ago
Felix Fietkau fa22714181 ar71xx: fix double registration of usb host mode devices, add usb client support for qca955x
Only register the chipidea usb device if the strapping option indicates
device mode. If not, use the regular ehci platform driver.

Add qca955x device mode support, tested on 8devices Rambutan.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 83ddc3bfc2 ar71xx: fix mii bus irq assignment
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau f62d2b9549 ar71xx: remove pdata->fifo_cfg*
The values are the same for all chipsets that use it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Stijn Segers e72b2464b1 kernel: bump 4.4 to 4.4.119
This bumps the 4.4. kernel in master to 4.4.119.
Includes more Meltdown & Spectre mitigation.

* Refresh patches.
* Refresh x86/config for RETPOLINE.
* Deleted 8049-PCI-layerscape-Add-fsl-ls2085a-pcie-compatible-ID.patch (accepted upstream)
* Deleted 8050-PCI-layerscape-Fix-MSG-TLP-drop-setting.patch (accepted upstream)
* Deleted 650-pppoe_header_pad.patch (does not apply anymore (code was replaced)).

Bumps from 4.4.112 to 4.4.115 were handled by Kevin Darbyshire-Bryant.

Compile-tested on: ar71xx & oxnas.

Signed-off-by: Stijn Segers <foss@volatilesystems.org>
Tested-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Magnus Kroken 5af85dab22 kernel: bump 4.9 to 4.9.85
Signed-off-by: Magnus Kroken <mkroken@gmail.com>
6 years ago
Felix Fietkau 36fb0697e2 ar71xx: fix build with ag71xx debugfs support enabled
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Rosen Penev 810659a22c ag71xx: Move timestamp struct member outside of struct.
With this change, the timestamp variable is only used in ag71xx_check_dma_stuck. Small tx speedup.

Based on a Qualcomm commit. ag->timestamp = jiffies was not replaced with netif_trans_update(dev) because of this quote:

It should be noted that after this series several instances
of netif_trans_update() are useless (if they occur in
.ndo_start_xmit and driver doesn't set LLTX flag -- stack already
did an update).

From: http://lists.openwall.net/netdev/2016/05/03/87

Signed-off-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Felix Fietkau a49f6565b3 kernel: m25p80: allow fallback from spi_flash_read to regular SPI transfer
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Piotr Dymacz 8c64824576 ar71xx: add support for GainStrong Oolite V5.2
GainStrong Oolite V5.2 is a small (39.5 x 78 mm), dual-band system on
module, based on Qualcomm QCA9531 + QCA9887. All QCA9531 SOC GPIOs are
available on castellated pins.

Specification:

- 650/400/200 MHz (CPU/DDR/AHB)
- 64/128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 5x 10/100 Mbps Ethernet (all ports available on castellated pins)
- 2T2R 2.4 GHz (QCA9531), with ext. PA and LNA
- 1T1R 5 GHz (QCA9887) with ext. FEM (SKY85710-11)
- 3x U.FL
- 1x USB 2.0

The dedicated development board includes 5 FE ports, USB 2.0 port, two
buttons (one directly connected to SOC reset input), header with all
GPIOs and several LEDs.

Flash instruction:

Vendor firmware is based on OpenWrt. LuCI or sysupgrade can be used to
flash OpenWrt firmware.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 907d674910 ar71xx: rework GainStrong devices support
- combine support for Oolite/MiniBox V1.0 in single mach-*.c file
- fix model/board names
- include correct/full vendor name
- drop redundant package and factory image

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 12c7b22e4e ar71xx: base-files: cosmetic cleanups in 04_led_migration
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 338a9fe8ad ar71xx: base-files: drop comment from 02_network
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Sebastian Kinne 950b278c81 ar71xx: add support for AR9331 based Hak5 devices
This adds support for AR9331 based Hak5 penetration testing tools:

- WiFi Pineapple NANO
- LAN Turtle
- Packet Squirrel

WiFi Pineapple NANO specifications:

- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: 1T1R AR9331 (built-in), 1T1R AR9271 (built-in via USB bus)
- Ethernet: 1x FE over USB (ASIX AX88772A)
- Ports: 2x RP-SMA for antennas, 1x USB 2.0 (host), 1x micro SD
- Power: USB 5 V, 1.5 A
- Other: status LED, reset button

LAN Turtle specifications:

- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: none
- Ethernet: 1x FE (AR9331), 1x FE over USB (Realtek RTL8152B)
- Ports: 1x RJ45, version dependent: micro SD or 3G SIM slot
- Power: USB 5 V, 0.5 A
- Other: status LED, reset button (inside, on PCB)

Packet Squirrel specifications:

- SoC: Atheros AR9331 (400 MHz)
- RAM: 64 MB (DDR2)
- FLASH: 16 MB
- WiFi: none
- Ethernet: 2x FE (AR9331)
- Ports: 2x RJ45, 1x USB 2.0
- Power: USB 5 V, 0.12 A
- Other: status LED, reset button, 4-way switch

Flash instructions for all 3 devices:

Original firmware is based on OpenWrt.
Use sysupgrade via SSH to flash.

Signed-off-by: Sebastian Kinne <contact@sebkinne.com>
[squashed commits, combined and reworked mach files, aligned board
naming with general convention, fixed minor issues, tested on real
hardware, reworded commit subject and description]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Matti Laakso 2ea98fc39b ar71xx: fix 5 GHz Wi-Fi on NBG6716
Some NBG6716 do not have ath10k calibration data in flash, only in chip
OTP. To determine if flash has a valid calibration data, the first two
bytes telling the length of the calibration data are checked against the
requested length. If the lengths match, calibration data is valid and
read from flash.

Signed-off-by: Matti Laakso <matti.laakso@outlook.com>
6 years ago
Piotr Dymacz 22ae9b742b ar71xx: YunCore AP90Q image supports also AP80Q
Vendor released new model (AP80Q) which is identical from hardware point
of view with already supported AP90Q. Include AP80Q in machine name.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz d6f187f938 ar71xx: add support for YunCore T830
YunCore T830 is a simple N300 router with 5-port FE switch, detachable
antennas and USB 2.0 port.

Specification:

- 650/597/216 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 5x 10/100 Mbps Ethernet
- 2T2R 2.4 GHz (QCA9531), with ext. PA (SKY65174-21) and LNA
- two external, detachable antennas (RP-SMA)
- 1x USB 2.0
- 8x LED (7 driven by GPIO)
- 1x button (reset)
- DC jack for main power input (12 V)
- UART and JTAG headers on PCB

Flash instruction:

1. First, gain root access to the device, following below steps:

- Login into web gui (default password/IP: admin/192.168.188.253).
- Go to "Advanced" -> "Management" -> "System" and download backup of
  configuration (bakfile.bin).
- Open the file as tar.gz archive, edit/update "shadow" file and change
  hash of root password to something known.
- Repack the archive, rename it back to "bakfile.bin" and use to
  restore configuration of the device.
- After that, device will reboot and can be accessed over SSH.

2. Then, install OpenWrt:

- Login over SSH and issue command:
  fw_setenv bootcmd "bootm 0x9f050000 || bootm 0x9fe80000"
- Upload "sysupgrade" image and install it (only if previous command
  succeeded) with command: "sysupgrade -n -F openwrt-...".

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz e58e49bdbe ar71xx: add support for Samsung WAM250
Samsung WAM250 is a dual-band (selectable, not simultaneous) wireless
hub, dedicated for Samsung Shape Wireless Audio System. The device is
based on Atheros AR9344. FCC ID: A3LWAM250.

Specification:

- 560/450/225 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 2x 10/100 Mbps Ethernet
- 2T2R 2.4/5 GHz (AR9344), with ext. PA (SE2598L, SE5003L) and LNA
- 1x USB 2.0
- 4x LED (all are driven by GPIO)
- 2x button (reset, wps/speaker add)
- DC jack for main power input (14 V)
- UART header on PCB (J4, RX: 3, TX: 5)

Flash instruction:

This device uses dual-image (switched between upgrades) with a common
jffs2 config partition. Fortunately, there is a way to disable this mode
so that more flash space can be used by OpenWrt image.

You can easily access this device over telnet, using root/root
credentials (the same also work for serial console access).

1. Make sure that your device uses second (bootpart=2) image using
   command: "fw_printenv bootpart".
2. If your device uses first image (bootpart=1), perform upgrade to the
   latest vendor firmware (after the update, device should boot from
   second partition) using web gui (default login: admin/1234567890).
3. Rename "sysupgrade" image to "firmware.bin", download it (you can use
   wget, tftp or ftpget) to "/tmp" and issue below commands:

   mtd_debug erase /dev/mtd3 0 $(wc -c /tmp/firmware.bin | awk -F' ' '{print $1}')
   mtd_debug write /dev/mtd3 0 $(wc -c /tmp/firmware.bin)
   fw_setenv bootpart
   fw_setenv bootcmd "bootm 0x9f070000"
   reboot

Revert to vendor firmware instruction:

1. Download vendor firmware to "/tmp" device and issue below commands:

   fw_setenv bootpart 1
   sysupgrade -n -F SS_BHUB_v2.2.05.bin

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 1b0e7a1453 ar71xx: fix COMFAST CF-E375AC support
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 650a5e993b ar71xx: add support for COMFAST CF-E385AC
COMFAST CF-E385AC is an AC2200 ceiling mount AP with PoE support, based
on Qualcomm/Atheros QCA9558 + QCA9984 + QCA8337N.

Specification:

- 720/600/200 MHz (CPU/DDR/AHB)
- 256 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 2x 10/100/1000 Mbps Ethernet, with PoE support
- 3T3R 2.4 GHz (QCA9558), with external LNA and PA (SE2576L)
- 4T4R 5 GHz (QCA9984), with external FEM (SKY85728-11)
- 7x internal antennas
- 1x RGB LED (driven by GPIO)
- 1x button (reset)
- UART, LEDs/GPIO and USB headers on PCB
- external watchdog (Pericon Technology PT7A7514)

Flash instruction:

Original firmware is based on OpenWrt.
Use sysupgrade image directly in vendor GUI.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 29d7c29046 ar71xx: remove unnecessary packages from COMFAST devices
swconfig and uboot-envtools packages are not required by any of the
supported COMFAST devices.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 106a56238f ar71xx: rename COMFAST CF-E355AC to CF-E355AC v1
There are now supported two versions of the CF-E355AC board which differ
in 802.11ac radio chip. Include version number in board, model, image
filename, etc., also for the v1.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 54b1be5f91 ar71xx: image: simplify Embedded Wireless definitions
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz a679a45f0e ar71xx: image: generic: use simply expanded variables
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 3bc017fa3c ar71xx: image: generic: clean up trailing whitespace
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Ding Tengfei e07014e70b ar71xx: add support for COMFAST CF-E355AC v2
COMFAST CF-E355AC v2 is a ceiling mount AP with PoE support, based on
Qualcomm/Atheros QCA9531 + QCA9886.

Short specification:

- 2x 10/100 Mbps Ethernet, with PoE support
- 128MB of RAM (DDR2)
- 16 MB of FLASH
- 2T2R 2.4 GHz, 802.11b/g/n
- 2T2R 5 GHz, 802.11ac/n/a, WAVE 2
- built-in 4x 3 dBi antennas
- output power (max): 500 mW (27 dBm)
- 1x RGB LED, 1x button
- built-in watchdog chipset

Flash instruction:

Original firmware is based on OpenWrt.
Use sysupgrade image directly in vendor GUI.

Signed-off-by: Ding Tengfei <dtf@comfast.cn>
[updated kernel config for both boards]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Sven Eckelmann b1d57dadb2 ar71xx: disable 40Mhz refclk for QCA953x
The "QCA9531 v2.0 802.11n 2x2 2.4 GHz Premium SOC for WLAN Platforms"
datasheet (80-Y7991-1 Rev. C - October 2014) doesn't specify support for a
40 Mhz reference clock. The register description for "Bootstrap Options"
(page 31) defines following states for the bit 4 (REF_CLK):

* 0 - CLK25 (default)
* 1 - (reserved)

Devices like the TP-Link CPE210 v2 has this bit set to 1 but is using a 25
Mhz reference clock. OpenWrt is still interpreted this bit as 40 Mhz and
then break the bootup of the system due to this incorrect interpretation.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[refreshed patches]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Peng Zhang d8e6c3f6d9 ar71xx: add support for WHQX E1700AC/E600G/E600GAC v2
WHQX E1700AC v2 is based on Qualcomm QCA9563 + QCA9880 + QCA8334.

Specification:

- 750/400/250 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 8/16 MB of FLASH (SPI NOR)
- 3T3R 2.4 GHz (QCA9563) with external FEM (SKY85309-11)
- 3T3R 5 GHz (QCA9880) with external FEM (SKY85728-11)
- 2x 10/100/1000 Mbps Ethernet (one port with PoE support)
- 1x miniPCIe slot (USB 2.0 bus only)
- 1x microSIM slot
- 1x USB 2.0
- 5x LED (4 driven by GPIO)
- 1x button (reset)
- 1x 2-pos switch
- 1x DC jack for main power input (9-48 V)
- UART (J5) and LEDs (J13) headers on PCB

WHQX E600G is based on Qualcomm QCA9531.

Specification:

- 650/391/216 MHz (CPU/DDR/AHB)
- 64/128 MB of RAM (DDR2)
- 8/16 MB of FLASH (SPI NOR)
- 2T2R 2.4 GHz (QCA9531) with external PA (LXK-6601)
- 2x 10/100 Mbps Ethernet (one port with PoE support)
- 1x miniPCIe slot (with PCIe and USB 2.0 buses)
- 1x microSIM slot
- 5x LED (4 driven by GPIO)
- 1x button (reset)
- 1x DC jack for main power input (9-48 V)
- UART (J100), SIM (J34), JTAG (J5) and LEDs (J7) headers on PCB

WHQX E600GAC is based on Qualcomm QCA9531 + QCA9887.

Specification:

- 650/391/216 MHz (CPU/DDR/AHB)
- 64/128 MB of RAM (DDR2)
- 8/16 MB of FLASH (SPI NOR)
- 2T2R 2.4 GHz (QCA9531)
- 1T1R 5 GHz (QCA9887) with external FEM (SKY85703-11)
- 2x 10/100 Mbps Ethernet
- 6x LED (1x RGB, 5 driven by GPIO)
- 1x button (reset)
- 1x DC jack for main power input (9-12 V)
- UART (J100), USB (J102), JTAG (J5) and LEDs (J7) header on PCB

Important notice:

First version of these boards are using different mtd layout, with ART
data at the end. You should not use v2 images on v1 board because it
will result in lost of ART data!

Flash instruction (using U-Boot CLI and tftp server):

1. Configure PC with static IP 192.168.1.10 and tftp server.
2. Rename "sysupgrade" filename to "firmware.bin" and place it in tftp
   server directory.
3. Connect PC with one of RJ45 ports, power up the board and press
   "enter" key to access U-Boot CLI.
4. Use the following command to update the device to OpenWrt: "run lfw".

Flash instruction (using U-Boot web-based recovery):

1. Configure PC with static IP 192.168.1.xxx(2-254)/24.
2. Connect PC with one of RJ45 ports, press the reset button, power up
   the board and keep button pressed for around 6-7 seconds, until LEDs
   start flashing.
3. Open your browser and enter 192.168.1.1, select "sysupgrade" image
   and click the upgrade button.

Signed-off-by: Peng Zhang <sd20@qxwlan.com>
[reworked: image generation code, mach-* files, commit description,
fixed minor code style issues, rebased on master]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz fc43e7a6e0 ar71xx: fix typos and indentation in Kconfig.openwrt
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Kyson Lok bb1df2d75b ar71xx: include vendor name for GL iNet products
This patch include GL.iNet vendor name in the
machine name for GL.iNet vendor products.

Signed-off-by: Kyson Lok <kysonlok@gmail.com>
6 years ago
Kyson Lok 9dbfd8e9df ar71xx: uniform GL iNet products mach name
The mach name of GL AR150 and GL AR300 is inconsistent
with other products.

Signed-off-by: Kyson Lok <kysonlok@gmail.com>
6 years ago
Stijn Tintel f621b53951 kernel: bump 4.9 to 4.9.82
Refresh patches.
Remove upstreamed patches:
- ar7/002-MIPS-AR7-ensure-the-port-type-s-FCR-value-is-used.patch
- backport/040-crypto-fix-typo-in-KPP-dependency-of-CRYPTO_ECDH.patch
Remove layerscape/819-Revert-dmaengine-dmatest-move-callback-wait-queue-to.patch,
it is superseded by upstream commit 297c7cc4b5651b174a62925b6c961085f04979fd.
Remove pending/650-pppoe_header_pad.patch, it is superseded by
upstream commit 1bd21b158e07e0b8c5a2ce832305a0ebfe42c480.
Update patches that no longer apply:
- ar71xx/004-register_gpio_driver_earlier.patch
- hack/204-module_strip.patch
- pending/493-ubi-set-ROOT_DEV-to-ubiblock-rootfs-if-unset.patch

Fixes CVE-2017-8824.

Compile-tested: ar71xx.
Runtime-tested: ar71xx.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Mathias Kresin 7a6de6d77a ar71xx: fix sysupgrade syntax error
Fix syntax error introduced with 188328111b ("treewide: move
nand_do_upgrade call to platform_do_upgrade").

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 188328111b treewide: move nand_do_upgrade call to platform_do_upgrade
Calling nand_do_upgrade() from platform_pre_upgrade() was deprecated
with 30f61a34b4 ("base-files: always use staged sysupgrade").

Update the platform upgrade code to use platform_do_upgrade() for NAND
images as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin c4ac02ffca treewide: remove obsolete sysupgrade watchdog kill
The watchdog kill command was meant for busybox watchdog. Busybox watchdog
was replaced by the procd watchdog mid 2013 with commit df7ce9301a
("busybox: disable the watchdog utility by default"), which makes the kill
command obsolete since quite some time.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Julien Dusser 8dd455e3c4 ar71xx: add more registers to ar71x_regs.h
Add more registers and flags to ar71x_regs.h for QCA955x and QCA956x
SoCs. Values come from Qualcomm Atheros u-boot code.

Patches can be merged into
622-MIPS-ath79-add-more-register-defines-for-QCA956x-SoC.patch

Signed-off-by: Julien Dusser <julien.dusser@free.fr>
6 years ago
Karl Palsson b2a5f7683b ar71xx: Add eTactica EG-200 support
EG-200 is a DIN rail mountable device with one ethernet port, wifi,
an RS-485 port, and an internal USB attached uSD card reader.

Two leds, "modbus" and "etactica" are managed by userspace applications
in factory firmware.

Flash instruction:
    Original firmware is based on OpenWrt.
    Use sysupgrade image directly in vendor GUI.

Signed-off-by: Karl Palsson <karlp@etactica.com>
6 years ago
Henryk Heisig a338491a30 ar71xx: add support for TP-Link RE355
This device is identical as TP-Link RE450
RE355 is a dual-band AC1200 router, based on Qualcomm/Atheros
QCA9558+QCA9880.

Specification:

720/600/200 MHz (CPU/DDR/AHB)
64/128 MB of RAM (DDR2)
8 MB of FLASH (SPI NOR)
3T3R 2.4 GHz
3T3R 5 GHz
1x 10/100/1000 Mbps Ethernet
7x LED, 3x button
UART header on PCB

Flash instruction:
Web:
Download lede-ar71xx-generic-archer-c60-v2-squashfs-factory.bin
and use OEM System Tools - Firmware Upgrade site.

Signed-off-by: Henryk Heisig <hyniu@o2.pl>
6 years ago
Matthias Schiffer 355009ebe7
ar71xx: add missing config symbol ATH79_MACH_CF_E375AC
Fixes: bf66bb8c96 "ar71xx:add support for COMFAST CF-E375AC"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Ding Tengfei bf66bb8c96 ar71xx:add support for COMFAST CF-E375AC
COMFAST CF-E375AC is a ceiling mount AP with PoE support, based on
Qualcomm/Atheros QCA9563 + QCA9886 + QCA8337.

Short specification:

    2x 10/100/1000 Mbps Ethernet, with PoE support
    128MB of RAM (DDR2)
    16 MB of FLASH
    3T3R 2.4 GHz, 802.11b/g/n
    2T2R 5 GHz, 802.11ac/n/a, wave 2
    built-in 5x 3 dBi antennas
    output power (max): 500 mW (27 dBm)
    1x RGB LED, 1x button
    built-in watchdog chipset

Flash instruction:

Original firmware is based on OpenWrt.
Use sysupgrade image directly in vendor GUI.

Signed-off-by: Ding Tengfei <dtf@comfast.cn>
6 years ago
David Bauer f17173f5a3 ar71xx: remove bs-partition ro-flag for UniFi AC
This removes the read-only flag from the bs (bootselect) partition
on UniFi AC devices. This allows to correct the indicator from which
partition the device is booting its kernel from.

See also:
 - https://github.com/freifunk-gluon/gluon/issues/1301
 - https://bugs.lede-project.org/index.php?do=details&task_id=662

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Arne Zachlod 186aebf90a
ar71xx: Orders the names of the devices alphabetically.
Signed-off-by: Arne Zachlod <arne@nerdkeller.org>
6 years ago
Felix Fietkau 798497c66e ar71xx: use global timestamp for hang check
Shrink the size of struct ag71xx_buf to 8 bytes, which improves cache
footprint

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 31e6016d2e ar71xx: only access device stats in tx handler if packets were processed
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 890e7458b0 ar71xx: allocate rx/tx descriptor/buffers in one chunk
Reduces false sharing due to cache aliases

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Rosen Penev 4e03a742e0 ag71xx: Reorder ag71xx struct members for better cache performance
Qualcomm claims this improves the D-cache footprint. Origina commit message below:

From: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
Date: Fri, 7 Jun 2013 10:57:28 -0500
Subject: [ag71xx] cluster/align structs for cache perf

Cluster the frequently used, per-packet structures in ag71xx near
to each other, and cacheline-align them.  Some other re-ordering
occurred to move "warmer" structures near the per-packet structures.

Signed-off-by: Ben Menchaca <ben.menchaca@qca.qualcomm.com>
Signed-off-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Felix Fietkau cde71a543c build: replace uses of OpenWrt with $(VERSION_DIST)
This makes the distribution name more configurable.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Matthias Schiffer 0c719bfcaf
ar71xx: /lib/ar71xx.sh: add model detection for TP-Link TL-WR810N
Properly report the revision in /tmp/sysinfo/model.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 3f7908d697
ar71xx-generic: enable ATH79_MACH_TL_WR841N_V8 machine
This machfile also contains the code for the TL-WR842N/ND v2, which is in
ar71xx-generic and not in ar71xx-tiny.

Fixes: 0cd5e85e7a "ar71xx: create new ar71xx/tiny subtarget for 4MB flash
devices"
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Catrinel Catrinescu 4ba2dd130a ar71xx: add ew-balin platform from Embedded Wireless
Add the Embedded Wireless "Balin" platform
 SoC: QCA AR9344 or AR9350
 RAM: DDR2-RAM 64MBytes
 Flash: SPI-NOR 16MBytes
 WLAN: 2 x 2 MIMO 2.4 & 5 GHz IEEE802.11 a/b/g/n
 Ethernet: 3 x 10/100 Mb/s
 USB: 1 x USB2.0 Host/Device bootstrap-pin at power-up
 PCI-Express: 1 x lane PCIe 1.2
 UART: 1 x Normal, 1 x High-Speed
 JTAG: 1 x EJTAG
 GPIO: 10 x Input/Output multiplexed

The module comes already with the current vanilla OpenWrt firmware.
To update, use "sysupgrade" image directly in vendor firmware.

Signed-off-by: Catrinel Catrinescu <cc@80211.de>
6 years ago
Matthias Schiffer ad4232e3e9
ar71xx: add unaligned access hacks for VXLAN
Gives a ~5% performance gain.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Daniel Golle 059b2f5481 ar71xx: fix MikroTik rb-nor-flash-16M-ac image
commit e15c63a375
ar71xx: add support for MikroTik RouterBOARD wAP G-5HacT2HnD (wAP AC)

changed the existing rb-nor-flash-16M-ac image in a way that it would
now only support the rb-wapg-5hact2hnd.
The board show however rather be added to the existing boards in the
rb-nor-flash-16M image template.

Reported-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Gabor Juhos eb9e3651dd ar71xx: add support for the MikroTik RB911-2Hn/5Hn boards
The patch adds support for the MikroTik RB911-2Hn (911 Lite2)
and the RB911-5Hn (911 Lite5) boards:

  https://mikrotik.com/product/RB911-2Hn
  https://mikrotik.com/product/RB911-5Hn

The two boards are using the same hardware design, the only difference
between the two is the supported wireless band.

Specifications:
  * SoC: Atheros AR9344 (600MHz)
  * RAM: 64MiB
  * Storage: 16 MiB SPI NOR flash
  * Ethernet: 1x100M (Passive PoE in)
  * Wireless: AR9344 built-in wireless MAC, single chain
              802.11b/g/n (911-2Hn) or 802.11a/g/n (911-5Hn)

Notes:
  * Older versions of these boards might be equipped with a NAND
    flash chip instead of the SPI NOR device. Those boards are not
    supported (yet).
  * The MikroTik RB911-5HnD (911 Lite5 Dual) board also uses the
    same hardware. Support for that can be added later with little
    effort probably.

Installation:

1. Setup a DHCP/BOOTP Server with the following parameters:
   * DHCP-Option 66 (TFTP server name): pointing to a local TFTP
     server within the same subnet of the DHCP range
   * DHCP-Option 67 (Bootfile-Name): matching the initramfs filename
     of the to be booted image. The usable intramfs files are:
       - openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf
       - openwrt-ar71xx-mikrotik-vmlinux-initramfs-lzma.elf
       - openwrt-ar71xx-mikrotik-rb-nor-flash-16M-initramfs-kernel.bin

2. Press the reset button on the board and keep that pressed.

3. Connect the board to your local network via its ethernet port.

4. Release the button after the LEDs on the board are turned off.
   Now the board should load and start the initramfs image from
   the TFTP server.

5. Upload the sysupgrade image to the board with scp:
     $ scp openwrt-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/fw.bin

5. Log in to the running system listening on 192.168.1.1 via ssh
   as root (without password):
     $ ssh root@192.168.1.1

7. Flash the uploaded firmware file from the ssh session via the
   sysupgrade command:
     root@OpenWrt:~# sysupgrade /tmp/fw.bin

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos a4320b3332 ar71xx: make leds-gpio usable with single-ended GPIOs
Add patches for the leds-gpio driver to make it usable with
open-drain and open-source kind of GPIO lines.

This type of functionality is required by various MikroTik boards.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos e379e60b17 ar71xx: mach-rbspi: return rb_info from rbspi_platform_setup
Modify the rbspi_platform_setup() function to return the pointer of the
rb_info structure. This allows board specific setup routines to access
the various fields of the information. It is useful for investigating
the hardware option bits for example.

Also update the board setup codes, to ensure that those handle the new
return value correctly.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos c7371cd1ee ar71xx: add definitions for RouterBOARD hardware option bits
Add bit definitions for the 'hardware options' tag which is used in
the MikroTik devices' hardware configurations. These values can be
used in board setup codes, to do different initialization sequences.
The values were obtained from the RouterOS 6.41-rc38 patches.

Additionally, introduce two helper functions what make the processing
of the hardware options easy.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Kevin Darbyshire-Bryant a30370bbf1 kernel: bump 4.4 to 4.4.112
Refresh patches.
Remove upstreamed patches:

target/linux/generic/patches-4.4/030-2-smsc75xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch
target/linux/generic/patches-4.4/030-3-cx82310_eth-use-skb_cow_head-to-deal-with-cloned-skb.patch
target/linux/generic/patches-4.4/030-4-sr9700-use-skb_cow_head-to-deal-with-cloned-skbs.patch
target/linux/generic/patches-4.4/030-5-lan78xx-use-skb_cow_head-to-deal-with-cloned-skbs.patch

CVEs completely or partially addressed:

CVE-2017-5715
CVE-2017-5753
CVE-2017-17741
CVE-2017-1000410

Compile-tested: ar71xx Archer C7 v2
Run-tested: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Gabor Juhos ec4e9a88ff ar71xx: drop mdio-gpio.h include from mach-om5pacv2.c
The setup code of the OpenMesh OM5P ACv2 device uses nothing
from the mdio-gpio.h header, so remove the inclusion of that.

Also remove the kernel version check which is needed only
because the mdio-gpio.h header exists in a different path
in older kernels.

Compile tested only.

Cc: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos fbd33c2b6c ar71xx: fix format of the 701-MIPS-ath79-add-routerboard-detection patches
Commit e15c63a375 ("ar71xx: add support for MikroTik RouterBOARD wAP
G-5HacT2HnD (wAP AC") broke the format of the patches. In unified diff
format, the unchanged, contextual lines must be preceded by a space
character.

Refresh the patches with quilt to fix them.

Fixes: e15c63a375 ("ar71xx: add support for MikroTik RouterBOARD wAPG-5HacT2HnD (wAP AC")
Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 508999d366 ar71xx: fix format of the 741-MIPS-ath79-add-PCI-for-QCA9556-SoC patches
The patches introduced in commit 20e68f6d39 ("ar71xx: kernel: enable
PCI on QCA9556 SoC") have non standard format. In unified diff format,
the unchanged, contextual lines must be preceded by a space character.

Refresh the patches with quilt to fix them.

Fixes: 20e68f6d39 ("ar71xx: kernel: enable PCI on QCA9556 SoC")
Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos bc178f6b15 ar71xx: mach-rbspi: simplify reset button registration
The setup code defines four individual structures for the
Reset buttons of the supported boards. The only difference
between the definitions is the GPIO number used for the
button.

Replace the different structures with one generic variant,
and add a helper function to simplify the button registration.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
David Bauer 6c56e968c1 ar71xx: fix TP-Link Archer C7 v4 switch LEDs
Match mapping of the switch LEDs according to the TP-Link
firmware behavior. LAN port 1 triggers the most right LAN LED,
LAN port 2 the second LAN LED from the right and so on.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Piotr Dymacz 030176e0e7 ar71xx: image: rework EnGenius ENS202EXT factory image
Current EnGenius ENS202EXT factory image recipe version causes factory
images of the following devices to be corrupted. This issue wasn't
visible until recent changes of image Makefile snippets order.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Roger Pueyo Centelles e15c63a375 ar71xx: add support for MikroTik RouterBOARD wAP G-5HacT2HnD (wAP AC)
This patch adds support for the MikroTik RouterBOARD wAP G-5HacT2HnD (wAP
AC), a small weatherproof dual band, dual-radio 802.11ac wireless AP with
integrated omnidirectional anntennae and one 10/100/1000 Mbps Ethernet
ports.

See https://mikrotik.com/product/RBwAPG-5HacT2HnD for more info.

Specifications:
 - SoC: Qualcomm Atheros QCA9556
 - RAM: 64 MB
 - Storage: 16 MB NOR
 - Wireless:
   · Atheros AR9550 (SoC) 802.11b/g/n 2x2:2, 2 dBi antennae
   · Qualcomm QCA9880 802.11a/n/ac 3x3:3, 2 dBi antennae
 - Ethernet: Atheros AG71xx (SoC, AR8033), 1x 1000/100/10 port, passive
   PoE in

Working:
 - Board/system detection
 - Sysupgrade
 - Serial console
 - Ethernet
 - 2.4 GHz radio
 - 5 GHz radio
 - Reset button

Not working:
 - LEDs (added according to Mikrotik's GPL sources but not functional)

 Unsupported:
 - ZT2046Q SPI temperature and voltage sensor

Contributors: Giuseppe Tipaldi (@Ciusss89)
              Ricky (@rickydee)

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
[daniel@makrotopia.org: whitespace fix, use PHYADDR instead of PHYMASK]
6 years ago
Roger Pueyo Centelles 20e68f6d39 ar71xx: kernel: enable PCI on QCA9556 SoC
This patch enables the PCI bus on the QCA9556 SoC, the same way it is
done on the same family SoC QCA9558.

Tested on a MikroTik RouterBoard wAPG-5HacT2HnD (wAP AC).

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
6 years ago
Piotr Dymacz 2e5252d346 ar71xx: add support for GL.iNet GL-AR750
GL.iNet GL-AR750 is a small size, dual-band (AC750) router, based on
Qualcomm/Atheros QCA9531 v2 + QCA9887. FCC ID: 2AFIW-AR750.

Specification:

- 650/597/216 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 3x 10/100 Mbps Ethernet
- 2T2R 2.4 GHz (QCA9531)
- 1T1R 5 GHz (QCA9887)
- 1x USB 2.0 (power controlled by GPIO)
- 1x microSD (GL857L)
- 3x LED (all driven by GPIO)
- 1x button (reset)
- 1x 2-pos switch
- header for optional PoE module
- 1x micro USB for main power input
- UART + I2C header on PCB

Flash instruction:

Vendor firmware is based on OpenWrt/LEDE. GUI or sysupgrade can be used
to flash OpenWrt/LEDE firmware.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 6cf682e214 ar71xx: image: move Sitecom WLR-8100 from legacy to generic
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Davide Fioravanti a85db951db ar71xx: fix Sitecom WLR-8100 support
This patch fixes Sitecom WLR-8100:

- mtd layout
- LAN and WAN MAC address setup
- 2.4 GHz Wi-Fi MAC address setup
- 5 GHz Wi-Fi support (calibration data, MAC address setup, missing
  ath10k-* packages)

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
[squashed commits, fixed whitespace issues, reworded commit message]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz af8f0629df ar71xx: add support for ALFA Network R36A
ALFA Network R36A is a successor of the previous model, the R36 (Ralink
RT3050F based). New version is based on Qualcomm/Atheros QCA9531 v2.

Specification:

- 650/400/200 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 2x 10/100 Mbps Ethernet, with passive PoE support (24 V)
- 2T2R (QCA9531) 2.4 GHz, 2x u.fl connectors on PCB
- 1x USB 2.0 (power controlled by GPIO)
- 6x LED (5 of them are driven by GPIO)
- 2x button (reset, wifi/wps)
- external h/w watchdog (EM6324QYSP5B, disabled and not used)
- DC jack for main power input (12 V)
- UART header on PCB

Flash instruction:

You can use sysupgrade image directly in vendor firmware which is based
on LEDE/OpenWrt. Alternatively, you can use web recovery mode in U-Boot:

1. Configure PC with static IP 192.168.1.2/24.
2. Connect PC with one of RJ45 ports, press the reset button, power up
   device, wait for first blink of all LEDs (indicates network setup),
   then keep button for 3 following blinks and release it.
3. Open 192.168.1.1 address in your browser and upload sysupgrade image.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 1f06144cde ar71xx: add support for Teltonika RUT900
Teltonika RUT900 is an industrial 3G router based on Atheros AR9344.

There are available 3 other models in RUT9xx series: RUT905, RUT950 and
RUT955, which differ in availability of additional I/O ports, built-in
GSM modem type, GPS antenna and other features. FCC ID of the RUT950
model (LTE module built-in): 2AET4-RUT950.

This patch adds support for the RUT900 model only but can be easily
extended to cover whole series. Also, as there are several different
3/4G modules (Huawei, Quectel, Telit) used in whole series, packages
required for WWAN support are not included by default. It is up to the
user to install required software for built-in modem.

Specification:

- 550/400/200 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 4x 10/100 Mbps Ethernet, with passive PoE support on LAN1
- 2T2R 2,4 GHz (AR9344), with ext. PA (MGA-22103) and LNA
- built-in 3G module (example: Telit HE910-D)
- 2x miniSIM slot
- 2x RP-SMA/F (Wi-Fi), 2x SMA/F (3G)
- PCA9539 16-bit GPIO I2C expander
- 12x LED (4 are driven by AR9344, 7 by PCA9539)
- 1x button (reset)
- DC jack for main power input (9-30 V)
- UART available on PCB edge connector

Serial console pinout:

- RX: pin1 (square) on top side of the main PCB (AR9344 is on top)
- TX: pin1 (square) on bottom side

Flash instruction:

Vendor firmware is based on OpenWrt CC release. Use the "factory" image
directly in GUI (make sure to uncheck "keep settings") or in U-Boot web
based recovery. To avoid any problems, make sure to first update vendor
firmware to latest version - "factory" image was successfully tested on
device running "RUT9XX_R_00.03.960" firmware and U-Boot "3.0.1".

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 4b0eebe9df ar71xx: add support for ALFA Network N5Q
ALFA Network N5Q is a successor of previous model, the N5 (outdoor
CPE/AP, based on Atheros AR7240 + AR9280). New version is based on
Atheros AR9344.

Specification:

- 550/400/200 MHz (CPU/DDR/AHB)
- 64 MB of RAM (DDR2)
- 16 MB of FLASH (SPI NOR)
- 2x 10/100 Mbps Ethernet, with passive PoE support (24 V)
- 2T2R 5 GHz (AR9344), with ext. PA (RFPA5542) and LNA, up to 27 dBm
- 8x LED (7 are driven by GPIO)
- 1x button (reset)
- external h/w watchdog (EM6324QYSP5B, disabled and not used)
- header for optional 802.3at/af PoE module
- DC jack for main power input (optional, not installed by default)
- UART header on PCB

Flash instruction:

You can use sysupgrade image directly in vendor firmare which is based
on OpenWrt/LEDE. Alternatively, you can use web recovery mode in U-Boot:

1. Configure PC with static IP 192.168.1.2/24.
2. Connect PC with one of RJ45 ports, press the reset button, power up
   device, wait for first blink of all LEDs (indicates network setup),
   then keep button for 3 following blinks and release it.
3. Open 192.168.1.1 address in your browser and upload sysupgrade image.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 7f9f42d42e ar71xx: add support for ALFA Network AP91-5G
ALFA Network AP91-5G is a 5 GHz outdoor AP/CPE board, based on Atheros
AR7240 + AR9280.

Specification:

- 400/400/200 MHz (CPU/DDR/AHB)
- 32 MB of RAM (DDR1)
- 8 MB of FLASH (SPI NOR)
- 1x 10/100 Mbps Ethernet, with passive PoE support (24 V)
- 1T1R 5 GHz (AR9280), with ext. PA (SE5004L) and LNA, up to 27 dBm
- 6x LED (5 are driven by GPIO)
- 1x button (reset)
- external h/w watchdog (EM6324QYSP5B, disabled and not used)
- header for optional 802.3at/af PoE module
- DC jack for main power input (optional, not installed by default)
- UART and LEDs headers on PCB

Flash instruction:

Use "factory" image in vendor GUI (in case of problems, make sure your
board has up to date firmware). Alternatively, TFTP in U-Boot can be
used: select option "2. Load system code then write to Flash via TFTP"
during early boot and use "sysupgrade" image.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz ce6c7691ec ar71xx: base-files: cosmetic cleanups in preinit scripts
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 9a867fcddf ar71xx: base-files: drop LED control from 05_set_iface_mac_ar71xx
There is no "dir-615-c1:green:wancpu" LED defined in mach-dir-615-c1.c

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Piotr Dymacz 71489bfa48 ar71xx: base-files: fix boards order in 05_set_preinit_iface_ar71xx
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Matthias Schiffer 0cd5e85e7a
ar71xx: create new ar71xx/tiny subtarget for 4MB flash devices
This new subtarget sets the small_flash flag and removes unused kernel
configuration.

small_flash removes KERNEL_KALLSYMS, which saves ~107KB in the default
configuration; removing unneeded hardware support from ar71xx/tiny saves
another ~18KB (both after LZMA).

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 29d126b5c1
ar71xx/generic: add generic- prefix to vendor-specific image Makefile snippets
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer 3d365831b0
ar71xx: reorganize kernel configuration
Rather than including all machines for the generic subtarget in the base
configuration, leave the base configuration without specific machines and
create a proper subtarget config for ar71xx/generic. The configuration
diffs of the mikrotik and nand subtargets get significantly shorter, as
will the configurations of future subtargets.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Matthias Schiffer d04056e5ea
ar71xx: disable devicetree support
While we'd like to convert ar71xx to DT-based configuration
eventually, we aren't quite there yet, and shipping half-baked DT support
that is not used at all wastes precious space.

Saves ~120KB before LZMA, ~33KB after LZMA.

Run-tested on TP-Link CPE510 and TL-WR841 v7.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
6 years ago
Kevin Darbyshire-Bryant efb375b579 kernel: bump 4.4 to 4.4.110
Refresh patches

Fixes:  CVE-2017-5754 aka Meltdown

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
[fix typo in commit msg, conflict after 4.14 bump]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Kevin Darbyshire-Bryant 1d2590f838 kernel: bump 4.9 to 4.9.75
Refresh patches

Fixes:  CVE-2017-5754 aka Meltdown

Tested-on: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[fix conflict after 4.14 bump]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
David Bauer daae09f1e5 ar71xx: fix Archer C7v4 5GHz MAC-address
The TP-Link firmware uses (primary_mac-1) as MAC-address
for the 5GHz WiFi. This applies the same behaviour to LEDE.

Currently, the MAC-address is retrieved from eth1, which
does not exist on the Archer C7 v4. As a result from this,
every C7 v4 with LEDE carries the same MAC-Address on the 5GHz WiFi.

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Gabor Juhos 82cc439976 ar71xx: remove obsolete '< KERNEL_VERSION(4, 4, 0)' check
Because the oldest supported kernel version on the ar71xx target is 4.4,
the condition that the kernel version is smaller than 4.4.0 is always
false. Remove the obsolete check from mach-rb4xx.c to clean up the code
a bit.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 8f44c8086b ar71xx: remove obsolete '< KERNEL_VERSION(4, 2, 0)' check
Because the oldest supported kernel version on the ar71xx target is 4.4,
the condition that the kernel version is smaller than 4.2.0 is always
false. Remove the obsolete check from ag71xx_main.c to clean up the code
a bit.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 7a4930b27c ar71xx: remove obsolete '< KERNEL_VERSION(3, 15, 0)' checks
Because the oldest supported kernel version on the ar71xx target is 4.4,
the condition that the kernel version is smaller than 3.15.0 is always
false. Remove the obsolete checks from the target specific source files
to clean up the code a bit.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 99be4170cb ar71xx/mikrotik: disable TP-Link TL-WR810N v2 board support
It does not belongs to the MikroTik boards.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 7f7eb18455 ar71xx/mikrotik: disable unused MTD partitioning and split drivers
Reduces the compressed kernel size by ~2.5KB.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago
Gabor Juhos 660ee2d0f0 ar71xx/mikrotik: disable unused ethernet switch and phy drivers
Disable the drivers for the following ethernet switches:
  Realtek RTL8306
  Realtek RTL8366/8367
  Marvell 88E6060 (DSA)
  Marvell 88E6063 (DSA)

Also disable the phy driver for Marvell PHYs.

None of the supported RouterBOARDs are using any device
which needs these drivers.

Disable the DSA framework too, because it is not required
by the remaining switch drivers.

This reduces the compressed kernel size by ~20KB.

Signed-off-by: Gabor Juhos <juhosg@freemail.hu>
6 years ago