Commit Graph

20439 Commits (5389db72e3265198986dfb50a831fb8f8264d346)

Author SHA1 Message Date
David Bauer 5389db72e3 fritz-tools: add support for IPQ40xx platform
AVM devices based on Qualcomm IPQ40xx do not store sector health
information in the OOB area. Make this check optional to support this
platform.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Jeff Kletsky fefa34def8 ath79: Add GL.iNet AR-300M-Lite
AR300M-Lite is single-Ethernet variant of the AR300M series
Its eth0 would otherwise be assigned to the WAN interface
making it unreachable firstboot or failsafe.

Installation instructions from OEM (OpenWrt variant):
* Install sysupgrade.bin using OEM's "Advanced" GUI (LuCI),
   * Do not preserve settings
   * Access rebooted device via Ethernet at OpenWrt default address

Add previously missing LED defaults for all three variants;
-nand, -nor, -lite to the definitions in 01_leds

Non-lite variants thanks to Andreas Ziegler
https://patchwork.ozlabs.org/patch/1049396/

Runtime-tested:  GL.iNet AR300M-Lite

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
5 years ago
Chen Minqiang 7dfe357a3d ramips: HC5861 drop unused gpio group define in dts
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
5 years ago
Ozgur Can Leonard d009033911 ramips: add support for Xiaomi Mi Router 3 Pro
Hardware:

CPU:   MediaTek MT7621AT (2x880MHz)
RAM:   512MB DDR3
FLASH: 256MB NAND
WiFi:  2.4GHz 4x4 MT7615 b/g/n (Needs driver, See Issues!)
WiFI:  5GHz 4x4 MT7615 a/n/ac  (Needs driver, See Issues!)
USB:   1x 3.0
ETH:   1x WAN 10/100/1000 3x LAN 10/100/1000
LED:   Power/Status
BTN:   RESET
UART:  115200 8n1

Partition layout and boot:

Stock Xiaomi firmware has the MTD split into (among others)

- kernel0 (@0x200000)
- kernel1 (@0x600000)
- rootfs0
- rootfs1
- overlay (ubi)

Xiaomi uboot expects to find kernels at 0x200000 & 0x600000
referred to as system 1 & system 2 respectively.
a kernel is considered suitable for handing control over
if its linux magic number exists & uImage CRC are correct.
If either of those conditions fail, a matching sys'n'_fail flag
is set in uboot env & a restart performed in the hope that the
alternate kernel is okay.
If neither kernel checksums ok and both are marked failed, system 2
is booted anyway.

Note uboot's tftp flash install writes the transferred
image to both kernel partitions.

Installation:

Similar to the Xiaomi MIR3G, we keep stock Xiaomi firmware in
kernel0 for ease of recovery, and install OpenWRT into kernel1 and
after.

The installation file for OpenWRT is a *squashfs-factory.bin file that
contains the kernel and a ubi partition. This is flashed as follows:

nvram set flag_try_sys1_failed=1
nvram set flag_try_sys2_failed=0
nvram commit
dd if=factory.bin bs=1M count=4 | mtd write - kernel1
dd if=factory.bin bs=1M skip=4 | mtd write - rootfs0
reboot

Reverting to stock:

The part of stock firmware we've kept in kernel0 allows us to run stock
recovery, which will re-flash stock firmware from a *.bin file on a USB.

For this we do the following:

fw_setenv flag_try_sys1_failed 0
fw_setenv flag_try_sys2_failed 1
reboot

After reboot the LED status light will blink red, at which point pressing
the 'reset' button will cause stock firmware to be installed from USB.

Issues:

OpenWRT currently does not have support for the MT7615 wifi chips. There is
ongoing work to add mt7615 support to the open source mt76 driver. Until that
support is in place, there are closed-source kernel modules that can be used.

See: https://forum.openwrt.org/t/support-for-xiaomi-wifi-r3p-pro/20290/170

Signed-off-by: Ozgur Can Leonard <ozgurcan@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[02_network remaps, Added link to notes]
5 years ago
Santiago Piccinini 24463d0d94 ath79: add support for LibreRouter v1
Hardware
--------
SOC:   QCA9558
RAM:   128M DDR2
Flash: 16MiB SPI-NOR
ETH:   QCA8337N: 2x 10/100/1000 PoE and PoE pass-through
WiFi2: QCA9558 (bgn) 2T2R
WiFi5: 2x mPCIE with AR9582 (an) 2T2R
BTN:   1x Reset
GPIO:  multiple GPIO on header, PoE passthrough enable
UART:  3.3V 115200 8N1 header on the board
WDG:   ATTiny13 watchdog
JTAG:  header on the board
USB:   1x connector and 1x header on the board
PoE:   10-32V input in ETH port 1, passthrough in port 2
mPCIE: 2x populated with radios (but replaceable)

OpenWrt is preinstalled from factory. To install use <your-image>-sysupgade.bin
using the web interface or with sysupgrade -n.

Flash from bootloader (in case failsafe does not work)
1. Connect the LibreRouter with a serial adapter (TTL voltage) to the UART
   header in the board.
2. Connect an ETH cable and configure static ip addres 192.168.1.10/24
3. Turn on the device and stop the bootloader sending any key through the serial
   interface.
4. Use a TFTP server to serve <your image>-sysupgrade.bin file.
5. Execute the following commands at the bootloader prompt:
    ath> tftp 82000000 <your image>-sysupgrade.bin
    ath> erase 0x9f050000 +$filesize
    ath> cp.b 0x82000000 0x9f050000 $filesize
    ath> bootm 0x9f050000

More docs
* Bootloader https://github.com/librerouterorg/u-boot
* Board details (schematics, gerbers): https://github.com/librerouterorg/board

Signed-off-by: Santiago Piccinini <spiccinini@altermundi.net>
5 years ago
David Bauer 93601d647f ipq40xx: fix FRITZBox 7530 NAND controller node
This removes the 'cs-gpios' property from the AVM FRITZ!Box 7530 NAND
controller node. As pointed out by Christian Lamparter, the property is
not needed by the Qualcomm NAND controller driver.

Signed-off-by: David Bauer <mail@david-bauer.net>
5 years ago
Christian Lamparter 784f2e73df ipq40xx: fix phy interrupt setting
This patch fixes a problem that was discovered during DSA
development. On the MR33, the link change events from the
external AR8035-PHY would never make it to the qca8k driver.

The issue turned out to be a misplaced memcpy that was copying
over the zero-initialized irq table, when it should have been
set to PHY_POLL. Hence this patch moves the memcpy after the
array has been initialized.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Christian Lamparter 39092ad9e9 ipq40xx: tidy up 02_networks
- fix linksys' EA6350v3 order

 - remove whitespace that should have been tabs

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Daniel Golle 8c593804d0 oxnas: install wireless driver on pogoplugpro
PogoPlug Pro comes with AzureWave AW-NE762H PCIe module containing
Ralink's Rt3090 chip supported by the rt2x00 driver.
Install the driver as well as wpad-basic.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Daniel Golle 74ef848b96 oxnas: also akitio,mycloud uses PCIe apparently
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Daniel Golle 0e9b11213e oxnas: enable pcie_phy on boards utilizing PCIe
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Piotr Dymacz db91418766 ath79: add support for TP-Link RE350K v1
TP-Link RE350K v1 (FCC ID: TE7RE350K) is a wall-plug AC1200 Wi-Fi range
extender with 'Kasa Smart' support. Device is based on Qualcomm/Atheros
QCA9558 + QCA9882 + AR8035 platform and is available only on US market.

Specification:

- 720/600/200 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of flash (SPI NOR)
- 1x 1 Gbps Ethernet (AR8035)
- 2T2R 2.4 GHz (QCA9558), with ext. PA (SE2565T) and LNA (SKY65971-11)
- 2T2R 5 GHz (QCA9882), with ext. PA (SE5003L1-R) and LNA (SKY65981-11)
- 2x U.FL connector on PCB
- 2x dual-band PCB antennas
- 1x LED, 2x dual-color LED (all driven by GPIO)
- 3x button (app config, led, reset)
- 1x mechanical on/off slide switch
- 1x UART (4-pin, 2.54 mm pitch) header on PCB
- 1x JTAG (8-pin, 1.27 mm pitch) header on PCB

Flash instruction:
Use 'factory' image directly in vendor GUI (default IP: 192.168.0.254,
default credentials: admin/admin).

Warning:
This device does not include any kind of recovery mechanism in U-Boot.

Vendor firmware access:
You can access vendor firmware over serial (RX line requires jumper
resistor in R306 place, near XTAL) with: root/sohoadmin credentials.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Piotr Dymacz 9b6413982c ramips: add support for ALFA Network Tube-E4G
ALFA Network Tube-E4G is an outdoor, dual-SIM LTE Cat. 4 CPE, based on
MediaTek MT7620A, equipped with Quectel EC25 miniPCIe modem.

Specification:

- MT7620A (580 MHz)
- 64/128/256 MB of RAM (DDR2)
- 16/32 MB of flash (SPI NOR)
- 1x 10/100 Mbps Ethernet, with passive PoE support (24 V)
- 1x miniPCIe slot (with PCIe and USB 2.0 buses)
- 2x SIM slot (mini, micro) with detect and switch driven by GPIO
- 1x detachable antenna (modem main)
- 1x internal antenna (modem div)
- 1x GPS passive antenna (optional)
- 5x LED (all driven by GPIO)
- 1x button (reset)
- UART (4-pin, 2.54 mm pitch) header on PCB

Other:

Default SIM slot is selected at an early stage by U-Boot, based on
'default_sim' environment value: 1 or unset = SIM1 (mini), 2 = SIM2
(micro). U-Boot also resets the modem, using #PERST signal, before
starting kernel.

Flash instruction:

You can use the 'sysupgrade' image directly in vendor firmware which is
based on OpenWrt (make sure to not preserve settings - use 'sysupgrade
-n -F ...' command). Alternatively, use web recovery mode in U-Boot:

1. Power the device with reset button pressed, the LAN LED will start
   blinking slowly and after ~3 seconds, when it starts blinking faster,
   you can release the button.
2. Setup static IP 192.168.1.2/24 on your PC.
3. Go to 192.168.1.1 in browser and upload 'sysupgrade' image.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Michael Heimpold 6ac5144b13 mxs: disable unused serial drivers
This disables PL010 and 8250 serial support for this platform
as both drivers are not used: the debug UART is PL011 and the
application UARTs use a dedicated MXS specific driver.

The kernel size reduction is neglectable, but it also removes
the non-working (confusing) /dev/ttyS0 and /dev/ttyS1 devices
in a running system (which generate errors when trying to use):

  root@OpenWrt:~# echo "hello world" > /dev/ttyS0
  ash: write error: I/O error
  root@OpenWrt:~#

Signed-off-by: Michael Heimpold <mhei@heimpold.de>
5 years ago
Daniel Golle b4917fa907 oxnas: fix oxnas-rps-timer dt-match
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Daniel Golle 87a81455a1 oxnas: replace oxnas-restart with version to be submitted to upstream
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Daniel Golle 35a7f79096 oxnas: use generic filenames for image and DTS
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Daniel Golle 8ad0ba3a07 oxnas: move PCIe controller outside of simple-bus
Move PCIe controller outside down to SoC level to avoid resource
mapping problems.
Also add more detailed error handling when mapping registers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Hauke Mehrtens a18e2994df lantiq: Refresh kernel 4.14 configuration
This adds two configuration options which are getting automatically
added.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
5 years ago
Daniel Golle 8f9155fe7a oxnas: fix PCIe register ranges in device-tree
They should be relative to apb-bridge@47000000 rather than to the
pcie-controller@c00000 inside it.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Mathew McBride 6a2705a52f layerscape: use wrapped nand_do_upgrade for traverse-ls1043 boards
Traverse LS1043 boards are set up with a dual-system layout, rootfs{1,2} and kernel{1,2}.
nand_do_upgrade can do the image replacement work we were doing before as long as we give it the partition names.
This greatly simplifies the /lib/upgrade/platform.sh.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
5 years ago
Mathew McBride 17468cc090 layerscape: rename Traverse boards along SoC lines
Upcoming product specification and branding changes mean that the names in tree do not accurately reflect released products.
To reduce any confusion, sort our boards by SoC family, e.g traverse-ls1043. Any future boards using Layerscape family SoC's
will be treated the same way, e.g Device/traverse-ls/lx/laXXXX.
The affected boards so far have only been available through OEM channels and those aren't using the provided sysupgrade.

Signed-off-by: Mathew McBride <matt@traverse.com.au>
5 years ago
Martin Schiller ff3cfe0848 ltq-atm/ltq-ptm: re-enable/fix reset_ppe() functionality for VR9
This patch re-enables the reset_ppe() functionality for VR9 targets by using
the new lantiq rcu subsystem. The reset sequence in the reset_ppe() function
was taken from the ppa datapath driver of lantiq UGW 7.4.1.

Additionally it adds the required reset definitions to the vr9 dtsi file.

It also prepares the reset_ppe() function calls for the other lantiq targets.

This feature is needed to be able to switch between ltq-atm/ltq-ptm driver
in ATM/PTM Auto-Mode at runtime.

Signed-off-by: Martin Schiller <ms@dev.tdt.de>
5 years ago
Danijel Tudek eae6cac6a3 lantiq: add support for AVM FRITZ!Box 7362 SL
Hardware:
- SoC: Lantiq VRX288
- RAM: Winbond W971GG6JB 1 Gb (128 MiB)
- Flash:
  - SPI: 8 Mb (1 MiB) for bootloader and tffs
  - NAND: 1 Gb (128 MiB) for OS
- xDSL: Lantiq VRX208
- WLAN: Atheros AR9381
- DECT: Dialog Semiconductors SC14441

Everything except FXS/DECT works
(no drivers for AVM's FXS implementation with SC14441).

Installation via FTP:
1. Use scripts/flashing/eva_ramboot.py to send initramfs-kernel.bin
to the device when powering on.
Standard AVM procedures with finding the correct IP address and
the right moment to open FTP apply here (approx. 4 seconds on 7362SL).
IMPORTANT: set lzma compression in ramdisk options, bootloader stalls
when receiving uncompressed images.

2. Transfer sysupgrade.bin image with scp to /tmp directory
and run sysupgrade

3. First boot might take a bit longer if linux_fs_start was set to 1,
in that case the device will reboot twice, first time it will fail to load
second kernel (overwritten by ubifs), set linux_fs_start to 0 and reboot.

OpenWrt uses the entire NAND flash. Kernel uses 4 MiB and rootfs uses
the rest of 124 MiB, overwriting everything related to FRITZ!OS - both
OS images, config and answering machine/media server data.
To return to FRITZ!OS, use AVM's recovery image.

Signed-off-by: Danijel Tudek <danijel.tudek@gmail.com>
5 years ago
Danijel Tudek 5026f43559 lantiq: move common FRITZ736X bits into dtsi
Move common FRITZ736X bits into dtsi file
as a preparation for FRITZ7362SL support.

Signed-off-by: Danijel Tudek <danijel.tudek@gmail.com>
5 years ago
Andy Binder 20f48c8ae3 lantiq: add support for AVM FRITZ!Box 7412
Hardware:

SoC: Lantiq VRX 220
CPU Cores: 2x MIPS 34Kc at 500 MHz
RAM: 128 MiB 250 MHz
Storage: 128 MiB NAND flash
Ethernet: built-in Fast Ethernet switch, only port 2 is used
Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
Modem: built-in A/VDSL2 modem
DECT: Dialog SC14441
LEDs: 1 two-color, 4 one-color
Buttons: 2
FXS: 1 port via TAE or RJ12 connector
Everything except FXS/DECT works
(no drivers for AVM's FXS implementation with SC14441).

Installation:

Use the eva_ramboot.py script to load an initramfs image on the
device. Run it a few seconds after turning the device on.
$ scripts/flashing eva_ramboot 192.168.178.1 bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin
If it fails to find the device try the ip address 169.254.120.1.
(Firmware updates or the recovery tool apparently change it.)

IMPORTANT: set lzma compression in ramdisk options, bootloader stalls
when receiving uncompressed images.

The device will load it in ram and boot it. You can reach it under
the openwrt default ip address 192.168.1.1.

Check if the key linux_fs_start is not set to 1 in tffs:
$ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
If it is set to 1, the bootloader will select the wrong set of
partitions. Restart the box and install an FritzOS upgrade or do a
recovery. Afterwards start again at step 1.

Run sysupgrade to persistently install OpenWRT.

Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.de>
Signed-off-by: Andy Binder <AndyBinder@gmx.de>
5 years ago
Aleksander Jan Bajkowski 445ca981d1 sunxi: add support for Orange Pi PC Plus
CPU: H3 Quad-core Cortex-A7 H.265/HEVC 4K @ 1.2 Ghz
GPU: Mali400MP2 GPU @ 600MHz (supports OpenGL ES 2.0)
Memory: 1GB DDR3 (shared with GPU)
Onboard: Storage TF card (Max. 64GB) / MMC card slot
Onboard: Storage 8 GB eMMC
Onboard: Network 10/100M Ethernet RJ45
Onboard: Network WiFi 802.11 b/g/n (Realtek RTL8189FTV)
Onboard header: SPI, I2C, GPIO, UART
USB 2.0: Three USB 2.0 HOST, One USB 2.0 OTG

Known issues:
-Wifi diesn't work

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
5 years ago
Piotr Dymacz 6fa94d5e8f ath79: add support for YunCore A770
YunCore A770 is a ceiling AC750 AP with 2 Fast Ethernet ports, PoE
(802.3at) support, based on QCA9531 + QCA9887.

Specification:

- 650/597/216 MHz (CPU/DDR/AHB)
- 128 MB of RAM (DDR2)
- 16 MB of flash (SPI NOR)
- 2x 10/100 Mbps Ethernet (PoE 802.3at support in WAN port)
- 2T2R 2.4 GHz (QCA9531), with ext. PA and LNA
- 1T1R 5 GHz (QCA9887), with ext. FEM (SKY85728-11)
- 2x regular LED, 1x RGB LED (all driven by GPIO)
- 1x button (reset)
- DC jack for main power input (12 V)
- UART header on PCB

Flash instruction:

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

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

2. Then, install OpenWrt:

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

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Piotr Dymacz 24de7c29e5 ipq40xx: backport I2C QUP driver changes from 4.17
Backport below changes for I2C QUP driver from v4.17:

  0668bc44a426 i2c: qup: fix copyrights and update to SPDX identifier
  7239872fb340 i2c: qup: fixed releasing dma without flush operation completion
  eb422b539c1f i2c: qup: minor code reorganization for use_dma
  6d5f37f166bb i2c: qup: remove redundant variables for BAM SG count
  c5adc0fa63a9 i2c: qup: schedule EOT and FLUSH tags at the end of transfer
  7e6c35fe602d i2c: qup: fix the transfer length for BAM RX EOT FLUSH tags
  3f450d3eea14 i2c: qup: proper error handling for i2c error in BAM mode
  08f15963bc75 i2c: qup: use the complete transfer length to choose DMA mode
  ecb6e1e5f435 i2c: qup: change completion timeout according to transfer length
  6f2f0f6465ac i2c: qup: fix buffer overflow for multiple msg of maximum xfer len
  f7714b4e451b i2c: qup: send NACK for last read sub transfers
  fbfab1ab0658 i2c: qup: reorganization of driver code to remove polling for qup v1
  7545c7dba169 i2c: qup: reorganization of driver code to remove polling for qup v2

This fixes various I2C issues observed on AP120C-AC board equipped with
Atmel/Microchip AT97SC3205T TPM module.

Tested-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Piotr Dymacz ff8a8074b2 ipq40xx: add ath10k-calibration-variant in AP120C-AC DTS
Use 'ath10k-calibration-variant' (with the value sent upstream) for the
second (5 GHz) radio in AP120C-AC board DTS. First radio uses the same
BDF as in one of Qualcomm reference designs.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
5 years ago
Koen Vandeputte 364ab348dc kernel: bump 4.14 to 4.14.105
Refreshed all patches.

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

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

Compile-tested on: ar7
Runtime-tested on: none

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Christian Lamparter 457de5a154 owl-loader: fix crash caused by endian patch
This patch fixes a crash that occured on the
BT Home Hub v5a (lantiq/xrx200) which resulted
in the device bootlooping.

Reported-by: Ryan Mounce <ryan@mounce.com.au>
Tested-by: Vitalij Alshevsky <v_alshevsky@tut.by>
Fixes: ddece08bf4 ("kernel: owl-loader: fix sparse endian warnings")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Mantas Pucka a4ba41863b mips: fix dynamic ftrace
This was fixed for v4.9 in 076d2ea68, now port to all kernels

Signed-off-by: Mantas Pucka <mantas@8devices.com>
5 years ago
Chen Minqiang e15bda603a ramips: rework network settings for HC5861
dts: disable port4 and leave it ephy mode because it connect to nothing
switch port5 connected to GE port we use it as wan port

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
5 years ago
Mantas Pucka fe591f2fe2 ar71xx: enable QCA955x SGMII fixup on Rambutan
fixes intermittent loss of connectivity on 1Gbit port, with
log message:

  803x_aneg_done: SGMII link is not ok

Signed-off-by: Mantas Pucka <mantas@8devices.com>
5 years ago
Christian Lamparter 33727ecea5 lantiq: enlarge ZyXEL P-2812HNU-F1 kernel partition (FS#2124)
The current snapshot release kernel with it's 2119245 Byte
size is too big to fit into the 2097152 (2MiB) area that
was set aside for the kernel. Which causes the device to
fail to boot (after an update or even during a fresh install)

 NAND read: device 0 offset 0x60000, size 0x200000
  2097152 bytes read: OK
 ## Booting kernel from Legacy Image at 80800000 ...
    Image Name:   MIPS OpenWrt Linux-4.14.98
    Created:      2019-02-13   9:37:36 UTC
    Image Type:   MIPS Linux Kernel Image (lzma compressed)
    Data Size:    2119245 Bytes = 2 MiB
    Load Address: 80002000
    Entry Point:  80002000
    Verifying Checksum ... Bad Data CRC
 ERROR: can't get kernel image!

This patch fixes the problem by enlarging the kernel partition
at the cost of the ubi/data partition behind it. The patch
also adds a KERNEL_SIZE variable to the image Makefile to
prevent silent corruptions from happening in the future.

Please note: The u-boot environment for the router also
needs to be updated. So please attach an appropriate
serial converter cable and enter the following commands
into the u-boot prompt:

 setenv nboot 'nand read 0x80800000 0x60000 0x300000; bootm 0x80800000'
 saveenv

The wiki has been updated accordingly:
<https://openwrt.org/toh/zyxel/p2812hnu-f1>

Fixes: FS#2124
Suggested-by: Mafketel (User on bugs.openwrt.org)
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
5 years ago
Daniel Golle c8778250a9 ramips: mt7620: export chip version and pkg
Similar to the (currently unused) mt7620_get_eco() function, introduce
mt7620_get_chipver() and mt7620_get_pkg() functions to allow rt2x00 to
probe for the type of WiSoC. This is ugly and probably unacceptable
for upstream, however, it should help to evaluate which of those hacks
are actually really needed, enumerate the possible values and label
them in a more meaningful way than currently done in the vendor driver.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
5 years ago
Rafał Miłecki 9e32e288f0 kernel: fix refcnt leak in LED netdev trigger on interface rename
This fixes a possible unbalanced dev_hold():
> iw dev bar del
[  237.355366] unregister_netdevice: waiting for bar to become free. Usage count = 1
[  247.435362] unregister_netdevice: waiting for bar to become free. Usage count = 1
[  257.545366] unregister_netdevice: waiting for bar to become free. Usage count = 1

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
5 years ago
Koen Vandeputte d3506d1bc1 ar71xx: ag71xx: fix compile error when enabling debug
Starting from kernel 4.5, phy_id needs to be fetched from a different location.

not doing so results in this compile error:

drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c: In function 'ag71xx_phy_connect_multi':
drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c:133:35: error: 'struct mdio_device' has no member named 'phy_id'
    ag->mii_bus->mdio_map[phy_addr]->phy_id);
                                   ^
./include/linux/printk.h:137:18: note: in definition of macro 'no_printk'
    printk(fmt, ##__VA_ARGS__); \
                  ^~~~~~~~~~~
drivers/net/ethernet/atheros/ag71xx/ag71xx.h:72:27: note: in expansion of macro 'pr_debug'
 #define DBG(fmt, args...) pr_debug(fmt, ## args)
                           ^~~~~~~~
drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.c:130:3: note: in expansion of macro 'DBG'
   DBG("%s: PHY found at %s, uid=%08x\n",
   ^~~
scripts/Makefile.build:326: recipe for target 'drivers/net/ethernet/atheros/ag71xx/ag71xx_phy.o' failed

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Koen Vandeputte 1cfbf95393 kernel: bump 4.14 to 4.14.104
Refreshed all patches.

Altered patches:
- 332-arc-add-OWRTDTB-section.patch

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

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

Altered patches:
- 332-arc-add-OWRTDTB-section.patch

Compile-tested on: ar7
Runtime-tested on: none

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
5 years ago
Petr Štetiar 40530c8eb4 ath79: Add support for Ubiquiti Nanostation M (XW)
CPU:  AR9342 SoC
RAM:      64 MB DDR2
Flash:     8 MB NOR SPI
Ports: 2x100 MBit (24V PoE in, 24V PoE out), AR8236 switch
WLAN:  2.4/5 GHz
UART:      1 UART
LEDs:        Power, 2x Ethernet, 4x RSSI LEDs (orange, red, 2x green)
Buttons:     Reset

Flashing instructions using recovery method over TFTP

 1. Unplug the ethernet cable from the router.
 2. Using paper clip press and hold the router's reset button. Make sure
    you can feel it depressed by the paper clip. Do not release the button
    until step 4.
 3. While keeping the reset button pressed in, plug the ethernet cable
    back into the AP. Keep the reset button depressed until you see the
    device's LEDs flashing in upgrade mode (alternating LED1/LED3 and
    LED2/LED4), this may take up to 25 seconds.
 4. You may release the reset button, now the device should be in TFTP
    transfer mode.
 5. Set a static IP on your Computer's NIC. A static IP of 192.168.1.25/24
    should work.
 6. Plug the PoE injector's LAN cable directly to your computer.
 7. Start tftp client and issue following commands:
     tftp> binary
     tftp> connect 192.168.1.20
     tftp> put openwrt-ath79-generic-ubnt-nano-m-xw-squashfs-factory.bin

Tested-by: Joe Ayers <ae6xe@arrl.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Petr Štetiar 368b6d1a52 ath79: gmac: ar934x: Add parser for mii-gmac0-slave
While converting Nanostation M XW from current ar71xx code to ath79 I've
hit one issue, where the ethernet networking wasn't working, so I was
checking every bit in the networking setup path between ar71xx and
ath79.

I've came to the following code in ar71xx/mach-ubnt-xm.c:

 static void __init ubnt_xw_init(void) {
 	...
 	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 |
                                   AR934X_ETH_CFG_MII_GMAC0_SLAVE);
 	...
 }

Where this code is setting AR934X_ETH_CFG_MII_GMAC0_SLAVE bit in
AR934X_GMAC_REG_ETH_CFG register, but I couldn't find a way of setting
this bit from DTS, so this patch adds `mii-gmac0-slave` DTS property
which allows setting of this bit in `gmac-config`, which is then used in
Nanostation M XW DTS.

Tested-by: Joe Ayers <ae6xe@arrl.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
5 years ago
Chuanhong Guo 47f0be676f ath79: qca955x: assert mdio/gmac reset together
This allows resetting gmac registers during initialization.
Also add compatible string for qca955x mdio to enable more mdio
clock dividers.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Chuanhong Guo 51cdf0e9eb ath79: ar934x: assert mac/mdio reset together for gmac0
This allows resetting gmac registers during initialization.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Chuanhong Guo cea3e9e438 ath79: ag71xx: add support for optional mdio reset
On ar933x and later chips, there are separated mac/mdio resets, but
resetting the entire gmac block with register values requires both
mac_reset and mdio_reset to be asserted together.

Add support for optional mdio reset so that we can do a full reset
if needed.

This patch also replaced deprecated devm_reset_control_get for
mac reset.

To use this feature, the following is needed:
 1. drop "simple-mfd" compatible to register mdio0 after gmac init
    so that mdio registers aren't reset after initialization.
 2. move mdio reset from mdio-bus to its parent eth node.

NOTE: This can't be applied on gmac1 with builtin switch since we
haven't add a feature to defer probe if phy connection failed.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Chuanhong Guo 596a5325cd ath79: ag71xx: register mdio using of_platform_populate
remove the hacky checking of "simple-mfd" compatible
also add some comments explaining that piece of code.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Chuanhong Guo f92bbdcc93 ath79: ag71xx-mdio: get reset control using devm api
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago
Chuanhong Guo a4eef43a12 ath79: ag71xx: replace alloc_etherdev with devm_alloc_etherdev
using the devm api makes the code simpler.
also drop unneeded memory free from ag71xx_remove since they are
allocated using devm apis.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
5 years ago