Commit Graph

408 Commits

Author SHA1 Message Date
Yushi Nishida 5e9a5c15ba ipq40xx: fix 5Ghz tx/rx power on the ASUS MAP-AC2200
The ASUS MAP-AC2200 suffers from a lower transmit/receive
signal power as compared to the stock firmware.

Upon investigation, it was discovered that stock firmware from
the GPL_MAP-AC2200_3.0.0.4.384.46249-g97d05bb.tar archive.
set the following GPIOs in "release/src/router/rc/init.c".

GPIO 44 and 46 have to be set to output high
GPIO 45 and 47 have to be set to output low

Here are some results, after activating the relevant
gpios through cmdline:

<https://forum.openwrt.org/t/asus-map-ac2200-low-transmit-receive-signal-5ghz/69005/12>

THX @ slh

Fixes: 9ad3967f14 ("ipq40xx: add support for ASUS Lyra")
Signed-off-by: Yushi Nishida <kyro2man@gmx.net>
[slightly rewritten commit, added missing <>)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-12-13 16:12:45 +01:00
Sven Eckelmann 8231994d3f ipq40xx: DTS style updates for OpenMesh devices
The OpenMesh related files were not updated since a while and the new
coding style requirements weren't integrated. This can cause problems
for new devices when an author uses these files as starting point.

* use SPDX-License-Identifiers instead of full license texts
* drop linux,default-trigger with value default-off for LEDs
* led nodes with label "abc:xyz" should have name "xyz_abc"
* led DT labels for "xyz_abc" should be "led_xyz_abc"
* "m25p80@0" flash node should be renamed to "flash@0"
* drop unnecessary empty lines

Signed-off-by: Sven Eckelmann <sven@narfation.org>
[minor commit title and message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-23 13:44:47 +01:00
John Audia 667f6c7f49 kernel: bump 5.4 to 5.4.77
Manually rebased patches:
 bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch
 generic-backport/744-v5.5-net-sfp-soft-status-and-control-support.patch
 layerscape/patches-5.4/819-uart-0005-tty-serial-fsl_lpuart-enable-dma-mode-for-imx8qxp.patch
 mvebu/patches-5.4/521-arm64-dts-marvell-espressobin-Add-ethernet-switch-al.patch

Removed:
 layerscape/patches-5.4/819-uart-0012-tty-serial-lpuart-add-LS1028A-support.patch

All modifications made by update_kernel.sh

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711,
              lantiq/Easybox 904 xDSL, x86_64
Run-tested: ipq806x/R7800, lantiq/Easybox 904 xDSL, x86_64

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
Co-developed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-18 21:13:46 +01:00
Adrian Schmutzler 95b0751d0f ipq40xx: do not remove pci@40000000 for ap.dk04.1
This pci@40000000 node from upstream was dropped when the device
was converted from local DTS(I) files to kernel patches in [1] to
ensure that change was purely cosmetic.

However, the DK04.1 has a PCI-E slot by default, so let's keep
(i.e. not remove) the kernel definition now.

[1] c4beac9ea2 ("ipq40xx: use upstream DTS files for IPQ4019/AP-DK04.1")

Suggested-by: Robert Marko <robert.marko@sartura.hr>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-13 18:34:41 +01:00
Robert Marko 4f277b4da5 ipq40xx: 5.4: update and reorder patches
A lot of patches are outdated versions of upstreamed patches and
drivers.

So lets pull in the upstreamed patches and reorder remaining ones.

This drops the unnecessary 721-dts-ipq4019-add-ethernet-essedma-node.patch
which adds nodes for not yet in OpenWrt IPQESS driver.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
[do not touch 902-dts-ipq4019-ap-dk04.1.patch here]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-13 16:08:58 +01:00
David Bauer e73d866c6f ipq40xx: enable RX hash / CTAG TX offloading for single-phy
This re-enables offloading features disabled by
commit 9da2b56760 ("ipq40xx: fix ethernet vlan double tagging").

Single-PHY devices use port-based VLANs on the switch, therefore no
S-TAG magic is involved here. Re-enabling these features restores
throughput back to 950 Mbit/s.

Reported-by: Jannis Pinter <jannis@pinterjann.is>
Signed-off-by: David Bauer <mail@david-bauer.net>
2020-11-01 15:30:22 +01:00
Adrian Schmutzler a7afeb3142 ipq40xx: remove support for kernel 4.19
The target uses 5.4 as default kernel since 03/2020.

Kernel 4.19 support is not really maintained anymore, it does not
seem to be needed, and removing it will make upcoming driver
updates easier. Thus, remove it.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-19 15:30:44 +02:00
John Audia 0efec6a008 kernel: bump 5.4 to 5.4.71
All modifications made by update_kernel.sh

Build system: x86_64
Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711,
              lantiq/Easybox 904 xDSL
Run-tested:   ipq806x/R7800, lantiq/Easybox 904 xDSL

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[add lantiq test reports]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-15 17:46:54 +02:00
Rui Salvaterra e788e9bd87 treewide: enable the vDSO
The vDSO is used to accelerate some syscalls. It should work fine wherever it's
available, so enable it globally for all targets.

Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
2020-10-13 20:08:41 +02:00
Robert Marko 9604e216bf ipq40xx: 5.4: move AR40xx driver into files
There is no point in keeping the AR40xx driver as a patch as its
not pending merge or backport.

To allow for easier maintenance until DSA is ready move it into
files like EDMA is.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
[combine with removal from patches-5.4]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-09 14:21:10 +02:00
Adrian Schmutzler c4beac9ea2 ipq40xx: use upstream DTS files for IPQ4019/AP-DK04.1
Upstream provides DTS(I) files for IPQ4019/AP-DK04.1, but we overwrite
them with local versions so far.

Remove the local files and use patches to be closer to upstream.
We already do the same for IPQ40xx/AP-DK01.1-C1.

Technically, this changes the compatible from "qcom,ipq4019" to
"qcom,ipq4019-dk04.1-c1", but it has never been implemented correctly
beforehand anyway.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-07 22:26:52 +02:00
Sungbo Eo 8f29e36963 ipq40xx: improve support for Edgecore ECW5211
This adds several stylistic and functional improvements of the recently
added Edgecore ECW5211, especially:

* Drop the local BDFs as those are already in the upstream under different names
* Add SPDX tag to DTS
* Add label MAC address
* Move LED trigger to DTS
* Remove unnecessary status="okay"
* Disable unused SS USB phy as the USB port only supports USB 2.0
* Make uboot-env partition writable
* Remove qcom,poll_required_dynamic property as the driver does not use it
* Tidy up the device recipe

Fixes: 4488b260a0 ("ipq40xx: add Edgecore ECW5211 support")
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
Acked-by: Robert Marko <robert.marko@sartura.hr>
2020-10-07 18:07:54 +02:00
Adrian Schmutzler ad90a42e48 ipq40xx: remove model name from LED labels
Like in the previous patches for ath79 and ramips, this will remove
the "devicename" from LED labels in ipq40xx.

The devicename is removed in DTS files and 01_leds, and a migration
script is added. While at it, also harmonize capitalization of
wlan2G/wlan5G vs. wlan2g/wlan5g.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-07 01:31:37 +02:00
Sungbo Eo 4682d4d770 ipq40xx: tidy up device recipe for Edgecore OAP100
* split up DEVICE_TITLE into DEVICE_{VENDOR,MODEL}
* use SOC instead of DEVICE_DTS

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-09-26 18:26:19 +02:00
Adrian Schmutzler bdd9dd8ab2 ipq40xx: tidy up dts-v1 statements
The "/dts-v1/;" identifier is supposed to be present once at the
top of a device tree file after the includes have been processed.

Therefore, adding it to a DTS _and_ a DTSI file is actually wrong,
as it will be present twice then (though the compiler does not
complain about it).

In ipq40xx, the dts-v1 statement is already included in
qcom-ipq4019.dtsi, so we don't have to add it anywhere at all.
However, based on the conditions stated above, this requires
qcom-ipq4019.dtsi to be included as the first file in any DTS(I).

Consequently, this patch removes all cases of dts-v1 for the
ipq40xx target, and moves the includes accordingly where necessary.

While at it, remove a few obviously unneeded includes on the way.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-25 21:10:41 +02:00
Christian Lamparter fa1713e791 ipq40xx: fix DTS warning in qcom-ipq4029-gl-s1300.dts
.dts:226.17-230.4: Warning (spi_bus_reg): /soc/spi@78b6000/spi@1:
	SPI bus unit address format error, expected "0"

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 19:32:34 +02:00
Christian Lamparter 890bb54d7f ipq40xx: fix DTS warning in qcom-ipq4019-cm520-79f.dts
.dts:121.4-14: Warning (reg_format): /led_spi/led_gpio@0:reg: \
	property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
.dts:119.24-126.5: Warning (avoid_default_addr_size): /led_spi/led_gpio@0: \
	Relying on default #size-cells value

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 19:32:34 +02:00
Hans Geiblinger a9071d02b5 ipq40xx: Add support for Linksys MR8300 (Dallas)
The Linksys MR8300 is based on QCA4019 and QCA9888
and provides three, independent radios.
NAND provides two, alternate kernel/firmware images
with fail-over provided by the OEM U-Boot.

Hardware Highlights:

SoC: IPQ4019 at 717 MHz (4 CPUs)
RAM: 512MB RAM

SoC:	Qualcomm IPQ4019 at 717 MHz (4 CPUs)
RAM:	512M DDR3
FLASH:	256 MB NAND (Winbond W29N02GV, 8-bit parallel)
ETH:	Qualcomm QCA8075 (4x GigE LAN, 1x GigE Internet Ethernet Jacks)
BTN:	Reset and WPS
USB:	USB3.0, single port on rear with LED
SERIAL:	Serial pads internal (unpopulated)
LED:	Four status lights on top + USB LED
WIFI1:	2x2:2 QCA4019 2.4 GHz radio on ch. 1-14
WIFI2:  2x2:2 QCA4019 5 GHz radio on ch. 36-64
WIFI3:  2x2:2 QCA9888 5 GHz radio on ch. 100-165

Support is based on the already supported EA8300.
Key differences:
	EA8300 has 256MB RAM where MR8300 has 512MB RAM.
	MR8300 has a revised top panel LED setup.

Installation:
"Factory" images may be installed directly through the OEM GUI using
URL: https://ip-of-router/fwupdate.html (Typically 192.168.1.1)

Signed-off-by: Hans Geiblinger <cybrnook2002@yahoo.com>
[copied Hardware-highlights from EA8300. Fixed alphabetical order.
fixed commit subject, removed bogus unit-address of keys,
fixed author (used Signed-off-By to From:) ]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 19:31:51 +02:00
Tomasz Maciej Nowak e24635710c ipq40xx: add support for Luma Home WRTQ-329ACN
Luma Home WRTQ-329ACN, also known as Luma WiFi System, is a dual-band
wireless access point.

Specification
SoC: Qualcomm Atheros IPQ4018
RAM: 256 MB DDR3
Flash: 2 MB SPI NOR
       128 MB SPI NAND
WIFI: 2.4 GHz 2T2R integrated
      5 GHz 2T2R integrated
Ethernet: 2x 10/100/1000 Mbps QCA8075
USB: 1x 2.0
Bluetooth: 1x 4.0 CSR8510 A10, connected to USB bus
LEDS: 16x multicolor LEDs ring, controlled by MSP430G2403 MCU
Buttons: 1x GPIO controlled
EEPROM: 16 Kbit, compatible with AT24C16
UART: row of 4 holes marked on PCB as J19, starting count from the side
      of J19 marking on PCB
      1. GND, 2. RX, 3. TX, 4. 3.3V
      baud: 115200, parity: none, flow control: none

The device supports OTA or USB flash drive updates, unfotunately they
are signed. Until the signing key is known, the UART access is mandatory
for installation. The difficult part is disassembling the casing, there
are a lot of latches holding it together.

Teardown
Prepare three thin, but sturdy, prying tools. Place the device with back
of it facing upwards. Start with the wall having a small notch. Insert
first tool, until You'll feel resistance and keep it there. Repeat the
procedure for neighbouring walls. With applying a pressure, one edge of
the back cover should pop up. Now carefully slide one of the tools to
free the rest of the latches.
There's no need to solder pins to the UART holes, You can use hook clips,
but wiring them outside the casing, will ease debuging and recovery if
problems occur.

Installation
1. Prepare TFTP server with OpenWrt initramfs image.
2. Connect to UART port (don't connect the voltage pin).
3. Connect to LAN port.
4. Power on the device, carefully observe the console output and when
   asked quickly enter the failsafe mode.
5. Invoke 'mount_root'.
6. After the overlayfs is mounted run:
     fw_setenv bootdelay 3
   This will allow to access U-Boot shell.
7. Reboot the device and when prompted to stop autoboot, hit any key.
8. Adjust "ipaddr" and "serverip" addresses in U-Boot environment, use
   'setenv' to do that, then run following commands:
     tftpboot 0x84000000 <openwrt_initramfs_image_name>
     bootm 0x84000000
   and wait till OpenWrt boots.
9. In OpenWrt command line run following commands:
     fw_setenv openwrt "setenv mtdids nand1=spi_nand; setenv mtdparts mtdparts=spi_nand:-(ubi); ubi part ubi; ubi read 0x84000000 kernel; bootm 0x84000000"
     fw_setenv bootcmd "run openwrt"
10. Transfer OpenWrt sysupgrade image to /tmp directory and flash it
    with:
     ubirmvol /dev/ubi0 -N ubi_rootfs
     sysupgrade -v -n /tmp/<openwrt_sysupgrade_image_name>
11. After flashing, the access point will reboot to OpenWrt, then it's
    ready for configuration.

Reverting to OEM firmware
1. Execute installation guide steps: 1, 2, 3, 7, 8.
2. In OpenWrt command line run following commands:
     ubirmvol /dev/ubi0 -N rootfs_data
     ubirmvol /dev/ubi0 -N rootfs
     ubirmvol /dev/ubi0 -N kernel
     ubirename /dev/ubi0 kernel1 kernel ubi_rootfs1 ubi_rootfs
     ubimkvol /dev/ubi0 -S 34 -N kernel1
     ubimkvol /dev/ubi0 -S 320 -N ubi_rootfs1
     ubimkvol /dev/ubi0 -S 264 -N rootfs_data
     fw_setenv bootcmd bootipq
3. Reboot.

Known issues
The LEDs ring doesn't have any dedicated driver or application to control
it, the only available option atm is to manipulate it with 'i2cset'
command. The default action after applying power to device is spinning
blue light. This light will stay active at all time. To disable it
install 'i2c-tools' with opkg and run:
 i2cset -y 2 0x48 3 1 0 0 i
The light will stay off until next cold boot.

Additional information
After completing 5. step from installation guide, one can disable asking
for root password on OEM firmware by running:
 sed -e 's/root/root::/' -i /etc/passwd
This is useful for investigating the OEM firmware. One can look
at the communication between the stock firmware and the vendor's
cloud servers or as a way of making a backup of both flash chips.
The root password seems to be constant across all sold devices.
This is output of 'led_ctl' from OEM firmware to illustrate
possibilities of LEDs ring:

Usage: led_ctl [status | upgrade | force_upgrade | version]
       led_ctl solid    COLOR <brightness>
       led_ctl single   COLOR INDEX <brightness 0 - 15>
       led_ctl spinning COLOR <period 1 - 16 (lower = faster)>
       led_ctl fill     COLOR <period 1 - 16 (lower = faster)>
                                             ( default is 5 )
       led_ctl flashing COLOR <on dur 1 - 128>  <off dur 1 - 128>
                              (default is  34)  ( default is 34 )
       led_ctl pulsing  COLOR
COLOR: red, green, blue, yellow, purple, cyan, white

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
[squash "ipq-wifi: add BDFs for Luma Home WRTQ-329ACN" into commit,
changed ubi volumes for easier integration, slightly reworded
commit message, changed ubi volume layout to use standard names all
around]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 19:30:19 +02:00
Brian Norris 03bc9b0002 ipq40xx: add open-drain support to pinctrl-msm
Submitted upstream. Shouldn't affect existing devices, but enables new
device support.

https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpeace@gmail.com/

Currently queued for-next:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=13355ca35cd16f5024655ac06e228b3c199e52a9

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
[refresh patch]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-09-25 18:43:09 +02:00
Adrian Schmutzler 0cfdc7d446 target: update SPDX license names
SPDX moved from GPL-2.0 to GPL-2.0-only and from GPL-2.0+ to
GPL-2.0-or-later. Reflect that in the SPDX license headers.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-22 20:58:26 +02:00
John Audia 770a9c6787 kernel: bump 5.4 to 5.4.66
All modifications made by update_kernel.sh/no manual intervention needed

Run-tested: ipq806x (R7800), ath79 (Archer C7v5), x86/64

No dmesg regressions, everything appears functional

Signed-off-by: John Audia <graysky@archlinux.us>
[add run test from PR]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-19 12:41:29 +02:00
David Bauer 056945faa4 ipq40xx: enable FRITZRepeater 3000 ports on switch
The ethernet ports on the AVM FRITZRepeater 3000 are not separated
between LAN and WAN in the stock firmware. OpenWrt currently abstracts
port 4 as eth0 and port 5 as eth1, bridging them in the kernel.

This patch adjusts the GMAC port bitmasks and default bitmask for ar40xx
to bridge them on the switch, avoiding traffic on both ports to pass
thru the CPU.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-09-17 18:08:46 +02:00
Adrian Schmutzler 0b1cdb7eea treewide: remove empty default cases
There is no apparent reason to have an empty default case.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-17 12:46:19 +02:00
John Crispin 0fbdb51f76 ipq40xx: add Edgecore OAP-100 support
flashing the unit
* first update to latest edcore FW as per the PDF instructions
* boot the initramfs
  - tftpboot 0x88000000 openwrt-ipq40xx-generic-edgecore_oap100-initramfs-fit-uImage.itb; bootm
* inside the initramfs call the following commiands
  - ubiattach -p /dev/mtd0
  - ubirmvol /dev/ubi0 -n0
  - ubirmvol /dev/ubi0 -n1
  - ubirmvol /dev/ubi0 -n2
* scp the sysupgrade image to the board and call
  - sysupgrade -n openwrt-ipq40xx-generic-edgecore_oap100-squashfs-nand-sysupgrade.bin

Signed-off-by: John Crispin <john@phrozen.org>
2020-09-17 08:43:07 +02:00
Robert Marko 4488b260a0 ipq40xx: add Edgecore ECW5211 support
This patch adds support for the Edgecore ECW5211 indoor AP.

Specification:
- SoC: Qualcomm Atheros IPQ4018 ARMv7-A 4x Cortex A-7
- RAM: 256MB DDR3
- NOR Flash: 16MB SPI NOR
- NAND Flash: 128MB MX35LFxGE4AB SPI-NAND
- Ethernet: 2 x 1G via Q8075 PHY connected to ethernet adapter via PSGMII (802.3af POE IN on eth0)
- USB: 1 x USB 3.0 SuperSpeed
- WLAN: Built-in IPQ4018 (2x2 802.11bng, 2x2 802.11 acn)
- CC2540 BLE connected to USB 2.0 port
- Atmel AT97SC3205T I2C TPM

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-09-17 08:43:03 +02:00
David Bauer 2e6c236abd ipq40xx: essedma: enable VLAN tag offload for single-port
Enable the VLAN tag offloading mechanism for RGMII single-port devices.
This allows those devices to use 802.1Q VLANs on the ethernet port.

Previously, RX frames were double tagged, as the RX TAG removal flag was
not enabled and an additional 802.1Q header was inserted elsewhere in
the code.

On the TX side, tagging was completely not present for single-port
devices. Enable tagging if an 802.1Q frame should be transmitted and
disable the default tagging mechanism for single-port devices.

Tested on Aruba AP-303

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-09-11 17:37:11 +02:00
John Audia 05b8e84362 kernel: bump 5.4 to 5.4.61
Manually merged:
  backport-5.4
     011-kbuild-export-SUBARCH.patch
  layerscape
    701-net-0262-net-dsa-ocelot-add-tagger-for-Ocelot-Felix-switches.patch

All other modifications made by update_kernel.sh

Build-tested: x86/64, lantiq/xrx200, ramips/mt7621
Run-tested: ipq806x (R7800), lantiq/xrx200, x86/64, ramips (RT-AC57U)

No dmesg regressions, everything functional

Signed-off-by: John Audia <graysky@archlinux.us>
[minor commit message adjustments]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-30 19:44:47 +02:00
Petr Štetiar a14f5bb4bd treewide: use wpad-basic-wolfssl as default
In order to support SAE/WPA3-Personal in default images. Replace almost
all occurencies of wpad-basic and wpad-mini with wpad-basic-wolfssl for
consistency. Keep out ar71xx from the list as it won't be in the next
release and would only make backports harder.

Build-tested (build-bot settings):
ath79: generic, ramips: mt7620/mt76x8/rt305x, lantiq: xrx200/xway,
sunxi: a53

Signed-off-by: Petr Štetiar <ynezz@true.cz>
[rebase, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-20 14:19:39 +02:00
Adrian Schmutzler d1db1f4240 ipq40xx: refresh kernel 5.4 config
Refresh config with make kernel_oldconfig.

After d1a8217d87 ("kernel: clean-up build-configurable kernel
config symbols"), the routine wants to add an additional
CONFIG_CGROUPS (=n), which has been removed manually again, as
this seems unintended.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-06 12:51:51 +02:00
Felix Fietkau b0f7ea2853 kernel: unify CONFIG_GPIO_SYSFS in kernel configs
Enable it for all platforms

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-08-06 12:37:04 +02:00
Phi Nguyen eda9751d86 ipq40xx: support reset button for WPJ419
Compex WPJ419 has a reset button on a GPIO pin.

Signed-off-by: Phi Nguyen <phind.uet@gmail.com>
2020-07-23 12:56:58 +02:00
John Audia b6443367d8 kernel: bump 5.4 to 5.4.52
update_kernel.sh refreshed all patches, no human interaction was needed

Build system: x86_64
Run-tested: Netgear R7800 (ipq806x)

Signed-off-by: John Audia <graysky@archlinux.us>
2020-07-17 11:00:33 +02:00
John Crispin 9da2b56760 ipq40xx: fix ethernet vlan double tagging
As the the SoC uses implicit vlan tagging for dual MAC support, the
offload feature breaks when using double tagging.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: John Crispin <john@phrozen.org>
2020-07-14 18:31:48 +02:00
John Crispin 2557d2eb4c ipq40xx: merge all ar40xx patches into one single patch
Signed-off-by: John Crispin <john@phrozen.org>
2020-07-14 18:31:12 +02:00
Petr Štetiar c7b750e7ac treewide: kernel: drop redundant USB_EHCI_HCD=n config symbol
Commit e53ec043ba ("kirkwood: move usb support to modules") has moved
this config symbol into generic configs, so it could be removed from
other configs.

Suggested-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-07-09 10:28:40 +02:00
Adrian Schmutzler f3921acdf0 ipq40xx: fix patches on dts Makefile
The patches for arch/arm/boot/dts/Makefile have not been updated
in a syntactically correct way (just body was changed). Fix it.

Fixes: 4a77a060ab ("ipq40xx: add support for Buffalo WTR-M2133HP")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-07-08 17:50:12 +02:00
Yanase Yuki 4a77a060ab ipq40xx: add support for Buffalo WTR-M2133HP
Buffalo WTR-M2133HP is a Tri-Band router based on IPQ4019.

Specification
-------------
- SoC: Qualcomm IPQ4019
- RAM: 512MiB
- Flash Memory: NAND 128MiB (MXIC MX30LF1G18AC)
- Wi-Fi: Qualcomm IPQ4019 (2.4GHz, 1ch - 13ch)
- Wi-Fi: Qualcomm IPQ4019 (5GHz, 36ch - 64ch)
- Wi-Fi: Qualcomm QCA9984 (2T2R, 5GHz, 100ch - 140ch)
- Ethernet: 4x 10/100/1000 Mbps (1x WAN, 3x LAN)
- LED: 4x white LED, 4x orange LED, 1x blue LED
- USB: 1x USB 3.0 port
- Input: 2x tactile switch, 2x slide switch (2x SP3T)
- Serial console: 115200bps, pinheader JP5 on PCB
- Power: DC 12V 2A

Flash instruction
-----------------
1. Set up a TFTP server (IP address: 192.168.11.10)
2. Rename "initramfs-fit-uImage.itb" to "WTR-M2133HP-initramfs.uImage"
   and put it into the TFTP server directory.
3. Connect the TFTP server and WTR-M2133HP.
4. Hold down the AOSS button, then power on the router.
5. After booting OpenWrt initramfs image, connect to the router by SSH.
6. Transfer "squashfs-nand-factory.ubi" to the router.
7. Execute the following commands.
    # ubidetach -p /dev/mtd15
    # ubiformat /dev/mtd15 -f /tmp/openwrt-ipq40xx-generic-buffalo_wtr-m2133hp-squashfs-nand-factory.ubi
    # fw_setenv bootcmd bootipq
8. Perform reboot.

Recover to stock firmware
-------------------------
1. Execute the following command.
    # fw_setenv bootcmd bootbf
2. Reboot and wait several minutes.

Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
2020-07-08 16:07:05 +02:00
Dongming Han f103321349 ipq40xx: add support for GL.iNet GL-S1300
Specifications:
SOC:        Qualcomm IPQ4029 (DAKOTA) ARM Quad-Core
RAM:        512 MiB
FLASH1:     16 MiB NOR - SPI0
FLASH2:     8 GiB eMMC
ETH:        Qualcomm QCA8075
WLAN1:      Qualcomm Atheros QCA4029 2.4GHz 802.11b/g/n 2x2
WLAN2:      Qualcomm Atheros QCA4029 5GHz 802.11n/ac W2 2x2
INPUT:      Reset, WPS
LED:        Power, Mesh, WLAN
UART1:      On board pin header near to LED (3.3V, TX, RX, GND), 3.3V without pin - 115200 8N1
UART2:      On board with BLE module
SPI1:       On board socket for Zigbee module

Install via tftp
- NB: need to flash transition image firstly

Firstly install transition image:
(IPQ40xx) # tftpboot 0x84000000 s1300-factory-to-openwrt.img
(IPQ40xx) # sf probe && imgaddr=0x84000000 && source :script

Secondly install openwrt sysupgrade bin:
(IPQ40xx) # run lf

Revert to factory image:
(IPQ40xx) # tftpboot 0x84000000 s1300-openwrt-to-factory.img
(IPQ40xx) # sf probe && imgaddr=0x84000000 && source :script

The kernel and rootfs of factory firmware are on eMMC, and openwrt
firmware is on NOR flash. The transition image includes U-boot
and partition table, which decides where to load kernel and rootfs.
After you firstly install openwrt image, you can switch between
factory and openwrt firmware by flashing transition image.

Signed-off-by: Dongming Han <handongming@gl-inet.com>
2020-07-08 16:07:05 +02:00
Hauke Mehrtens 6062d85892 kernel: Update kernel 4.19 to version 4.19.131
Fixes:
- CVE-2020-10757

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

Run tested: ath79
Build tested: ath79

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2020-07-04 21:12:42 +02:00
Adrian Schmutzler e8afeaabc0 ipq40xx: set IMAGES in Device/Default definition
The Device/Default definition sets a default IMAGE/sysupgrade.bin,
but does not enable it by setting IMAGES. This is not consistent,
and has led to IMAGES being defined at various other places in the
file.

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-06-28 14:07:43 +02:00
Adrian Schmutzler fa6d53261a ipq40xx: consolidate DTS files
The DTS files in files-4.19 and files-5.4 are exactly identical
except for one file (qcom-ipq4018-emr3500.dts), which is only
present for 5.4.

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

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-06-23 21:02:26 +02:00
Petr Štetiar e44e60b290 kernel: bump 5.4 to 5.4.48
Resolved merge conflict in the following patches:

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

Refreshed patches, removed upstreamed patch:

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

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-06-22 12:51:22 +02:00
Adrian Schmutzler 48c1fdd046 treewide: drop shebang from non-executable target files
This drops the shebang from all target files for /lib and
/etc/uci-defaults folders, as these are sourced and the shebang
is useless.

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

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

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-06-16 14:26:33 +02:00
David Bauer 373f446049 ipq40xx: check kernel-size for NBG6617
The ZyXEL NBG6617 has a separate kernel partition which is 4MiB large.

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

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-06-14 13:10:00 +02:00
David Bauer 5b50895a63 ipq40xx: add image size checks for several devices
This adds image size checks for various devies using an automatic
mtdsplit.

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

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

Size reduced: ~1.1 MiB

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-06-13 16:57:53 +02:00
DENG Qingfang 752cee796d ipq40xx: disable DSA and Switchdev
ipq40xx is still using swconfig based switch management. This might
change in he future, however disable the DSA and Switchdev support for
now.

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

Flash instruction:

From EnGenius firmware to OpenWrt firmware:

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

From OpenWrt firmware to EnGenius firmware:

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

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

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

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

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

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: John Crispin <john@phrozen.org>
2020-06-13 14:38:03 +02:00
Adrian Schmutzler 2308644b0c ipq40xx: replace "ok" with "okay" for status in DTS files
While "ok" is recognized in DT parsing, only "okay" is actually
mentioned as valid value. Replace it accordingly.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-05-12 19:16:41 +02:00
David Bauer 300b7fe85a ipq40xx: add support for Aruba AP-365
Hardware
--------
SoC:   Qualcomm IPQ4029
RAM:   512M DDR3
FLASH: - 128MB NAND (Macronix MX30LF1G18AC)
       - 4MB SPI-NOR (Macronix MX25R3235F)
TPM:   Atmel AT97SC3203
BLE:   Texas Instruments CC2540T
       attached to ttyMSM0
ETH:   Atheros AR8035
LED:   System (red / green / amber)
BTN:   Reset

The USB port on the device is (in contrast to other Aruba boards) real
USB. The AP uses a CP2101 USB TTY converter on the board.

Console baudrate is 9600 8n1.

To enable a full list of commands in the U-Boot "help" command, execute
the literal "diag" command.

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

1. Get the OpenWrt initramfs image. Rename it to ipq40xx.ari and put it
   into the TFTP server root directory. Configure the TFTP server to
   be reachable at 192.168.1.75/24. Connect the machine running the TFTP
   server to the ethernet port of the access point.

2. Connect to the serial console. Interrupt autobooting by pressing
   Enter when prompted.

3. Configure the bootargs and bootcmd for OpenWrt.
   $ setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8"
   $ setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1;
     ubi read 0x85000000 kernel; bootm 0x85000000"
   $ setenv ramboot_openwrt "run bootargs_openwrt;
     setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75;
     netget; set fdt_high 0x87000000; bootm"
   $ setenv bootcmd "run nandboot_openwrt"
   $ saveenv

4. Load OpenWrt into RAM:
   $ run ramboot_openwrt

5. After OpenWrt booted, transfer the OpenWrt sysupgrade image to the
   /tmp folder on the device.

6. Flash OpenWrt:
   Make sure you use the mtd partition with the label "ubi" here!

   $ ubidetach -p /dev/mtd1
   $ ubiformat /dev/mtd1
   $ sysupgrade -n /tmp/openwrt-sysupgrade.bin

To go back to the stock firmware, simply reset the bootcmd in the
bootloader to the original value:

  $ setenv bootcmd "boot"
  $ saveenv

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-05-11 01:05:16 +02:00
David Bauer 9fac9168c6 ipq40xx: fix alphabetical order in 02_network
Signed-off-by: David Bauer <mail@david-bauer.net>
2020-04-24 20:03:41 +02:00
Petr Štetiar faf668be35 kernel: bump 5.4 to 5.4.34
Refreshed patches.

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-04-21 22:16:33 +02:00
Petr Štetiar 23916bca61 kernel: bump 5.4 to 5.4.33
Refreshed patches, removed upstreamed patches:

 oxnas: 001-irqchip-versatile-fpga-Handle-chained-IRQs-properly.patch
 oxnas: 002-irqchip-versatile-fpga-Apply-clear-mask-earlier.patch

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-04-17 15:18:12 +02:00
Petr Štetiar 0bea89a1d0 kernel: bump 5.4 to 5.4.32
Refreshed patches, removed upstreamed patches:

 generic: 746-stable-net-dsa-mt7530-fix-null-pointer-dereferencing-in-por.patch

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-04-14 21:58:16 +02:00
Pawel Dembicki c30220d458 ipq40xx: add support for Cell C RTL30VW
Cell C RTL30VW is a LTE router with tho gigabit ethernets and integrated
QMI mPCIE modem.

This is stripped version of ASKEY RTL0030VW.

Hardware:

Specification:
-CPU: IPQ4019
-RAM: 256MB
-Flash: NAND 128MB + NOR 16MB
-WiFi: Integrated bgn/ac
-LTE: mPCIe card (Modem chipset MDM9230)
-LAN: 2 Gigabit Ports
-USB: 2x USB2.0
-Serial console: RJ-45 115200 8n1
-Unsupported VoIP

Known issues:

None so far.

Instruction install:

There are two methods: Factory web-gui and serial + tftp.

Web-gui:
1. Apply factory image via stock web-gui.

Serial + initramfs:
1. Rename OpenWrt initramfs image to "image"
2. Connect serial console (115200,8n1)
3. Set IP to different than 192.168.1.11, but 24 bit mask, eg. 192.168.1.4.

4. U-Boot commands:
sf probe && sf read 0x80000000 0x180000 0x10000
setenv serverip 192.168.1.4
set fdt_high 0x85000000
tftpboot 0x84000000 image
bootm 0x84000000

5. Install sysupgrade image via "sysupgrade -n"

Back to stock:

All is needed is swap 0x4c byte in mtd8 from 0 to 1 or 1 to 0,
do firstboot and factory reset with OFW:

1. read mtd8:
dd if=/dev/mtd8 of=/tmp/mtd8
2. go to tmp:
cd /tmp/
3. write first part of partition:
dd if=mtd8 of=mtd8.new bs=1 count=76
4. check which layout uses bootloader:
cat /proc/mtd
5a. If first are kernel_1 and rootfs_1 write 0:
echo -n -e '\x00' >> mtd8.new
5b. If first are kernel and rootfs write 1:
echo -n -e '\x01' >> mtd8.new
6. fill with rest of data:
dd if=mtd8 bs=1 skip=77 >> mtd8.new
7. CHECK IF mtd8.new HAVE CHANGED ONLY ONE BYTE! e.g with:
hexdump mtd8.new
8. write new mtd8 to flash:
mtd write mtd8.new /dev/mtd8
9. do firstboot
10.reboot
11. Do back to factory defaults in OFW GUI.

Based on work: Cezary Jackiewicz <cezary@eko.one.pl>

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
2020-04-10 15:22:26 +02:00
DENG Qingfang a30abb1b6b ipq40xx: add support for MobiPromo CM520-79F
MobiPromo CM520-79F is an AC1300 dual band router based on IPQ4019

Specification:

SoC/Wireless: QCA IPQ4019
RAM: 512MiB
Flash: 128MiB SLC NAND
Ethernet PHY: QCA8075
Ethernet ports: 1x WAN, 2x LAN
LEDs: 7 LEDs
      2 (USB, CAN) are GPIO
      other 5 (2.4G, 5G, LAN1, LAN2, WAN) are connected to a shift register
Button: Reset

Flash instruction:
Disassemble the router, connect UART pins like this:
 GND TX    RX
  [x x . . x .]
  [. . . . . .]

(QCA8075 and IPQ4019 below)
Baud-rate: 115200

Set up TFTP server: IP 192.168.1.188/24
Power on the router and interrupt the booting with UART console
env backup (in case you want to go back to stock and need it there):
	printenv
	(Copy the output to somewhere save)
Set bootenv:
	setenv set_ubi 'set mtdids nand0=nand0; set mtdparts mtdparts=nand0:0x7480000@0xb80000(fs); ubi part fs'
	setenv bootkernel 'ubi read 0x84000000 kernel; bootm 0x84000000#config@1'
	setenv cm520_boot 'run set_ubi; run bootkernel'
	setenv bootcmd 'run cm520_boot'
	setenv bootargs
	saveenv
Boot initramfs from TFTP:
	tftpboot openwrt-ipq40xx-generic-mobipromo_cm520-79f-initramfs-fit-zImage.itb
	bootm
After initramfs image is booted, backup rootfs partition in case of reverting to stock image
	cat /dev/mtd12 > /tmp/mtd12.bin
Then fetch it via SCP

Upload nand-factory.ubi to /tmp via SCP, then run
	mtd erase rootfs
	mtd write /tmp/*nand-factory.ubi rootfs
	reboot

To revert to stock image, restore default bootenv in uboot UART console
	setenv bootcmd 'bootipq'
	printenv
use the saved dump you did back when you installed OpenWrt to verify that
there are no other differences from back in the day.
	saveenv
upload the backed up mtd12.bin and run
	tftpboot mtd12.bin
	nand erase 0xb80000 0x7480000
	nand write 0x84000000 0xb80000 0x7480000
The BOOTCONFIG may have been configured to boot from alternate partition (rootfs_1) instead
In case of this, set it back to rootfs:
	cd /tmp
	cat /dev/mtd7 > mtd7.bin
	echo -ne '\x0b' | dd of=mtd7.bin conv=notrunc bs=1 count=1 seek=4
	for i in 28 48 68 108; do
		dd if=/dev/zero of=mtd7.bin conv=notrunc bs=1 count=1 seek=$i
	done
	mtd write mtd7.bin BOOTCONFIG
	mtd write mtd7.bin BOOTCONFIG1

Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[renamed volume to ubi to support autoboot,
as per David Lam's test in PR#2432]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-04-10 15:22:26 +02:00
Stefan Lippers-Hollmann fabcfa9222 ipq40xx: re-add LEDS_LP5523 for the ASUS Lyra MAP-AC2200
This symbol had been enabled in the initial device support submission
for kernel 4.14, but apparently got lost during the v4.19 port.

The ASUS Lyra MAP-AC2200 has a single (very bright) rgb LED, which is
controlled by the TI/National LP5523/55231 LED driver chip. It is left
enabled in a pulsating infinite rainbow loop by the bootloader,
expecting it to be reconfigured (disabled by default) after the boot
process has finished and is also required to indicate failsafe/
firstboot conditions.

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
2020-04-09 12:51:10 +02:00
Petr Štetiar 5562c5add2 ipq40xx: fix DAP-2610 boot failure
Albert has reported, that his DAP-2610 wont boot with the latest
snapshot and Fredrik has found out, that the device gets stuck at
"Waiting for root device ..." due to missing 5.4 kernel config symbol
CONFIG_MTD_SPLIT_WRGG_FW which was probably lost during the kernel
version bump.

Ref: https://forum.openwrt.org/t/dap-2610-bricked-help-needed
Fixes: 272e0a702a ("ipq40xx: add v5.4 support")
Suggested-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-03-31 16:20:47 +02:00
Petr Štetiar bf15557f8a ipq40xx: switch to 5.4 kernel
5.4.24 seems to be working fine on my zyxel,nbg6617, so let's start
wider userbase testing.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-03-28 13:03:02 +01:00
Leon M. George d59137d1d9 ipq40xx: wpj428: fix missing MDIO GPIO reset and pinmux
The bootloader does not always initialize the MDIO pins before booting
Linux. E.g. on version "U-Boot 2012.07 [Chaos Calmer 15.05.1,r35193] (Jul
25 2017 - 11:36:26)" this is the case when booting automatically without
activating the U-Boot console.

Without this change, the kernel boot will complain about missing PHYs:

 libphy: ipq40xx_mdio: probed
 ar40xx c000000.ess-switch: Probe failed - Missing PHYs!
 libphy: Fixed MDIO Bus: probed

With this change it will work as expected:

 libphy: ipq40xx_mdio: probed
 ESS reset ok!
 ESS reset ok!
 libphy: Fixed MDIO Bus: probed

Ref: GH-2835
Tested-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
Signed-off-by: Leon M. George <leon@georgemail.eu>
[commit description from Fredrik, subject facelift]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-03-28 13:03:02 +01:00
Sungbo Eo 3f14f034fb treewide: omit IMAGE_SIZE argument from check-size
Now that check-size uses IMAGE_SIZE by default, we can skip the argument from
image recipes to reduce redundancy.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[do not touch ar71xx]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-03-21 20:02:55 +01:00
Sungbo Eo 5b392c7119 treewide: gather DEVICE_VARS into one place
Place DEVICE_VARS assignments at the top of the file or above Device/Default
to make them easier to find.

For ramips, remove redundant values already present in parent file.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[do not touch ar71xx, extend commit message]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-03-21 19:55:12 +01:00
Tomasz Maciej Nowak ddc0e87fae kernel: move TEO governor to generic config
This new symbol popped up in few places. Disable it in generic config.

Signed-off-by: Tomasz Maciej Nowak <tomek_n@o2.pl>
[fixed merge conflict in generic/config-5.4]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-03-17 00:51:48 +01:00
Petr Štetiar 9ba09653ad treewide: remove maintainer variable from targets
There is no such role as target maintainer anymore, one should always
send corresponding changes for the review and anyone from the commiters
is allowed to merge them or eventually use the hand break and NACK them.

Lets make it clear, that it is solely a community doing the maintenance
tasks.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Piotr Dymacz <pepe2k@gmail.com>
2020-03-16 22:21:45 +01:00
Robert Marko 72c3997003 ipq40xx: 5.4: fix ethernet driver
In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
So lets migrate the EDMA driver to support linkmode.
Also, old get/set settings API for ethtool is also dropped so lets convert to new ksettings API while at it as it demands linkmode.

Now, gigabit works properly as well as ethtool.
Previously you would get this in ethtool:
root@OpenWrt:/# ethtool eth1
Settings for eth1:
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000000 (0)

        Link detected: yes

Now, features are properly advertised:
root@OpenWrt:/# ethtool eth1
Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Full
        Link partner advertised pause frame use: No
        Link partner advertised auto-negotiation: No
        Link partner advertised FEC modes: Not reported
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 4
        Transceiver: internal
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Current message level: 0x00000000 (0)

        Link detected: yes

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-03-16 22:21:45 +01:00
Robert Marko 2b7344055b ipq40xx: 5.4: fix networking PHY driver
In 5.4 kernel old u32 array way of setting network features was dropped and linkmode is now the only way.
So lets migrate the PHY driver to support linkmode.
Also, now in order for gigabit to work, PHY driver needs to advertise PHY_GBIT_FEATURES instead of PHY_BASIC_FEATURES

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2020-03-16 22:21:45 +01:00
Petr Štetiar f521ef5ff3 ipq40xx: 5.4: fix of_get_mac_address obsolete usage OOPs
of_get_mac_address returns valid pointer or ERR_PTR since 5.2 via commit
d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") so the
patch fixes following OOPs on nbg6617:

 Unable to handle kernel paging request at virtual address ffffffed
 CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.24 #0
 PC is at edma_axi_probe+0x444/0x1114
 LR is at bus_find_device+0x88/0x9c

Where the PC can be resolved to:

 >>> l *edma_axi_probe+0x444
 0xc067be5c is in edma_axi_probe (./include/linux/string.h:378).

 >>> l *edma_axi_probe+0x43f
 0xc067be57 is in edma_axi_probe (drivers/net/ethernet/qualcomm/essedma/edma_axi.c:936)

Which leads to the following code fragment:

 935  mac_addr = of_get_mac_address(pnp);
 936  if (mac_addr)
 937      memcpy(edma_netdev[idx_mac]->dev_addr, mac_addr, ETH_ALEN);

Where using mac_addr=0xffffffed (-ENODEV) as source address in memcpy()
is causing the OOPs.

Acked-by: John Crispin <john@phrozen.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2020-03-16 22:21:45 +01:00
Robert Marko e09a5efcdb ipq40xx: 5.4: enable NAND
Lets enable RAW NAND and Qcom NANDC drivers again in kernel 5.4.
They were dropped when 5.4 support was introduced due to upstream
changing the symbol names so refreshing was not enough.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
[cut long line in commit message, enabled BCH as well]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-03-15 15:26:34 +01:00
Robert Marko 3ef988caf3 generic: 4.19: Add 4B_OPCODES flag to w25q256
This patch backports the upstream patch that adds the 4B_OPCODES flag to w25q256 under 4.19 kernel.
This is needed for ipq40xx and ramips.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2020-03-12 12:59:44 +01:00
Hauke Mehrtens 988546cd13 ipq40xx: Remove kernel 4.14 support
This target was switched to kernel 4.19 more than 6 months ago in commit
f342ffd300 ("treewide: kernel: bump some targets to 4.19") and now
with kernel 5.4 support being added it gets harder to support kernel
4.14 in addition to kernel 4.19 and 5.4.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2020-03-12 09:28:23 +01:00
Sungbo Eo 926f4da2b2 ipq40xx: replace ${} with $()
${} and $() are exactly the same. Follow the convention of using $().

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-03-11 19:24:37 +01:00
Leon M. George 377e8942b2 ipq40xx: add cpximg to flash Compex WPJ428 via bootloader
Generate a cpximg that is compatible with the cpximg loader in Compex' u-boot.
The cpximg loader can be started either by holding the reset button during power
up or by entering the u-boot prompt and entering 'cpximg'.
Once it's running, a TFTP-server under 192.168.1.1 will accept an image
appropriate for the board revision that is etched on the board (e.g. 6A04).

The image can be pushed using tftp:
  tftp -v -m binary 192.168.1.1 -c put openwrt-ipq40xx-generic-compex_wpj428-squashfs-cpximg-6a04.bin

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

In mkmylofw_32m, the calculation of the "partition size" has been preferred
to just padding the partition as this will result in less block transfers
during flashing (while the additional complexity is bearable).

Signed-off-by: Leon M. George <leon@georgemail.eu>
Co-developed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-03-10 13:44:51 +01:00
Yousong Zhou 860652f4b9 kernel: 5.4: move some kconfig options to generic
CONFIG_64BIT_TIME=y
	CONFIG_KASAN_STACK=1
	CONFIG_UBSAN_ALIGNMENT=y
	CONFIG_UNIX_SCM=y
	CONFIG_DMA_DECLARE_COHERENT=y
	CONFIG_OF_RESERVED_MEM=y

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2020-03-10 10:05:50 +08:00
Koen Vandeputte f9f62d43e4 kernel: bump 5.4 to 5.4.24
Refreshed all patches.

Compile-tested on: imx6
Runtime-tested on: imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-03-09 20:43:53 +01:00
Koen Vandeputte e64564920a kernel: bump 4.19 to 4.19.108
Refreshed all patches.

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-03-09 20:43:53 +01:00
Koen Vandeputte d5a3536631 kernel: bump 4.14 to 4.14.172
Refreshed all patches.

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-03-09 20:43:53 +01:00
Robert Marko 6256ca3232 ipq40xx: add support for 8devices Habanero DVK
This patch adds support for the 8devices Habanero development board.

Specs are:
CPU: QCA IPQ4019
RAM: DDR3L 512MB
Storage: 32MB SPI-NOR and optional Parallel SLC NAND(Some boards ship with it and some without)
WLAN1: 2.4 GHz built into IPQ4019 (802.11n) 2x2
WLAN2: 5 GHz built into IPO4019 (802.11ac Wawe-2) 2x2
Ethernet: 5x Gbit LAN (QCA 8075)
USB: 1x USB 2.0 and 1x USB 3.0 (Both built into IPQ4019)
MicroSD slot (Uses SD controller built into IPQ4019)
SDIO3.0/EMMC slot (Uses the same SD controller)
Mini PCI-E Gen 2.0 slot (Built into IPQ4019)
5x LEDs (4 GPIO controllable)
2x Pushbutton (1 is connected to GPIO, other to SoC reset)
LCD ZIF socket (Uses the LCD controller built into IPQ4019 which has no driver support)
1x UART 115200 rate on J18

2x breakout development headers
12V DC Jack for power
DIP switch for bootstrap configuration

Installation instructions:
Since boards ship with vendors fork of OpenWrt sysupgrade can be used.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2020-03-09 00:53:50 +01:00
Robert Marko 4ff6c43499 ipq40xx: add IPQ4019 SD/MMC controller support
This commit finally adds support for the built in SD/MMC controller in IPQ4019 SoC.

Controller is supported by the upstream SDHCI-MSM driver with a minor clock setting patch.
Patch is special to the IPQ4019 and cannot be upstreamed.

LDO and SDHCI node are upstreamed, and LDO node is awaiting to be accepted.

Signed-off-by: Robert Marko <robimarko@gmail.com>
2020-03-09 00:53:50 +01:00
Adrian Schmutzler 74cbc44086 ipq40xx: fix support of EnGenius EAP2200
This fixes a typo in the device string for MAC address setup in
02_network and corrects the indent in the device's DTS files.

While at it, move the aliases section before the keys section to
have it closer to the top of the file.

Fixes: a736d912e2 ("ipq40xx: add support for EnGenius EAP2200")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-03-05 12:53:06 +01:00
David Bauer 0d727f231f treewide: move commonly disabled symbols to generic config
Move new commonly disabled kernel 5.4 symbols to the generic kernel
configuration.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-03-01 00:51:23 +01:00
Christian Lamparter 91a7c9c27d ipq40xx: 5.4: refresh patches and config
This patch just refreshes the 5.4 patches. It seems as if
070-v4.20-soc-qcom-spm-add-SCM-probe-dependency.patch is
already applied, so drop it. It also does a quick
make kernel_oldconfig to get rid of unneeded symbols.

[Looks like USB and Ethernet need some more work].

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-02-28 22:46:27 +01:00
Eneas U de Queiroz 13b8404b1e ipq40xx: qce - add fixes for AES ciphers
This backports commits from master that fix AES ciphers when using the
qce driver:

 - A couple of simple fixes for CTR and XTS modes used with AES:
   * 041-crypto-qce-fix-ctr-aes-qce-block-chunk-sizes.patch
   * 042-crypto-qce-fix-xts-aes-qce-key-sizes.patch

 - A fix for a bug that affected cases when there were more entries in
   the input sg list than necessary to actually encrypt, resulting in
   failure in gcm, where the authentication tag is present after the
   encryption data:
   * 043-crypto-qce-save-a-sg-table-slot-for-result-buf.patch

 - A fix to update the IV buffer passed to the driver from the kernel:
   * 044-crypto-qce-update-the-skcipher-IV.patch

 - A patch that reduces memory footprint and driver initialization by
   only initializing the fallback mechanism where it is actually used:
   * 046-crypto-qce-initialize-fallback-only-for-AES.patch

 - Three patches that make gcm and xts modes work with the qce driver,
   and improve performance with small blocks:
   * 047-crypto-qce-use-cryptlen-when-adding-extra-sgl.patch
   * 048-crypto-qce-use-AES-fallback-for-small-requests.patch
   * 049-crypto-qce-handle-AES-XTS-cases-that-qce-fails.patch

 - A patch that allows the hashes/ciphers to be built individually.
   * 051-crypto-qce-allow-building-only-hashes-ciphers.patch

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[renumbered patches, added patches from dropped commit, refreshed, 5.4]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-02-28 22:46:09 +01:00
Eneas U de Queiroz ee4a0afdcd ipq40xx: use neon crypto drivers
This adds the neon based implementations of AES & SHA256.

For AES, according to the kernel config help:

Use a faster and more secure NEON based implementation of AES in CBC,
CTR and XTS modes.
Bit sliced AES gives around 45% speedup on Cortex-A15 for CTR mode
and for XTS mode encryption, CBC and XTS mode decryption speedup is
around 25%. (CBC encryption speed is not affected by this driver.)
This implementation does not rely on any lookup tables so it is
believed to be invulnerable to cache timing attacks.
...
The observed speedups on ipq40xx are more modest: speedup is around 20%
for CTR mode and for XTS mode encryption, CBC and XTS mode decryption
speedup is around 10%. Measurements were made using tcrypt, with
1024-bytes blocks for CTR & CBC, and 4096-bytes for XTS.
The aes-neon-bs driver uses a fallback for CBC encryption; that fallback
could be either the generic driver written in C, or the scalar arm-asm
one.  Even though aes-arm is 1.9% slower, it is more resilient to timing
attacks (the reason for being slower), so it is being included here.

The neon sha256 module increases performance over the generic module by
33%.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[Enable only ciphers for now, reorder patch in series to help bisect
as new symbols could lead to build failures, 5.4]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-02-28 22:46:09 +01:00
Eneas U de Queiroz 26681de412 ipq40xx: qce - switch to skcipher API
This backports a commit updating the API of the QCE crypto engine to
what is used in current kerenl, easing future upstream backports.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[renumber patches, refreshed, added 5.4 patches]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-02-28 22:46:01 +01:00
Steven Lin a736d912e2 ipq40xx: add support for EnGenius EAP2200
SOC:    IPQ4019 / QCA Dakota
CPU:    Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:   256 MiB
FLASH:  NOR 4 MiB + NAND 128 MiB
ETH:    Qualcomm Atheros QCA8072
WLAN1:  Qualcomm Atheros QCA4019 2.4GHz 802.11bgn 2:2x2
WLAN2:  Qualcomm Atheros QCA4019 5GHz 802.11a/n/ac 2:2x2
WLAN2:  Qualcomm Atheros QCA9888 5GHz 802.11a/n/ac 2:2x2
INPUT:  WPS Button
LEDS:   Power, LAN1, LAN2, WLAN 2.4GHz, WLAN 5GHz-1, WLAN 5GHz-2, OPMODE

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.
c. Set a static ip 192.168.99.8 for Ethernet that connects to board.
d. The PC must have a TFTP server launched and listening on the interface to which the board is connected.
e. 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.9 && tftpboot 0x84000000 192.168.99.8:openwrt.itb && bootm

Signed-off-by: Steven Lin <steven.lin@senao.com>
[copied 4.19 dts to 5.4]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-02-28 22:29:10 +01:00
John Crispin 272e0a702a ipq40xx: add v5.4 support
Signed-off-by: John Crispin <john@phrozen.org>
2020-02-28 17:50:46 +01:00
Koen Vandeputte b6c9d2bab0 kernel: bump 4.19 to 4.19.105
Refreshed all patches.

Fixes:
- CVE-2013-1798
- CVE-2019-3016

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-02-24 14:19:16 +01:00
Koen Vandeputte f4bea1b6a3 kernel: bump 4.14 to 4.14.171
Refreshed all patches.

Fixes:
- CVE-2013-1798

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-02-24 14:18:59 +01:00
Koen Vandeputte 20b5a4ca01 kernel: bump 4.19 to 4.19.101
Refreshed all patches.

Fixes:
- CVE-2019-14896
- CVE-2019-14897

Remove upstreamed:
- 023-0007-crypto-crypto4xx-Fix-wrong-ppc4xx_trng_probe-ppc4xx_.patch
- 950-0202-staging-bcm2835-camera-fix-module-autoloading.patch
- 001-4.22-01-MIPS-BCM63XX-drop-unused-and-broken-DSP-platform-dev.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-02-04 18:10:13 +01:00
Koen Vandeputte 1b310cff0f kernel: bump 4.14 to 4.14.169
Refreshed all patches.

Fixes:
- CVE-2019-14896
- CVE-2019-14897

Remove upstreamed:
- 023-0007-crypto-crypto4xx-Fix-wrong-ppc4xx_trng_probe-ppc4xx_.patch
- 001-4.22-01-MIPS-BCM63XX-drop-unused-and-broken-DSP-platform-dev.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-02-04 18:10:13 +01:00
Christian Lamparter 016339ba42 ipq40xx: fix misplaced cells-sizes in WPJ419's dts
This patch fixes the occurences of the following warning
message from the dtc:

Warning (reg_format): /soc/spi@78b5000/flash0@0/partitions/partition@0:reg:
property has invalid length (8 bytes) (#address-cells == 2, #size-cells == 1)

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-01-26 01:20:46 +01:00
Yen-Ting-Shen 51f3035978 ipq40xx: add support for EnGenius EMD1
SOC:     IPQ4018 / QCA Dakota
CPU:     Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7
DRAM:    256 MiB
NOR:     32 MiB
ETH:     Qualcomm Atheros QCA8072 (1 port)
WLAN1:   Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2
WLAN2:   Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2
INPUT:   RESET Button
LEDS:    White, Blue, Red, Orange

Flash instruction:

From EnGenius firmware to OpenWrt firmware:

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

From OpenWrt firmware to EnGenius firmware:

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

Signed-off-by: Yen-Ting-Shen <frank.shen@senao.com>
[removed BOARD_NAME]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-01-26 01:20:45 +01:00
Fredrik Olofsson 52b8c7a892 ipq40xx: Add support for D-Link DAP-2610
Specifications
==============
- SOC: IPQ4018
- RAM: DDR3 256MB
- Flash: SPI NOR 16MB
- WiFi:
    - 2.4GHz: IPQ4018, 2x2, front end SKY85303-11
    - 5GHz: IPQ4018, 2x2, front end SKY85717-21
- Ethernet: 1x 10/100/1000Mbps, POE 802.3af
- PHY: QCA8072
- UART: GND, blocked, 3.3V, RX, TX / 115200 8N1
- LED: 1x red / green
- Button: 1x reset / factory default
- U-Boot bootloader with tftp and "emergency web server" accessible
  using serial port.

Installation
============
Flash factory image from D-Link web UI. Constraints in the D-Link web UI
makes the factory image unnecessarily large. Flash again using
sysupgrade from inside OpenWrt to reclaim some flash space.

Return to stock D-Link firmware
===============================
Partition layout is preserved, and it is possible to return to the stock
firmware simply by downloading it from D-Link and writing it to the
firmware partition.

    # mtd -r write dap2610-firmware.bin firmware

Quirks
======
To be flashable from the D-Link http server, the firmware must be larger
then 6MB, and the size in the firmware header must match the actual file
size. Also, the boot loader verifies the checksum of the firmware before
each boot, thus the jffs2 must be after the checksum covered part. This
is solved in the factory image by having the rootfs at the very end of
the image (without pad-rootfs).

The sysupgrade image which does not have to be flashable from the D-Link
web UI may be smaller, and the checksum in the firmware header only
covers the kernel part of the image.

Signed-off-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
[added WRGG Variables to DEVICE_VARS, squashed spi pinconf/mux,
added emd1's gmac0 config,fix dtc warnings]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-01-26 01:20:45 +01:00
Koen Vandeputte 40842167d2 kernel: bump 4.19 to 4.19.98
Refreshed all patches.

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2020-01-24 13:14:33 +01:00
David Bauer c6e972c877 ipq40xx: add support for Aruba AP-303H
The Aruba AP-303H is the hospitality version of the Aruba AP-303 with a
POE-passthrough enabled ethernet switch instead of a sigle PHY.

Hardware
--------

SoC:   Qualcomm IPQ4029
RAM:   512M DDR3
FLASH: - 128MB SPI-NAND (Macronix)
       - 4MB SPI-NOR (Macronix MX25R3235F)
TPM:   Atmel AT97SC3203
BLE:   Texas Instruments CC2540T
       attached to ttyMSM1
ETH:   Qualcomm QCA8075
LED:   WiFi (amber / green)
       System (red / green /amber)
       PSE (green)
BTN:   Reset
USB:   USB 2.0

To connect to the serial console, you can solder to the labled pads next
to the USB port or use your Aruba supplied UARt adapter.

Do NOT plug a standard USB cable into the Console labled USB-port!
Aruba/HPE simply put UART on the micro-USB pins. You can solder yourself
an adapter cable:

VCC - NC
 D+ - TX
 D- - RX
GND - GND

The console setting in bootloader and OS is 9600 8N1. Voltage level is
3.3V.

To enable a full list of commands in the U-Boot "help" command, execute
the literal "diag" command.

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

1. Get the OpenWrt initramfs image. Rename it to ipq40xx.ari and put it
   into the TFTP server root directory. Configure the TFTP server to
   be reachable at 192.168.1.75/24. Connect the machine running the TFTP
   server to the E0 (!) ethernet port of the access point, as it only
   tries to pull from the WAN port.

2. Connect to the serial console. Interrupt autobooting by pressing
   Enter when prompted.

3. Configure the bootargs and bootcmd for OpenWrt.
   $ setenv bootargs_openwrt "setenv bootargs console=ttyMSM0,9600n8"
   $ setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1;
     ubi read 0x85000000 kernel; set fdt_high 0x87000000;
     bootm 0x85000000"
   $ setenv ramboot_openwrt "run bootargs_openwrt;
     setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75;
     netget; set fdt_high 0x87000000; bootm"
   $ setenv bootcmd "run nandboot_openwrt"
   $ saveenv

4. Load OpenWrt into RAM:
   $ run ramboot_openwrt

5. After OpenWrt booted, transfer the OpenWrt sysupgrade image to the
   /tmp folder on the device. You will need to plug into E1-E3 ports of
   the access point to reach OpenWrt, as E0 is the WAN port of the
   device.

6. Flash OpenWrt:
   $ ubidetach -p /dev/mtd16
   $ ubiformat /dev/mtd16
   $ sysupgrade -n /tmp/openwrt-sysupgrade.bin

To go back to the stock firmware, simply reset the bootcmd in the
bootloader to the original value:

  $ setenv bootcmd "boot"
  $ saveenv

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-01-14 09:38:32 +01:00
Tom Brouwer 2090b8af0a ipq40xx: add support for EZVIZ CS-W3-WD1200G EUP
Hardware:
SOC:    Qualcomm IPQ4018
RAM:	128 MB Nanya NT5CC64M16GP-DI
FLASH:  16 MB Macronix MX25L12805D
ETH:    Qualcomm QCA8075 (4 Gigabit ports, 3xLAN, 1xWAN)
WLAN:   Qualcomm IPQ4018 (2.4 & 5 Ghz)
BUTTON: Shared WPS/Reset button
LED:    RGB Status/Power LED
SERIAL: Header J8 (UART, Left side of board). Numbered from
        top to bottom:
        (1) GND, (2) TX, (3) RX, (4) VCC (White triangle
        next to it).
        3.3v, 115200, 8N1

Tested/Working:
* Ethernet
* WiFi (2.4 and 5GHz)
* Status LED
* Reset Button (See note below)

Implementation notes:
* The shared WPS/Reset button is implemented as a Reset button
* I could not find a original firmware image to reverse engineer, meaning
currently it's not possible to flash OpenWrt through the Web GUI.

Installation (Through Serial console & TFTP):
1. Set your PC to fixed IP 192.168.1.12, Netmask 255.255.255.0, and connect to
one of the LAN ports
2. Rename the initramfs image to 'C0A8010B.img' and enable a TFTP server on
your pc, to serve the image
2. Connect to the router through serial (See connection properties above)
3. Hit a key during startup, to pause startup
4. type `setenv serverip 192.168.1.12`, to set the tftp server address
5. type `tftpboot`, to load the image from the laptop through tftp
6. type `bootm` to run the loaded image from memory
6. (If you want to return to stock firmware later, create an full MTD backup,
e.g. using instructions here https://openwrt.org/docs/guide-user/installation/generic.backup#create_full_mtd_backup)
7. Transfer the 'sysupgrade' OpenWrt firmware image from PC to router, e.g.:
`scp xxx-squashfs-sysupgrade.bin root@192.168.1.1:/tmp/upgrade.bin`
8. Run sysupgrade to permanently install OpenWrt to flash: `sysupgrade -n /tmp/upgrade.bin`

Revert to stock:
To revert to stock, you need the MTD backup from step 6 above:
1. Unpack the MTD backup archive
2. Transfer the 'firmware' partition image to the router (e.g. mtd8_firmware.backup)
3. On the router, do `mtd write mtd8_firmware.backup firmware`

Signed-off-by: Tom Brouwer <tombrouwer@outlook.com>
[removed BOARD_NAME, OpenWRT->OpenWrt, changed LED device name to board name]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-01-12 15:57:58 +01:00
Christian Lamparter a0c0ad728c ipq40xx: fix usbport trigger on the RT-AC58U with USB 2.0 devices
This patch partially reverts
"ipq40xx: remove unnecessary usb nodes in DTS for ASUS RT-AC58U"
as the change removed the usb2 port-trigger, so the LED would no
longer light-up when a USB 2.0 was inserted into the USB port.

Fixes: d0efb1ba95 ("ipq40xx: remove unnecessary usb nodes in DTS for ASUS RT-AC58U")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2020-01-12 15:47:50 +01:00
Adrian Schmutzler 9c7025b779 ipq40xx: build DEVICE_DTS based on SOC and device name
This patch uses the SOC variable to calculate DTS names automatically
based on the SOC and the device definition node name.

This reduces redundancy and (by having to choose DTS name
appropriately) will unify the naming of a device in different places
(image/Makefile, DTS name, compatible, image name). This is supposed
to make life easier for developers and reviewers.

Since the kernel uses a "soc-device.dts" scheme for this target, we
use this for the derivation of DEVICE_DTS, too, and rename the files
not having followed it so far.

Note that for some devices the kernel itself is inconsistent, leaving
us with a manual overwrite for ap.dk01.1-c1 and ap.dk04.1-c1.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-12-27 18:00:15 +01:00
Paul Fertser 0b7d779dcf ipq40xx: use ath10k-ct-smallbuffers for 128 MiB devices
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2019-12-26 15:48:23 +01:00
Hauke Mehrtens 729d7bc751 kernel: Deactivate CONFIG_SFP in generic config
Deactivate CONFIG_SFP for kernel 4.19 in the generic configuration.
The CONFIG_SFP configuration option was not set to anything in the
ath79 build for me, set it to deactivated by default.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2019-12-23 15:25:36 +01:00
Sungbo Eo d0efb1ba95 ipq40xx: remove unnecessary usb nodes in DTS for ASUS RT-AC58U
RT-AC58U has single USB 3.0 port, and only usb3_port1 is actually used.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2019-12-22 01:04:51 +01:00
Sungbo Eo 8083969405 ipq40xx: improve ASUS RT-AC58U support
This patch does the following:

- move WiFi LED setup to DTS
- fix LAN/WAN MAC addresses and add label MAC address
- wan5G -> wlan5G, power -> led_power
- increase flash SPI frequency to 30MHz

MAC addresses are stored in Factory partition at:
0x1006: WiFi 2.4GHz, WAN (label_mac)
0x5006: WiFi 5GHz, LAN (label_mac +4)

By improving flash speed,
`time dd if=/dev/mtdblock8 of=/dev/null bs=2k`
is reduced from 7m 10.26s to 5m 9.52s.
Using higher frequencies did not improve speed further.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2019-12-22 01:04:51 +01:00
David Bauer 102c8c55f2 ipq40xx: add support for Aruba AP-303
Hardware
--------

SoC:   Qualcomm IPQ4029
RAM:   512M DDR3
FLASH: - 128MB NAND (Macronix MX30LF1G18AC)
       - 4MB SPI-NOR (Macronix MX25R3235F)
TPM:   Atmel AT97SC3203
BLE:   Texas Instruments CC2540T
       attached to ttyMSM0
ETH:   Atheros AR8035
LED:   WiFi (amber / green)
       System (red / green)
BTN:   Reset

To connect to the serial console, you can solder to the labled pads next
to the USB port or use your Aruba supplied UARt adapter.

Do NOT plug a standard USB cable into the Console labled USB-port!
Aruba/HPE simply put UART on the micro-USB pins. You can solder yourself
an adapter cable:

VCC - NC
 D+ - TX
 D- - RX
GND - GND

The console setting in bootloader and OS is 9600 8N1. Voltage level is
3.3V.

To enable a full list of commands in the U-Boot "help" command, execute
the literal "diag" command.

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

1. Get the OpenWrt initramfs image. Rename it to ipq40xx.ari and put it
   into the TFTP server root directory. Configure the TFTP server to
   be reachable at 192.168.1.75/24. Connect the machine running the TFTP
   server to the ethernet port of the access point.

2. Connect to the serial console. Interrupt autobooting by pressing
   Enter when prompted.

3. Configure the bootargs and bootcmd for OpenWrt.
   $ setenv bootargs_openwrt "setenv bootargs console=ttyMSM1,9600n8"
   $ setenv nandboot_openwrt "run bootargs_openwrt; ubi part aos1;
     ubi read 0x85000000 kernel; bootm 0x85000000"
   $ setenv ramboot_openwrt "run bootargs_openwrt;
     setenv ipaddr 192.168.1.105; setenv serverip 192.168.1.75;
     netget; set fdt_high 0x87000000; bootm"
   $ setenv bootcmd "run nandboot_openwrt"
   $ saveenv

4. Load OpenWrt into RAM:
   $ run ramboot_openwrt

5. After OpenWrt booted, transfer the OpenWrt sysupgrade image to the
   /tmp folder on the device.

6. Flash OpenWrt:
   $ ubidetach -p /dev/mtd1
   $ ubiformat /dev/mtd1
   $ sysupgrade -n /tmp/openwrt-sysupgrade.bin

To go back to the stock firmware, simply reset the bootcmd in the
bootloader to the original value:

  $ setenv bootcmd "boot"
  $ saveenv

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-12-20 17:48:52 +01:00
Robert Marko 146eb4925c ipq40xx: add support for Crisis Innovation Lab MeshPoint.One
MeshPoint.One is Wi-Fi hotspot and smart IoT gateway (based upon
Jalapeno module from 8Devices).

MeshPoint.One (https://meshpointone.com) is a unique Wi-Fi hotspot and
smart city gateway that can be installed and powered from street
lighting (even solar power in the future).  MeshPoint provides up to 27
hours of interrupted Wi-Fi and IoT services from internal battery even
when external power is not available.  MeshPoint.One can be used for
disaster relief efforts in order to provide instant Wi-Fi coverage that
can be easily expanded by just adding more devices that create wide area
mesh network.  MeshPoint.One devices have standard Luci UI for
management.

Features:
- 1x 1Gpbs WAN
- 1x 1Gbps LAN
- POE input (eth0)
- POE output (eth1)
- Sensor for temperature, humidity and pressure (Bosch BME280)
- current, voltage and power measurement via TI INA230
- Hardware real time clock
- optional power via Li-Ion battery
- micro USB port with USB to serial chip for easy OpenWrt terminal
  access
- I2C header for connecting additional sensors

Installation:
-------------
Simply flash the sysupgrade image from stock firmware.

Or use the built in Web recovery into bootloader:
Hold Reset button for 5 to 20 seconds or use UART and httpd command.
Web UI will appear on 192.168.2.100 by default.
For web recovery use the factory.ubi image.

Signed-off-by: Damir Samardzic <damir.samardzic@sartura.hr>
Signed-off-by: Damir Franusic <damir.franusic@sartura.hr>
Signed-off-by: Valent Turkovic <valent@meshpoint.me>
Signed-off-by: Robert Marko <robert@meshpoint.me>
[commit description long line wrap, usb->USB]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-30 00:53:36 +01:00
Robert Marko c550b1acfc ipq40xx: use DTSI for Jalapeno
Lets move common code for Jalapeno into DTSI, this way Jalapeno based
boards don't introduce duplicate code.

While at it, lets also fix some style issues and update to current DTS
style.

Signed-off-by: Robert Marko <robert@meshpoint.me>
[commit description long line wrap]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-30 00:53:36 +01:00
Koen Vandeputte e29500eb84 kernel: bump 4.19 to 4.19.85
Refreshed all patches.

Altered patches:
- 080-sata_support.patch

Remove upstreamed:
- 034-v4.20-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch
- 001-4.21-01-BCM63XX-fix-switch-core-reset-on-BCM6368.patch
- 073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-11-22 16:56:46 +01:00
Koen Vandeputte db9e9e8382 kernel: bump 4.14 to 4.14.155
Refreshed all patches.

Altered patches:
- 707-dpaa-ethernet-support-layerscape.patch

Remove upstreamed:
- 034-v4.20-MIPS-BCM47XX-Enable-USB-power-on-Netgear-WNDR3400v3.patch
- 001-4.21-01-BCM63XX-fix-switch-core-reset-on-BCM6368.patch
- 073-qcom-ipq4019-fix-cpu0-s-qcom-saw2-reg-value.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-11-22 16:56:46 +01:00
Koen Vandeputte 50ff887f41 ipq40xx: fix build error
Add missing brace which was accidentally omitted

Fixes: d6aea46a50 ("kernel: bump 4.14 to 4.14.154")
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-11-20 09:26:26 +01:00
Koen Vandeputte d6aea46a50 kernel: bump 4.14 to 4.14.154
Refreshed all patches.

Altered patches:
- 902-debloat_proc.patch
- 040-dmaengine-qcom-bam-Process-multiple-pending-descript.patch
- 807-usb-support-layerscape.patch
- 809-flexcan-support-layerscape.patch
- 816-pcie-support-layerscape.patch

Remove upstreamed:
- 150-MIPS-bmips-mark-exception-vectors-as-char-arrays.patch
- 303-spi-nor-enable-4B-opcodes-for-mx66l51235l.patch

New symbols:
X86_INTEL_MPX
X86_INTEL_MEMORY_PROTECTION_KEYS
X86_INTEL_TSX_MODE_OFF
X86_INTEL_TSX_MODE_ON
X86_INTEL_TSX_MODE_AUTO
SGL_ALLOC

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-11-19 14:59:03 +01:00
Kristian Evensen 6ab84579c6 ipq40xx: u4019: use reset-gpios instead of phy-reset-gpio
Use reset-gpio instead of the custom phy-reset-gpio property to do phy
reset on the U4019. phy-reset-gpio was incorrectly introduced when we
added support for the U4019, and will be deprecated.

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2019-11-07 22:51:37 +01:00
Daniel Danzberger 8db4496443 ipq40xx: wpj419: use reset-gpios property for phy reset
The old GPIO based phy reset (phy-reset-gpio) will be removed form
the ipq40xx mdio driver in the future.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2019-11-07 22:51:37 +01:00
DENG Qingfang 6abce4d5e4 ipq40xx: mdio: remove support for phy-reset-gpio
Commit 6f6c00cfc9 ("ipq40xx: Add support for Unielec U4019") has
introduced support for `phy-reset-gpio` DT property, which isn't needed
as the MDIO already supports `reset-gpios`[1] which could be used instead.

1. https://elixir.bootlin.com/linux/v4.19.81/source/Documentation/devicetree/bindings/net/mdio.txt

Ref: PR#2511
Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
[commit title and description facelift]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-07 22:51:37 +01:00
Adrian Schmutzler dc90caf45a ipq40xx: convert IMAGE_SIZE/KERNEL_SIZE/BLOCKSIZE to kiB
This cosmetical patch converts IMAGE_SIZE, KERNEL_SIZE and
BLOCKSIZE definitions to kilobytes, as this is consistent and
easier to read/type.

An exception was made for asus_rt-ac58u, where the IMAGE_SIZE of
20439364 cannot be divided by 1024 (and also does not seem to
match anything in DTS).

Build-tested for all devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-11-02 20:51:56 +01:00
Daniel Danzberger affe633be4 ipq40xx: ipq4019: Add new device Compex WPJ419
This device contains 2 flash devices. One NOR (32M) and one NAND (128M).
U-boot and caldata are on the NOR, the firmware on the NAND.

    SoC:    IPQ4019
    CPU:    4x 710MHz ARMv7
    RAM:    256MB
    FLASH:  NOR:32MB NAND:128MB
    ETH:    2x GMAC Gigabit
    POE:    802.3 af/at POE, IEEE802.3af/IEEE802.3at(48-56V)
    WIFI:   1x 2.4Ghz Atheros qca4019 2x2 MU-MIMO
            1x 5.0Ghz Atheros qca4019 2x2 MU-MIMO
    USB:    1x 3.0
    PCI:    1x Mini PCIe
    SIM:    1x Slot
    SD:     1x MicroSD slot
    BTN:    Reset
    LED:    - Power
            - Ethernet
    UART:  1x Serial Port 4 Pin Connector (UART)
           1x Serial Port 6 Pin Connector (High Speed UART)
    POWER: 12V 2A

Installation
------------
Initial flashing can only be done via u-boot using the following commands:

tftpboot openwrt-ipq40xx-generic-compex_wpj419-squashfs-nand-factory.ubi
nand erase.chip; nand write ${fileaddr} 0x0 ${filesize}
res

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2019-11-02 19:25:15 +01:00
Koen Vandeputte 4b2ab533d4 kernel: bump 4.19 to 4.19.80
Refreshed all patches.

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-10-30 11:16:25 +01:00
Adrian Schmutzler 0b2a2f4380 ipq40xx: add label MAC address for Netgear EX6100v2/EX6150v2
This is based on the EX6150v2, which should be identical to
the EX6100v2:

The device bears two MAC addresses ("MAC 1" and "MAC 2") that
correspond to phy0 and phy1.

The ethernet MAC address (gmac0) is the same as phy0.
As this one is accessible via local-mac-address in gmac0, the
latter is used for label-mac-device.

(Although this is a one-port, gmac1 also has a local-mac-address
assigned. This has the same vendor part as the other addresses,
but completely different data for the device part.)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-27 14:03:43 +01:00
Adrian Schmutzler dc7872d8f8 ipq40xx: use DEVICE_VARIANT for Unielec U4019 flash size
If flash size is used as part of a device's title, it should be
specified as DEVICE_VARIANT like for the other devices so far.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-27 14:03:21 +01:00
Jeff Kletsky b9d58f7e06 kernel: mtd: spinand: Backport chip definitions
generic: Add/rename patches for upstream consistency

ipq40xx: generic-level patch replaces same-source patches-4.19/
         082-v4.20-mtd-spinand-winbond-Add-support-for-W25N01GV.patch

The SPI-NAND framework from Linux uses common driver code that is then
"tuned" by a tiny struct of chip-specific data that describes
available commands, timing, and layout (data and OOB data). Several
manufacturers and chips have been added since 4.19, several of which
are used in devices already supported by OpenWrt (typically with no or
"legacy" access to their NAND memory). This commit catches up the
supported-chip definitions through Linux 5.2-rc6 and linux/next.

The driver is only compiled for platforms with CONFIG_MTD_SPI_NAND=y.
This presently includes ipq40xx and pistachio, with the addition of
ath79-nand in these commits (and not ath79-generic or ath79-tiny).

Upstream patches refreshed against 4.19.75

Build-tested-on: ipq40xx
Run-tested-on: ath79-nand

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
2019-10-24 23:07:47 +02:00
David Bauer 7f187229a8 ipq40xx: add support for AVM FRITZ!Repeater 1200
Hardware
--------
SoC:   Qualcomm IPQ4019
RAM:   256M DDR3
FLASH: 128M NAND
WiFi:  2T2R IPQ4019 bgn
       2T2R IPQ4019 a/n/ac
ETH:   Atheros AR8033 RGMII PHY
BTN:   1x Connect (WPS)
LED:   Power (green/red/yellow)

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

1. Grab the uboot for the Device from the 'u-boot-fritz1200'
   subdirectory. Place it in the same directory as the 'eva_ramboot.py'
   script. It is located in the 'scripts/flashing' subdirectory of the
   OpenWRT tree.

2. Assign yourself the IP address 192.168.178.10/24. Connect your
   Computer to one of the boxes LAN ports.

3. Connect Power to the Box. As soon as the LAN port of your computer
   shows link, load the U-Boot to the box using following command.

   > ./eva_ramboot.py --offset 0x85000000 192.168.178.1 uboot-fritz1200.bin

4. The U-Boot will now start. Now assign yourself the IP address
   192.168.1.70/24. Copy the OpenWRT initramfs (!) image to a TFTP
   server root directory and rename it to 'FRITZ1200.bin'.

5. The Box will now boot OpenWRT from RAM. This can take up to two
   minutes.

6. Copy the U-Boot and the OpenWRT sysupgrade (!) image to the Box using
   scp. SSH into the Box and first write the Bootloader to both previous
   kernel partitions.

   > mtd write /path/to/uboot-fritz1200.bin uboot0
   > mtd write /path/to/uboot-fritz1200.bin uboot1

7. Remove the AVM filesystem partitions to make room for our kernel +
   rootfs + overlayfs.

   > ubirmvol /dev/ubi0 --name=avm_filesys_0
   > ubirmvol /dev/ubi0 --name=avm_filesys_1

8. Flash OpenWRT peristently using sysupgrade.

   > sysupgrade -n /path/to/openwrt-sysupgrade.bin

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-10-23 01:17:28 +02:00
David Bauer 6fd9eeeeb2 ipq40xx: add missing backslash in 11-ath10k-caldata
This adds a missing backslash in the caldata-extraction script. Without
this fix, caldata extraction fails for every device.

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-10-23 01:17:28 +02:00
David Bauer 7be79a3ab2 ipq40xx: fix ethernet probe abort on missing phy-reset
This commit completely fixes the abortion of the ipq40xx ethernet driver
probe in case no phy-reset is defined.

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-10-23 01:17:28 +02:00
John Crispin 8285af1928 ipq40xx: fix optional gpio-reset
If a gpio reset pin was not defined we should not bog out.

Signed-off-by: John Crispin <john@phrozen.org>
2019-10-22 00:00:36 +02:00
Kristian Evensen 6f6c00cfc9 ipq40xx: Add support for Unielec U4019
This commit adds support for the 32MB storage/512MB RAM version of the U4019
IPQ4019-based board from Unielec. The board has the following specifications:

* Qualcomm IPQ4019 (running at 717MHz)
* 512MB DDR3 RAM (optional 256MB/1GB)
* 32MB SPI NOR (optional 8/16MB or NAND)
* Five gigabit ports (Qualcomm QCA8075)
* 1x 2.4 GHz wifi (QCA4019 hw1.0)
* 1x 5 Ghz wifi (QCA4019 hw1.0)
* 1x mini-PCIe slot (only USB-pins connected)
* 1x SIM slot (mini-SIM)
* 1x USB2.0 port
* 1x button
* 1x controllable LED
* 1x micro SD-card reader

Working:
* Ethernet
* Wifi
* USB-port
* mini-PCIe slot + SIM slot
* Button
* Sysupgrade

Not working:
* SD card slot (no upstream support)

Installation instructions:

In order to install OpenWRT on the U4019, you need to go via the
initramfs-image. The installation steps are as follows:

* Connect to board via serial (header exposed and clearly marked).
* Interrupt bootloader by pressing a button.
* Copy the initramfs-image to your tftp folder, call the file C0A80079.img.
* Give the network interface connected to the U4019 the address
192.168.0.156/24.
* Start your tftp-server and run tftpboot on the board.
* Run bootm when the file has been transferred, to boot OpenWRT.
* Once OpenWRT has booted, copy the sysupgrade-image to the device and run
sysupgrade to install OpenWRT on the U4019.

Notes:

- Since IPQ4019 has been moved to 4.19, I have not added support for kernel
4.14.

- There is a bug with hardware encryption on IPQ4019, causing poor performance
with TCP and ipsec (see for example FS#2355). In order to improve performance,
I have disabled hardware encryption in the DTS. We can enable hw. enc. once/if
bug is fixed.

- In order for Ethernet to work, the phy has to be reset by setting gpio 47
low/high. Adding support for phy reset via gpio required patching the
mdio-driver, and the code added comes from the vendor driver. I do not know if
patching the driver is an acceptable approach or not.

v1->v2:
* Do not use wildcard as identifier in the board.d-scripts (thanks
Adrian Schmutzler).

Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
2019-10-21 12:28:03 +02:00
Masafumi UTSUGI f1d761f95e ipq40xx: essedma: Fix dead lock
edma_read_append_stats() gets called from two places in the driver.
The first place is the kernel timer that periodically updates
the statistics, so nothing gets lost due to overflows.
The second one it's part of the userspace ethtool ioctl handler
to provide up-to-date values.

For this configuration, the use of spin_lock() is not sufficient
and as per:
<https://mirrors.edge.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/c214.html>
the locking has to be upgraded to spin_lock_bh().

Signed-off-by: Masafumi UTSUGI <mutsugi@allied-telesis.co.jp>
[folded patch into 710-, rewrote message]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-10-20 13:01:43 +02:00
Adrian Schmutzler 48b5d08a48 treewide: use a single ath10k MAC patching function with checksum
While all ath10k eeproms have a checksum field, so far two
functions for patching ath10k MAC address have been present (and
been used).

This merges code to provide a single function ath10k_patch_mac
in caldata.sh, having its name in accordance with ath9k functions.
By doing so, correct MAC patching for current and future ath10k
devices should be ensured.

This patch adds checksum adjustments for several targets on
ath79 and lantiq.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-15 18:13:54 +02:00
Adrian Schmutzler 332b1f46e9 ipq40xx: add label MAC address for FritzBox 4040
The CWMP-Account on the device's label contains the eth0 MAC
address.

This only changes 4.19 files as label-mac-device is introduced
after 19.07 branch, so there won't be a 4.14 release anymore.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-15 18:13:54 +02:00
Adrian Schmutzler 2c60de0e3f treewide: move MAC address patch functions to common library
This unifies MAC address patch functions and moves them to a
common script. While those were implemented differently for
different targets, they all seem to do the same. The number of
different variants is significantly reduced by this patch.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-14 12:36:02 +02:00
Adrian Schmutzler 5b6a809092 treewide: move calibration data extraction function to library
This moves the almost identical calibration data extraction
functions present multiple times in several targets to a single
library file /lib/functions/caldata.sh.

Functions are renamed with more generic names to merge different
variants that only differ in their names.

Most of the targets used find_mtd_chardev, while some used
find_mtd_part inside the extraction code. To merge them, the more
abundant version with find_mtd_chardev is used in the common code.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
[rebase on latest master; add mpc85xx]
Signed-off-by: David Bauer <mail@david-bauer.net>
2019-10-13 21:48:58 +02:00
Adrian Schmutzler c1388a2deb base-files: move xor() from caldata extraction to functions.sh
The xor() function is defined in each of the caldata extraction
scripts for several targets. Move it to functions.sh to reduce
duplicate code.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-13 19:03:57 +02:00
David Bauer e2c084cabc ipq40xx: abort ar40xx probe on missing PHYs
The ar40xx driver currently panics in case no QCA807x PHY has been
successfully probed. This happens when the external PHY is still
in reset when probing the ar40xx switch driver.

Note that this patch does not fix the root cause, ar40xx_probe now
simply fails instead of causing a kernel panic due to a nullpointer
dereference.

Signed-off-by: David Bauer <mail@david-bauer.net>
2019-09-25 22:42:03 +02:00
Eneas U de Queiroz 391b14a892 ipq40xx: fix hw-crypto detection of qce driver
This adds the CRYPTO_ALG_KERN_DRIVER_ONLY flag to Qualcomm crypto engine
driver algorithms, so that openssl devcrypto can recognize them as
hardware-accelerated.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[refresh, move to ipq40xx as its the only target right now]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-09-21 23:41:31 +02:00
Koen Vandeputte c79cb9fda7 kernel: bump 4.19 to 4.19.73
Refreshed all patches.

Remove upstreamed:
- 840-media-i2c-tda1997x-select-V4L2_FWNODE.patch
- 079-v4.20-ARM-dts-qcom-ipq4019-fix-PCI-range.patch
- 083-ARM-dts-qcom-ipq4019-enlarge-PCIe-BAR-range.patch
- 084-ARM-dts-qcom-ipq4019-Fix-MSI-IRQ-type.patch

Fixes:
- CVE-2019-15030

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-09-20 13:16:17 +02:00
Rafał Miłecki a858db3136 treewide: sysupgrade: use $UPGRADE_BACKUP to check for backup
Now that $UPGRADE_BACKUP is set conditionally there is no need to check
the $UPGRADE_OPT_SAVE_CONFIG anymore. All conditions can be simplified.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2019-09-11 09:05:35 +02:00
Rafał Miłecki 641f6b6c26 treewide: use new procd sysupgrade $UPGRADE_BACKUP variable
It's a variable set by procd that should replace hardcoded
/tmp/sysupgrade.tgz.

This change requires the most recent procd with the commit 0f3c136
("sysupgrade: set UPGRADE_BACKUP env variable").

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2019-09-05 23:33:19 +02:00
Rafał Miłecki 5797fe84a3 treewide: replace remaining (not working now) $SAVE_CONFIG uses
This var has been replaced by the $UPGRADE_OPT_UPGRADE_OPT_SAVE_CONFIG

Fixes: b534ba9611 ("base-files: pass "save_config" option to the "sysupgrade" method")
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2019-09-05 08:43:24 +02:00
Koen Vandeputte 1bc31e0339 kernel: bump 4.19 to 4.19.68
Refreshed all patches.

Remove upstreamed:
- 950-0307-Revert-pwm-Set-class-for-exported-channels-in-sysfs.patch

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-08-28 13:08:20 +02:00
Christian Lamparter 94bf2e4813 ipq40xx: drop unreachable ipq-wifi package for the AP120C-AC
Harri Hursti reported that ALFA Network AP120C-AC does not
work anymore due to: "Unknown package 'ipq-wifi-alfa-network_ap120c-ac'."

This patch fixes the issue by removing the stale package from
the device's dependencies as the calibration data is now
provided by the upstream board-2.bin.

Reported-by: Harri Hursti <harri@nordicinnovationlabs.com>
Fixes: 8f757d427c ("ipq-wifi: drop upstreamed custom board-2.bin")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-08-24 23:23:31 +02:00
Paul Spooren 853e4dd306 ipqx0xx: add Generic subtarget
Both targets miss a subtarget causing an image naming style which is
different from other all othe targets, even tho it already uses
`x/generic/` as subfolder as if the subtarget would exist.

This commit adds the Generic subtarget resulting in consistent naming.

    ~/src/openwrt/openwrt/bin/targets/ipq806x/generic$ ls
    openwrt-ipq806x-generic-netgear_d7800-initramfs-uImage
    openwrt-ipq806x-generic-netgear-d7800.manifest
    openwrt-ipq806x-generic-netgear_d7800-squashfs-factory.img
    openwrt-ipq806x-generic-netgear_d7800-squashfs-sysupgrade.bin

CC: John Crispin <john@phrozen.org>

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-08-22 21:15:28 +02:00
Christian Lamparter 8f757d427c ipq-wifi: drop upstreamed custom board-2.bin
The BDFs for the:
	ALFA Network AP120C-AC
	ASUS Lyra
	AVM FRITZ!Box 7530
	AVM FRITZ!Repeater 3000
	EnGenius EAP1300
	EnGenius ENS620EXT
	Netgear Orbi Pro SRK60

boards were upstreamed to the ath10k-firmware repository
and linux-firmware.git.

Furthermore the BDFs for the:
	OpenMesh A42 specific BDFs
	OpenMesh A62 specific BDFs
	Linksys EA6350v3
have been updated.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-08-18 20:56:41 +02:00
Chuanhong Guo 92e60260d5 treewide: sync bootcount scripts across targets
This commit made the following changes to sync all bootcount scripts:

1. use boot() instead of start()
    This script only needs to be executed once when boot is complete.
    use boot() to make this explicit.

2. drop sourcing of /lib/functions.sh
    This is aready done in /etc/rc.common.

3. ramips: replace board name checking with a case

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2019-08-17 23:52:34 +08:00
David Bauer a6f85b81b7 ipq40xx: fix AVM NAND caldata extraction
The AVM Fritz!Box 7530 (and probably other AVM IPQ4019 NAND devices)
has it's caldata not stored consistently, but instead at currently
3 known possible offsets.

As we get a non-zero exit code from fritz_cal_extract, simply try all
three possible offsets on both bootloader partitions, until a matching
caldata for each radio is found.

Reported-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David Bauer <mail@david-bauer.net>
2019-08-15 00:33:12 +02:00
Adrian Schmutzler b133e466b0
treewide: convert WiFi caldata size and offset to hexadecimal
This changes size and offset set for WiFi caldata extraction and
MAC address adjustment to hexadecimal notation.

This will be much clearer for the reader when numbers are big, and
will also match the style used for mtd-cal-data in DTS files.

Since dd cannot deal with hexadecimal notation, one has to convert
back to decimal by simple $(($hexnum)).

Acked-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-08-14 12:36:37 +02:00
Adrian Schmutzler 75bfc393ba treewide: convert MAC address location offsets to hexadecimal
This changes the offsets for the MAC address location in
mtd_get_mac_binary* and mtd_get_mac_text to hexadecimal notation.

This will be much clearer for the reader when numbers are big, and
will also match the style used for mtd-mac-address in DTS files.

(e.g. 0x1006 and 0x5006 are much more useful than 4102 and 20486)

Acked-by: Alexander Couzens <lynxis@fe80.eu>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-08-14 12:10:12 +02:00
Koen Vandeputte 96f1d4b02b kernel: bump 4.14 to 4.14.136
Refreshed all patches.

Altered patches:
- 306-v4.16-netfilter-remove-saveroute-indirection-in-struct-nf_.patch

Remove upstreamed:
- 100-powerpc-4xx-uic-clear-pending-interrupt-after-irq-ty.patch
- 088-0002-i2c-qup-fixed-releasing-dma-without-flush-operation.patch
- 500-arm64-dts-marvell-Fix-A37xx-UART0-register-size.patch

Fixes:
- CVE-2019-13648
- CVE-2019-10207

Compile-tested on: cns3xxx
Runtime-tested on: cns3xxx

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-08-06 11:52:47 +02:00
Christian Lamparter 6825b4ca95 ipq40xx: remove redundant PHY_POLL set code
The [devm_]mdiobus_alloc[_size()] functions are creating
the array of interrupt numbers as well as initializing
them to POLLING.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-08-02 23:18:26 +02:00
Christian Lamparter fd58035a8e ipq40xx: decouple mdio-ipq40xx and ar40xx
This makes it possible to delete the ar40xx driver in the
future by just removing the file.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-08-02 23:18:25 +02:00
Christian Lamparter ef4bea0b51 ipq40xx: extend DT mdio node to be more accessible
The MDIO node will become more important in the future.
Hence, this patch adds DT labels to make the properties
inside the various subnodes more accessible.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
2019-08-02 22:46:45 +02:00
Koen Vandeputte c7634180fc kernel: bump 4.19 to 4.19.62
Refreshed all patches.

Remove upstreamed:
- 023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch
- 023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch
- 023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch
- 950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch
- 950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch
- 950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch
- 950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch
- 0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch
- 049-v4.20-mips-remove-superfluous-check-for-linux.patch
- 100-MIPS-fix-build-on-non-linux-hosts.patch
- 303-MIPS-Fix-bounds-check-virt_addr_valid.patch
- 0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch

Altered patches:
- 950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch
- 700-net-add-qualcomm-mdio-and-phy.patch

Fixes:
- CVE-2019-3846

New symbol:
- AX88796B_PHY

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
2019-07-31 16:51:46 +02:00