Commit Graph

3681 Commits (be2b61e4f1ec1e351733bebb7105629599034639)

Author SHA1 Message Date
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