Commit Graph

1178 Commits (fbd4214bb0727268aa535af5b600d38939ec8dbc)

Author SHA1 Message Date
Johann Neuhauser 02d53e6a21 lantiq: add support for FritzBox 7312
The FritzBox 7312 is also known as 1&1 WLAN-MODEM. The device is almost
the same as FB7330, but only one ETH-Port and no USB.

Hardware
SoC: Lantiq Xway ARX188 PSB 50812 EL
RAM: 64MB DDR1 (Zentel A4S12D40FTP-G5)
Ethernet: Atheros 8030
Wireless: Atheros AR9227 b/g/n 2x2
DSL: Lantiq ADSL2+
DECT: Dialog SC14441
Buttons: WiFi, DECT
LEDs: Power/DSL, Fon, DECT, WLAN, Info

LEDs
Power: GPIO#44 (active low)
Internet: GPIO#47 (active low)
DECT: GPIO#38 (active low)
WLAN: GPIO#37 (active low)
Info: GPIO#35 (active low)

The Fon LED is labeled as internet in avm gpl sources.

Buttons
WLAN: GPIO#1 (active low)
DECT: GPIO#2 (active low)

Phy
GPIO#03: 25 MHz
GPIO#34: Reset (active low)
GPIO#39: Int
GPIO#42: MII MDIO
GPIO#43: MII MDC

PCIe
GPIO#21: reset (active low)

Installation:

To install OpenWrt via Eva bootloader, within the first seconds after
power on a ftp connection need to be established to the FRITZ!Box at
192.168.178.1 and the the following ftp commands need to be run:

  ftp> quote USER adam2
  ftp> quote PASS adam2
  ftp> binary
  ftp> debug
  ftp> passive
  ftp> quote MEDIA FLSH
  ftp> put /path/to/openwrt-lantiq-xway-avm_fritz7312-squashfs-sysupgrade.bin mtd1
  ftp> quote REBOOT

Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
6 years ago
Johann Neuhauser f2f7802148 lantiq: etop: pass devicetree node to phy driver
Use of_mdiobus_register() to pass the ethernet phy node to the phy
drivers. This is needed for the at8030 phy driver which needs to know
the GPIO which is connected to the ar8030 reset pin.

This driver expects a child in gsw/etop node named "mdio-bus", which has
the ethernet phys defined:

&gsw {
	phy-mode = "rmii";
	phy-handle = <&phy0>;
	mtd-mac-address = <&ath9k_cal 0xa91>;
	mtd-mac-address-increment = <(-2)>;

	mdio-bus {
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0>;

		phy0: ethernet-phy@0 {
			reg = <0>;
			reset-gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
		};
	};
};

Fallback to mdiobus_register() if no mdio-bus child node exists. This
way we don't need to touch all xway dts files, for which we don't know
the actual address on the mdio bus.

Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
6 years ago
Mathias Kresin cf7154db07 kernel: only optimized for size if small_flash
Add a new config option to allow to select the default compile
optimization level for the kernel.

Select the optimization for size by default if the small_flash feature is
set. Otherwise "Optimize for performance" is set.

Add the small_flash feature flag to all (sub)targets which had the
optimization for size in their default kernel config.

Remove CC_OPTIMIZE_FOR_* symbols from all kernel configs to apply the new
setting.

Exceptions to the above are:

  - lantiq, where the optimization for size is only required for the
    xway_legacy subtarget but was set for the whole target
  - mediatek, ramips/mt7620 & ramips/mt76x8 where boards should have
    plenty of space and an optimization for size doesn't make much sense
  - rb532, which has 128MByte flash

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Michael Kuron d0b89e48d7 lantiq: enlarge AVM Fritz!Box 3370 flash
Increase the available flash memory size in AVM Fritz!Box 3370 by
incorporating the unused extra partitions located after the ubi partition.

Note that users upgrading from a previous OpenWRT version need to
re-install from the boot loader to pick up the new partition layout.

Available flash space for rootfs+overlay increases from 48MB to 124MB.

Reverting to the OEM firmware is still possible (via the recovery utility
provided by AVM) as the OEM firmware appears to reformat the config and
nand-filesystem partitions upon first boot if necessary. The
reserved-kernel and reserved-filesystem partitions are overwritten by the
OEM firmware when installing an update, so their contents do not matter.

Boot loader and device-specific information (MAC addresses, calibration
data, etc.) are not located in NAND flash and remain unharmed by this
changed.

Tested with OEM firmware 06.54 on device with HWRevision 5 and Micron
flash chip.

Signed-off-by: Michael Kuron <m.kuron@gmx.de>
6 years ago
Mathias Kresin f72605f70e lantiq: backport stp-xway get callback implementation
To keep the status of a LED connected to the stp during boot, the get
callback is required. If the callback is missing and the LED default
state is set to keep in the devicetree, the gpio led driver errors out
during load.

Fixes: FS#1620

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a570933999 treewide: gpio-export: add error handling
Check if the GPIO is valid (or set at all). If no GPIO is set in the
devicetree, a gpiolib related kernel warning + stacktrace is shown during
boot and gpio-export reports GPIOs as exported albeit none really is.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 004fe89620 lantiq: fix arcadyan vg3503j switch port indexing
Both version of the vg3503j have the LAN1 labelled port connected to
switch port 4 and the LAN2 labelled port connected to switch port 2.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Kevin Darbyshire-Bryant 0276e1f760 lantiq: atm: fix ifx_atm driver integration
When upstream kernel introduced commit c55fa3cccbc2c672e7f118be8f7484e53a8e9e77
we incorrectly updated our hack integration patch that updates atm/common.c

+++ b/net/atm/common.c
@@ -62,10 +62,16 @@ static void vcc_remove_socket(struct soc
        write_unlock_irq(&vcc_sklist_lock);
 }

+struct sk_buff* (*ifx_atm_alloc_tx)(struct atm_vcc *, unsigned int) = NULL;
+EXPORT_SYMBOL(ifx_atm_alloc_tx);
+
 static bool vcc_tx_ready(struct atm_vcc *vcc, unsigned int size)
 {
        struct sock *sk = sk_atm(vcc);

+       if (ifx_atm_alloc_tx != NULL)
+               return ifx_atm_alloc_tx(vcc, size)

The correct solution is to drop our ifx_atm_alloc_tx replacement hack
entirely and let the kernel do its thing.

In reality neither pppoatm or BR2684 interfaces actually hit this code,
so the incorrect integration would only be noticed with direct socket
calls which we are unaware of a use-case.

This is not the solution to pppoatm vc-mux failing to work which started
the whole investigation, but let's fix it up anyway.

With sincerest thanks to David Woodhouse <dwmw2@infradead.org> &
Mathias Kresin <dev@kresin.me>.

Tested-on: lantiq, BT HomeHub 5a

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Daniel Golle 0653e31270 lantiq-vdsl-fw: update to provide recent vectoring firmware
Recent Speedport firmware downloads only work over HTTPS, so the user
either needs to provide the already downloaded file or install
ustream-ssl-* as well as ca-certificates or ca-bundle.

So to get VDSL2 with vectoring on xRX200, simply run
vdsl_fw_install.sh
on the target and either provide the downloaded file as instructed or
make sure the device is connected to the Internet and can download that
HTTPS url itself.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Daniel Golle 8e2f8b0c83 Revert "lantiq: get rid of ltq-vdsl-fw"
This reverts commit 0938233fcd.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Stijn Tintel e52f3e9b13 kernel: bump 4.14 to 4.14.48
Remove upstreamed patches:
generic/pending/101-clocksource-mips-gic-timer-fix-clocksource-counter-w.patch
generic/pending/103-MIPS-c-r4k-fix-data-corruption-related-to-cache-coherence.patch
generic/pending/182-net-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch
lantiq/0025-MIPS-lantiq-gphy-Remove-reboot-remove-reset-asserts.patch
Update patches that no longer apply:
generic/pending/811-pci_disable_usb_common_quirks.patch
ath79/0009-MIPS-ath79-add-lots-of-missing-registers.patch

Fixes CVE-2018-6412.

Compile-tested: octeon, x86/64.
Runtime-tested: octeon, x86/64.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Sergey Ryazanov 67a3cdcbb0 kernel: enable THIN_ARCHIVES by default
THIN_ARCHIVES option is enabled by default in the kernel configuration
and no one target config disables it. So enable it by default and remove
this symbol from target specific configs to keep them light.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov bdc2b58c4b kernel: enable FUTEX_PI by default
New FUTEX_PI configuration symbol enabled if FUTEX and RT_MUTEX symbols
are enabled. Both of these symbols are enabled by default in the
generic config, so enable FUTEX_PI by default too to keep platform
specific configs minimal.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov a08b0d0c31 kernel: enable EXPORTFS by default
OVERLAY_FS config symbol selects EXPORTFS since 4.12 kernel, we have
OVERLAY_FS enabled by default, so enable EXPORTFS in the generic config
of 4.14 and remove this option from platform specific configs.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov 978543a246 kernel: disable DRM_LIB_RANDOM by default
DRM_LIB_RANDOM config symbol selected only by DRM_DEBUG_MM_SELFTEST
which is disable by default, so disable DRM_LIB_RANDOM by default too.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov ead26e9db6 kernel: disable DMA_{NOOP|VIRT}_OPS by default
These options do not used by any supported arch, so disable them by
default to make arch configs a bit more clean.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov f928c338ad kernel: disable ARCH_WANTS_THP_SWAP by default
Only one arch (x86_64) enables this option. So disable
ARCH_WANTS_THP_SWAP by default and remove referencies to it from all
configs (except x86_64) to make them clean.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Mathias Kresin d8b475212b lantiq: kernel 4.14: use vbus-supply devicetree property
It isn't a phy supply, as the phy is still up if the GPIO is low. It
rather is the supply for the vbus. A correct setting/definition will be
relevant as soon as USB peripheral mode is supported.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 0b62fe5ed8 lantiq: complete AVM FRITZ!Box 3370 support
Rename the image and use a compatible string which indicates that only
hardware revision 2 and higher is supported.

It allows to use the wireless LED, as HWRev 1 uses GPIO#39 for the
wireless LED and starting with HWRev 2 GPIO#35 is used for the wireless
LED and GPIO#39 for IFX_GPIO_MODULE_EXTPHY_MDIO.

The HWREV can be checked by connecting to the fritzbox right after power
on via ftp:

  ftp> quote GETENV HWSubRevision

Within the same HW revision 5 of the Fritz!Box 3370 different NAND flash
chips are used. Usually it isn't a big deal but depending on the used
NAND flash chip, the ECC calculation is done different (and incompatible
of course).

Boards with a Micron MT29F1G08ABADA NAND flash chip are using the NAND
chip to calculate the ECC (on-die). Boards with a Hynix HY27UF081G2M NAND
flash chip are doing the ECC calculation in software.

Supporting both with a single DTS isn't possible. It might be possible
to add a patch selecting the ECC mode dynamicaly based on the found NAND
flash chip. But such a patch has no chance to get accepted upstream and
most likely need to be touched with every kernel update.

Instead two images are created. One for Micron NAND flash chip and one
for Hynix NAND flash chip. So far no pattern is known to identify the
used flash chip without opening the box.

Add the power off GPIO. At least EVA version 2186 sets/keeps the GPIO as
input, which will cause a reboot 30sec after power on. For boards with
EVA version 2186 the installation is tricky as it has to be finished
within the 30sec time frame.

The EVA version can be checked by connecting to the fritzbox right after
power on via ftp:

  ftp> quote GETENV urlader-version

The ath9k eeprom/caldata is at a different and offset and stored in
reverse order (from the last byte to the beginning) on the flash.
Reverse the bits to bring the data into the format expected by the
ath9k driver.

Since the ath9k eeprom is stored in reverse order on flash, we can not
use the mac address from the on flash eeprom. Get the MAC address from
the tffs instead.

Within the same HW revision 5 of the Fritz!Box 3370 both version of the
vr9 SoC are used. During preparation of kernel 4.14 support, all
devicetree source files were changed to load the vr9 v1.1 and vr9 v1.2
gphy firmware, which fixed the embedded phys for boards using the
version 1.2 of the vr9 SoC.

While at it, add a trigger to make use of the LAN LED. Setup the
build-in switch and add a hint for LuCI two show the ports in order
matching the labels on the case

Add support for the second USB port and provide the volatage GPIOs. Use
GPIO#21 as PCIe reset pin. The lan led is connected to GPIO#38.

Name the rootfs partition ubi and remove the mtd/rootfs related kernel
bootargs to use the OpenWrt autoprobing based on the partition name.

Enable sysupgrade support to allow an upgrade from a running system.
Since sysupgrade wasn't supported till now, drop image build code which
was added to allow a sysupgrade from earlier OpenWrt versions.

Build images that allow an (initial) installation via EVA bootloader.

To install OpenWrt via Eva bootloader, within the first seconds after
power on a ftp connection need to be established to the FRITZ!Box at
192.168.178.1 and the the following ftp commands need to be run:

  ftp> quote USER adam2
  ftp> quote PASS adam2
  ftp> binary
  ftp> debug
  ftp> passive
  ftp> quote SETENV linux_fs_start 0
  ftp> quote MEDIA FLSH
  ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-kernel.bin mtd1
  ftp> put /path/to/openwrt-lantiq-xrx200-FRITZ3370-eva-filesystem.bin mtd0

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin d7b7483343 lantiq: switch to kernel 4.14
Use kernel 4.14 by default.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin ef19747b6c lantiq: kernel 4.14: Remove reboot/remove reset asserts
Backport patch accepted upstream which removes the reset asserts of the
xrx200 gphy driver on reboot/remove.

While doing a global software reset, these bits are not cleared and let
some bootloader fail to initialise the GPHYs. The bootloader don't expect
these bits to be set, as they aren't during power on.

The asserts were a workaround for a wrong syscon-reboot mask. With a mask
set which includes the GPHY resets of the first reset register, the
resets of the second reset register arn't required any more.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Kevin Darbyshire-Bryant 9aa196e0f2 kernel: bump 4.9 to 4.9.96
Refresh patches, following required reworking:

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

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

Tested on: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
Tested-by: Arjen de Korte <build+openwrt@de-korte.org>
6 years ago
Mathias Kresin 74a0d8cd92 build: consolidate fake uImage header build commands
Merge the two existing functions and use a parameter for the type
header field.

It updates the syntax of the former mpc85xx fake ramdisk header
command to be compatible with mkimage from u-boot 2018.03 and fixes the
build error spotted by the build bot.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 0c26264dee lantiq: kernel 4.14: fix vr9 reboot mask
We need to reset the GPHYs on reboot as well. Otherwise the bootloader
might have issues to reset/find the GPHYs.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Hauke Mehrtens a74fd570a2 kernel: update kernel 4.14 to 4.14.32
The following patches are now included upstream:
* 0052-MIPS-lantiq-fix-usb-clocks.patch
* 0053-MIPS-lantiq-enable-AHB-Bus-for-USB.patch
* 0060-lantiq-ase-enable-MFD-SYSCON.patch

Closes: FS#1466

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Tested-by: Stijn Segers <foss@volatilesystems.org>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Mathias Kresin af3a9566fe lantiq: intel-xway: add vr9 v1.1 phy support
During upstreaming the intel phy driver, support for the vr9 v1.1
embedded phys got lost. Backport the upstream send patch adding support
for the vr9 v1.1 embbeded phys to the driver.

Signed-off-by: Mathias Kresin <dev@kresin.me>

cosmetic fixes

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Thomas Nixon 8c88e23b99 lantiq: fix DM200 boot with fake uImage headers
The latest bootloader versions load the firmware into memory and call
`chk_dniimg` (defined in Netgear GPL release), which expects to find
three consecutive block-aligned uImages. Add two fake uImage headers
after the kernel to fool this check.

This wastes up to 128k of space for alignment. The alternative would be
to put the rootfs in a second uImage, but this would limit the firmware
size to 0x710000 (the number of bytes loaded and verified by the
bootloader) instead of 0x7b0000 (the size of the firmware partition).

Signed-off-by: Thomas Nixon <tom@tomn.co.uk>
6 years ago
Valentin Spreckels ac1c31c259 lantiq: fix AVM initramfs image
Create an initramfs that can be used with the EVA bootloader.

Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE>
6 years ago
Hauke Mehrtens bf4aa52dbf kernel: make mtd patches apply again
This makes some of the mtd patches apply again after some generic
patches were changed.
These problems where found by build bot.

Fixes: ac9bcefa3b ("kernel: use V10 of mtd patchset adding support for "compatible" string")
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Martin Schiller d84ac78d6a lantiq/xrx200: add usif support to dts files
The Lantiq XRX200 aka VR9 doesn't have an asc0. Instead,
there is an USIF module which can either be an UART or a
SPI Controller.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
6 years ago
Magnus Kroken 5af85dab22 kernel: bump 4.9 to 4.9.85
Signed-off-by: Magnus Kroken <mkroken@gmail.com>
6 years ago
Felix Fietkau a49f6565b3 kernel: m25p80: allow fallback from spi_flash_read to regular SPI transfer
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 46c49d8381 kernel: optimize for performance by default starting with 4.14
Keep size optimizations for smaller targets that already switched

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Hauke Mehrtens 6eaf8b3d89 lantiq: kernel 4.14: update dts files
Updated the devicetree source files to make use of the following
upstreamed drivers:

 - xrx200 ethernet phy
 - reset controller unit
 - dwc2
 - fpi

Use our custom xrx200 ethernet phy compatible to support boards, which
have switched the vr9 revision during lifetime, with a single devicetree
source file.

By switching to the dwc2 driver + usb phy framework, we don't need to used
our custom gpio power patch and can use a fixed regulator instead.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin f519fea4c6 lantiq: kernel 4.14: cleanup dts files
Move common used parts to dtsi. Add labels to nodes and reference nodes
via labels in dts files.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 82ae68be70 lantiq: kernel 4.14: fix usb
On danube the USB0 registers are at 1e101000 similar to all other lantiq
SoCs.

On Danube and AR9 the USB core is connected to the AHB bus, hence we need
to enable the AHB Bus as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 2368f7cb78 lantiq: kernel 4.14: autoselect matching vr9 rev firmware
Add a custom xrx200 ethernet phy compatible to load the firmware matching
the vr9 revision without specifing an expected revision.

We have quite a few boards in the tree were later produced ones are using
a more recent vr9. It is impossible to distinguish which revision of the
vr9 is used without opening the case and removing a heatsink for some of
them.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a48b4ae38b lantiq: kernel 4.14: don't use CPU interrupt controller IPI IRQ domain support
This reverts kernel commit 1eed40043579 ("MIPS: smp-mt: Use CPU interrupt
controller IPI IRQ domain support"). With the patch applied, the kernel
hangs during boot if SMP is active.

The Lantiq IRQ controller gets registered first and it directly handles
the MIPS native SW1/2 and HW0 - HW5 IRQs. It looks like this controller
already registers IRQ 0 - 7 and the generic driver only gets the following
IRQs starting later.

The upstream discussion can be found at
https://www.linux-mips.org/archives/linux-mips/2017-05/msg00059.html.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin cf53f2180c lantiq: kernel 4.14: select MFD SYSCON for ase
Enable syscon to use it for the RCU MFD on Amazon SE as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Hauke Mehrtens f1d84023cb lantiq: kernel 4.14: update patches and config
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Hauke Mehrtens 5eeaba31b8 lantiq: kernel 4.14: copy patches, config and dts files
This just copies the patches, configuration and dts files into the
directories hich are used for kernel 4.14.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Mathias Kresin f8a6987cd1 lantiq: make dts files and kernel config kernel version specific
Move the devicetree source files to a kernel specific directory in
preparation of adding kernel 4.14 support.

Rename the subtarget kernel config files to match a specific kernel
version.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 627a28eb09 lantiq: rename gphy firmware
Rename the gphy firmware to match the name requested by kernel 4.14 and
update the devicetree source files to use the new name.

Update the u-boot lantiq Makefile to be compatible with the new names as
well.

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

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

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

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Felix Fietkau cde71a543c build: replace uses of OpenWrt with $(VERSION_DIST)
This makes the distribution name more configurable.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Yousong Zhou 82ceb2ad2a build: add config option KERNEL_MIPS_FPU_EMULATOR
To make it more accessible for nodejs users to configure and run a build
on mips target lacking hardware fpu

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
6 years ago
Mathias Kresin d3fd38637f lantiq: create ATM/PTM interfaces with dsl as netdev name
Renaming an atm etherbride using 'ip link' (via hotplug) is racy since the
original netdev might disappear before br2684ctl has finished appling it's
setting:

 local2.notice br2684ctl[1667]: Interface "nas0" created sucessfully
 local2.notice br2684ctl[1667]: Communicating over ATM 0.8.35, encapsulation: LLC
 kern.info kernel: dsl0: renamed from nas0
 kern.err kernel: br2684:br2684_regvcc: tried to attach to non-existent device
 local2.err br2684ctl[1667]: Could not configure interface:No such device or address

By passing the final used netdev name to br2684ctl_wrap another race
condition workaround will be enabled again.

Change the lantiq ptm driver to create a netdev with the name dsl as well.
Albeit the rename via 'ip link' works fine so far, using a different
approach for ptm then atm could be confusing.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin d726187367 lantiq: fix wbmr-hp-g300h image metadata
The Annex A and Annex B version are using the same (old) userspace
boardname. Update the SUPPORTED_DEVICES to allow an update from lede-17.01.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Thomas Nixon 9fc9fbeb97 lantiq: fix dts compatible string
This was broken in 7bab49fd ("lantiq: add compatible strings to dts
files"), causing for the dm200 garbled serial output during boot, and
likely other issues.

Signed-off-by: Thomas Nixon <tom@tomn.co.uk>
[fix the compat string of the P2601HNFX as well]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Martin Schiller 94952636e7 lantiq: remove DSL_ChipSetHWVersion from status information
The value DSL_ChipSetHWVersion is fetched from the dsl frontend
via the dsl_control service, but not really provided by the dsl
frontend firmware and for now always "UNKNOWN".

The lantiq support told us that this information wouldn't be
provided in the foreseeable future, so let's remove this
useless "UNKNOWN" information.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
6 years ago
Hauke Mehrtens f704b643b9 kernel: Update kernel 4.9 to 4.9.70
Runtime tested on lantiq.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 years ago
Mathias Kresin 4a4d957d1a lantiq: sync image filename with boardname
Use <manufacturer>_<modelname> as image name.

Use the BOARD_NAME variable to ensure that the former used boardname is
still used as the subdirectory name for the sysupgrade-tar image, to
not break sysupgrade from earlier versions.

While at it, normalise the image filenames by using only lower case
characters and bin as file extension for sysupgrade images.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 58c6ad53a8 lantiq: drop unused variable from image build code
Remove the DEVICE_PROFILE variable. The variable isn't
used at all.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 7f68bd8119 lantiq: use the generic board detect
Drop the target specific detection function in favour of the generic
one provided by base-files.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin ed72540c10 lantiq: add missing model names
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 26dc65b126 lantiq: remove the former board name from device tree model
Remove the former used board name from the device model property and
use the model name as it is.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 63d7f7fc92 lantiq: use the compatible string as board name
Use the first compatible string as board name in userspace. Add the new
board name as well as the former used board name to the image metadata
to keep compatibilty with already deployed installations.

Don't add the former used boardname for boards which exists only in
master or evaluation boards.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin aba421432f lantiq: drop SoC name from eval boards compatible string
Keep it in the same format as used for the other eval boards.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 7bab49fd7a lantiq: add compatible strings to dts files
The compatible string is mandetory for devicetree source file.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Christian Lamparter da6fdce365 base-files: unify get_dt_led helper function
Lantiq and IPQ806X (which includes IPQ40XX) both define the
same custom function {ipq806x|lantiq}_get_dt_led.

This patch moves the function into the base-file package at
lib/functions/leds.sh to make it more accessible for other
targets as well.

Cc: Mathias Kresin <dev@kresin.me>
Cc: John Crispin <john@phrozen.org>
Cc: Hannu Nyman <hannu.nyman@iki.fi>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Luis Araneda 575178e462 treewide: add only one device when appending to TARGET_DEVICES
This will avoid some conflicts when doing a git rebase or merge,
specially when adding support to a new device.

Signed-off-by: Luis Araneda <luaraneda@gmail.com>
[drop brcm47xx changes which rename the images]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin ab6620e817 lantiq: dgn3500 drop worldwide suffix
Remove the WW suffix, everything without a region suffix is world wide
anyway.

While at it, normalise the image filenames by using only lower case
characters.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 0c7ad4e5d3 lantiq: nand: drop ubifs images
Users are confused which image type they should use and there are more
drawbacks than adavantages in using a r/w ubifs rootfs in constrast to
a read-only squashfs rootfs like:

 - less available free flash space due to better compression of squashfs
   images
 - no support for factory reset due to r/w filesystem
 - possibility to break failsafe due to r/w filesystem

Therefore, drop support for r/w ubifs rootfs images.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Zoltan HERPAI 7b5c989ab9 merge: targets: update image generation and targets
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
7 years ago
Stijn Tintel f997478655 kernel: bump 4.9 to 4.9.67
Refresh patches.
Remove upstreamed patches:
- generic/190-1-5-e1000e-Fix-error-path-in-link-detection.patch
- generic/190-3-5-e1000e-Fix-return-value-test.patch
- generic/190-4-5-e1000e-Separate-signaling-for-link-check-link-up.patch
- generic/190-5-5-e1000e-Avoid-receiver-overrun-interrupt-bursts.patch
- ramips/0102-MIPS-ralink-Fix-MT7628-pinmux.patch
- ramips/0103-MIPS-ralink-Fix-typo-in-mt7628-pinmux-function
Update patches that no longer apply:
- layerscape/815-spi-support-layerscape.patch
- ramips/0099-pci-mt7620.patch

Compile-tested on ar71xx, brcm2708/bcm2708, octeon and x86/64.
Runtime-tested on ar71xx, brcm2708/bcm2708, octeon and x86/64.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Koen Vandeputte 62ede4f783 kernel: bump 4.9 to 4.9.63
Refreshed all patches.

Removed upstreamed parts.

Compile-tested: cns3xxx, imx6, mvebu, layerscape
Run-tested: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 years ago
Daniel Gimpelevich a6e9d146f2 lantiq: add missing macaddr retrieval for Netgear DGN3500
The MAC addresses were not being set for LAN and WAN. This will now use the
same MAC mechanism as the rest of the target.

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
7 years ago
Mathias Kresin b02b7004f8 lantiq: xway: rename nas0/ptm0 to dsl0
This change makes it possible to configure the wan/dsl ppp interface
settings independantly from the used TC-Layer (ATM/PTM).

By using dsl0 as interface name as for the xrx200 we can get rid of a
few conditionals which were introduced because of the different default
TC-Layer in xway and xrx200.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 664369f6b2 lantiq: match default adsl annex and firmware
Set a default Annex matching the the annex of the selected adsl
firmware.

Set Annex B for xrx200 board which are known to have an ADSL hybrid for
Annex B.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 9dd2d99525 lantiq: add missing default lan interface
With removing the boards from the the default case to fix the xDSL WAN
MAC-Address, the setting for the default LAN interface wasn't added.

Fixes: 92a12c434c ("lantiq: fix avm fritz box mac addresses")

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 36d2884d55 lantiq: ARV752DPW22: fix wireless mac address
The ARV752DPW22 has the same generic mac address in the EEPROM as it
was already noticed for other lantiq boards using a ralink wireless.

Use the base mac address from the boardconfig partition as it is done
by the stock firmware.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin a02a866519 lantiq: ARV752DPW22: set correct wireless led trigger
The ARV752DPW22 has a ralink based wireless and can not use the ath9k
only phy0tpt trigger.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Martin Schiller 2dc9c8206b lantiq: xrx200: rename nas0/ptm0 to dsl0
This change makes it possible to configure the wan/dsl ppp interface
settings independantly from the used TC-Layer (ATM/PTM).

Now you can move a device from an ADSL/ATM port to an VDSL/PTM port
without any configuration changes for example.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
[use the dsl0 interface name for the default netdev trigger in 01_led,
add ip dependency]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Stijn Tintel 239dff6697 kernel: update and refresh patches
The lantiq patch 0028-NET-lantiq-various-etop-fixes.patch and sunxi
patch 0051-stmmac-form-4-11.patch no longer applied after applying the
the "generalize napi_complete_done()" patch.
Update them so they apply, and refresh patches while at it.

Fixes: 9aeb7ce8dc ("generic: net: generalize napi_complete_done")
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Mathias Kresin d65b1c815a lantiq: drop phy id specfic compatible string
With kernel commit 7630ea4bda18 ("Documentation: net: phy: improve
explanation when to specify the PHY ID") the purpose of using phy id
specific compatibles was clarified.

Remove the phy id specific compatibles since they are meant to be used
if the phy reports an incorrect or no phy id at all.

Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin a6bd7255ab lantiq: remove gen_nand compatible string
The generic nand driver fails to load with:

  gen_nand 14000000.nand-parts: platform_nand_data is missing
  gen_nand: probe of 14000000.nand-parts failed with error -22

and the xway-nand driver is used afterwards.

Drop the gen_nand compatible to get rid of the error message.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Thibaut VARÈNE 254061ee97 build: add mktplinkfw2 hardcoded values to makefile
This patch adds all the board-specific values currently hardcoded
in mktplinkfw2.c back to the respective device declarations in the
makefiles.

The rationale is to avoid modifying the source code every time a
new board or board variant is added.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
7 years ago
Mathias Kresin aba297b7fd lantiq: ase: enable USB and wireless
Add the missing USB related kernel config options to target config.
Enable wireless as well, wireless is supported via USB.

Fixes compile/packaging errors with the libertas wireless kernel
module.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 695645b9ac lantiq: ase: fix SPI support
Do not disable SPI in the subtarget, otherwise the SPI driver can not
be used.

Disable SPI by default and enable it in the board specific device tree
source file.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 66a0f3a397 lantiq: select PCI support in subtargets
AmazonSE and Falcon do not have support for PCI and it can't be
unselected in the subtarget kernel config. This way the enabled PCI
support is inherit from the higher level config to the subtarget.

If CONFIG_PCI is selected, PCI_SUPPORT will be autoselected as well and
all packages depending on this config symbol will be build and at least
some of them fail due to missing pci functions.

The issue can be observed if all kmods and all non-shared packages are
build. Fix the issue by enabling PCI support only in subtargets with
PCI support.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 77fee9bcce lantiq: ase: cleanup kernel config
The subtarget kernel config options CONFIG_CC_OPTIMIZE_FOR_SIZE and
CONFIG_HAVE_IRQ_EXIT_ON_IRQ_STACK are already set by the target or
global kernel config.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin d7a76be980 lantiq: xway: cleanup kernel config
CONFIG_SPI_LANTIQ was replaced by CONFIG_SPI_LANTIQ_SSC with the switch
to the upstreamed driver.

All other removed subtarget kernel config options are already set by
the target specific or global kernel config.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin d3f3b817ac lantiq: xrx200: cleanup kernel config
CONFIG_MTSCHED & CONFIG_PERFCTRS were never defined in the kernel.

CONFIG_LANTIQ_PHY was replaced by CONFIG_INTEL_XWAY_PHY with the switch
to the upstreamed driver.

Add autoselected dependecies to the kernel config.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 054f01ac16 lantiq: xrx200: fix sorting of kernel config
Use the kconfig script to sort the kernel config. It makes further
changes more obvious.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 1c45d11bb3 treewide: drop obsolete kernel config options
CONFIG_GPIO_DEVRES was removed with kernel commit f9c22ec6c1c5 ("gpio:
Remove GPIO_DEVRES option") during kernel 4.9 development.

CONFIG_HAVE_BPF_JIT was removed with kernel commit 6077776b5908 ("bpf:
split HAVE_BPF_JIT into cBPF and eBPF variant") during kernel 4.7
development.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Stijn Tintel 6e48eb22b8 kernel: update 4.9 to 4.9.51
Refresh patches.
Compile-tested on octeon and x86/64.
Runtime-tested on octeon and x86/64.

Fixes the following CVEs:
- CVE-2017-14106
- CVE-2017-14497

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Stijn Tintel d5b7215e31 kernel: update 4.9 to 4.9.49
Refresh patches.
Compile-tested on octeon and x86/64.
Runtime-tested on octeon and x86/64.

Fixes CVE-2017-11600.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Jorge Amorós e2218ea148 lantiq: ARV7519RW22: enable PCIe
Enable PCIe to make the (still unsupported) WAVE300 wireless visible to
the system.

Signed-off-by: Jorge Amorós <joramar76@yahoo.es>
7 years ago
Vittorio Alfieri 31b5069a50 lantiq: VR200v: enable PCI
Enable PCI to make the (still unsupported) WAVE300 wireless visible to
the system.

Signed-off-by: Vittorio Alfieri <vittorio88@gmail.com>
7 years ago
Mathias Kresin 47be42c347 lantiq: fix xrx200 switch carrier state
In conditions where none of the switch ports is connected during boot,
the priv->port[i].link != priv->port[i].phydev->link condition is false
since both link values are equal (false). The carrier of the switch
netdev is never set to off and the link state reported by ip is UNKNOWN.

Turn the carrier off if none of the switch ports has a link, regardless
whether something has been changed. Add a check for a carrier to
prevent unnecessary calls to netif_carrier_off() if the carrier is
already off.

Based on a patch send by Martin Schiller.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 6b06c2fb8e lantiq: drop kernel 4.4 support
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Edward O'Callaghan e0d6f541f7 lantiq: switch to kernel 4.9
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years ago
Daniel Golle 2f0a8558be lantiq: ACMP252: clean up device modules
Install kmod-rt2800-pci instead of only the rt2x00 library.
Fixes missing wireless interface on AudioCodes AC-MP252.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
7 years ago
Kevin Darbyshire-Bryant 364befeccf kernel: update 4.4 to 4.4.83
Refresh patches.
Minor update 704-phy-no-genphy-soft-reset.patch which was partially
accepted upstream.
Compile-tested on ar71xx.
Runtime-tested on ar71xx.

Fixes the following vulnerabilities:
- CVE-2017-7533 (4.4.80)
- CVE-2017-1000111 (4.4.82)
- CVE-2017-1000112 (4.4.82)

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
[cleanup commit message, add compile/runtime tested]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Stijn Tintel 2d02a4f5bd kernel: update 4.9 to 4.9.44
Refresh patches.
Adapt 704-phy-no-genphy-soft-reset.patch.
Remove brcm2708/950-0005-mm-Remove-the-PFN-busy-warning.patch.
Compile-tested on brcm2708/bcm2708 and x86/64.
Runtime-tested on brcm2708/bcm2708 and x86/64.

Fixes the following vulnerabilities:
- CVE-2017-7533
- CVE-2017-1000111
- CVE-2017-1000112

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Daniel Gonzalez Cabanelas e1f91b4a1c lantiq: fix missing otg_cap on danube platform
USB doesn't work in some danube boards because otg_cap
is missing since previous changes made on the USB-dwc2
lantiq driver. Fix it.

Tested on the ARV7518PW router.

Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu@gmail.com>
7 years ago
Martin Schiller c8904e9c04 lantiq: board.d: use auto xfer_mode as default
If xfer_mode is set to auto the vdsl_cpe_control daemon assumes that
ATM should be used for ADSL and PTM for VDSL.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
7 years ago
Martin Schiller 0481a2a2c5 lantiq: split up dsl_notify.sh into separate notification handlers
This makes it possible to simply add additional notification handlers
by putting new scripts in the /etc/hotplug.d/dsl directory.

the following Environment Variables are used:

(values marked with an * are only available when bonding support is
compiled in)

DSL_NOTIFICATION_TYPE with one of these values:
- DSL_STATUS
- DSL_INTERFACE_STATUS
- DSL_DATARATE_STATUS_US
- DSL_DATARATE_STATUS_DS

DSL_LINE_NUMBER=<0|1> *

If DSL_NOTIFICATION_TYPE == DSL_STATUS, these variables are set:

- DSL_XTU_STATUS=<ADSL|VDSL>
- DSL_TC_LAYER_STATUS=<ATM|EFM>
- DSL_EFM_TC_CONFIG_US=<NORMAL|PRE_EMPTION>
- DSL_EFM_TC_CONFIG_DS=<NORMAL>

If DSL_NOTIFICATION_TYPE == DSL_INTERFACE_STATUS, these variables are
set:

- DSL_INTERFACE_STATUS=<DOWN|READY|HANDSHAKE|TRAINING|UP>
- DSL_BONDING_STATUS=<INACTIVE|ACTIVE> *

If DSL_NOTIFICATION_TYPE == DSL_DATARATE_STATUS_US, these variables are
set:

- DSL_DATARATE_US_BC0=<Upstream data rate in bit/s for Channel 0>
- DSL_DATARATE_US_BC1=<Upstream data rate in bit/s for Channel 1> *

If DSL_NOTIFICATION_TYPE == DSL_DATARATE_STATUS_DS, these variables are
set:

- DSL_DATARATE_DS_BC0=<Downstream data rate in bit/s for Channel 0>
- DSL_DATARATE_DS_BC1=<Downstream data rate in bit/s for Channel 1> *

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
7 years ago
Andrea Merello b81c04382b lantiq: fix sleep with spinlock held in xrx200 network driver
In the xrx200_close() function we call napi_disable(), that could
sleep, with priv->hw->chan[i].lock held. This could lead to deadlock
and causes the kernel to complain.

Look at the code I couldn't convince myself about why we
need to protect that specific code part with the lock. IMHO there
seems no reason to protect the refcount variables, because AFAIK
ndo_close() and ndo_open() callbacks are already called with a
semaphore held. Neither I could figure out why napi_disable() have to
be called with that lock held. The only remaining code part for
which I could guess the lock is useful for is ltq_dma_close()
function call.

This patch reduces the lock to the said function call, avoiding the
sleep-with-spinlock-held situation

Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
[fold into 0025-NET-MIPS-lantiq-adds-xrx200-net.patch, backport to
kernel 4.4]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin ac3e05c5d7 treewide: populate boardname and model earlier
For targets using the generic board detection and board specific
settings in diag.sh, the board name is still unset at the time the
set_state() provided by diag.sh is called by 10_indicate_preinit.

Change the execution order to ensure the boardname is populated before
required the first time. Do the target specific board detection as
early as possible, directly followed by the generic one to allow a
seamless switch to the generic function for populating /tmp/sysinfo/.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Koen Vandeputte cd54b2d42b kernel: update kernel 4.9 to 4.9.37
- Refreshed all patches
- Removed upstreamed
- Adapted 4 patches:

473-fix-marvell-phy-initialization-issues.patch
-----------------------------------------------
Removed hunk 5 which got upstreamed

403-net-phy-avoid-setting-unsupported-EEE-advertisments.patch
404-net-phy-restart-phy-autonegotiation-after-EEE-advert.patch
--------------------------------------------------------------
Adapted these 2 RFC patches, merging the delta's from an upstream commit
(see below) which made it before these 2.

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-
stable.git/commit/?h=v4.9.36&id=97ace183074d306942b903a148aebd5d061758f0

180-usb-xhci-add-support-for-performing-fake-doorbell.patch
-----------------------------------------------------------
- Moved fake_doorbell bitmask due to new item

Compile tested on: cns3xxx, imx6
Run tested on: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 years ago
Mathias Kresin 3dc757856c lantiq: fix typo in EASY80920.dtsi
There is no device tree property named phynmode0. Use phy-mode as it is
done for the other ethernet nodes.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Thomas Nixon 50e3659703 lantiq: add Netgear DM200 support
Netgear DM200 is an inexpensive VDSL modem:

    CPU: VRX220 MIPS 34Kc 5.6 @ 500Mhz
    RAM: 64MiB
    Flash: 8MiB
    Ethernet: 1x100M
    DSL: VDSL2+, ADSL2+
    reset button, 3x bi-color LEDs

Serial port is 115200 baud, on the 4 pin header; pins from the bottom to
top are GND, RX, TX.

To upgrade from the vendor firmware, upload factory.img

The DM200 bootloader supports flashing over TFTP; hold the reset button
while powering on the device, and wait for the power light to start
flashing green before releasing. The device is now listening on
192.168.0.1/24, and can be sent a factory.img or a netgear image with a
TFTP put.

Once the image is loaded, it will be written to the flash, and the
device will reboot; this will take a few minutes.

Thanks to Edward O'Callaghan and Baptiste Jonglez, who implemented their
own ports for this device and provided valuable feedback.

Signed-off-by: Thomas Nixon <tom@tomn.co.uk>
7 years ago
Mathias Kresin 08c499f865 lantiq: use img file extension for DGN3500 factory images
The Netgear UI in basic mode refuses the upgrade file if the the
fileextension is not img. The expert/advanced mode accepts any
fileextension. Use img to make it work in any case.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Piotr Dymacz 5b7f592251 build: move mktplinkfw2 related commands to image-commands.mk
There are already two targets (lantiq, ramips) which use mktplinkfw2
tool for creating images. This de-duplicates code, introduces two new
build commands: tplink-v2-header, tplink-v2-image and makes use of
them in place of old, (sub)target specific ones.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
7 years ago
Stijn Tintel 880f73c327 kernel: cleanup CONFIG_SCHED_HRTICK
Remove CONFIG_SCHED_HRTICK from target configs, as it was added to the
generic config in b47fd76563.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Koen Vandeputte 69649a1b45 kernel: update kernel 4.9 to 4.9.34
- Refreshed all patches
- Adapted 1 (0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch)

Compile tested on: brcm2708, cns3xxx, imx6
Run tested on: brcm2708, cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[Compile and run tested on brcm2708]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Mathias Kresin 8e0d7d6574 build: move lzma2eva build step to image-commands.mk
Move it to image-commands.mk so that it can used by other targets with
eva based boards as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin d165f1f3bc kernel: move Lantiq PEF7061/7071/7072 phy driver to generic
The driver is used for boards outside the lantiq target as well. Move
it to generic to make it available for more targets.

The phy driver is included in kernel 4.8 as INTEL_XWAY_PHY.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 259fc1e778 lantiq: show xdsl line init status on shared dsl/internet led
On boards which don't have a distinct internet and dsl led, use the
shared LED to indicate the xdsl line state and any traffic that is
send/received via the netdev. This traffic doesn't necessarily need to
be internet traffic.

Rename the shared LED of existing configs to "dsl", to match the new
defaults. The configuration of the to be renamed LED is identical with
the new defaults.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Martin Schiller 03776d813c lantiq: restore netdev trigger of dsl led on line up
Allows to use a single LED for line init status indication and to show
any rx/tx activity on a synchronized dsl line.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Sergey Ryazanov 68e7a2a0b7 kernel: disable CONFIG_SG_POOL by default
CONFIG_SG_POOL symbol is selected only by CONFIG_SCSI, since the last
one is disabled by default then disable CONFIG_SG_POOL by default too.
And explicitly enable it only for platforms that use CONFIG_SCSI.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
7 years ago
Tino Reichardt e097eb27af lantiq: fix 0008-MIPS-lantiq-backport-old-timer-code.patch for Amazon-SE
The patch 0008 removes the vanilla kernel gptu.c of lantiq.
But the replacement file timer.c does not work Amazon-SE and
is also protected therefore with an CONFIG_SOC_AMAZON_SE :-)

This commit will re-activate the default vanilla kernel code
in gptu.c for Amazon-SE.

Signed-off-by: Tino Reichardt <milky-lede@mcmilk.de>
[refresh patches and add same change for kernel 4.9]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Tino Reichardt 712ebe95f8 lantiq: add Allnet ALL0333CJ support
This patch adds support for the Allnet ADSL2+ Modem ALL0333CJ.

Specifications:
- SoC: Amazon-SE
- RAM: 16MB
- Storage: 4MB NOR FLash
- LEDs: Power, Ethernet, DSL (Sync)
- Buttons: 1x Reset Button (not currently supported, will be done)
- 1x Ethernet-Port: 1x RJ45 10/100BaseTX
- 1x WAN-Port: AnnexB & J, G.992.1(ADSL), G.992.3(ADSL2), G.992.5(ADSL2+)

Installation:
- can be done via telnet+tftp or serial console
- default passwords:
  - via telnet (root:admin)
  - via webinterface http://172.16.1.254:8235/ (admin:coolwhite)

Installation via telnet / tftp:
host: # your own host must have an tftpd daemon, then do this:
host: ifconfig eth0:172 172.16.1.1 up
host: # telnet to allnet modem, root:admin
host: telnet 172.16.1.254
modem: # kill this daemon, it spams your console
modem: killall dsl_cpe_control
modem: # change to some place in ram:
modem: cd /ramdisk/tftp_upload
modem: # load lede-lantiq-ase-ALL0333CJ-squashfs-sysupgrade.bin alias uImage
modem: tftp -g -r uImage 172.16.1.1
modem: # load these extra tools from your tftpd via:
modem: # source: https://github.com/mcmilk/uboot-utils/releases/download/0.1/mips32.tar.gz
modem: tftp -g -r flashwrite 172.16.1.1
modem: tftp -g -r fw_setenv 172.16.1.1
modem: tftp -g -r fw.conf 172.16.1.1
modem: ln -s fw_setenv fw_printenv
modem: chmod +x *
modem: ./fw_setenv disable_recovery y
modem: ./fw_setenv kernel_addr 0xb0010000
modem: ./flashwrite /dev/mtd/1 uImage 0

Installation via serial line at uboot:
uboot: # erase everything exept bootloader
uboot: protect on b0000000 +10000; protect on b03f0000 +10000
uboot: erase all
uboot: # get new firmware via tftp:
uboot: tftpboot 0x80100000 uImage; setenv kernel_addr 0xb0010000
uboot: # copy to flash:
uboot: cp.b 0x80100000 $(kernel_addr) $(filesize)
uboot: # disable proprietary image checking:
uboot: setenv disable_recovery=y; saveenv
uboot: # reboot with LEDE ;)
uboot: reset

Ethernet works as expected, DSL syncronization does not work properly
currently, I am working on this issue.

Signed-off-by: Tino Reichardt <milky-lede@mcmilk.de>
7 years ago
Tino Reichardt 995ad357f9 lantiq: enable Netgear DGN1000B image build
Enable the building of Netgear DGN1000B images. I have an
example device here, but it was not tested currently.
Also WLAN and USB is not ready in the moment.

This is just the proper way, so that developing on this
device is known to be done in the near future.

Signed-off-by: Tino Reichardt <milky-lede@mcmilk.de>
7 years ago
Tino Reichardt 9b321bc60d lantiq: add Amazon-SE subtarget
Re-Add support for the Amazon-SE subtarget on Lantiq.

Signed-off-by: Tino Reichardt <milky-lede@mcmilk.de>
7 years ago
Tino Reichardt 1039e41dea lantiq: fix amazonse.dsti
Add missing memory@0 and localbus@0 sections.
Fix MEI and GPTU interrupt definitions.

Signed-off-by: Tino Reichardt <milky-lede@mcmilk.de>
7 years ago
Helge Mader 63a20c95fd lantiq: modified lantiq_dsl.sh status output of latency
Signed-off-by: Helge Mader <ma@dev.tdt.de>
7 years ago
Helge Mader 666dd85b36 lantiq: fix lantiq_dsl.sh status and lucistat output
Signed-off-by: Helge Mader <ma@dev.tdt.de>
7 years ago
Martin Schiller 82f7fd7457 lantiq: pinctrl: xway: fix copy/paste error in xrx200_grps
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
7 years ago
Hauke Mehrtens 0b17375931 kernel: update kernel 4.9 to 4.9.30
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Mathias Kresin 822ee54544 treewide: fix device tree path in scripts
The device tree is at /proc/device-tree/ without a base subdir.

Fixes: da472e5b30 ("treewide: access device tree from userspace via /proc/")

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin da472e5b30 treewide: access device tree from userspace via /proc/
Access the device tree via /proc/device-tree/ is the documented way to
access the properties. Everything else might not work in future.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Hauke Mehrtens 6153248052 lantiq: spi: double time out tolerance
The generic SPI code calculates how long the issued transfer would take
and adds 100ms in addition to the timeout as tolerance. On my 500 MHz
Lantiq Mips SoC I am getting timeouts from the SPI like this when the
system boots up:

m25p80 spi32766.4: SPI transfer timed out
blk_update_request: I/O error, dev mtdblock3, sector 2
SQUASHFS error: squashfs_read_data failed to read block 0x6e

After increasing the tolerance for the timeout to 200ms I haven't seen
these SPI transfer time outs any more.
The Lantiq SPI driver in use here has an extra work queue in between,
which gets triggered when the controller send the last word and the
hardware FIFOs used for reading and writing are only 8 words long.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Koen Vandeputte e842e16f45 kernel: update kernel 4.9 to 4.9.29
- Refresh all patches
- Removed upstreamed
- Adapted 1

Compile tested on: bcm53xx, cns3xxx, imx6, lantiq
Run tested on: cns3xxx & imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[update from 4.9.28 to 4.9.29]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Kevin Darbyshire-Bryant 088e28772c kernel: update kernel 4.4 to version 4.4.69
Refresh patches. A number of patches have landed upstream & hence are no
longer required locally:

062-[1-6]-MIPS-* series
042-0004-mtd-bcm47xxpart-fix-parsing-first-block

Reintroduced lantiq/patches-4.4/0050-MIPS-Lantiq-Fix-cascaded-IRQ-setup
as it was incorrectly included upstream thus dropped from LEDE.
As it has now been reverted upstream it needs to be included again for
LEDE.

Run tested ar71xx Archer C7 v2 and lantiq.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
[update from 4.4.68 to 4.4.69]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Mathias Kresin 92a12c434c lantiq: fix avm fritz box mac addresses
It has been shown that the Fritz boxes have the correct mac address set
in the wireless calibration data/eeeprom. Use this mac address as base
for the ethernet and xdsl interface increment/decrement the address to
match the values stored in the tffs.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Kevin Darbyshire-Bryant 42120bd7f3 lantiq: DGN3500: make switch LEDs blink on activity
Make switch port LEDs blink on activity as they do with stock firmware.

The u-boot loader sets suitable values in the LED control register that
unfortunately get blown away by the linux switch driver init.  Restore
that value by using driver 'initvals'.  0x0431 is the led control
register, the value 0x0960. Each nybble represents each LED's mode
(LED3,2,1,0) in this case OFF, 1000LINK+Activity, 100/10LINK+Activity,
OFF.  Only LED1&2 are physically present.

Enabling the blinkenlights exposed the fact that an RRCP packet was
being emitted by the switch on all ports every second.  Further initvals
copied from stock firmware's u-boot driver disabled this 'feature'.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
7 years ago
Kevin Darbyshire-Bryant e1d433b293 lantiq: improve DGN3500 LED definitions
Add red:internet led on gpio 30 previously claimed as missing.
Wifi led was claimed as blue however there are no blue leds on the
board at all.  Actually there are two wifi leds, green & amber so add
definitions for those.  Make the newly discovered green wifi led gpio
14 the default.

There is no amber power led on this board. The mention of the amber
power led in the manual means power red and power green at the same
time.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
[removed unnecessary aliases, add migration script]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Jo-Philipp Wich aefa195749 kernel: update kernel 4.4 to 4.4.61
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
7 years ago
Mathias Kresin af9afa2811 lantiq: drop tffs patches
With the fritz-tools a userspace parser for the Tiny Flash File System
is available and makes the tffs2 kernel patches obsolete.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 136718a3d9 kernel: update MIPS pci fix to the accepted version
Fix the list order instead of adjusting the controller scan order.
Revert the former required changes to the lantiq PCIe driver.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Hauke Mehrtens 6c1657623f lantiq: update spi driver to upstream version
These patches are backported from upstream Linux kernel.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens fb7ea71c15 kernel: update kernel 4.9 to 4.9.17
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Stefan Koch 322a7226d3 lantiq: vr9 fxs support: remove unused wdog declarations and initializers
modify 0152-lantiq-VPE.patch from
commit e0229a16b0 ("lantiq: added support for VPE1")

- remove wdog function declarations from header (asm/vpe.h)
- remove wdog command line init functions (vpe.c)

Signed-off-by: Stefan Koch <stefan.koch10@gmail.com>
7 years ago
Stefan Koch c9783dd728 lantiq: vr9 fxs support: remove soft-watchdog functionality
- remove patched header (vpe.h) because kernel
  already provides one (asm/vpe.h)
- remove module softdog_vpe since watchdog functionality is unused
- remove module softdog_vpe from Makefile

Signed-off-by: Stefan Koch <stefan.koch10@gmail.com>
7 years ago
Mathias Kresin e4c53c751e lantiq: fix pci with kernel 4.9
Commit 23dac14d058f ("MIPS: PCI: Use struct list_head lists") changed
the controller list from reverse to straight order. Use the last entry
in the controller list to get the fist conroller of the system.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Felix Fietkau fd93f81fd8 lantiq: remove lantiq_board_model, it is unused
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 7e798dab56 lantiq: remove lantiq_board_name, use the generic function instead
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau aa95d6cd20 lantiq: move lantiq_board_detect() to 03_preinit_board.sh
It is only used there

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Oswald Buddenhagen 6a82f4006c lantiq: Shortcut non-pppoa interfaces in dsl_notify
No need to query 'up' and 'auto' when they are not going to be used.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
7 years ago
Stefan Koch 443e67a459 lantiq: vr9 fxs support: fixed check of SMP state within vpe-mt.c
SMP state is generally affected by
- CONFIG_SMP build-time kernel configuration option and
- 'nosmp' runtime kernel commandline option

The SMP state within vpe-mt.c is determined by CONFIG_SMP option.
A runtime check is needed if VPE functionality
should be used with a kernel image that supports SMP.

This fix introduces a check for 'nosmp' command line option
if CONFIG_SMP kernel configuration option is enabled.

Note: This patch is needed to use lantiq FXS if CONFIG_MIPS_MT_SMP
(that activates CONFIG_SMP) is enabled within kernel configuration
and the 'nosmp' command line argument is given to disable SMP at runtime.

Without this patch CONFIG_MIPS_MT_SMP must be disabled before using FXS.
With this patch setting the 'nosmp' parameter is enough.

In general, concurrent usage of FXS and SMP
is incompatible and will cause kernel panics.

Signed-off-by: Stefan Koch <stefan.koch10@gmail.com>
7 years ago
Stefan Koch d4203dfa55 lantiq: vr9 fxs support: fixed check of SMP state within vpe-mt.c
SMP state is generally affected by
- CONFIG_SMP build-time kernel configuration option and
- 'nosmp' runtime kernel commandline option

The SMP state within vpe-mt.c is determined by CONFIG_SMP option.
A runtime check is needed if VPE functionality
should be used with a kernel image that supports SMP.

This fix introduces a check for 'nosmp' command line option
if CONFIG_SMP kernel configuration option is enabled.

Note: This patch is needed to use lantiq FXS if CONFIG_MIPS_MT_SMP
(that activates CONFIG_SMP) is enabled within kernel configuration
and the 'nosmp' command line argument is given to disable SMP at runtime.

Without this patch CONFIG_MIPS_MT_SMP must be disabled before using FXS.
With this patch setting the 'nosmp' parameter is enough.

In general, concurrent usage of FXS and SMP
is incompatible and will cause kernel panics.

Signed-off-by: Stefan Koch <stefan.koch10@gmail.com>
7 years ago
Hauke Mehrtens 31c6452107 kernel: update kernel 4.4 to 4.4.53
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens 9a065fcfec kernel: update kernel 4.9 to 4.9.14
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Mathias Kresin 73eb5c74a1 lantiq: use the P2812HNUF* wan port as wan
The port is labeled as wan and was only used as lan port because of the
"tx ring full" issues fixed with 8f02f7c.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin cd8b20931e lantiq: xrx200: use vlan for ethernet wan port
Using the lantiq,wan device tree property for one interface node and
the lantiq,switch device tree property for another interface node at
the same time was never intended/isn't supported at the moment.

The property is meant to be used in two phy operation mode where one
phy is assigned to an interface without lantiq,* device tree property
and the other phy is assigned to an interface with the lantiq,wan
device property to have two netdevs.

If both properties are used at the same time, the lantiq,wan interface
is shown as independent netdev but not able to operate independent. The
port needs to be managed via swconfig. These dependency is not obvious
and fooled already a lot of users.

Add a default WAN vlan for xrx200 devices having an ethernet WAN port
and remove the lantiq,wan device tree property. Leave it up to the user
to set the ethernet WAN port as default WAN interface or to use this
port as additional LAN port.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 715b066419 lantiq: fix broadcasts and vlans in two iface mode
The two phy operation mode where one phy is assigned to an interface
without lantiq,* device tree property and the other phy is assigned to
an interface with the lantiq,wan device property was broken with the
multicast package leaks between vlans fixes.

Move the multicast packages relevant portmap settings to the condition
which handles multicast packages for better readability.

Replace the priv->port_map based port_map only for the interface which
has the lantiq,switch device tree property set, to allow tagged
multicast packages in two phy mode where the lantiq,switch device tree
property isn't used.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Alex Maclean 6254a2028c lantiq: add support for the Alpha ASL56026
The ASL56026 is a VDSL2 router with dual 100mbit ethernet,
also known as the ECI B-FOCuS V-2FUb/I.

CPU: Lantiq XRX268 v1.1 at 333MHz
Modem: Lantiq VRX208
RAM: 32MiB DDR2 at 167MHz
Flash: 8MiB NOR, Spansion S29GL064N90TF04

UART is at JP1:
Pin 1 TX
Pin 2 GND
Pin 3 +3.3V
Pin 4 NC
Pin 5 RX

Boot selection pins are exposed via several resistor jumpers:
boot_sel0 is at J15, on the rear of the board. Default is high.
boot_sel1 is at J3, next to the flash - it is also the flash CE# pin. Default is low.
boot_sel2 is at J12, directly below the SoC. Default is low.
boot_sel3 is at J16, on the rear of the board. Default is low.

The boot_sel pins should never be shorted, the jumper must be moved or
a lower value resistor used to change the pull (existing resistors are 4k7, 1k should work)

To install with the stock bootloader you must break the built in image selection process
which uses at least the following vars: f_upgrade_addr, f_upgrade2_addr, loadaddr, kernel_addr, activeregion, committedregion
This is done by setting loadaddr and both f_upgrade_addr vars to the same address:

	VR9 # setenv loadaddr 0xB0040000
	VR9 # setenv f_upgrade_addr 0xB0040000
	VR9 # setenv f_upgrade2_addr 0xB0040000
	VR9 # saveenv

Then flash the firmware image:

	VR9 # tftpboot 0x81000000 lede-lantiq-xrx200-ASL56026-squashfs-sysupgrade.bin
	VR9 # erase B0040000 +${filesize}
	VR9 # cp.b 0x81000000 0xB0040000 ${filesize}

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
7 years ago
Alex Maclean a9b74f9f81 lantiq: clarify VG3503J name
Append the ECI model to the device name, to avoid confusion with the
older model.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
7 years ago
Felix Fietkau 891ed144ff lantiq: select kmod-mt7603 instead of kmod-mt76 for WBMR-300HPD
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 735a27df81 lantiq: fix broadcast packets leaking on the wrong vlan on xrx200
The ethernet driver uses a port map override via special tag to control
the ports on which multicast packets are sent. This was added to work
around an issue in the switch that was occasionally leaking packets onto
the wrong vlan.
Unfortunately the change had some leftover lines that were overwrting
the port map with a list of all ports, thus always leaking packets onto
the wront vlan.

Fix this by only enabling the override with the VLAN port map and only
if a matching VLAN port map was actually found

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Mathias Kresin bececcce86 lantiq: fix warning if ltq_atm modules are missing
Fixes the following warning on first boot if the ltq_atm modules are
not included in the image:

  ls: /lib/modules/4.4.49/ltq_atm*: No such file or directory

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin e88b36f4be lantiq: set the internet led interface according to wan interface
Use the nas0 interface for the netdev trigger as default. Use the ptm0
interface for xRX200 boards to match the default wan interface set in
02_network.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin 044a4eafd5 lantiq: introduce lantiq_is_vdsl_system
Move the code to check if the current system is a system with vdsl
support to a dedicate function to make it reusable.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin cfd16ecc48 lantiq: fix ARV7519RW22 switch port indexing
Fixes FS#454.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Martin Blumenstingl 70395ae8cb lantiq: fix patching the wifi mac address on BTHOMEHUBV3A
The firmware hotplug script tries to read the mac address from a
partition with the name "uboot-env" which does not exist (instead it's
name is uboot_env). This broke calculation of the new checksum (after
patching the mac address) which resulted in ath9k refusing to use the
EEPROM data.

The original error reported by ath9k was:
PCI: Enabling device 0000:00:0e.0 (0000 -> 0002)
ath: phy0: Bad EEPROM checksum 0x2523
ath: phy0: Unable to initialize hardware; initialization status: -22
ath9k 0000:00:0e.0: Failed to initialize device

Fixes: a20616863d ("lantiq: use ath9k device tree bindings
binding/owl-loader")

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
7 years ago
Hauke Mehrtens 136d4a0656 lantiq: fix section mismatch in PCIe driver
Do not put the probe function into the __init section, but use the normal
section. This fixes a section mismatch warning.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens 863e79f8d5 lantiq: add support for kernel 4.9
The following patches were dropped because they are already applied
upstream:
0012-pinctrl-lantiq-fix-up-pinmux.patch
0013-MTD-lantiq-xway-fix-invalid-operator.patch
0014-MTD-lantiq-xway-the-latched-command-should-be-persis.patch
0015-MTD-lantiq-xway-remove-endless-loop.patch
0016-MTD-lantiq-xway-add-missing-write_buf-and-read_buf-t.patch
0017-MTD-xway-fix-nand-locking.patch
0044-pinctrl-lantiq-introduce-new-dedicated-devicetree-bi.patch
0045-pinctrl-lantiq-Fix-GPIO-Setup-of-GPIO-Port3.patch
0046-pinctrl-lantiq-2-pins-have-the-wrong-mux-list.patch
0047-irq-fixes.patch
0047-mtd-plat-nand-pass-of-node.patch
0060-usb-dwc2-Add-support-for-Lantiq-ARX-and-XRX-SoCs.patch
0120-MIPS-lantiq-add-support-for-device-tree-file-from-bo.patch
0121-MIPS-lantiq-make-it-possible-to-build-in-no-device-t.patch
122-MIPS-store-the-appended-dtb-address-in-a-variable.patch

The PHY driver was reduced to the code adding the LED configuration,
the rest is already upstream:
0023-NET-PHY-adds-driver-for-lantiq-PHY11G.patch

The SPI driver was replaced with the version pending for upstream
inclusion:
New driver:
0090-spi-add-transfer_status-callback.patch
0091-spi-lantiq-ssc-add-support-for-Lantiq-SSC-SPI-controller.patch
Old driver:
0100-spi-add-support-for-Lantiq-SPI-controller.patch

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Mathias Kresin a0888ecbaf generic: rtl8366rb: fix compatible string
Use a vendor prefix as it has to be for all not core driver. Update the
compatible string in the device tree files accordingly.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Felix Fietkau 71e86199ff lantiq: enable SMP for XRX200
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Alexander Couzens 2711b94932 lantiq: fix unaligned access in xrx200_poll_rx()
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
7 years ago
Mathias Kresin 271db9f18e lantiq: fix brnImage signature for the VGV7510KW22BRN images
The VGV7510KW22BRN and VGV7519BRN do not have the same brnImage
signature. It was accidentally changed with ba42c1d ("lantiq: un-macro
the image building code").

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Felix Fietkau ad85464f11 lantiq: remove CPU_TYPE:=mips32r2, it gets overwritten anyway
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau bfdc56d3a2 build: remove mips16 feature flag from target makefiles
It can be implicitly derived from the MIPS32 revision support in the
kernel configuration

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 254ccf9f4c lantiq: fix an ethernet stability issue triggered by receving packets during boot
Disabling ethernet during reboot (only to enable it again when the
ethernet driver attaches) can put the chip into a faulty state where it
corrupts the header of all incoming packets.

This happens if packets arrive during the time window where the core is
disabled, and it can be easily reproduced by rebooting while sending a
flood ping to the broadcast address.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 24c06e2481 lantiq: fix spurious irq storm
Since the MIPS IRQ stack patches, lantiq devices were emitting a storm
of messages like this:

[  567.872172] Spurious IRQ: CAUSE=0x1100c300

Fix this by reworking the IRQ dispatch code

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 1708644f19 kernel: backport MIPS changes introducing a separate IRQ stack
Prevents crashes when IRQs arrive when the current kernel stack context
already contains deeply nested function calls, e.g. when stacking lots
of network devices on top of each other

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Hauke Mehrtens 5b089e45a6 kernel: update 4.4 kernel to 4.4.42
Refresh patches on all 4.4 supported platforms.
Compile & run tested: lantiq/xrx200

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens f036956e1f lantiq: update USB controller initialization
This adds USB initialization fixes for Danube, Amazon SE and xrx300 and
should fix the clock on at least Danube which hopefully closes FS#351.

The xrx200 usb driver now uses more memory for the dwc2 fifos, this was
increased in the chip compared to ar9.

This is based in part on the vendor documentation and the vendor code
base as a reference.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens 2dac67464d lantiq: fix dma locking problems with SMP
The DMA controller used only local locks, which will not lock the
section against other CPUs, fix this by using spin locks.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Felix Fietkau 018d80007e kernel: remove ubifs xz decompression support
It has been unused, and less useful than squashfs for cases where flash
space usage matters.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Hauke Mehrtens 8f0dc92afd lantiq: fix console print for additional boards
I missed 3 boards in this commit:
commit d8dde8c517
Author: Hauke Mehrtens <hauke@hauke-m.de>
Date:   Wed Jan 4 21:53:22 2017 +0100

    lantiq: fix console print

Add bootargs parameters for ARV4525PW, ARV7506PW11 and ARV8539PW22
again.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Hauke Mehrtens d8dde8c517 lantiq: fix console print
The boot loader of many boards provides a kernel boot argument with a
broken console parameter to the kernel. This will be taken before the
stdout-path defined in device tree and the serial will not work on this
board. Multiple boards are affected by this problem, so revert this
patch for all boards. Later we can remove the boot arguments from the
device tree again, after the individual board was checked to work.

This partly reverts this commit:
commit 4995c64857
Author: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date:   Sun Dec 11 21:55:00 2016 +0100

    lantiq: specify console using stdout-path instead of cmdline argument

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
John Crispin 9998bc5ef7 lantiq: fix falcon build
The following commit changed the build templates name but forgot to
update the TARGET_DEVICES variable properly.

commit f9226158be (lantiq: rename EASY98000 to EASY98000NOR)

Signed-off-by: John Crispin <john@phrozen.org>
7 years ago
Hauke Mehrtens f9226158be lantiq: rename EASY98000 to EASY98000NOR
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
8 years ago
Mathias Kresin ea9b71e5b1 lantiq: drop the FRITZ7360SL led-dsl alias
The power LED can not be used for indicating the xDSL line state and
the in system (boot) state at the same time in LEDE.  As soon as the
xDSL Line goes down, the power LED is switched off.

During xDSL handshake the power led would blink with the same or a
similar pattern as during boot.

Both might confuse users.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 7dd42d610d lantiq: add FRITZ7360SL phy reset gpios
Due to a hardware bug of Atheros 8030 phys, the driver need to reset
the phys on link state change.

Use the correct compatible string for the at903x phys connected to
switch port 0 and 1.

Fix the pinmux of the gpio lines connected to the reset pin of the phys
and define the reset-pins to let the driver do the fixups.

Fixes FS#343

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 9aa420b00e lantiq: fix DGN1000B boot status leds
The alias node should not be a child of the chosen node.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Martin Blumenstingl 6b94234a65 lantiq: remove "init" kernel command line parameter from bootargs
/etc/preinit has been the default init-script for a very long time (at
least since Linux 2.6.30 in OpenWrt). Remove the kernel command line
"init" parameter to get rid of duplicate and inconsistent definitions
of this parameter (some boards, like FRITZ3370 for example did not use
it at all, while it's just copy and paste on others).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
8 years ago
Martin Blumenstingl 4995c64857 lantiq: specify console using stdout-path instead of cmdline argument
Use devicetree's /chosen/stdout-path instead of the kernel command line
(embedded in the .dts-files) to specify the serial console. Using the
chosen node is recommended on devicetree based platforms.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
8 years ago
Hauke Mehrtens 7c47f43fe6 lantiq: falcon: remove bootargs-append
This attribute is not evaluated any more and the boot loader on these
reference boards does not provide a broken root= or console= parameter.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
8 years ago
Mathias Kresin ee5a6c1041 lantiq: simplify ath9k eeprom extraction script
Add an extra function to patch the mac and fixup the checksum
afterwards. Calculate the checksum position automatically. The offset
to the mac address is the same for all checksum protected EEPROMs.

No EEPROM requires a byte swapped mac address. The mac byte swap code
was required due to an bug in the script that is now fixed.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Martin Blumenstingl afa3709266 lantiq: fix ath9k EEPROM data swapping for some devices
The EEPROM data in the flash of the ARV7518PW, ARV8539PW22,
BTHOMEHUBV2B and BTHOMEHUBV3A is stored byte-swapped (swab16), meaning
that for example the ath9k base_eep_header fields "version" (high and
low byte), "opCapFlags" and "eepMisc" are swapped (the latter ones are
just 1 byte wide, thus their position is swapped).

The old "ath,eep-endian" property enabled the corresponding swapping
logic in the ath9k driver (swab16 in ath9k_hw_nvram_swap_data, which is
based on the magic bytes in the EEPROM data which have nothing to do
with the calibration data - thus this logic should not be used
anymore).
Since we have switched to the upstream ath9k devicetree bindings there
is no binding anymore which enables swab16 in ath9k (as this logic is
not recommended anymore as explained above), leading to ath9k
initialization errors:
ath: phy0: Bad EEPROM VER 0x0001 or REV 0x00e0
(this shows that the version field is swapped, expected values are VER
0x000E and REV 0x0001)

Swapping the ath9k calibration data when extracting it from the flash
fixes the devices listed above (all other devices do not require
additional swapping, since the position of the fields is already as
expected by ath9k). This allows ath9k to read the version correctly
again, as well as the more important "eepmisc" field (which is used for
determining whether the data inside the EEPROM is Big or Little Endian
which is required to parse the EEPROM contents correctly).

Fixes: a20616863d ("lantiq: use ath9k device tree bindings
binding/owl-loader")

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
8 years ago
Álvaro Fernández Rojas 758ef7aa99 kernel: bump to 4.4.36
Refresh patches on all 4.4 supported platforms.
Compile & run tested: brcm2708/bcm2710 - Raspberry Pi 3

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
8 years ago
Mathias Kresin d9d838bc97 lantiq: fix image validation errors
The boards did not have the name set that is expected during metadata
validation on sysupgrade.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Kevin Darbyshire-Bryant 102cb4742c kernel: bump to 4.4.35
Refresh patches on all 4.4 supported platforms.

077-0005-bgmac-stop-clearing-DMA-receive-control-register-rig.patch
removed as now upstream.

Compile & run tested: ar71xx - Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
8 years ago
Mathias Kresin c0e66478b5 lantiq: drop obsolete patch
ifxhcd never had roothub support but since kernel 3.x it was expected
that a roothub always exists.

The patched fixed a null pointer deref in the usb subsystem because of
the missing roothub.

Since ifxhcd is gone, this whole patch isn't required any longer.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 0e34459e6b lantiq: use BT HomeHub 5 Type A OEM partition layout
This way the on nand bad block table is preserved and used. Add support
for nand OOB ECC checksums as well. It should fix all reported ubi
errors, which were all related to bad nand blocks and a purged on nand
bad block table.

The existing ubi partition will be reused, which eliminates the need
to touch the caldata during initial install. The BT u-boot has support
for loading a kernel from an ubi volume. It isn't necessary any longer
to replace the BT u-boot with a custom compiled one to use LEDE.

It is required to restore the BT Firmware and install LEDE from scratch
to switch to the new partition layout.

An image for restoring the BT firmware and installing LEDE is provided
at https://github.com/mkresin/lede/releases.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 860210c373 lantiq: backport kernel patch to pass of node to nand_dt_init
Backport upstream commit a61ae81a1907af1987ad4c77300508327bc48b23.

The actually purpose of the patch was to do some cleanup. As a side
effect of this cleanup, the device node is now passed to nand_dt_init.

This allows to use the common nand device tree properties

 - nand-bus-width
 - nand-on-flash-bbt
 - nand-ecc-mode
 - nand-ecc-step-size
 - nand-ecc-strength

for the plat_nand driver.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 62a347b1d9 lantiq: drop ath9k device tree binding & ath9k pci fixup
Due to the addition of the bindings to the ath9k driver, this code
isn't used any longer. The fixup is now done by the owloader.

Rename the ath_eep.c file to ath5k_eep.c to indicate that this files
includes ath5k related code only.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Martin Blumenstingl a20616863d lantiq: use ath9k device tree bindings binding/owl-loader
This moves the extraction of the eeprom/calibration data to a hotplug
firmware script. Additionally it modifies all .dts to configure ath9k
directly from within the .dts.

The owl-loader approach enables support on devices with exotic eeprom
data locations (such as unaligned positions on the flash or data
inside an UBI volume).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
[add ath9k caldata mac address patcher]
[fixes DGN3500 wifi mac]
[fixes BTHOMEHUBV3A wifi mac]
[set invalid mac for BTHOMEHUB2B, FRITZ3370, FRITZ7320 & FRITZ7360SL to restore previous random mac behavior]
Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Hauke Mehrtens 9371542783 lantiq: add Falcon support
This adds support for the Intel Falcon SoC for GPON.

Support for the Falcon SoC was removed in commit c821836395 svn rev:
40392 from OpenWrt, this commit adds it again.

This patch adds a new subtarget for the Falcon SoC, but it still misses
all the drivers needed to control the GPON part.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
8 years ago
Mathias Kresin 5cdbc86329 lantiq: add swconfig to the default packages
The DEVICE_PACKAGES are not included in the initramfs image in case
TARGET_PER_DEVICE_ROOTFS is set. This might produces initramfs images
with a not working network configuration because of a missing swconfig.

Workaround the issues by adding the essential swconfig package to the
default packages selection and deselect swconfig for boards not having
swconfig included before via device packages.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin 18c64f41c7 treewide: fix button keys codes used in dts
Use keycodes that matches the intended use case based on the label.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Martin Blumenstingl d76ee5bfac lantiq: specify the PCIe controller's interrupt, size and address cells
This allows adding devices to the PCIe controller in the .dts files.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
8 years ago
Martin Blumenstingl 79741dc379 lantiq: Register the device tree node with the PCIe controller
This allows specifying PCI devices as children of the PCIe controller
node to pass configuration data to them.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
8 years ago
Eddi De Pieri d596c21ebd lantiq: write protect vgv7519 u-boot and u-boot-env partitions
Signed-off-by: Eddi De Pieri <eddi@depieri.net>
8 years ago
Felix Fietkau c2582f58dc lantiq: add missing metadata for tp-link images
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago