Commit Graph

2327 Commits (6ba58b7b020c4b793e6fb7a43c8adef070579d8d)

Author SHA1 Message Date
Mathias Kresin 509d02a3d1 ramips: use generic board detection for Unielec u7621-06
Use the generic board detection for the board instead of the target
specific one. Mark the sysupgrade image compatible with the former used
userspace boardname to allow an upgrade from earlier versions.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Thomas Vincent-Cross a160f50d4f ramips: add support for Wavlink WL-WN570HA1
This commit adds support for the Wavlink WL-WN570HA1, a dual-band PoE
wireless router with the following specifications:

 - CPU: MediaTek MT7688AN 580MHz
 - Flash: 8MB
 - RAM: 64MB
 - Ethernet: 1x 10/100Mbps
 - 2.4 GHz: 802.11b/g/n SoC, 1T1R, 27 dBm
 - 5 GHz: 802.11a/n/ac MT7610E, 1T1R, 25 dBm
 - Antennas: 2x external (1 per radio), detachable
 - LEDs: 3 programmable + Wi-Fi, WAN/LAN, Power
 - Buttons: Reset

Flashing instructions:

Factory U-boot launches a TFTP client if reset button is pressed during power-on.
Rename the sysupgrade file and configure TFTP as follows:

 - Client (WL-WN570HA1) IP: 192.168.10.101
 - Server IP: 192.168.10.100
 - Filename: firmware.bin

Signed-off-by: Thomas Vincent-Cross <me@tvc.id.au>
[use generic board detection, add firmware partition compatible]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Russell Senior e0def989e8 ramips: fix alphabetic ordering of skylab skw92a
Fix the alphabetic ordering of skylab skw92a in ramips_setup_interfaces.

Signed-off-by: Russell Senior <russell@personaltelco.net>
6 years ago
Matthias Badaire 1100ba43db ramips: fix RavPower WD03 SoC dtsi include
The RavPower WD03 is a mt7620n based baord. With the change applied, I2C
should work now with the RavPower WD03.

Signed-off-by: Matthias Badaire <mbadaire@gmail.com>
[reworded commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin aa82fdf110 ramips: fix GB-PC1/PC2 build error
With ed25e3ac02 ("ramips: fix some clocks in mt7621.dtsi") the
cpuclock node was dropped from the mt7621.dtsi without removing the
references to this node from the GB-PC1/PC2 dts files.

Remove them now, to fix the build error.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin d7494f30f5 ramips: fix Lava LR-25G001 invalid led names
It has to be <board>:<colour>:<function> and is expected exactly this
way by the userspace scripts.

While at it, fix some whitespace issues in the dts file and rename the
flash node as required upstream.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin be3e69d991 ramips: rt2880: fix pci cells definition
Set the correct number of cells to fix "property has invalid length" dtc
compiler warnings.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin e4d9217fe5 ramips: improve BDCOM WAP2100-SK support
Use the generic board detection instead of the target specific one as
all recent additions are doing.

Setup the USB led via devicetree (a58535771f) and include the required
driver by default. Merge the led userspace setting with an existing
identical case.

Use the wps led for boot status indication.

Move the partitions into a partition table node (6031ab345d) and drop
needless labels. Drop misplaced cells properties (53624c1702).

Cleanup the pinmux and only switch pins to gpio functions which a
referenced as gpio in the dts.

Match the maximum image size with the size of the firmware partition.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 71ba834cf1 ramips: add Sanlinking Technologies D240 pinmux quirk
The sd function of the nd_sd group configures two of the groups pins as
gpios. The pins are used as PCIe reset/power.

Due to the driver load order, the pins are configured way to late if
triggered by the sd-card driver.

To not introduce another kind of driver load order dependency and
configure the pins as early as possible, means during pinmux driver
load.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin d6ce04dad8 ralink: fix mt7620 nd_sd pinmux
In case the nd_sd group is set to the sd-card function, Pins 45 + 46 are
configured as GPIOs. If they are blocked by the sd function, they can't
be used as GPIOs.

Reported-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 9ebce69611 ramips: revert fix rt3883 pci pinmux
This reverts commit dcdc6d9dad.

Even if described this way in the datasheet, it causes a bootloop on a
RT-N56U (v1):

  of-flash 1c000000.nor-flash: do_map_probe() failed for type cfi_probe
  of-flash 1c000000.nor-flash: do_map_probe() failed
  VFS: Cannot open root device “(null)” or unknown-block(0,0): error -6

Fixes: FS#1930

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 8ec1a66c34 ramips: improve Skylab SKW92A support
Use the generic board detection instead of the target specific one as
all recent additions are doing.

Add the wireless led according the gpio number from the datasheet.
Rename the board part of the leds to match the name used for the
compatible string. Finally, do not hijack the wps led for boot status
indication longer than necessary.

Merge userspace config into existing cases.

Include the manufacture Name in the dts model string.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
John Crispin 749a29f76c Revert "ramips: mt7621-spi: replace the driver with upstream staging one"
This reverts commit a44f000077.

This breaks some mt7621 devices.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Zheng Qian 48a7a2a75d ramips: fix switch ports mapping for newifi d2
Signed-off-by: Zheng Qian <sotux82@gmail.com>
6 years ago
Chuanhong Guo a44f000077 ramips: mt7621-spi: replace the driver with upstream staging one
That driver is more efficient thanks to the refactor of spi reading operation.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
6 years ago
Pawel Dembicki 20b09a2125 ramips: add support for Lava LR-25G001
The Lava LR-25G001 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 64 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7610EN)
- 5x 10/100/1000 Mbps AR8337 Switch (1 WAN AND 4 LAN)
- 2x external, detachable antennas
- 1x USB 2.0
- UART (J3) header on PCB (57600 8n1)
- 8x LED (3x GPIO-controlled), 2x button
- JBOOT bootloader

Known issues:
- Work only three Gigabit ports (3/5, 1 WAN and 2LAN)

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago
Pawel Dembicki b85fe43ec8 ramips: mt7620: add force use of mdio-mode
Some boards have external switches different than mt7530.

This patch allow to use mdio-mode without 0x1f register.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago
Weijie Gao ed25e3ac02 ramips: fix some clocks in mt7621.dtsi
As the cpu clock calculation has been fixed, the clock for gic and spi
should be also fixed.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
6 years ago
Weijie Gao c7ca224299 ramips: fix cpu clock of mt7621 and add dt clk devices
For a long time the mt7621 uses a fixed cpu clock which causes a problem
if the cpu frequency is not 880MHz.

This patch fixes the cpu clock calculation and adds the cpu/bus clkdev
which will be used in dts.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
6 years ago
Weijie Gao f5af8be636 ramips: fix register range of memc node in mt7621.dtsi
The memc node from mt7621.dtsi has incorrect register resource.
Fix it according to the programming guide.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
6 years ago
Weijie Gao e217d69a4a ramips: merge two patches 101-mt7621-timer and 998-mt7621-needs-jiffies
These two patches both modified the mt7621.c, and the patch file
998-mt7621-needs-jiffies.patch adds only one line which is used by the
another patch file. So merge them into one file.

Signed-off-by: Weijie Gao <hackpascal@gmail.com>
6 years ago
Lorenzo Bianconi e612e60517 ramips: add mt76x0 node to RT-AC51U device tree
Introduce mt76x0e device tree node in RT-AC51U dts.
Define mt76x0e mtd partition and offset

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
6 years ago
Daniel Santos 89eb1a6d72 ralink: Add support for GPIO as interrupt-controller
The gpio-ralink driver has everything it needs to be used as an
interrupt controller except for device tree support.  This simple patch
adds that support by configuring the irq domain to use two cells and
adding the appropriate documentation to the devicetree bindings.

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
6 years ago
Petr Štetiar 16b950c981 ramips: Add support for ZTE ZXECS EBG3130 aka BDCOM WAP2100-SK
On the bottom sticker it's branded as ZTE ZXECS EBG3130 device, but in factory
OpenWrt image it's referenced as BDCOM WAP2100-SK device.

Specifications:

- SoC: MediaTek MT7620A
- RAM: 128 MB
- Flash: 16 MB
- Ethernet: 5 FE ports
- Wireless radio: 2T2R 2.4 GHz and 1T1R 5 GHz (MT7610EN, unsupported)
- UART: 1 x UART on PCB marked as J2 (R=RX, T=TX, G=GND) with 115200 8N1 config
- LEDs: Power, FE ports 1-5, WPS, USB, RF 2.4G, RF 5G
- Other: USB port, SD card slot and 2x external antennas (non-detachable)

Flashing instructions:

A) The U-Boot has HTTP based firmware upgrade

  A1) Flashing notes

  We've identified so far two different batches of units, unfortunately
  each batch has different U-Boot bootloader flashed with different
  default environment variables, thus each batch has different IP address
  for accessing web based firmware updater.

  * First batch has web based bootloader IP address 1.1.1.1
  * Second batch has web based bootloader IP address 192.168.1.250

  In case you can't connect to either of those IPs, you can try to get
  the default IP address via two methods:

  A1.1) Serial console, then the IP address is visible during the boot

   ...
   HTTP server is starting at IP: 1.1.1.1
   raspi_read: from:40004 len:6
   HTTP server is ready!
   ...

  A1.2) Over telnet/SSH using this command:

   root@bdcom:/# grep ipaddr= /dev/mtd0
   ipaddr=1.1.1.1

  A2) Flashing with browser

  * Change IP address of PC to 1.1.1.2 with 255.255.255.0 netmask
  * Reboot the device and try to reach web based bootloader in the
    browser with the following URL http://1.1.1.1

  * Quickly select the firmware sysupgrade file and click on the
    `Update firmware` button, this all has to be done within 10 seconds,
    bootloader doesn't wait any longer

   If done correctly, the web page should show UPDATE IN PROGRESS page
   with progress indicator. Once the flashing completes (it takes roughly
   around 1 minute), the device will reboot to the OpenWrt firmware

  A3) Flashing with curl

   sudo ip addr add 1.1.1.2/24 dev eth0
   curl \
      --verbose \
      --retry 3 \
      --retry-delay 1 \
      --retry-max-time 30 \
      --connect-timeout 30 \
      --form "firmware=@openwrt-ramips-mt7620-BDCOM-WAP2100-SK-squashfs-sysupgrade.bin" \
      http://1.1.1.1

   Now power on the router.

B) The U-boot is based on Ralink SDK so we can flash the firmware using UART.

   1. Configure PC with a static IP address and setup an TFTP server.
   2. Put the firmware into the tftp directory.
   3. Connect the UART line as described on the PCB (G=GND, R=RX, T=TX)
   4. Power up the device and press 2, follow the instruction to set device and
      tftp server IP address and input the firmware file name. U-boot will then load
      the firmware and write it into the flash.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
6 years ago
Roman Yeryomin ae2b43b873 ramips: fix ethernet for f5d8235-v2 board
Belkin F5D8235 v2 has two ethernet switches on board.
One internal rt3052 and rtl8366rb on rgmii interface.
Looks like internal switch settings were lost in
translation to device tree infrastructure.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
6 years ago
Russell Senior e42327aa89 ramips: add support for Skylab SKW92A in EVB
Specifically, SKW92A_E16, described here:

  http://www.skylabmodule.com/wp-content/uploads/SkyLab_SKW92A_V1.04_datasheet.pdf

Specification:
- MediaTek MT7628N/N (580 Mhz)
- 64 MB of RAM
- 16 MB of FLASH
- 2T2R 2.4 GHz
- 5x 10/100 Mbps Ethernet
- 2x u.FL
- Power by micro-USB connector at USB1 on EVB
- UART via micro-USB connector at USB3 on EVB (57600 8n1)
- 5x Ethernet LEDs
- 1x WLAN LEDs
- 1x WPS LED connected by jumper wire from I2S_CK on J20 to WPS_LED pin hole next
  to daughter board on EVB
- WPS/Reset button (S2 on EVB)
- RESET button (S1 on EVB) is *not* connected to RST hole next to daughter board

Flash instruction:

>From Skylab firmware:

1. Associate with SKYLAP_AP
2. In a browser, load: http://10.10.10.254/
3. Username/password: admin/admin
4. In web admin interface: Administration / Upload Firmware, browse to
   sysupgrade image, apply, flash will fail with a message:
   Not a valid firmware. *** Warning: "/var/tmpFW" has corrupted data!
5. Telnet to 10.10.10.254, drops you into a root shell with no credentials
6. # cd /var
7. # mtd_write -r write tmpFW mtd4
   Unlocking mtd4 ...
   Writing from tmpFW to mtd4 ... [e]
8. When flash has completed, you will have booted into your firmware.

>From U-boot via TFTP and initramfs:

1. Place openwrt-ramips-mt76x8-skw92a-initramfs-kernel.bin on a TFTP server
2. Connect to serial console at USB3 on EVB
3. Connect ethernet between port 1 (not WAN) and your TFTP server (e.g.
   192.168.11.20)
4. Start terminal software (e.g. screen /dev/ttyUSB0 57600) on PC
5. Apply power to EVB
6. Interrupt u-boot with keypress of "1"
7. At u-boot prompts:
   Input device IP (10.10.10.123) ==:192.168.11.21
   Input server IP (10.10.10.3) ==:192.168.11.20
   Input Linux Kernel filename (root_uImage) ==:openwrt-ramips-mt76x8-skw92a-initramfs-kernel.bin
8. Move ethernet to port 0 (WAN) on EVB
9. At new OpenWrt console shell, fetch squashfs-sysupgrade image and flash
   with sysupgrade.

>From U-boot via TFTP direct flash:

1. Place openwrt-ramips-mt76x8-skw92a-squashfs-sysupgrade.bin on a TFTP server
2. Connect to serial console at USB3 on EVB (57600 8N1)
3. Connect ethernet between port 1 (not WAN) an your TFTP server (e.g.
   192.168.11.20)
4. Start terminal software (e.g. screen /dev/ttyUSB0 57600) on PC
5. Apply power to EVB
6. Interrupt u-boot with keypress of "2"
7. At u-boot prompts:
   Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N) Y
   Input device IP (10.10.10.123) ==:192.168.11.21
   Input server IP (10.10.10.3) ==:192.168.11.20
   Input Linux Kernel filename (root_uImage) ==:openwrt-ramips-mt76x8-skw92a-squashfs-sysupgrade.bin
8. When transfer is complete or as OpenWrt begins booting, move ethernet to
   port 0 (WAN).

Signed-off-by: Russell Senior <russell@personaltelco.net>
6 years ago
Daniel Golle 7c4251d881 ramips: select kmod-mt76x0e for TP-Link ArcherC20i and wr902ac-v3
Both devices come with a MediaTek MT7610E 5GHz 802.11ac 1T1R radio
which wasn't supported at the time the devices were added to OpenWrt.
Now that we got it, include kmod-mt76x0e in images for those devices.

Reported-by: Arian Sanusi <openwrt@semioptimal.net>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
Rafał Miłecki 9a3c805584 ramips: use separated mtd patch reverting write_page() removal
This helps understanding mtd changes needed to get downstream NAND
driver working.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years ago
Koen Vandeputte b4e17a7440 ramips: fix netgear r6120 factory image generation
as indicated in commit c5bf408ed6 "(ramips: fix image generation for mt76x8")
more rework was needed to fix the other issues.

Building on another machine, but using the same arch, showed
the application failing again for different reasons.

Fix this by completely rewriting the application, fixing following found issues:

- buffer overflows, resulting in stack corruption
- flaws in memory requirement calculations (too small, too large)
- memory leaks
- missing bounds checking on string handling
- non-reproducable images, by using unitilized memory in checksum calculation
- missing error handling, resulting in succes on specific image errors
- endianness errors when building on BE machines
- various minor build warnings
- documentation did not match the code actions (header item locations)
- allowing input to be decimal, hex or octal now

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Felix Fietkau b318edb999 ramips: add missing DTS frequency limit for the 5 GHz radio on Archer C20i
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Koen Vandeputte c764b2b531 kernel: bump 4.14 to 4.14.79
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Martin Weinelt 0411813c6f
ramips: fix leds on GL.iNet GL-MT300N-V2
The WAN LED now shows the link state. It's color is green,
not blue.

Signed-off-by: Martin Weinelt <hexa@darmstadt.ccc.de>
6 years ago
Baptiste Jonglez b2c68ceea7 kernel: Add support for Winbond w25q128jv SPI NOR flash
Newer batches of several Mikrotik boards contain this yet-unsupported
flash chip, for instance:

- rb941-2nd (hAP lite)
- rb952ui-5ac2nd (hAP ac lite)
- RBM33G

and probably other Mikrotik boards need this patch as well.

The patch was submitted upstream by Robert Marko: https://patchwork.ozlabs.org/patch/934181/

Closes: FS#1715
Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org>
Cc: Robert Marko <robimarko@gmail.com>
6 years ago
Mathias Kresin 80c61c161a treewide: use wpad-basic for not small flash targets
Add out of the box support for 802.11r and 802.11w to all targets not
suffering from small flash.

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

Mathias did all the heavy lifting on this, but I'm the one who should
get shouted at for committing.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Felix Fietkau d251a11f60 ramips: refresh mt7621 kernel config
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Koen Vandeputte f983956a8b kernel: bump 4.14 to 4.14.75
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Mathias Kresin b07b3ddaad ramips: don't hijack the status led
Don't hijack the status led to indicate the wireless state. If we don't
have a dedicated wireless led, it's as simply as the wireless status
can't be indicated.

Such a led misuse should be set by the user and not shipped by default.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin c074239c79 ramips: move status led unset to devicetree
Release the led used for boot status indication via devicetree instead
of setting a default off trigger in userspace.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 8f4dfadd5a ramips: add support for indicating the boot state using multiple leds
Use diag.sh version used for other targets supporting different leds
for the different boot states.

The existing led sequences should be the same as before.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 772b27c207 ramips: set F5D8235 v1 usb led trigger via devicetree
Assign the usbdev trigger via devicetree and drop the userspace
handling of the usb leds.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 04eab0a1c9 ramips: set rt2880 pci controller of_node
Set the PCI controller of_node such that PCI devices can be
instantiated via device tree.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a58535771f ramips: set usb led trigger via devicetree
Assign the usbdev trigger via devicetree for all subtargets and drop
the userspace handling of the usb leds.

With the change all usb ports are triggering the usb led instead of
only usb 1.1 XOR usb 2.0 XOR usb 3.0 as it was before.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte a2adeffffc kernel: bump 4.14 to 4.14.74
Refreshed all patches.

Fixes CVE:

- CVE-2018-7755

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Steffen Förster 8480907e70 ramips: fix Archer C20 sysupgrade
The sysupgrade image failed the check due to the wrong string in the
supported devices. This patch provides the correct name by dropping the
SUPPORTED_DEVICES to use the default generated name.

Signed-off-by: Steffen Förster <steffen@chemnitz.freifunk.net>
[drop the SUPPORTED_DEVICES, the old name was never used in a release]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Emil Muratov 8e6bc1a5be ramips: fix power LED DTB for wt3020
Since c134210 power LED is no longer lights after boot-up.
Reversing gpio polarity makes it work as it should be.

Signed-off-by: Emil Muratov <gpm@hotplug.ru>
6 years ago
Joseph C. Lehner d6e39e7466 ramips: ex2700: actually remove kmod-mt76*
When building using the multiple devices option with per-device root
filesystem, only the meta package mt76 is omitted but not the
dependencies selected by the package.

Explicitly exclude all 3 mt76 packages, plus the metapackage.
Otherwise, these modules will be included in the build, wasting
a few hundred kilobytes.

Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
[mention the root cause of the issue in the commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte 0cda4af005 kernel: bump 4.14 to 4.14.70
Refreshed all patches.

Added new patch:
- 192-Revert-ubifs-xattr-Don-t-operate-on-deleted-inodes.patch

This fixes a bug introduced in upstream 4.14.68 which caused targets using
ubifs to produce file-system errors on boot, rendering them useless.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Tobias Wolf 93bfafb8dc ramips: Fix early memory calculation for certain MIPS platforms
Kernel upstream commit 67a3ba25aa95 ("MIPS: Fix incorrect mem=X@Y handling") introduced a new issue for rt288x where "PHYS_OFFSET" is 0x0 but the calculated "ramstart" is not. As the prerequisite of custom memory map has been removed, this results in the full memory range of 0x0 - 0x8000000 to be marked as reserved
for this platform.

This patch adds the originally intended prerequisite again.

Signed-off-by: Tobias Wolf <dev-NTEO@vplace.de>
6 years ago
Carlo Nel 6bbb220255 ramips: add support for TP-Link TL-MR3020 v3
TP-Link TL-MR3020 v3 is a pocket-size router based on MediaTek MT7628N.

This PR is based on the work of @meyergru[1], with his permission.

Specification:
- MediaTek MT7628N/N (575 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 2T2R 2.4 GHz
- 1x 10/100 Mbps Ethernet

Flash instruction:

The only way to flash the image in TL-MR3020 v3 is to use
tftp recovery mode in U-Boot:

1. Configure PC with static IP 192.168.0.225/24 and tftp server.
2. Rename "openwrt-ramips-mt76x8-tplink_tl-mr3020-v3-squashfs-tftp-recovery.bin"
   to "tp_recovery.bin" and place it in tftp server directory.
3. Connect PC with the LAN port, press the reset button, power up
   the router and keep button pressed for around 6-7 seconds, until
   device starts downloading the file.
4. Router will download file from server, write it to flash and reboot.

[1] https://github.com/meyergru/lede-source/commits/TL-MR3020-V3

Signed-off-by: Carlo Nel <carlojnel@gmail.com>
6 years ago
Mathias Kresin 287b7aa583 ramips: drop obsolete sd card driver code
The pinmux for all SoCs using this driver is now set via the pinmux. It
makes this code obsolete.

Some of the code targeting the mt76x8 SoCs is still required. The sd
card pins share the pads with the EPHY. These pads need to be switched
to digital mode if the pins are used for sd cards.

The eMMC 8-bit mode has to be enabled via pinmux instead of a kernel
option. The uart2 group need to be set to function "sdxc d5 d4", pwm1
to "sdxc d6" and pwm0 to "sdxc d7" to do so. It can't be done by as
part of a default pinmux, as it would break the normal operation of
uart2.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 563a5b5f94 ramips: add mt7620/1 sdhci pinmux
Set the pins to the required mode via the pinmux driver. It allows to
get rid of the pinmux related code in the sd card driver.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin a14097e8e0 ramips: fix mt7620a ND/SD pins pinmuxes
Drop the nd_sd gpio pinmux in case sdcard is used. They're mutually
exclusive and for most of the boards not even used as GPIOs.

If the pins are in sdcard mode, the pins ND_WE_N and ND_CS_N are still
GPIOs (#45 and #46).

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 2cc7980dcb ramips: reference node by label
Reference the HC5661A sdhci node by label instead of by the full path.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 1d08951628 ramips: add rt3352 SPI_CS1 pinmux
The rt3352 has a pin that can be used as second spi chip select,
watchdog reset or GPIO. The pinmux setup was missing the definition of
said pin but it is already used in the SoC dtsi.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Felix Fietkau b605a84a74 ramips: ethernet: unify tx descriptor buffer splitting
A buffer is split into multiple descriptors if it exceeds 16 KB.
Apply the same split for the skb head as well (to deal with corner cases
on fraglist support)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Jo-Philipp Wich 4302c917cc Revert "ramips: mmc: Fix init for MT7628AN"
This reverts commit 3a8efaef00.

The change reportedly breaks UART2 on some boards. Furthermore it uses
bitwise logic on an uninitialized variable and fails to explain what it
is fixing exactly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Jo-Philipp Wich 77e2bccde8 ramips: only limit lzma dictionary size on mt7621
The changed dictionary size leads to a different LZMA header which breaks
sysupgrade image magic checkibng on at least some RT288x boards.

Since the commit message only mentions testing on MT7621 and since the
change appears to break at least one other ramips subtarget, do not take
any chances and restrict the size limitation to only MT7621.

Fixes FS#1797
Fixes 09b6755946 ("ramips: limit dictionary size for lzma compression")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
6 years ago
Mathias Kresin a6e11ccb13 ramips: fix rt3883 pinmux for second SPI
The rt3883 doesn't have a pinmux group named spi_cs1. The cs1 is part
of the pci group. The function pci-func enables the second chip select.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin dcdc6d9dad ramips: fix rt3883 pci pinmux
The PCI pins need to be set to "PCI Host support one device" to allow
the use of one PCI device and flash memory.

The pci-fnc function is intended to be used if no PCI is used but
flash, nand or the codec functionality is.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin c134210b8f ramips: drop pointless default led definitions
The LEDs should be triggered/lit by any kind of state change instead of
turned on/off unconditional.

If LEDs really need to be turned off by default, it should be done via
the default-state devicetree led property.

The handling of the wndr3700v5 and wt3020 power led is at least
strange. Something is for sure wrong with them. Either the leds are
misnamed, the default off trigger is a typo or the polarity of the
gpios is wrong. Drop the power led from userspace and wait for someone
with access to the hardware to fix it properly.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 43df31f64d ramips: add missing zbt-cpe102 diag led
Based on the userspace led configuration it's quite obvious that the
4g-0 led should be used for boot status indication.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 99045dfc59 ramips: express diag led handling via devicetree
Use the default-state property to express the desired led handling in
the devicetree source file instead of the userspace.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 111907e8d3 ramips: remove default on userspace trigger for diag leds
All the LEDs are turned on by diag.sh at the end of the boot process.
No need to do the same via userspace configuration again.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 56e6ebdea4 ramips: fix multi colour led handling
All boards either have a multi colour led or a single lightpipe. It
makes it impossible to handle the LEDs individual. Change the LED
config for these boards to take it into account.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin fe1e90deb4 ramips: rt-n12p: use the boardname helper variable
Use the helper variable for the Asus RT-N12P as it is done by all
boards.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Koen Vandeputte 01793e8752 kernel: bump 4.14 to 4.14.67
Refreshed all patches.

Removed upstreamed patches:
- 037-v4.18-0008-ARM-dts-BCM5301x-Fix-i2c-controller-interrupt-type.patch

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

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

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Paul Wassi <p.wassi@gmx.at>
6 years ago
Mathias Kresin 3601c3de23 ramips: fix mt7620 pinmux for second SPI
The mt7620 doesn't have a pinmux group named spi_cs1. The cs1 is part
of the "spi refclk" group. The function "spi refclk" enables the second
chip select.

On reset, the pins of the "spi refclk" group are used as reference
clock and GPIO.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Thibaut VARÈNE bbe2cf657c ramips: fix RBM11G partitioning
This patch improves faf64056dd by correcting
the partition scheme for the "RouterBoot" section of the flash.

The partition scheme initially submitted is incorrect and does not reflect
the actual flash structure.

The "RouterBoot" section (name matching OEM) is subdivided in several
static segments, as they are on ar71xx RB devices albeit with different
offsets and sizes.
The naming convention from ar71xx has been preserved, except for the
bootloaders which are named "bootloader1" and "bootloader2" to avoid
confusion with the master "RouterBoot" partition.
The preferred 'fixed-partitions' DTS node syntax is used, with nesting
support as introduced in 2a598bbaa3.
"partition" is used for node names, with associated "label" to match
policy set by 6dd94c2781.

Leave a note in DTS to explain how the original author selected the SPI speed.

Tested-by: Tobias Schramm <tobleminer@gmail.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Reviewed-by: Rafał Miłecki <rafal@milecki.pl>
6 years ago
Thibaut VARÈNE b90cad2c2e ramips: fix RBM33G partitioning
This patch improves 5684d08741 by correcting
the partition scheme for the "RouterBoot" section of the flash.

The partition scheme initially submitted is incorrect and does not reflect
the actual flash structure.

The "RouterBoot" section (name matching OEM) is subdivided in several
static segments, as they are on ar71xx RB devices albeit with different
offsets and sizes.
The naming convention from ar71xx has been preserved, except for the
bootloaders which are named "bootloader1" and "bootloader2" to avoid
confusion with the master "RouterBoot" partition.
The preferred 'fixed-partitions' DTS node syntax is used, with nesting
support as introduced in 2a598bbaa3.
"partition" is used for node names, with associated "label" to match
policy set by 6dd94c2781.

The OEM source code also define a "RouterBootFake" partition at the
beginning of the secondary flash chip: to avoid trouble if OEM ever makes
use of that space, it is also defined here.

The resulting partition scheme looks like this:
[   10.114241] m25p80 spi0.0: w25x40 (512 Kbytes)
[   10.118708] 1 fixed-partitions partitions found on MTD device spi0.0
[   10.125049] Creating 1 MTD partitions on "spi0.0":
[   10.129824] 0x000000000000-0x000000040000 : "RouterBoot"
[   10.136215] 5 fixed-partitions partitions found on MTD device RouterBoot
[   10.142894] Creating 5 MTD partitions on "RouterBoot":
[   10.148032] 0x000000000000-0x00000000f000 : "bootloader1"
[   10.154336] 0x00000000f000-0x000000010000 : "hard_config"
[   10.160665] 0x000000010000-0x00000001f000 : "bootloader2"
[   10.167046] 0x000000020000-0x000000021000 : "soft_config"
[   10.173461] 0x000000030000-0x000000031000 : "bios"
[   10.190191] m25p80 spi0.1: w25q128 (16384 Kbytes)
[   10.194950] 2 fixed-partitions partitions found on MTD device spi0.1
[   10.201271] Creating 2 MTD partitions on "spi0.1":
[   10.206071] 0x000000000000-0x000000040000 : "RouterBootFake"
[   10.212746] 0x000000040000-0x000001000000 : "firmware"
[   10.307216] 2 minor-fw partitions found on MTD device firmware
[   10.313044] 0x000000040000-0x000000220000 : "kernel"
[   10.319002] 0x000000220000-0x000001000000 : "rootfs"
[   10.324906] mtd: device 9 (rootfs) set to be root filesystem
[   10.330678] 1 squashfs-split partitions found on MTD device rootfs
[   10.336886] 0x000000b40000-0x000001000000 : "rootfs_data"

Leave a note in DTS to explain how the original author selected the SPI speed.

Tested-by: Tobias Schramm <tobleminer@gmail.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Reviewed-by: Rafał Miłecki <rafal@milecki.pl>
[rmilecki: dropped "RouterBootFake" partition]
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
6 years ago
Roger Pueyo Centelles 524c17d865 ramips: mt7620: add dir-810l network config
The device was not included in the /etc/board.d/02_network file, so
the network wouldn't be properly set up on boot.

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
6 years ago
NOGUCHI Hiroshi ad10e71bec ramips: add support for ELECOM WRC-1900GST
ELECOM WRC-1900GST is a wireless router, based on Mediatek MT7621A.
This is almost same as WRC-2533GST except wireless specs.

Specifications:

  - SoC : MT7621A (four logical CPU cores)
  - RAM : 128MiB
  - ROM : 16MiB of SPI NOR-FLASH
  - wireless :
          5GHz : 3T3R up to 1300Mbps/11ac with MT7615
          2.4GHz : 3T3R up to 600Mbps/11n with MT7615
  - Ethernet : 5 ports, all ports is capable of 1000base-T
  - Ether switch : MT7530 (MT7621A built-in)
  - LEDs : 4 LEDs
  - buttons : 2 buttons and 1 slide-switch
  - UART : header is on PCB, 57600bps

Flash instruction using factory image:

 1. Connect the computer to the LAN port of WRC-1900GST
 2. Connect power cable to WRC-1900GST and turn on it
 3. Access to "https://192.168.2.1/" and open firmware update
    page ("ファームウェア更新")
 4. Select the OpenWrt factory image and click apply ("適用")
    button
 5. Wait ~150 seconds to complete flashing

Signed-off-by: NOGUCHI Hiroshi <drvlabo@gmail.com>
6 years ago
Mathias Kresin b8996ea08a ramips: fix compatibles in SoC dtsi
The former used compatibles aren't defined anywhere and aren't used by
the devicetree source files including them.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin b88e03e2d4 ramips: fix GL-MT300N-V2 SoC compatible
According to abbfcc8525 ("ramips: add support for GL-inet
GL-MT300N-V2") the board has a MediaTek MT7628AN. Change the SoC
compatible to match the used hardware.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 28de86e816 ramips: drop not existing groups from pinmux
RT5350 neither have rgmii nor a mdio pinmux group. MT7628an doesn't
have a jtag group. Having these groups defined might cause a boot
panic.

The pin controller fails to initialise for kernels > 4.9 if invalid
groups are used. If a subsystem references a pin controller
configuration node, it can not find this node and errors out. In worst
case it's the SPI driver which errors out and we have no root
filesystem to mount.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 56b8ac1e86 treewide: consolidate upgrade state set
Set the (sys)upgrade state when sourcing the stage2 script instead of
setting the state for each target individual.

This change fixes the, due to a missing state set, not working upgrade
led on ath79 and apm821xx.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 1ea1f3a223 ramips: mt7620: fix bad indent
Fix the indent to make the make it obvious which condition is the
parent of the loop.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Cezary Jackiewicz 37af596593 ramips: add support for D-Link DWR-118-A2
The DWR-118-A2 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 128 MB of RAM
- 16 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7612EN)
- 4x 10/100 Mbps Ethernet (1 WAN and 3 LAN)
- 1x 10/100/1000 Mbps Marvell Ethernet PHY (1 LAN)
- 2x external, non-detachable antennas
- 1x USB 2.0
- UART (J1) header on PCB (57600 8n1)
- 7x LED (5x GPIO-controlled), 2x button
- JBOOT bootloader

Known issues:
- GELAN not working
- flash is very slow

The status led has been assigned to the dwr-118-a2:green:internet led.
At the end of the boot it is switched off and is available for other
operation. Work correctly also during sysupgrade operation.

Installation:
Apply factory image via http web-gui or JBOOT recovery page

How to revert to OEM firmware:
- push the reset button and turn on the power. Wait until LED start
  blinking (~10sec.)
- upload original factory image via JBOOT http (IP: 192.168.123.254)

Signed-off-by: Cezary Jackiewicz <cezary@eko.one.pl>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago
Pawel Dembicki 4877ad44c7 ramips: mt7620: enable all ports unconditionally
This patch make all mt7620 ephy ports turned on.
It is necessary for some JBOOT devices.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
6 years ago
Deng Qingfang d20f4fc628 ramips: add support for HiWiFi HC5861B
HiWiFi "Gee Enjoy1200" HC5861B is a dual-band router based on MediaTek MT7628AN
https://www.hiwifi.com/enjoy-view

Specifications:
- MediaTek MT7628AN 580MHz
- 128 MB DDR2 RAM
- 16 MB SPI Flash
- 2.4G MT7628AN 802.11bgn 2T2R 300Mbps
- 5G MT7612EN 802.11ac 2T2R 867Mbps
- 5x 10/100 Mbps Ethernet

Flash instruction:
1. Get SSH access to the router
2. SSH to router with `ssh -p 1022 root@192.168.199.1`, The SSH password is the same as the webconfig one
3. Upload OpenWrt sysupgrade firmware into the router's `/tmp` folder with SCP
4. Run `mtd write /tmp/<filename> firmware`
5. reboot

Everything is working

Signed-off-by: Deng Qingfang <dengqf6@mail2.sysu.edu.cn>
6 years ago
Zoltan HERPAI d6844b3bfa ramips: add missing USB packages into ASL26555-16M
Mirror the package list from the 8M device profile to the
16M device profile.

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
6 years ago
Daniel Gimpelevich 1d3ea7874d ramips: fix BR-6478ACv2 support
The wholesale changes introduced in commit f9b8328 missed this DTS file
because it hadn't been merged yet. This patch brings it in line to match
the other mt7620a devices' DTS files.

Additionally, the Internet LED is now labeled correctly and set to unused
by default, since the WAN interface is not known in every configuration.

Using sysupgrade between images before and after this commit will require
the -F flag.

Tested-by: Rohan Murch <rohan.murch@gmail.com>
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
[drop internet led default setting]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Ludwig Thomeczek 5543d63fc8 ramips: add support for Netgear R6120
This patch adds support for the Netgear R6120, aka Netgear AC1200.

Specification:
- SoC: MediaTek MT7628 (580 MHz)
- Flash: 16 MiB
- RAM: 64 MiB
- Wireless: 2.4Ghz(builtin) and 5Ghz (MT7612E)
- LAN speed: 10/100
- LAN ports: 4
- WAN speed: 10/100
- WAN ports: 1
- Serial baud rate of Bootloader and factory firmware: 57600

To flash use nmrpflash with the provided factory.img.
Flashing via webinterface will not work, for now.

Signed-off-by: Ludwig Thomeczek <ledesrc@wxorx.net>
6 years ago
INAGAKI Hiroshi a6369206fe ath79: add support for I-O DATA WN-AC1600DGR2
I-O DATA WN-AC1600DGR2 is a 2.4/5 GHz band 11ac router, based on
Qualcomm Atheros QCA9557.

Specification:

- Qualcomm Atheros QCA9557
- 128 MB of RAM
- 16 MB of Flash
- 2.4/5 GHz wifi
  - 2.4 GHz: 2T2R (SoC internal)
  - 5 GHz: 3T3R (QCA9880)
- 5x 10/100/1000 Mbps Ethernet
- 6x LEDs, 6x keys (4x buttons, 1x slide switch)
- UART header on PCB
  - Vcc, GND, TX, RX from ethernet port side
  - 115200n8

Flash instruction using factory image:

1. Connect the computer to the LAN port of WN-AC1600DGR2
2. Connect power cable to WN-AC1600DGR2 and turn on it
3. Access to "http://192.168.0.1/" and open firmware update page
("ファームウェア")
4. Select the OpenWrt factory image and click update ("更新") button
5. Wait ~150 seconds to complete flashing

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
6 years ago
Mathias Kresin 3b1213a377 ramips: use #include syntax for dtsi files
Use the same syntax for including dtsi for all dts files.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Chen Minqiang f6d81e2fa1 mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possible
To share mdio addr for IntPHY and ExtPHY,
as described in the documentation (MT7620_ProgrammingGuide.pdf).
(refer: http://download.villagetelco.org/hardware/MT7620/MT7620_ProgrammingGuide.pdf)

when port4 setup to work as gmac mode, dts like:

&gsw {
    mediatek,port4 = "gmac";
};

we should set SYSCFG1.GE2_MODE==0x0 (RGMII).
but SYSCFG1.GE2_MODE may have been set to 3(RJ-45) by uboot/default
so we need to re-set it to 0x0

before this changes:
gsw: 4FE + 2GE may not work correctly and MDIO addr 4 cannot be used by ExtPHY

after this changes:
gsw: 4FE + 2GE works and MDIO addr 4 can be used by ExtPHY

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
6 years ago
Daniel Gimpelevich 379fe50672 ramips: fix gigabit switch PHY access on MDIO
When PHY's are defined on the MDIO bus in the DTS, gigabit support was
being masked out for no apparent reason, pegging all such ports to 10/100.
If gigabit support must be disabled for some reason, there should be a
"max-speed" property in the DTS.

Reported-by: James McKenzie <openwrt@madingley.org>
Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
6 years ago
Daniel Gimpelevich 5a6229a93d ramips: remove superfluous & confusing DT binding
Mediatek has a reference platform that pairs an MT7620A with an MT7530W,
where the latter responds on MDIO address 0x1f while both chips respond on
0x0 to 0x4. The driver special-cases this arrangement to make sure it's
talking to the right chip, but two different ways in two different places.
This patch consolidates the detection without the current requirement of
both tests to be separately satisfied in the DTS.

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
6 years ago
Daniel Gimpelevich f72fa883b3 ramips: add support for Edimax BR-6478AC v2
Roll-up of patches by Rohan Murch, Hans Ulli Kroll, and James McKenzie.
Taken from https://forum.openwrt.org/viewtopic.php?id=67192 and updated.

Specification:
- System-On-Chip: MT7620A
- CPU/Speed: 580 MHz
- Flash-Chip: Macronix MX25L6405D
- Flash size: 8192 KiB
- RAM: 64 MiB
- Wireless No1: SoC-integrated: MT7620A 2.4GHz 802.11bgn
- Wireless No2: On-board chip: MT7612E 5GHz 802.11ac
- Switch: Mediatek MT7530W Gigabit Switch
- USB: Yes 1 x 2.0

Installation:
1. Download sysupgrade.bin
2. Open vendor web interface
3. Choose to upgrade firmware
4. After reboot connect via ethernet at 192.168.1.1

Signed-off-by: Daniel Gimpelevich <daniel@gimpelevich.san-francisco.ca.us>
6 years ago
Alex Maclean 6031ab345d ramips: move partitions into partition table node
Starting with kernel 4.4, the use of partitions as direct subnodes of the
mtd device is discouraged and only supported for backward compatiblity
reasons.

Signed-off-by: Alex Maclean <monkeh@monkeh.net>
6 years ago
Mathias Kresin 6dd94c2781 ramips: unify partition node names in dts files
Use partition@ as name for all partition nodes. Add a label where
necessary.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin bfd65fc4ab ramips: fix whitespace and comment issues in dts
Fix space vs. tabs issue and trainling whitespaces. Use C style
comments or drop the comments if they explain what is already to see in
the devicetree parameters.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 53624c1702 ramips: fix dtc warnings
Fix individual boards dtc warnings or obvious mistakes.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 6384e0d16a ramips: fix hnat dtc warning
The hardware NAT node has the same reg/unit as the ethernet node. One
of them need to be a child of the other.

Make the hardware NAT node a child of the ethernet node since the it
"reference" the netdev in its properties.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin f9b8328d79 ramips: fix pci/pcie related dtc warnings
Add the ranges property to the PCI bridges where missing. Add the unit
address to PCI bridge where missing.

Rework the complete rt3883 pci node. Drop the PCI unit nodes from the
dtsi. They are not used by any dts file and should be rather in the dts
than in the SoC dtsi. Express the PCI-PCI bridge in a clean devicetree
syntax. The ralink,pci-slot isn't used by any driver, drop it. Move the
pci interrupt controller out of the pci node. It doesn't share the same
reg and therefore should be an independent/SoC child node.

Move the pci related rt3883 pinctrl setting to the dtsi instead of
defining the very same for each rt3883 board.

If the device_type property is used for PCI units, the unit is treated
as pci bridge which it isn't. Drop it for PCI units.

Reference pci-bridges or the pci node defined in the dtsi instead of
recreating the whole node hierarchy. It allows to change the referenced
node in the dtsi without the need to touch all dts.

Fix the PCI(e) wireless unit addresses. All our PCI(e) wireless chips
are the first device on the bus. The unit address has to be the bus
address instead of the PCI vendor/device id.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin d8e7a526a3 ramips: use ralink,nr-gpio instead of ralink,num-gpios
Since commit c1e7738988f5 ("checks: add gpio binding properties check")
dtc treats any *-gpios and *-gpio property as phandle at least during
checks. The only whitelisted property is nr-gpio.

Use ralink,nr-gpio in favour of ralink,num-gpios to get rid of false
positive warnings.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 1bad2b74ae ramips: fix cpu interrupt controller dtc warnings
The cpu interrupt controller doesn't have a reg property, hence we
can't use a unit address in the node name.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin b9dbf3f3c8 ramips: fix cpu related dtc warnings
We need a reg property if we are using a unit address.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
René van Dorst 0ae9396556 treewide: convert gpio-export to platform driver
Without this patch you will get an error "gpio-export probe deferral
not supported" when you try to export i2c expander gpio pins.

gpio-export is probed long before i2c-bus and i2c expander are created
and it doesn't retry it so none pins are exported.

Signed-off-by: René van Dorst <opensource@vdorst.com>
apply the change to all instances of the gpio exports patch
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Stijn Tintel 22b9f99b87 kernel: bump 4.14 to 4.14.59
Drop patch that was superseded upstream:
ramips/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch

Drop upstreamed patches:
- apm821xx/020-0001-crypto-crypto4xx-remove-bad-list_del.patch
- apm821xx/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch
- ath79/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
- brcm63xx/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
- brcm63xx/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
- generic/backport/080-net-convert-sock.sk_wmem_alloc-from-atomic_t-to-refc.patch
- generic/pending/170-usb-dwc2-Fix-DMA-alignment-to-start-at-allocated-boun.patch
- generic/pending/900-gen_stats-fix-netlink-stats-padding.patch

In 4.14.55, a patch was introduced that breaks ext4 images in some
cases. The newly introduced patch
backport-4.14/500-ext4-fix-check-to-prevent-initializing-reserved-inod.patch
addresses this breakage.

Fixes the following CVEs:
- CVE-2018-10876
- CVE-2018-10877
- CVE-2018-10879
- CVE-2018-10880
- CVE-2018-10881
- CVE-2018-10882
- CVE-2018-10883

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

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago