Commit Graph

44 Commits (ef5ff08662532a6b1770214569e4c27b05e1dc35)

Author SHA1 Message Date
Christian Lamparter ef5ff08662 ipq40xx: convert to device-tree based USB LED trigger
Thanks to the ledtrig-usb.c the USB LED trigger can be
setup in the device-tree definition for the Asus RT-AC58U
and ZyXEL NBG6617.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 6dff341106 ipq40xx: fix pcie wifi unit-address of the MR33 and A62
The unit address should be wifi@1,0 since the device is located
at 0000:01:00.0.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 5ae45dc7b3 ipq40xx: GL-B1300: convert to new partitions layout
Alberto Bursi reported:
>The patch "ipq40xx: specify "firmware" partition format for GL.iNet GL-B1300"
>prevents boot on my B1300. I compiled from latest sources.

The GL-B1300 was using the discouraged direct subnodes method to declare
the partitions on the flash.

|The partition table should be a subnode of the flash node and should be named
|'partitions'. This node should have the following property:
|- compatible : (required) must be "fixed-partitions"
|Partitions are then defined in subnodes of the partitions node.
|
|For backwards compatibility partitions as direct subnodes of the flash device are
|supported. This use is discouraged.
|NOTE: also for backwards compatibility, direct subnodes that have a compatible
|string are not considered partitions, as they may be used for other bindings.
<https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/partition.txt>

Hence, this patch converts the device to the "partitions" layout.

Fixes: 1cbe457cf9 ("ipq40xx: specify "firmware" partition format for GL.iNet GL-B1300")
Reported-by: Alberto Bursi <bobafetthotmail@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Petr Štetiar 0d23fd2ab2 treewide: dts: Remove default-state=off property from all gpio LED nodes
>From the Documentation/devicetree/bindings/leds/common.txt:

- default-state : The initial state of the LED. Valid values are "on", "off",
  and "keep". If the LED is already on or off and the default-state property is
  set the to same value, then no glitch should be produced where the LED
  momentarily turns off (or on). The "keep" setting will keep the LED at
  whatever its current state is, without producing a glitch.  The default is
  off if this property is not present.

So setting the default-state of the LEDs to `off` is redundant as `off`
is default LED state anyway. We should remove it as almost every new
PR/patch submission contains this property by default which seems to be
just copy&paste from some DTS file already present in the tree.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
6 years ago
Christian Lamparter 2630aae36f ipq40xx: device-tree overhaul
- replace licence texts with SPDX-License-Identifier where
   applicable.

 - make node-names more generic to fit with Device-Tree Release v0.2
   Section 2.2.2 Generic Names Recommendation.

 - utilize wifi0/1, blsp1_uart1 labels

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 97ba1411e5 ipq40xx: specify "firmware" partition format for EnGenius EAP1300
Specify firmware partition format by compatible string.

Cc: Steven Lin <steven.lin@senao.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 1cbe457cf9 ipq40xx: specify "firmware" partition format for GL.iNet GL-B1300
Specify firmware partition format by compatible string.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 771736c039 ipq40xx: specify "firmware" partition format for Compex WPJ428
Specify firmware partition format by compatible string.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter db2e32c04b ipq40xx: specify "firmware" partition format for ZyXEL WRE6606
Specify firmware partition format by compatible string.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter e2dc8f2ab4 ipq40xx: specify "firmware" partition format for Netgear EX61[50]0v2
Specify firmware partition format by compatible string.

Cc: David Bauer <mail@david-bauer.net>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter bff9d4e081 ipq40xx: specify "firmware" partition format for AVM Fritz!Box 4040
Specify firmware partition format by compatible string.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Steven Lin 2b4ac79a79 ipq40xx: add support for EnGenius EAP1300
SOC:    IPQ4018 / QCA Dakota
CPU:    Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:   256 MiB
NOR:    32 MiB
ETH:    Qualcomm Atheros QCA8072
WLAN1:  Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:  Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:  RESET Button
LEDS:   Power, LAN, MESH, WLAN 2.4GHz, WLAN 5GHz

1. Load Ramdisk via U-Boot

To set up the flash memory environment, do the following:
a. As a preliminary step, ensure that the board console port is connected to the PC using these RS232 parameters:
   * 115200bps
   * 8N1
b. Confirm that the PC is connected to the board using one of the Ethernet ports. Set a static ip 192.168.99.8 for Ethernet that connects to board. The PC must have a TFTP server launched and listening on the interface to which the board is connected. At this stage power up the board and, after a few seconds, press 4 and then any key during the countdown.

U-BOOT> set serverip 192.168.99.8 && set ipaddr 192.168.99.9 && tftpboot 0x84000000 openwrt.itb && bootm

2. Load image via GUI

a. Upgrade EAP1300 to FW v3.5.3.2
In the GUI, System Manager > Firmware > Firmware Upgrade, to do upgrade.
b. Transfer to OpenWrt from EnGenius.
In Firmware Upgrade page, to upgrade yours openwrt-ipq40xx-engenius_eap1300-squashfs-sysupgrade.bin.

3. Revert to EnGenius EAP1300
To flash openwrt-ipq40xx-engenius_eap1300-squashfs-factory.bin by using sysupgrade command and "DO NOT" keep configuration.
$ sysupgrade –n openwrt-ipq40xx-engenius_eap1300-squashfs-factory.bin

Signed-off-by: Steven Lin <steven.lin@senao.com>
6 years ago
Christian Lamparter 8b18fce3b8 ipq40xx: nbg6617: switch to upstream boardfile variant
The NBG6617's boardfile was merged and this device can
now switch to the upstream ath10k board-2.bin.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 6840f15a16 ipq40xx: rt-ac58u: replace ubi auto load hack
This patch replaces the custom autoload quirk of the
RT-AC58U with a bootargs-append overwrite.

The vendor's u-boot doesn't leave the bootargs / cmdline alone,
so the it can't be overwritten in any other way right now...
And of course, this will be a lot of fun to deal with once
the device switches to the new spi-nand subsystem.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Paul Wassi e348ccc4e6 treewide: fix some cosmetic glitches in dts files
- fix single spaces hidden by a tab
- replace indentation with spaces by tabs
- make empty lines empty
- drop trailing whitespace
- drop unnecessary blank lines

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Paul Wassi <p.wassi@gmx.at>
6 years ago
Sven Eckelmann e3b8ae2b09 ipq40xx: Limit usable channels for OpenMesh A62 PHYs
The OpenMesh A62 is a tri-band device (1x 2.4GHz, 2x 5GHz) with special
filters in front of the RX+TX paths to the 5GHz PHYs. These filtered
channel can in theory still be used by the hardware but the signal strength
is reduced so much that it makes no sense.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
John Crispin 95672e0433 ipq40xx: use patches that were sent upstream
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
John Crispin 1e48e56c50 ipq40xx: drop bus driver, its a no-op and only does lots of alloc/free
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Christian Lamparter 82618062cf ipq40xx: add support for the ZyXEL NBG6617
This patch adds support for ZyXEL NBG6617

Hardware highlights:

SOC:    IPQ4018 / QCA Dakota
CPU:    Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:   256 MiB DDR3L-1600/1866 Nanya NT5CC128M16IP-DI @ 537 MHz
NOR:    32 MiB Macronix MX25L25635F
ETH:    Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB:    1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1:  Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:  Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:  RESET Button, WIFI/Rfkill Togglebutton, WPS Button
LEDS:   Power, WAN, LAN 1-4, WLAN 2.4GHz, WLAN 5GHz, USB, WPS

Serial:
	WARNING: The serial port needs a TTL/RS-232 3.3v level converter!
	The Serial setting is 115200-8-N-1. The 1x4 .1" header comes
	pre-soldered. Pinout:
	  1. 3v3 (Label printed on the PCB), 2. RX, 3. GND, 4. TX

first install / debricking / restore stock:
 0. Have a PC running a tftp-server @ 192.168.1.99/24
 1. connect the PC to any LAN-Ports
 2. put the openwrt...-factory.bin (or V1.00(ABCT.X).bin for stock) file
    into the tftp-server root directory and rename it to just "ras.bin".
 3. power-cycle the router and hold down the the WPS button (for 30sek)
 4. Wait (for a long time - the serial console provides some progress
    reports. The u-boot says it best: "Please be patient".
 5. Once the power LED starts to flashes slowly and the USB + WPS LEDs
    flashes fast at the same time. You have to reboot the device and
    it should then come right up.

Installation via Web-UI:
 0. Connect a PC to the powered-on router. It will assign your PC a
    IP-address via DHCP
 1. Access the Web-UI at 192.168.1.1 (Default Passwort: 1234)
 2. Go to the "Expert Mode"
 3. Under "Maintenance", select "Firmware-Upgrade"
 4. Upload the OpenWRT factory image
 5. Wait for the Device to finish.
    It will reboot into OpenWRT without any additional actions needed.

To open the ZyXEL NBG6617:
 0. remove the four rubber feet glued on the backside
 1. remove the four philips screws and pry open the top cover
    (by applying force between the plastic top housing from the
    backside/lan-port side)

Access the real u-boot shell:
ZyXEL uses a proprietary loader/shell on top of u-boot: "ZyXEL zloader v2.02"
When the device is starting up, the user can enter the the loader shell
by simply pressing a key within the 3 seconds once the following string
appears on the serial console:

|   Hit any key to stop autoboot:  3

The user is then dropped to a locked shell.

|NBG6617> HELP
|ATEN    x[,y]     set BootExtension Debug Flag (y=password)
|ATSE    x         show the seed of password generator
|ATSH              dump manufacturer related data in ROM
|ATRT    [x,y,z,u] RAM read/write test (x=level, y=start addr, z=end addr, u=iterations)
|ATGO              boot up whole system
|ATUR    x         upgrade RAS image (filename)
|NBG6617>

In order to escape/unlock a password challenge has to be passed.
Note: the value is dynamic! you have to calculate your own!

First use ATSE $MODELNAME (MODELNAME is the hostname in u-boot env)
to get the challange value/seed.

|NBG6617> ATSE NBG6617
|012345678901

This seed/value can be converted to the password with the help of this
bash script (Thanks to http://www.adslayuda.com/Zyxel650-9.html authors):

- tool.sh -
ror32() {
  echo $(( ($1 >> $2) | (($1 << (32 - $2) & (2**32-1)) ) ))
}
v="0x$1"
a="0x${v:2:6}"
b=$(( $a + 0x10F0A563))
c=$(( 0x${v:12:14} & 7 ))
p=$(( $(ror32 $b $c) ^ $a ))
printf "ATEN 1,%X\n" $p
- end of tool.sh -

|# bash ./tool.sh 012345678901
|
|ATEN 1,879C711

copy and paste the result into the shell to unlock zloader.

|NBG6617> ATEN 1,0046B0017430

If the entered code was correct the shell will change to
use the ATGU command to enter the real u-boot shell.

|NBG6617> ATGU
|NBG6617#

Co-authored-by: David Bauer <mail@david-bauer.net>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Magnus Frühling 4b280ad91a ipq40xx: add support for ZyXEL WRE6606
Specifications:
SOC:	Qualcomm IPQ4018 (DAKOTA) ARM Quad-Core
RAM:	128 MB Nanya NT5CC64M16GP-DI
FLASH:	16 MiB Macronix MX25L12845EMI-12G
ETH:	Qualcomm QCA8072
WLAN1:  Qualcomm Atheros QCA4018 2.4GHz 802.11b/g/n 2x2
WLAN2:  Qualcomm Atheros QCA4018 5GHz 802.11n/ac W2 2x2
INPUT:  WPS, Mode-toggle-switch
LED:	Power, WLAN 2.4GHz, WLAN 5GHz, LAN, WPS
        (LAN not controllable by software)
        (WLAN each green / red)
SERIAL:	Header next to eth-phy.
        VCC, TX, GND, RX (Square hole is VCC)
        The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet (Correct MAC-address)
 - 2.4 GHz WiFi (Correct MAC-address)
 - 5 GHz WiFi (Correct MAC-address)
 - Factory installation from tftp
 - OpenWRT sysupgrade
 - LEDs
 - WPS Button

Not Working:
 - Mode-toggle-switch

Install via TFTP:

Connect to the devices serial. Hit Enter-Key in bootloader to stop
autobooting. Command `tftpboot` will pull an initramfs image named
`C0A86302.img` from a tftp server at `192.168.99.08/24`.
After successfull transfer, boot the image with `bootm`.

To persistently write the firmware, flash an openwrt sysupgrade image
from inside the initramfs, for example transfer
via `scp <sysupgrade> root@192.168.1.1:/tmp` and flash on the device
with `sysupgrade -n /tmp/<sysupgrade>`.

append-cmdline patch taken from chunkeeys work on the NBG6617.

Signed-off-by: Magnus Frühling <skorpy@frankfurt.ccc.de>
Co-authored-by: David Bauer <mail@david-bauer.net>
Co-authored-by: Christian Lamparter <chunkeey@googlemail.com>
6 years ago
Christian Lamparter 4363b5362f ipq40xx: flesh out MR33's pcie dts definitions
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 146fbeb81c ipq40xx: fix OpenMesh A62 dtc warnings
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0 missing ranges for PCI bridge (or not a bridge)
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0 missing bus-range for PCI bridge
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0/ath10k@0,0 node name is not "pci" or "pcie"
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0/ath10k@0,0 missing ranges for PCI bridge (or not a bridge)
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0/ath10k@0,0 incorrect #address-cells for PCI bridge
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0/ath10k@0,0 incorrect #size-cells for PCI bridge
Warning (pci_bridge): Node /soc/pci@40000000/pcie@0/ath10k@0,0 missing bus-range for PCI bridge
Warning (unit_address_format): Failed prerequisite 'pci_bridge'
Warning (pci_device_reg): Failed prerequisite 'pci_bridge'
Warning (pci_device_bus_num): Failed prerequisite 'pci_bridge'

Cc: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Tested-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
6 years ago
Christian Lamparter 2f1fa04587 ipq40xx: fix dtc warning about /soc/ad-hoc-bus missing a unit name
This patch fixes a dtc warning that shows up for every device
Warning (unit_address_vs_reg): Node /soc/ad-hoc-bus has a reg or ranges property, but no unit name

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter b22e37528b ipq40xx: set #size-cells to 0 to fix warning
qcom-ipq4018-ex6100v2.dtb: Warning (reg_format): "reg" property in
	/led_spi/led_gpio@0 has invalid length (4 bytes)
qcom-ipq4018-ex6100v2.dtb: Warning (avoid_default_addr_size):
	Relying on default #size-cells value for /led_spi/led_gpio@0

Cc: Thomas Hebb <tommyhebb@gmail.com>
Cc: David Bauer <mail@david-bauer.net>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Sven Eckelmann 0b20490207 ipq40xx: add support for OpenMesh A62
* QCA IPQ4019
* 256 MB of RAM
* 32 MB of SPI NOR flash (s25fl256s1)
  - 2x 15 MB available; but one of the 15 MB regions is the recovery image
* 2T2R 2.4 GHz
  - QCA4019 hw1.0 (SoC)
  - requires special BDF in QCA4019/hw1.0/board-2.bin with
    bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=OM-A62
* 2T2R 5 GHz (channel 36-64)
  - QCA9888 hw2.0 (PCI)
  - requires special BDF in QCA9888/hw2.0/board-2.bin
    bus=pci,bmi-chip-id=0,bmi-board-id=16,variant=OM-A62
* 2T2R 5 GHz (channel 100-165)
  - QCA4019 hw1.0 (SoC)
  - requires special BDF in QCA4019/hw1.0/board-2.bin with
    bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=OM-A62
* multi-color LED (controlled via red/green/blue GPIOs)
* 1x button (reset; kmod-input-gpio-keys compatible)
* external watchdog
  - triggered GPIO
* 1x USB (xHCI)
* TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX)
* 2x gigabit ethernet
  - phy@mdio3:
    + Label: Ethernet 1
    + gmac0 (ethaddr) in original firmware
    + 802.3at POE+
  - phy@mdio4:
    + Label: Ethernet 2
    + gmac1 (eth1addr) in original firmware
    + 18-24V passive POE (mode B)
* powered only via POE

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

The initramfs image can be started using

  setenv bootargs 'loglevel=8 earlycon=msm_serial_dm,0x78af000 console=ttyMSM0,115200 mtdparts=spi0.0:256k(0:SBL1),128k(0:MIBIB),384k(0:QSEE),64k(0:CDT),64k(0:DDRPARAMS),64k(0:APPSBLENV),512k(0:APPSBL),64k(0:ART),64k(0:custom),64k(0:KEYS),15552k(inactive),15552k(inactive2)'
  tftpboot 0x84000000 openwrt-ipq40xx-openmesh_a62-initramfs-fit-uImage.itb
  set fdt_high 0x85000000
  bootm 0x84000000

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Sven Eckelmann 856f0d5d0d ipq40xx: use upstream board-2.bin
The BDFs for all boards were upstreamed to the ath10k-firmware
repository and are now part of ath10k-firmware 2018-04-19.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Thomas Hebb 16b25ad829 ipq40xx: ex61x0v2: Disable unused GMACs
These devices have only one ethernet port. It doesn't make sense to
expose the unused GMACs as separate network devices.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>
6 years ago
Sven Eckelmann c4c2a8f00c ipq40xx: Move reserved-memory DT to qcom-ipq4019.dtsi
The tz and smem reserved-memory information handled in the upstream Linux
sources by the SoC specific dtsi and not by the the boards dts. Using the
same approach in OpenWrt avoids unneccessary duplication.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Sven Eckelmann 0d62432834 ipq40xx: Remove unused reserved-memory nodes
The reserved-memory regions are mostly undocumented by QCA and are named
very unspecific in the QSDK device trees. It was tried to clean them up by
commit 71ed9f10a3 ("ipq40xx: Use detailed reserved memory for A42") and
similar changes.

The features which require these regions were mostly unknown but
Senthilkumar N L <snlakshm@qti.qualcomm.com> and Sricharan Ramabadhran
<srichara@qti.qualcomm.com> provided some more insight in some of them:

* crash dump feature
  - a couple of regions used when 'qca,scm_restart_reason' dt node has the
    value 'dload_status' not set to 1
    + apps_bl <0x87000000 0x400000>
    + sbl <0x87400000 0x100000>
    + cnss_debug <0x87400000 0x100000>
    + cpu_context_dump <0x87b00000 0x080000>
  - required driver not available in Linux
  - safe to remove
* QSEE app execution
  - region tz_apps <0x87b80000 0x280000>
  - required driver not available in Linux
  - safe to remove
* communication with TZ/QSEE
  - region smem <0x87b80000 0x280000>
  - driver changes not yet upstreamed
  - must not be removed because any access can crash kernel/program
* trustzone (QSEE) private memory
  - region tz <0x87e80000 0x180000>
  - must not be removed because any access can crash kernel/program

Removing the unnecessary regions saves some kilobyte of reserved-memory and
cleans up the device tree:

* 2560 KiB
  - 8devices Jalapeno
  - AVM FRITZ!Box 4040
  - Compex WPJ428
  - Meraki MR33 Access Point
  - OpenMesh A42
* 14336 KiB
  - GL.iNet GL-B1300
  - Qualcomm Technologies, Inc. IPQ40xx/AP-DK01.1-C1

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
David Bauer 970f1914be ipq40xx: add support for Netgear EX6100v2/EX6150v2
Specifications:
SOC:	Qualcomm IPQ4018 (DAKOTA) ARM Quad-Core
RAM:	256 MB Winbond W632GU6KB12J
FLASH:	16 MiB Macronix MX25L12805D
ETH:	Qualcomm QCA8072
WLAN1:  Qualcomm Atheros QCA4018 2.4GHz 802.11b/g/n/ac 2x2
WLAN2:  Qualcomm Atheros QCA4018 5GHz 802.11n/ac
	1x1 (EX6100)
	2x2 (EX6150)
INPUT:  Power, WPS, reset button
	AP / Range-extender toggle
LED:	Power, Router, Extender (dual), WPS, Left-/Right-arrow
SERIAL:	Header next to QCA8072 chip.
	VCC, TX, RX, GND (Square hole is VCC)
	WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!
        The Serial setting is 115200-8-N-1.

Tested and working:
 - Ethernet
 - 2.4 GHz WiFi (Correct MAC-address)
 - 5 GHz WiFi (Correct MAC-address)
 - Factory installation from WebIF
 - Factory installation from tftp
 - OpenWRT sysupgrade (Preserving and non-preserving)
 - LEDs
 - Buttons

Not Working:
 - AP/Extender toggle-switch

Untested:
 - Support on EX6100v2. They share the same GPL-Code and vendor-images.
   The 6100v2 seems to lack one 5GHz stream and differs in the 5GHz
   board-blob. I only own a EX6150v2, therefore i am only able to verify
   functionality on this device.

Install via Web-Interface:
Upload the factory image to the device to the Netgear Web-Interface.
The device might asks you to confirm the update a second time due to
detecting the OpenWRT firmware as older. The device will automatically
reboot after the image is written to flash.

Install via TFTP:
Connect to the devices serial. Hit Enter-Key in bootloader to stop
autobooting. Command "fw_recovery" will start a tftp server, waiting for
a DNI image to be pushed.
Assign your computer the IP-address 192.168.1.10/24. Push image with
tftp -4 -v -m binary 192.168.1.1 -c put <OPENWRT_FACTORY>
Device will erase factory-partition first, then writes the pushed image
to flash and reboots.

Parts of this commit are based on Thomas Hebb's work on the
openwrt-devel mailinglist.

See https://lists.openwrt.org/pipermail/openwrt-devel/2018-January/043418.html

Signed-off-by: David Bauer <mail@david-bauer.net>
6 years ago
Robert Marko 1e341bb5ef ipq40xx: add support for 8devices Jalapeno
This patch adds support for 8devices Jalapeno.

Specification:
QCA IPQ4018, Quad core ARM v7 Cortex A7 717MHz
256 MB of DDR3 RAM
8 MB of SPI NOR flash
128 MB of Winbond SPI NAND flash
WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
requires special BDF in QCA4019/hw1.0/board-2.bin with:
bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=8devices-Jalapeno
WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
requires special BDF in QCA4019/hw1.0/board-2.bin with:
bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=8devices-Jalapeno
ETH: Qualcomm Atheros QCA8072 Gigabit Switch (1 x LAN, 1 x WAN)
phy@mdio3:
Label: eth0
gmac0
phy@mdio4:
Label: eth1
gmac1

Installation instructions:
Since boards ship with old version of LEDE installation is simple.
Just use sysupgrade -n -F sysupgrade.bin

Syuspgrade needs to be forced since OpenWRT uses DT detection in recent
releases.

If you get error that FIT configuration is not found during boot it is
due to older U-boot used on your board.
That is because 8devices used custom FIT configuration partition name
as they internally had v1 and v2 boards.
Only v2 boards are sold so now they are shipping boards with never
U-boot using generic config@1 FIT partition name.

Also for old uboot it is possible to force loading config@1 by changing
uboot environment:

setenv boot5 'bootm 0x84000000#config@1’
saveenv

Signed-off-by: Robert Marko <robimarko@gmail.com>
6 years ago
Sven Eckelmann 7004f681cd ipq40xx: Add reserved memory for WPJ428
The APPSBL and anything after that it not allowed to touch some of the
memory regions which are used by other components. Still trying to write to
the memory can lead to sudden device restarts

  (IPQ40xx) # mw 87e80000 0
  data abort
  pc : [<873149f8>]          lr : [<87308578>]
  sp : 86edfc28  ip : 86ef4412     fp : 00000000
  r10: 00000000  r9 : 00000000     r8 : 86edff68
  r7 : 00000003  r6 : 8737e624     r5 : 86ef4420  r4 : 8736c154
  r3 : 00000000  r2 : 00000010     r1 : 00000000  r0 : 00000000
  Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
  Resetting CPU ...

The device manufacturer only provided a very rough list of regions:

* rsvd1:     0x87000000 0x500000
* wifi_dump: 0x87500000 0x600000
* rsvd2:     0x87b00000 0x500000

A more detailed list for devices using the AP.DK reference design memory
maps was provided by Roman Yeryomin <roman@advem.lv> in commit 56f2df879fd
("ipq806x: ipq4019: add ap-dk01.1-c1 board support"):

* apps_bl:          0x87000000 0x400000
* sbl:              0x87400000 0x100000
* cnss_debug:       0x87500000 0x600000
* cpu_context_dump: 0x87b00000 0x080000
* tz_apps:          0x87b80000 0x280000
* smem:             0x87e00000 0x080000
* tz:               0x87e80000 0x180000

The u-boot function ipq_fdt_mem_rsvd_fixup seems to suggest that only the
rsvd2 (tz_apps, smem, tz) should be protected. All other regions would have
been removed by it when CONFIG_QCA_APPSBL_DLOAD is not enabled. This allows
to reduce the 16MB reserved memory region to only 4.5MB.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Sven Eckelmann 71ed9f10a3 ipq40xx: Use detailed reserved memory for A42
The APPSBL and anything after that it not allowed to touch some of the
memory regions which are used by other components. Still trying to write to
the memory can lead to sudden device restarts

  (IPQ40xx) # mw 87e80000 0
  data abort
  pc : [<873149f8>]          lr : [<87308578>]
  sp : 86edfc28  ip : 86ef4412     fp : 00000000
  r10: 00000000  r9 : 00000000     r8 : 86edff68
  r7 : 00000003  r6 : 8737e624     r5 : 86ef4420  r4 : 8736c154
  r3 : 00000000  r2 : 00000010     r1 : 00000000  r0 : 00000000
  Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
  Resetting CPU ...

The device manufacturer only provided a very rough list of regions:

* rsvd1:     0x87000000 0x500000
* wifi_dump: 0x87500000 0x600000
* rsvd2:     0x87b00000 0x500000

A more detailed list for devices using the AP.DK reference design memory
maps was provided by Roman Yeryomin <roman@advem.lv> in commit 56f2df879fd
("ipq806x: ipq4019: add ap-dk01.1-c1 board support"):

* apps_bl:          0x87000000 0x400000
* sbl:              0x87400000 0x100000
* cnss_debug:       0x87500000 0x600000
* cpu_context_dump: 0x87b00000 0x080000
* tz_apps:          0x87b80000 0x280000
* smem:             0x87e00000 0x080000
* tz:               0x87e80000 0x180000

The u-boot function ipq_fdt_mem_rsvd_fixup seems to suggest that only the
rsvd2 (tz_apps, smem, tz) should be protected. All other regions would have
been removed by it when CONFIG_QCA_APPSBL_DLOAD is not enabled. This allows
to reduce the 16MB reserved memory region to only 4.5MB.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Sven Eckelmann 1fcd625c0a ipq40xx: Remove phy reset gpio from Cisco Meraki MR33
There is currently no code to read the phy reset gpios for the ethernet
PHY. It would also have been better to use the more common name
"phy-reset-gpios" for this property.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
6 years ago
Sven Eckelmann 7a8017b0ae ipq40xx: Adjust SoC name of AVM Fritz!Box 4040
The AVM Fritz!Box 4040 uses an IPQ4018 as SoC and not an IPQ4019. The DTS
must be adjusted to reflect this.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
6 years ago
Sven Eckelmann 9ca81646b9 ipq40xx: Use constant to set gpio active low/high
The GPIO configuration in the DTS have as third parameter the active
low/high configuration. This parameter is not easy to parse by humans when
it is only set to 0/1. It is better to use the predefined constants
GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Sven Eckelmann 688ae1c4c0 ipq40xx: Fix DTS status parameter values
The "Devicetree Specification, Release v0.2 - 2.3.4 status" [1] only allows
the "okay" value for an operational device. The "ok" value will be accepted
by the kernel but should be avoided.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
6 years ago
Mathias Kresin 403260dbf7 ipq40xx: fix GL.iNet GL-B1300
The deletion of the mdio node childs was meant for testing and were
committed accidentally. Without the mdio nodes the network isn't
initialised.

While at it, remove the orphaned qcom-ipq4019-gl-b1300.dts as well.

Fixes: FS#1439
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Sven Eckelmann 2796ab85ed ipq40xx: add support for Compex WPJ428
* QCA IPQ4028
* 256 MB of RAM
* 32 MB of SPI NOR flash (mx25l25635e)
* 128 MB of SPI NAND flash (gd5f1gq4ucy1g)
* 2T2R 2.4 GHz
  - QCA4019 hw1.0 (SoC)
  - uses AP-DK03 BDF from QCA4019/hw1.0/board-2.bin
* 2T2R 5 GHz
  - QCA4019 hw1.0 (SoC)
  - uses AP-DK03 BDF from QCA4019/hw1.0/board-2.bin
* 2 fully software controllable GPIO-LEDs
* 2 additional GPIO-LEDs which also affect the SIM card detection
* 1x button (reset)
* 1x GPIO buzzer
* 1x USB (xHCI)
* 1x NGFF (USB-only with Dual-SIM support, untested)
* TTL pins are on board (R124 is next to GND, then follows: RX, TX, VCC)
* 2x gigabit ethernet
  - phy@mdio4:
    + Manual: Ethernet port 0
    + gmac0 (ethaddr) in original firmware
    + 802.3af POE (HV version)
    + 24v passive POE (LV version)
  - phy@mdio3:
    + Manual: Ethernet port 1
    + gmac1 (eth1addr) in original firmware
* DC Jack connector
  + 24-56V (HV version)
  + 12-24V (LV version)

The SPI NAND flash isn't supported at the moment.

The bootloader has to be updated before OpenWrt is installed to fix a
reboot problem. The nor-ipq40xx-single.img from
https://downloads.compex.com.sg/?dir=uploads/QSDK/QCA-Reference/WPJ428/b170123-IPQ40xx-Reference-Firmware
has to be downloaded and the transfered in u-boot via TFTP

  set ipaddr 192.168.1.11
  set serverip 192.168.1.10
  ping ${serverip}
  tftpboot 0x84000000 nor-ipq40xx-single.img
  imgaddr=0x84000000 && source $imgaddr:script

The sysupgrade image can be installed directly on flash using u-boot:

  sf probe
  tftpboot 0x84000000 openwrt-ipq40xx-compex_wpj428-squashfs-sysupgrade.bin
  sf erase 0x00180000 +$filesize
  sf write 0x84000000 0x00180000 $filesize
  bootipq

The initramfs image can be started using

  tftpboot 0x82000000 openwrt-ipq40xx-compex_wpj428-initramfs-fit-uImage.itb
  set fdt_high 0x83000000
  bootm 0x82000000

The used SIM card slot can be changed using

  # slot 1 (also enables orange LED)
  echo 1 > /sys/class/gpio/gpio3/value
  # slot 2
  echo 0 > /sys/class/gpio/gpio3/value

It can be checked whether a SIM card is inserted in the current slot and
the red LED is subsequently on via:

  echo 2 > /sys/class/gpio/export
  cat /sys/class/gpio/gpio2/value

Signed-off-by: Sven Eckelmann <sven@narfation.org>
6 years ago
Chris Blake 4943afd781 ipq40xx: add Cisco Meraki MR33 Support
This patch adds support for Cisco Meraki MR33

hardware highlights:

SOC:	IPQ4029 Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:	256 MiB DDR3L-1600 @ 627 MHz Micron MT41K128M16JT-125IT
NAND:	128 MiB SLC NAND Spansion S34ML01G200TFV00 (106 MiB usable)
ETH:	Qualcomm Atheros AR8035 Gigabit PHY (1 x LAN/WAN) + PoE
WLAN1:	QCA9887 (168c:0050) PCIe 1x1:1 802.11abgn ac Dualband VHT80
WLAN2:	Qualcomm Atheros QCA4029 2.4GHz 802.11bgn 2:2x2
WLAN3:	Qualcomm Atheros QCA4029 5GHz 802.11a/n/ac 2:2x2 VHT80
LEDS:	1 x Programmable RGB+White Status LED (driven by Ti LP5562 on i2c-1)
	1 x Orange LED Fault Indicator (shared with LP5562)
	2 x LAN Activity / Speed LEDs (On the RJ45 Port)
BUTTON:	one Reset button
MISC:	Bluetooth LE Ti cc2650 PG2.3 4x4mm - BL_CONFIG at 0x0001FFD8
	AT24C64 8KiB EEPROM
	Kensington Lock

Serial:
	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
	The Serial setting is 115200-8-N-1. The board has a populated
	1x4 0.1" header with half-height/low profile pins.
	The pinout is: VCC (little white arrow), RX, TX, GND.

Flashing needs a serial adaptor, as well as patched ubootwrite utility
(needs Little-Endian support). And a modified u-boot (enabled Ethernet).
Meraki's original u-boot source can be found in:
<https://github.com/riptidewave93/meraki-uboot/tree/mr33-20170427>

Add images to do an installation via bootloader:
 0. open up the MR33 and connect the serial console.

 1. start the 2nd stage bootloader transfer from client pc:

  # ubootwrite.py --write=mr33-uboot.bin
  (The ubootwrite tool will interrupt the boot-process and hence
   it needs to listen for cues. If the connection is bad (due to
   the low-profile pins), the tool can fail multiple times and in
   weird ways. If you are not sure, just use a terminal program
   and see what the device is doing there.

 2. power on the MR33 (with ethernet + serial cables attached)
    Warning: Make sure you do this in a private LAN that has
    no connection to the internet.

 - let it upload the u-boot this can take 250-300 seconds -

 3. use a tftp client (in binary mode!) on your PC to upload the sysupgrade.bin
    (the u-boot is listening on 192.168.1.1)
    # tftp 192.168.1.1
    binary
    put openwrt-ipq40xx-meraki_mr33-squashfs-sysupgrade.bin

 4. wait for it to reboot

 5. connect to your MR33 via ssh on 192.168.1.1

For more detailed instructions, please take a look at the:
"Flashing Instructions for the MR33" PDF. This can be found
on the wiki: <https://openwrt.org/toh/meraki/mr33>
(A link to the mr33-uboot.bin + the modified ubootwrite is
also there)

Thanks to Jerome C. for sending an MR33 to Chris.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 87c42101cf ipq40xx: add support for ASUS RT-AC58U/RT-ACRH13
This patch adds support for ASUS RT-AC58U/RT-ACRH13.

hardware highlights:

SOC:	IPQ4018 / QCA Dakota
CPU:	Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:	128 MiB DDR3L-1066 @ 537 MHz (1074?) NT5CC64M16GP-DI
NOR:	2 MiB Macronix MX25L1606E (for boot, QSEE)
NAND:   128 MiB Winbond W25NO1GVZE1G (cal + kernel + root, UBI)
ETH:    Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN)
USB:    1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC)
WLAN1:  Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:  Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:	one Reset and one WPS button
LEDS:	Status, WAN, WIFI1/2, USB and LAN (one blue LED for each)
Serial:
	WARNING: The serial port needs a TTL/RS-232 3V3 level converter!
	The Serial setting is 115200-8-N-1. The board has an unpopulated
	1x4 0.1" header. The pinout (VDD, RX, GND, TX) is printed on the
	PCB right next to the connector.

U-Boot Note: The ethernet driver isn't always reliable and can sometime
time out... Don't worry, just retry.

Access via the serial console is required. As well as a working
TFTP-server setup and the initramfs image. (If not provided, it
has to be built from the OpenWrt source. Make sure to enable
LZMA as the compression for the INITRAMFS!)

To install the image permanently, you have to do the following
steps in the listed order.

1. Open up the router.
   There are four phillips screws hiding behind the four plastic
   feets on the underside.

2. Connect the serial cable (See notes above)

3. Connect your router via one of the four LAN-ports (yellow)
   to a PC which can set the IP-Address and ssh and scp from.

   If possible set your PC's IPv4 Address to 192.168.1.70
   (As this is the IP-Address the Router's bootloader expects
   for the tftp server)

4. power up the router and enter the u-boot
   choose option 1 to upload the initramfs image. And follow
   through the ipv4 setup.

Wait for your router's status LED to stop blinking rapidly and
glow just blue. (The LAN LED should also be glowing blue).

3. Connect to the OpenWrt running in RAM

   The default IPv4-Address of your router will be 192.168.1.1.

   1. Copy over the openwrt-sysupgrade.bin image to your router's
      temporary directory

   # scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp

   2. ssh from your PC into your router as root.

   # ssh root@192.168.1.1

   The default OpenWrt-Image won't ask for a password. Simply hit the Enter-Key.

   Once connected...: run the following commands on your temporary installation

   3. delete the "jffs2" ubi partition to make room for your new root partition

   # ubirmvol /dev/ubi0 --name=jffs2

   4. install OpenWrt on the NAND Flash.

   # sysupgrade -v /tmp/openwrt-sysupgrade.bin

   - This will will automatically reboot the router -

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Mathias Kresin 249a9b35e0 ipq40xx: fix GL.iNet GL-B1300 support
Rename the dts file to match the used SoC type and drop the unnecessary
KERNEL_INSTALL from the image build code.

Remove the fixed rootfs and kernel partitions and create an image with
rootfs appended after kernel.

Setup a switch portmap matching the hardware and a default network/switch
configuration to make make the second lan port working. Use eth0 as lan
to have it consistent accross the target.

Use the power LED to indicate the boot status.

Sort the SoC entries within the dts by address and use dtc labels
whenever possible.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
6 years ago
Christian Lamparter d0e9621404 ipq40xx: OpenMesh A42 overhaul
Sort the soc entries in the dts by address and use dtc labels whenever
possible.

Adjust the DTS files, the OpenMesh A42 is actually an IPQ4018 and not an
IPQ4019.

Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
John Crispin 54b275c8ed ipq40xx: add target
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago