Commit Graph

22966 Commits (58bdbe73212a7f1c2755cf640e21b01e9b2d7b04)

Author SHA1 Message Date
Hauke Mehrtens 586661018e ath79: Do not build buffalo_whr-g301n by default
The squashfs partition is getting too big.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
4 years ago
Álvaro Fernández Rojas 78a0ae9023 bcm63xx: WIP: add Huawei HG253s v2 support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 5998c8f059 bcm63xx: nand: support CFE partition tags
Introduce support for generating JFFS2 CFE partition tags.
This is used in NAND devices in order to verify the integrity of the JFFS2
partition.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 6dc3dce658 bcm63xx: improve rgmii ctrl overrides
There are older devices which require overriding the RGMII ports, so this
shouldn't be limited and forced to BCM63268.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 7a817752f6 bcm63xx: dgnd3700-v1: add NAND support
NAND is used as extra storage on this device.

Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu@gmail.com>
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 67861b2a66 bcm63xx: nand: fix v2.1 controller support
Page size shift is different from v2.2+ controllers

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Russell King 6593ea23e5 kernel: backport the I2C bus recovery for uDPU
Backport the I2C bus recovery DT configuration for the uDPU that has
been queued for 5.8.

Signed-off-by: Russell King <linux@armlinux.org.uk>
4 years ago
Russell King 714199ec34 kernel: backport v5.8 i2c-pxa updates
Add i2c-pxa updates queued for v5.8, which add bus recovery to this
driver; this is needed for the uDPU platform.

Signed-off-by: Russell King <linux@armlinux.org.uk>
4 years ago
Russell King 72a1d5c3ac kernel: backport gpio emulated open drain output fix
Backport the GPIO emulated open drain output fix from v5.5, which is
required for the i2c-pxa backport.

Signed-off-by: Russell King <linux@armlinux.org.uk>
4 years ago
Thibaut VARÈNE 6934b20912 generic: platform/mikrotik: disambiguate SPDX-License-Identifier
I meant it to be GPL-2.0-only, as evidenced by the boilerplate.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 49eec56bfc generic: routerbootpart.c: disambiguate SPDX-License-Identifier
I meant it to be GPL-2.0-only, as evidenced by the boilerplate.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Eneas U de Queiroz 94e27d62ab sdk: add OpenWrt branding to menuconfig & .config
Set the mainmenu symbol in SDK Config.in to "OpenWrt Configuration", the
same as the main OpenWrt Config.in.  This string is is used as the name
of the top menu in menuconfig, and at the top of the .config file.  If
unset, current kconfig will use "Linux Kernel Configuration".

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
4 years ago
Eneas U de Queiroz 1f2539a1f4 sdk: fix host menu config targets using ncurses
This applies 965f341aa9 ("build: fix host menu config targets using
ncurses") to the SDK top Makefile.

If there is a pkg-config in the staging dir, it will try to use it
instead of the host system's pkg-config; then it will fail to find the
ncurses package.  Linux's default will be used, which fails in some
cases, such as recent Gentoo systems.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
[fixed From: to match SoB]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Petr Štetiar 1b2fefb244 kernel: bump 5.4 to 5.4.42
Refreshed patches, removed upstreamed patch:

 generic/pending: 001-v5.4-pinctrl-qcom-fix-wrong-write-in-update_dual_edge.patch.patch

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

Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Alberto Bursi dc7cc60ca3 x86: fix generic kernel 5.4 config
The last kernel update done with commit 500a02bc29 ("x86: Update
configuration") placed most of the updated config only in the x86_64
target.

Move the options needed by the other targets too in the x86 base config,
and add an additional option needed by those targets.

Fixes: 500a02bc29 ("x86: Update configuration")
Signed-off-by: Alberto Bursi <bobafetthotmail@gmail.com>
[commit subject/description tweaks]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
4 years ago
Richard Huynh f3792690c4 ramips: Add support for Xiaomi Redmi Router AC2100 (RM2100)
Specification:
- CPU: MediaTek MT7621A
- RAM: 128 MB DDR3
- FLASH: 128 MB ESMT NAND
- WIFI: 2x2 802.11bgn (MT7603)
- WIFI: 4x4 802.11ac (MT7615)
- ETH: 3xLAN+1xWAN 1000base-T
- LED: Power, WAN, in Amber and White
- UART: On board near ethernet, opposite side from power
- Modified u-boot

Installation:

1. Run linked exploit to get shell, startup telnet and wget the files over
2. mtd write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-kernel1.bin kernel1
3. nvram set uart_en=1
4. nvram set bootdelay=5
5. nvram set flag_try_sys1_failed=1
6. nvram commit
7. mtd -r write openwrt-ramips-mt7621-xiaomi_rm2100-squashfs-rootfs0.bin rootfs0

Restore to stock:

1. Setup PXE and TFTP server serving stock firmware image
(See dhcp-boot option of dnsmasq)
2. Hold reset button down before powering on and wait for flashing amber led
3. Release reset button
4. Wait until status led changes from flashing amber to white

Notes:
This device has dual kernel and rootfs slots like other Xiaomi devices currently
supported (mir3g, etc.) thus, we use the second slot and overwrite the first
rootfs onwards in order to get more space.

Exploit and detailed instructions:

https://openwrt.org/toh/xiaomi/xiaomi_redmi_router_ac2100

An implementation of CVE-2020-8597 against stock firmware version 1.0.14

This requires a computer with ethernet plugged into the wan port and an active
PPPoE session, and if successful will open a reverse shell to 192.168.31.177
on port 31337.

As this shell is somewhat unreliable and likely to be killed in a random amount
of time, it is recommended to wget a static compiled busybox binary onto the
device and start telnetd with it.

The stock telnetd and dropbear unfortunately appear inoperable.
(Disabled on release versions of stock firmware likely)
Ie. wget https://yourip/busybox-mipsel -O /tmp/busybox
chmod a+x /tmp/busybox
/tmp/busybox telnetd -l /bin/sh

Tested-by: David Martinez <bonkilla@gmail.com>
Signed-off-by: Richard Huynh <voxlympha@gmail.com>
4 years ago
Álvaro Fernández Rojas c93cdf536a bcm63xx: lzma-loader: rely on CHIP_ID for UART address
lzma-loader uart output wasn't working on BCM3380/BCM6362 because these
SoCs have the same processor ID.
Let's use CHIP_ID for establishing the UART base address.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 8e8920c92f bcm63xx: lzma-loader: remove unused definitions
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 0836e22a83 bcm63xx: image: add CVG834G CHIP_ID
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 91b275b6e3 bcm63xx: image: rename CFE_CHIP_ID to CHIP_ID
Rename CFE_CHIP_ID to a generic name that doesn't involve CFE.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas e0382c50e9 bcm63xx: fix AD1018 WLAN led
Standard AD1018 has lower case LEDs.

Fixes: 5f82691923 ("bcm63xx: add unmodded SERCOMM AD1018 support")
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 5f82691923 bcm63xx: add unmodded SERCOMM AD1018 support
Until now only HW modded SPI flash version was supported.

BCM6328 with 64M RAM and 128M NAND.
More info: https://openwrt.org/toh/sercomm/ad1018

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 5d3bb7ea9a kernel: mtdsplit: bcm_wfi: add sercomm support
SERCOMM creates separates partitions for cferam.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas f996377a26 bcm63xx: bcm6328: fix strapbus boot sel
Boot selection bit is 18, not 28.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Sungbo Eo 31697f92a2 ramips: fix MAC address setup for RT5350F-OLinuXino devices
Olimex RT5350F-OLinuXino devices do not have a default MAC address, and there is
nothing at the 0x4 offset in the factory partition. Using a local address, which
is randomly generated by the kernel, would be a better choice.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo f7112a180f ramips: 5.4: handle ERR_PTR properly
of_get_mac_address can return ERR_PTR since 5.2, so the return pointer should be
checked before used. Otherwise it might cause an oops during boot.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
INAGAKI Hiroshi 0a05d71f6f ramips: fix initramfs image for I-O DATA mt7621 devices
This is additional fix of c998ae7f0e.

The sysupgrade image of I-O DATA MT7621 devices manufactured by MSTC
(MitraStar Technology Corp.) faced to the booting issue. This was caused
by imcomplete extraction of large kernel image by U-Boot, and this issue
is occurred in initramfs image after fixing of sysupgrade image.
So, use lzma-loader for initramfs image to fix the issue.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Co-developed-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
Tested-by: Yanase Yuki <dev@zpc.sakura.ne.jp> [wn-ax2033gr]
4 years ago
Chuanhong Guo a43cbfe2e3 ramips: remove default switch setup in 02_network
ramips images now relies on explicit switch setup for proper failsafe
functionality. Remove default cases where it relies on vlan setup in
dts and add switch setup for devices affected.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
4 years ago
Álvaro Fernández Rojas 597df570f3 bcm63xx: reorganize board patches
Let's put some order on board patches.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas edafbe81e0 bcm63xx: bcm6328-leds: improve HW blinking
Add support for second HW blinking interval.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas daee6b4661 bcm63xx: add Comtrend VG-8050 support
BCM63169 with 128M RAM, 128M NAND and BCM53125 switch.
Switch is connected by HSSPI to CS5.
More info: https://openwrt.org/toh/comtrend/vg8050

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 62e7342ddf bcm63xx: add NETGEAR DGND3700v2 support
BCM6362 with 64M RAM, 32M NAND and BCM53125 switch.
Switch is connected by MMAP, which is currently unsupported (no VLANs).
More info: https://openwrt.org/toh/netgear/dgnd3700v2

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Adrian Schmutzler 74ff0773b5 ramips: remove leading zeros from MAC address location
Cosmetic adjustment to match the rest of the target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler be9eab9bca ramips: set WAN address in DTS for ASUS RT-AC51U/RT-AC54U
The location 0x28 in factory partition is the common one used for
ethernet address on this architecture. Despite, it contains the label
MAC address for the devices at hand.

Consequently, this patch moves 0x28 to the &ethernet node in DTS files
(setting the WAN MAC address there) and sets up the lan_mac from 0x22
in 02_network. As a benefit, this allows to use label-mac-device in
DTS instead of ucidef_set_label_macaddr.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler a1f0fd8cba ramips: use DT trigger for 2G WiFi on ASUS RT-AC51U
Like for the RT-AC54U, this uses a DT trigger for WiFi also at the
RT-AC51U. While at it, rename node and label to wifi2g.

Note that the 5g WiFi LED still isn't supported (see PR #3017 for
further details: https://github.com/openwrt/openwrt/pull/3017 )

Tested-by: Davide Fioravanti <pantanastyle@gmail.com>
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 0b34a36da9 ramips: fix MAC address assignment for ASUS RT-AC51U
The current MAC address assignment for the ASUS RT-AC51U is "wrong",
it actually should be the same as for the RT-AC54U. Fix it.

MAC assignment based on vendor firmware:

  2g    0x4	label
  5g    0x8004	label +4
  lan   0x22	label +4
  wan   0x28	label

Thanks to Davide Fioravanti for checking this on his device.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Fabian Bläse 33b2078528 mt7621: Make ER-X-SFP factory image compatible with EP-R6
The version inside the compat file determines, if a firmware supports
a specific device. I have not yet fully understood, how this is checked,
but it only seems to indicate which devices are supported by a specific
version of the combined vendor firmware. Devices assume that subsequent
versions, starting with the version that initially added support for a
specific device, are always compatible.

The first compat version that added support for the EP-R6 was '21001:7',
but OpenWrt did use '21001:6' before. This is why the factory image could
not be flashed using the vendor software, but only using TFTP.

The compat version has been bumped by the vendor a few times, but more
devices have been added since (e.g. ER-10X). Because OpenWrt currently
only supports the ER-X, ER-X-SFP and EP-R6, the compat version is
incremented to the version that first supported the EP-R6, which is
'21001:7'.

This allows the factory image to be flashed on EP-R6 without TFTP.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
4 years ago
David Bauer 4133304413 mpc85xx: restructure image receipts
Move the image receipts into separate per-subtarget files like it is
done on most other targets.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
David Bauer 564f87ef5b mpc85xx: rename generic subtarget to p1010
The mpc85xx-generic subtarget supports the QorIQ SoCs of the p1010
family. Rename the subtarget to reflect this affiliation as it's the
case with the other mpc85xx subtargets.

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Álvaro Fernández Rojas 367a30389d bcm63xx: add support for Comtrend VR-3032u
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 86583384ff bcm63xx: smp: add NAND support
NAND controller is present on BCM6328, BCM6362, BCM6368 and BCM63268.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas cca13d8e82 kernel: mtdsplit: add BCM WFI support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Adrian Schmutzler 4a61a88f90 ath79: add support for TP-Link TL-WA901ND v4 and v5
This ports support for the TL-WA901ND v4 and v5 from ar71xx to ath79.
They are similar to the TP9343-based TL-WR940N v3/v4 and TL-WR941ND v6.

Specifications:
  SoC: TP9343
  Flash/RAM: 4/32 MiB
  CPU: 750 MHz
  WiFi: 2.4 GHz b/g/n
  Ethernet: 1 port (100M)

Flashing instructions:
  Upload the factory image via the vendor firmware upgrade option.

Flash instruction (TFTP):
  1. Set PC to fixed ip address 192.168.0.66
  2. Download *-factory.bin image and rename it to * (see below)
  3. Start a tftp server with the image file in its root directory
  4. Turn off the router
  5. Press and hold Reset button
  6. Turn on router with the reset button pressed and wait ~15 seconds
  7. Release the reset button and after a short time
     the firmware should be transferred from the tftp server
  8. Wait ~30 second to complete recovery.

  * The image name for TFTP recovery is wa901ndv4_tp_recovery.bin for
  both variants.

In ar71xx, a MAC address with offset 1 was used for ethernet port.
That's probably wrong, but this commit sticks to it until we know
the correct value.

Like in ar71xx, this builds the default factory.bin with EU country
code.

Thanks to Leonardo Weiss for testing on the v5.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Alexander Couzens bf5d800578
lantiq: fritz 7360 v2: remove additional supported devices
The additional supported device isn't required since this is a new
device. Some board contains an addtional device,
those device were supported in earlier versions which used the
"old" image builder code.
To support an sysupgrade from such old version, there is the all caps
additional device.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Alexander Couzens 0962baae4e lantiq: fritz 7360 v2: rename device before it will be used
Use similiar naming scheme as ath79.
Since the fritz 7360 v2 was only in the tree for 2 days, there
is no compatibility for the old image.
Users which has installed the fritz 7360 v2 before this change, must
use sysupgrade --force to skip checks on the board.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 30cc7f3510 ramips: increase SPI frequency for ASUS RT-AC51U/RT-AC54U
This increases the SPI frequency for both ASUS RT-AC51U and RT-AC54U.

Speed comparison tests have been performed on RT-AC54U:

- 10Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    4m 37.78s
user    0m 0.02s
sys     2m 43.92s

- 50Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 28.34s
user    0m 0.03s
sys     0m 46.96s

- 50Mhz fast read
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 11.94s
user    0m 0.01s
sys     0m 46.94s

- 80Mhz
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 12.31s
user    0m 0.04s
sys     0m 46.96s

- 80Mhz fast read
root@OpenWrt:~# time cat /dev/mtd* > /dev/null
real    1m 12.15s
user    0m 0.02s
sys     0m 46.97s

Based on that, we took 50 MHz with fast-read, as higher frequencies
didn't yield further improvements.

For the RT-AC51U, only the final configuration was tested.

Tested-by: Zhijun You <hujy652@gmail.com> [RT-AC54U]
Tested-by: Davide Fioravanti <pantanastyle@gmail.com> [RT-AC51U]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Álvaro Fernández Rojas 13c33f3f12 bcm63xx: mask interrupts on init
Fixes BCM6348/BCM6358 hangs while booting:
https://bugs.openwrt.org/index.php?do=details&task_id=2202

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Roger Pueyo Centelles a0ef42e77c ath79: add support for Ubiquiti PowerBeam 5AC 500
The Ubiquiti PowerBeam 5AC 500 (PBE-5AC-500) is an outdoor 802.11ac
5 GHz bridge with a radio feed and a dish antenna.

Specifications:
 - SoC: Qualcomm Atheros QCA9558
 - RAM: 128 MB DDR2
 - Flash: 16 MB SPI NOR (mx25l12805d)
 - Ethernet: 1x 10/100/1000 Mbps Atheros 8031, 24 Vdc PoE-in
 - WiFi 5 GHz: QCA988x HW2.0 Ubiquiti target 0x4100016c chip_id 0x043222ff
 - Buttons: 1x (reset)
 - LEDs: 1x power, 1x Ethernet, 4x RSSI, all blue
 - UART: not tested

Not supported:
 - RSSI LEDs (probably through 74HC595 chip)

Installation from stock airOS firmware:
 - Follow instructions for XC-type Ubiquiti devices on OpenWrt wiki at
   https://openwrt.org/toh/ubiquiti/common

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
4 years ago
Davide Fioravanti 31b49f02ca ramips: add support for Linksys EA7500 v2
The Linksys EA7500 v2 is advertised as AC1900, but its internal
hardware is AC2600 capable.

Hardware
--------
SoC:   Mediatek MT7621AT (880 MHz, 2 cores 4 threads)
RAM:   256M (Nanya NT5CC128M16IP-DI)
FLASH: 128MB NAND (Macronix MX30LF1G18AC-TI)
ETH:   5x 10/100/1000 Mbps Ethernet (MT7530)
WIFI:
  - 2.4GHz: 1x MT7615N (4x4:4)
  - 5GHz:   1x MT7615N (4x4:4)
  - 4 antennas: 3 external detachable antennas and 1 internal
USB:
  - 1x USB 3.0
  - 1x USB 2.0
BTN:
  - 1x Reset button
  - 1x WPS button
LEDS:
  - 1x White led (Power)
  - 6x Green leds (link lan1-lan4, link wan, wps)
  - 5x Orange leds (act lan1-lan4, act wan) (working but unmodifiable)

Everything works correctly.

Installation
------------
The “factory” openwrt image can be flashed directly from OEM stock
firmware. After the flash the router will reboot automatically.

However, due to the dual boot system, the first installation could fail
(if you want to know why, read the footnotes).
If the flash succeed and you can reach OpenWrt through the web
interface or ssh, you are done.
Otherwise the router will try to boot 3 times and then will
automatically boot the OEM firmware (don’t turn off the router.
Simply wait and try to reach the router through the web interface
every now and then, it will take few minutes).

After this, you should be back in the OEM firmware.

Now you have to flash the OEM Firmware over itself using the OEM web
interface (I tested it using the FW_EA7500v2_2.0.8.194281_prod.img
downloaded from the Linksys website).

When the router reboots flash the “factory” OpenWrt image and this
time it should work.

After the OpenWrt installation you have to use the sysupgrade image
for future updates.

Restore OEM Firmware
--------------------
After the OpenWrt flash, the OEM firmware is still stored in the
second partition thanks to the dual boot system.
You can switch from OpenWrt to OEM firmware and vice-versa failing
the boot 3 times in a row:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

If you want to completely remove OpenWrt from your router, switch to
the OEM firmware and then flash OEM firmware from the web interface
as a normal update.
This procedure will overwrite the OpenWrt partition.

Footnotes
---------
The Linksys EA7500-v2 has a dual boot system to avoid bricks.
This system works using 2 pair of partitions:
 1) "kernel" and "rootfs"
 2) "alt_kernel" and "alt_rootfs".
After 3 failed boot attempts, the bootloader tries to boot the other
pair of partitions and so on.

This system is managed by the bootloader, which writes a bootcount in
the s_env partition, and if successfully booted, the system add a
"zero-bootcount" after the previous value.

A system update performed from OEM firmware, writes the firmware on the
other pair of partitions and sets the bootloader to boot the new pair
of partitions editing the “boot_part” variable in the bootloader vars.
Effectively it's a quick and safe system to switch the selected boot
partition.

Another way to switch the boot partition is:
 1) power on the router
 2) wait 15 seconds
 3) power off the router
 4) repeat steps 1-2-3 twice more.
 5) power on the router and you should be in the “other” firmware

In this OpenWrt port, this dual boot system is partially working
because the bootloader sets the right rootfs partition in the cmdline
but unfortunately OpenWrt for ramips platform overwrites the cmdline
so is not possible to detect the right rootfs partition.

Because all of this, I preferred to simply use the first pair of
partitions and set read-only the other pair.

However this solution is not optimal because is not possible to know
without opening the case which is the current booted partition.
Let’s take for example a router booting the OEM firmware from the first
pair of partitions. If we flash the OpenWrt image, it will be written
on the second pair. In this situation the router will bootloop 3 times
and then will automatically come back to the first pair of partitions
containg the OEM firmware.
In this situation, to flash OpenWrt correctly is necessary to switch
the booting partition, flashing again the OEM firmware over itself.
At this point the OEM firmware is on both pair of partitions but the
current booted pair is the second one.
Now, flashing the OpenWrt factory image will write the firmware on
the first pair and then will boot correctly.

If this limitation in the ramips platform about the cmdline will be
fixed, the dual boot system can also be implemented in OpenWrt with
almost no effort.

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
Co-Developed-by: Jackson Lim <jackcolentern@gmail.com>
Signed-off-by: Jackson Lim <jackcolentern@gmail.com>
4 years ago
Sungbo Eo a4e9c8f14b ramips: add support for netis WF2770
netis WF2770 is a 2.4/5GHz band AC750 router, based on MediaTek MT7620A.

Specifications:
- SoC: MT7620A
- RAM: DDR2 64MB
- Flash: SPI NOR 16MB
- WiFi:
  - 2.4GHz: SoC internal
  - 5GHz: MT7610EN
- Ethernet: 5x 10/100/1000Mbps
  - Switch: MT7530BU
- UART:
  - J2: 3.3V, RX, TX, GND (3.3V is the square pad) / 57600 8N1

MAC addresses in factory partition:
0x0004: LAN, WiFi 2.4GHz (label_mac-6)
0x0028: not used (label_mac-1)
0x002e: WAN (label_mac)
0x8004: WiFi 5GHz (label_mac+2)

Installation via web interface:
1.  Flash **initramfs** image through the stock web interface.
2.  Boot into OpenWrt and perform sysupgrade with sysupgrade image.

Revert to stock firmware:
1.  Perform sysupgrade with stock image.

Reviewed-by: Pawel Dembicki <paweldembicki@gmail.com>
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Zhijun You 46674723e1 ramips: add support for ASUS RT-AC54U
Specification:

- CPU: MTK MT7620A
- RAM: 64MB
- ROM: 16MB SPI Flash Macronix MX25L12835E
- WiFi1: MediaTek MT7620A
- WiFi2: MediaTek MT7612E
- Button: reset, wps
- LED: 9 LEDs:Power, WiFi 2.4G,WiFi 5G, USB, LAN1, LAN2, LAN3, LAN4, WAN
- Ethernet: 5 ports, 4 LAN + 1 WAN
- Other: 1x UART 1x USB2.0

Installation:

   Update using ASUS Firmware Restoration Tool:

1. Download the ASUS Firmware Restoration Tool but don't open it yet
2. Unplug your computer from the router
3. Put the router into Rescue Mode by: turning the power off, using a pin
   to press and hold the reset button, then turning the router back on while
   keeping the reset button pressed for ~5 secs until the power LED starts
   flashing slowly (which indicates the router has entered Rescue Mode)
4. Important (if you don't do this next step the Asus Firmware
   Restoration Tool will wrongly assume that the router is not in Rescue Mode
   and will refuse to flash it): go to the Windows Control Panel and
   temporarily disable ALL other network adapters except the one you will use
   to connect your computer to the router
5. For the single adapter you left enabled, temporarily give it the
   static IP 192.168.1.10 and the subnet mask 255.255.255.0
6. Connect a LAN cable between your computer (make sure to use the
   Ethernet port of the adapter you've just set up) and port 1 of the router
   (not the router's WAN port)
7. Rename sysupgrade.bin to factory.trx
8. Open the Asus Firmware Restoration Tool, locate factory.trx and click
   upload (if Windows shows a compatibility prompt, confirm that the tool worked fine)
9. Flashing and reboot is finished when the power LED stops blinking and
   stays on

MAC assignment based on vendor firmware:

2g    0x4	label
5g    0x8004	label +4
lan   0x22	label +4
wan   0x28	label

Signed-off-by: Zhijun You <hujy652@gmail.com>
[rebased due to DTSI patch, minor commit message adjustments, fix
label MAC address (lan->wan), do spi frequency increase separately]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 685cc66c2a ramips: create DTSI for ASUS RT-AC51U and RT-AC54U
This creates a DTSI for the ASUS RT-AC51U and the upcoming RT-AC54U,
as they are quite similar.

White at it, drop the unneeded "status = okay" for ethernet.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler b24fd13024 lantiq: drop outdated kernel version switches from patches-5.4
This drops some ancient kernel version switches from patches on
lantiq target. The patch only adjusts the latest kernel 5.4, as
doing it a second time for an older kernel seems a waste of time
for a cosmetic change.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 41b5ca1458 bcm27xx: drop outdated kernel version switches from patches-5.4
This drops some ancient kernel version switches from patches on
bcm27xx target. The patch only adjusts the latest kernel 5.4, as
doing it a second time for an older kernel seems a waste of time
for a cosmetic change.

Refresh remaining target patches.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 8ff813e5f4 generic: drop outdated kernel version switches in local drivers
This drops the obsolete version switches for non-supported kernels
from local drivers in generic target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler c00b2df6c8 ramips: drop non-existant ralink,port-map for Ravpower WD03
The property "ralink,port-map" has been obsolete long before
this device was added, and the device is a one-port anyway.
Just remove it.

Fixes: 5ef79af4f8 ("ramips: add support for Ravpower WD03")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler d7a28e8ed2 ramips: mt7620: tidy up ethernet node in DTS files
This tidies up the ethernet node in mt7620 DTS files by:

- removing unnecessary status as it is not disabled
- reordering properties consistently
- adding empty lines to enhance readability

This should make comparison and reviewing new PRs based on C/P easier.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Thibaut VARÈNE 2ea481193c generic: platform/mikrotik: fix LZOR support
31e99fe3da which introduced this code was unfortunately untested.
This commit fixes a number of issues and works around the fact that in
this particular scheme, the LZO payload may be padded at the end which
will trigger a harmless lzo decompression error.
This commit also disambiguates the debug printks.

Tested-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
Fixes: 31e99fe3da ("generic: platform/mikrotik: support LZOR encoding")
4 years ago
Yushi Nishida 78bebe680f
lantiq/xrx200: add support for the Fritzbox 7360v2
This commit adds support for the Fritzbox 7360v2

CPU: VR9 500MHz Cores: 2
RAM: 128 MB
NOR-Flash: 32 MB
WLAN: AR9287-BL1A

DECT is not working.

Thanks Sebastian Ortwein for adding 7360SL.
The dts file is derived from avm_fritz7360sl.dts.

Firmware can be flashed with this method:

1.) Set your client IP to 192.168.178.2
2.) Power on your your Fritzbox and connect to 192.168.178.1
    via ftp in the first 5 seconds.
3.) login with adam2/adam2
4.) type into the ftp prompt:

passive
binary
debug 1
quote MEDIA FLSH // (not FLASH)
put openwrt-lantiq-xrx200-avm_fritz7360v2-squashfs-sysupgrade.bin mtd1
// using the correct location for the squashfs-sysupgrade-firmware.bin

5.) wait till red light flashing turns off.
6.) type: exit

Run tested with kernel 4.19 and 5.4 on Fritzbox 7360 V2.

Issue:
Ethernet speed is slow, (iperf between a Xiaomi mir3g
and this router results in <80Mbits throughput
with a wired cable when using the gbit ports.)

Signed-off-by: Yushi Nishida <kyro2man@gmx.net>
4 years ago
Aleksander Jan Bajkowski 2f7118712e ath79: increase spi frequency on tp-link tl-wr1043nd v2
Increase SPI frequency to 33.333 MHz. It's maximum frequency supported
by SPI Flash memory chip without Fast read opcode.

Before:
$ time dd if=/dev/mtd1 of=/dev/null bs=8M
0+1 records in
0+1 records out
real	0m 3.21s
user	0m 0.00s
sys	0m 3.21s

After:
$ time dd if=/dev/mtd1 of=/dev/null bs=8M
0+1 records in
0+1 records out
real	0m 2.52s
user	0m 0.00s
sys	0m 2.52s

Tested on TP-Link TL-WR1043ND V2.

Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
4 years ago
Daniel Gonzalez Cabanelas e04ff3c7cc bcm63xx: periph_intc: report effective affinity
The bcm6345-periph-intc driver only targets a single CPU at a time, even
if the notional affinity is wider. Let's inform the core code about this.

This patch gets rid of the kernel message:
"genirq: irq_chip bcm6345-periph-intc did not update eff. affinity mask
of irq 52"

Signed-off-by: Daniel Gonzalez Cabanelas <dgcbueu@gmail.com>
4 years ago
Álvaro Fernández Rojas 29c3bb5f41 bcm63xx: ext_intc: fix warning
In file included from ./arch/mips/include/asm/io.h:34,
                 from ./arch/mips/include/asm/mmiowb.h:5,
                 from ./include/linux/spinlock.h:60,
                 from ./include/linux/irq.h:14,
                 from drivers/irqchip/irq-bcm6345-ext.c:10:
drivers/irqchip/irq-bcm6345-ext.c: In function 'bcm6345_ext_intc_of_init':
./arch/mips/include/asm/mach-bcm63xx/ioremap.h:48:9: warning: 'base' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return is_bcm63xx_internal_registers((unsigned long)addr);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/irqchip/irq-bcm6345-ext.c:255:16: note: 'base' was declared here
  void __iomem *base;
                ^~~~

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas f2f2cf07a6 bcm63xx: periph_intc: fix warning
drivers/irqchip/irq-bcm6345-periph.c: In function 'bcm6345_periph_irq_handle':
drivers/irqchip/irq-bcm6345-periph.c:55:21: warning: 'block' may be used uninitialized in this function [-Wmaybe-uninitialized]
  struct intc_block *block;
                     ^~~~~

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas f314cbe54b bcm63xx: redboot: fix warning
drivers/mtd/parsers/redboot.c: In function 'parse_redboot_partitions':
drivers/mtd/parsers/redboot.c:194:59: warning: suggest parentheses around '-' in operand of '&' [-Wparentheses]
     fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
                                       ~~~~~~~~~~~~~~~~~~~~^~~

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas ee6bf7e865 bcm63xx: bcm6362: fix pinctrl bug
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas aa2f2276f7 bcm63xx: image: remove unused definition
KERNEL_ENTRY isn't used by lzma-loader.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas eea23c2004 bcm63xx: remove linux 4.14 support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Koen Vandeputte eb17ee294c kernel: bump 5.4 to 5.4.41
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Koen Vandeputte d503492857 kernel: bump 4.19 to 4.19.123
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Adrian Schmutzler 2308644b0c ipq40xx: replace "ok" with "okay" for status in DTS files
While "ok" is recognized in DT parsing, only "okay" is actually
mentioned as valid value. Replace it accordingly.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler fdd968d64e bcm63xx: replace "ok" with "okay" for status in DTS files
While "ok" is recognized in DT parsing, only "okay" is actually
mentioned as valid value. Replace it accordingly.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Adrian Schmutzler 026fe1308c bcm63xx: use generic diag.sh
This commit removes the target-specific diag.sh script. This way, the
generic one is used for the target, which uses DT-aliases to specify the
LEDs used.

Though generic diag.sh allows to use different LEDs to indicate different
states, this patch just moves the old assignment and does not try to
"improve" the assignment by using additional colors.
However, individual proposals to do so are welcome.

For the few cases where status_led2 was used in old diag.sh, only the
primary LED was migrated.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Thibaut VARÈNE 96414047c9 ar71xx: mikrotik: mach-rbspi.c remove wlan id
Following on the previous commit, this patch removes useless id argument
from rbspi_wlan_init().

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 1c6990fe6d ar71xx: mikrotik: bypass id check in __rb_get_wlan_data()
The id parameter in __rb_get_wlan_data() was incorrectly used on the
assumption that id "0" would always be tied to ath9k with RLE encoding
and positive id (in fact, only id "1" was valid) would always be tied to
("external") ath10k with LZO encoding.

Newer hardware revisions of supported devices prove this assumption to
be invalid, with ath9k caldata being now wrapped in MAGIC_ERD and LZO
compressed, so disable this check to allow newer hardware to correctly
decode caldata for ath9k. Since ath10k caldata is no longer pulled from
this implementation, this commit also disables the publication in sysfs
to avoid wasting memory.

Note: this patch assumes that ath9k caldata is never stored with the new
"LZOR" encoding scheme found on some ath10k devices.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Koen Vandeputte 0fed36dd48 kernel: bump 5.4 to 5.4.40
Refreshed all patches.

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Koen Vandeputte 7dd2d7289a kernel: bump 4.19 to 4.19.122
Refreshed all patches.

Remove upstreamed:
- 551-loop-Better-discard-support-for-block-devices.patch

Fixed:
- CVE-2020-11884
- CVE-2020-12114
- CVE-2019-3016
- CVE-2020-11669

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

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Koen Vandeputte ef2d5a2ab4 kernel: bump 4.14 to 4.14.180
Refreshed all patches.

Fixes:
- CVE-2020-12114
- CVE-2020-11669

Compile-tested on: pistachio
Runtime-tested on: none

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Álvaro Fernández Rojas a0081b1945 bcm63xx: loader-lzma: use default lzma
Specific CFE LZMA parameters aren't needed for LZMA Loader.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Álvaro Fernández Rojas 84646936a6 bcm63xx: image: rename LOADADDR to KERNEL_LOADADDR
Also remove KERNEL_ENTRY, since it's the same as KERNEL_LOADADDR

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
4 years ago
Koen Vandeputte 146e18af56 generic: add MikroTik hw bit description
An e-mail response from MikroTik contained a minimal overview
on hardware option bits which mentioned a currently unknown bit.

While not being too detailed what it does, add it for documentation purposes.

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
David Bauer 300b7fe85a ipq40xx: add support for Aruba AP-365
Hardware
--------
SoC:   Qualcomm IPQ4029
RAM:   512M DDR3
FLASH: - 128MB NAND (Macronix MX30LF1G18AC)
       - 4MB SPI-NOR (Macronix MX25R3235F)
TPM:   Atmel AT97SC3203
BLE:   Texas Instruments CC2540T
       attached to ttyMSM0
ETH:   Atheros AR8035
LED:   System (red / green / amber)
BTN:   Reset

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

Console baudrate is 9600 8n1.

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

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

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

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

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

4. Load OpenWrt into RAM:
   $ run ramboot_openwrt

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

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

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

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

  $ setenv bootcmd "boot"
  $ saveenv

Signed-off-by: David Bauer <mail@david-bauer.net>
4 years ago
Andrey Kunitsyn e31e5c4ea4 bcm27xx: label to boot partition
Get fat partition name allow easy partition identification
for user.

Signed-off-by: Andrey Kunitsyn <blackicebox@gmail.com>
4 years ago
Pawel Dembicki 426fb8cf84 ramips: add support for LB-Link BL-W1200
The BL-W1200 Wireless Router is based on the MT7620A SoC.

Specification:

- MediaTek MT7620A (580 Mhz)
- 64 MB of RAM
- 8 MB of FLASH
- 1x 802.11bgn radio
- 1x 802.11ac radio (MT7612E)
- 5x 10/100/1000 Mbps Ethernet (MT7530)
- 2x external, non-detachable antennas (Wifi 2.4G/5G)
- 1x USB 2.0
- UART (R2) on PCB (57600 8n1)
- 9x LED (1 GPIO controlled), 1x button
- u-Boot bootloader

Known issues:
- No status LED. Used WPS LED during boot/failsafe/sysupgrade.

Installation:
1. Apply initramfs image via factory web-gui.
2. Install sysupgrade image.

How to revert to OEM firmware:
- sysupgrade -n -F stock_firmware.bin

Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
4 years ago
Sungbo Eo 0cdf7bc4fb ramips: dts: fix incorrect flash reg property
Most work was done in commit 021c893658 ("ramips: fix size-cells on spi
nodes"), but a few more DTS files using the old reg style have been added
since then. This commit fixes them.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo 1eceab3fc0 ramips: dts: use generic node name for flash
In DTS Checklist[1] we're now demanding proper generic node names, as
the name of a node should reflect the function of the device and use
generic name for that[2]. Everybody seems to be copy&pasting from DTS
files available in the repository today, so let's unify that naming
there as well and provide proper examples.

While at it, remove unused m25p80 label.

Tested on rt5350 (for spi-nor) and rt3662 (for cfi-flash).

1. https://openwrt.org/submitting-patches#dts_checklist
2. https://github.com/devicetree-org/devicetree-specification/blob/master/source/devicetree-basics.rst#generic-names-recommendation

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Jakov Petrina b1cfbff0a7 mvebu: uDPU: switch default kernel and U-Boot PHY mode
Certain SFP modules (most notably Nokia GPON ones) first check
connectivity on 1000base-x, and switch to 2500base-x afterwards. This
is considered a quirk so the phylink switches the interface to
2500base-x as well.

However, after power-cycling the uDPU device, network interface/SFP module
will not work correctly until the module is re-seated. This patch
resolves this issue by forcing the interface to be brought up in
2500base-x mode by default.

Signed-off-by: Jakov Petrina <jakov.petrina@sartura.hr>
Signed-off-by: Vladimir Vid <vladimir.vid@sartura.hr>
Cc: Luka Perkov <luka.perkov@sartura.hr>
4 years ago
Lech Perczak 94f3449977 ath79: dts: add missing 'serial0' alias for TP-Link TL-MR3040v2
Out of all devices currently supported based on AR9331 chipset,
this one had the 'serial0' alias missing. Add it to fix setting of
/dev/console and login shell on the onboard UART.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
4 years ago
Sungbo Eo a5720d3276 ramips: tidy up image subtarget Makefiles
- use tab indent in image build recipes for consistency
- harmonize line wrapping

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
[use different line wrapping for one recipe]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
4 years ago
Sungbo Eo c5fdab84ed ramips: tidy up image Makefile
- sort recipes alphabetically
- simplify subtarget include directives

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo fa9e7ca466 ramips: simplify palmbus/{i2c,spi} in device DTS files
As the node is already defined and labeled in SoC DTSI file, we can refer to it
outside of root node and reduce redundancy.

While at it, remove unused pcf8563 label.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Sungbo Eo 22a21b0c18 ramips: use hex notation for *-mtd-eeprom property
Change "0" to "0x0" for consistency. This is an extension of commit 34abfb6e91
("ramips: convert mediatek,mtd-eeprom from decimal to hex notation").

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
4 years ago
Koen Vandeputte 51a7184a7d generic: fix patching error on kernel 5.4
Fixes a build error seen when applying the kernel patches.

Applying patch generic/435-mtd-add-routerbootpart-parser-config.patch
patching file drivers/mtd/parsers/Kconfig
Hunk #1 FAILED at 160.
1 out of 1 hunk FAILED -- rejects in file drivers/mtd/parsers/Kconfig
patching file drivers/mtd/parsers/Makefile
Hunk #1 FAILED at 10.
1 out of 1 hunk FAILED -- rejects in file drivers/mtd/parsers/Makefile

This was missed as 5.4 is currently set as testing kernel
while the main kernel being used is 4.19

Fixes: 2976e423dc ("generic: routerboot partition build bits")
Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
4 years ago
Thibaut VARÈNE 5e50515fa6 ramips/mt7621: mikrotik: don't use mtd-mac-address in DTS
As evidenced here[1] the device MAC address can be stored at a random
offset in the hard_config partition. Rely on sysfs to update the MAC
address correctly.

Adjust config so that WAN is base MAC and LAN is base MAC +1 to better
match label and vendor OS.

[1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 9242d691ec ath79/mikrotik: load caldata via sysfs loader
This commit takes advantages of base-files 220 which introduces routines
to perform caldata loading directly via the kernel sysfs loader helper.
This has the benefits of not wasting flash space to store caldata.

Memory footprint is reduced to the bare minimum: for devices that don't
need MAC patching, the caldata is loaded directly, for devices that do
need MAC patching, the caldata is extracted to /tmp, patched and then
loaded.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE e995577e70 ar71xx/mikrotik: ath10k: use new sysfs driver
Fetch ath10k calibration data from new mikrotik sysfs driver

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 1e24af5638 ath79/mikrotik: use standard caldata functions
With the implementation of a sysfs interface to access WLAN data, this
target no longer needs a special wrapper to extract caldata.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 301bc3290d ath79/mikrotik: don't use mtd-mac-address in DTS
As evidenced here[1] the device MAC address can be stored at a random
offset in the hard_config partition. Rely on sysfs to update the MAC
address correctly.

To match sticker and vendor OS behavior, WAN MAC is set to the device
base MAC and LAN MAC is incremented from that.

Note: this will trigger a harmless kernel message during boot:
ag71xx 19000000.eth: invalid MAC address, using random address

There is no clean workaround to prevent this message from being emitted.

[1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 31e99fe3da generic: platform/mikrotik: support LZOR encoding
Some newer MikroTik RouterBOARD devices use a new encoding scheme
for their WLAN calibration data. This patch provides support for
decoding this new scheme.

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 97337d3e5d ramips/mt7621: enable mikrotik platform driver
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago
Thibaut VARÈNE 00d2ab7602 ar71xx/mikrotik: enable mikrotik platform driver
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
4 years ago