From 87c42101cfb001b4bd418d1201fa4d8c822dc77b Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Wed, 7 Mar 2018 09:13:10 +0100 Subject: [PATCH] ipq40xx: add support for ASUS RT-AC58U/RT-ACRH13 This patch adds support for ASUS RT-AC58U/RT-ACRH13. hardware highlights: SOC: IPQ4018 / QCA Dakota CPU: Quad-Core ARMv7 Processor rev 5 (v7l) Cortex-A7 DRAM: 128 MiB DDR3L-1066 @ 537 MHz (1074?) NT5CC64M16GP-DI NOR: 2 MiB Macronix MX25L1606E (for boot, QSEE) NAND: 128 MiB Winbond W25NO1GVZE1G (cal + kernel + root, UBI) ETH: Qualcomm Atheros QCA8075 Gigabit Switch (4 x LAN, 1 x WAN) USB: 1 x 3.0 (via Synopsys DesignWare DWC3 controller in the SoC) WLAN1: Qualcomm Atheros QCA4018 2.4GHz 802.11bgn 2:2x2 WLAN2: Qualcomm Atheros QCA4018 5GHz 802.11a/n/ac 2:2x2 INPUT: one Reset and one WPS button LEDS: Status, WAN, WIFI1/2, USB and LAN (one blue LED for each) Serial: WARNING: The serial port needs a TTL/RS-232 3V3 level converter! The Serial setting is 115200-8-N-1. The board has an unpopulated 1x4 0.1" header. The pinout (VDD, RX, GND, TX) is printed on the PCB right next to the connector. U-Boot Note: The ethernet driver isn't always reliable and can sometime time out... Don't worry, just retry. Access via the serial console is required. As well as a working TFTP-server setup and the initramfs image. (If not provided, it has to be built from the OpenWrt source. Make sure to enable LZMA as the compression for the INITRAMFS!) To install the image permanently, you have to do the following steps in the listed order. 1. Open up the router. There are four phillips screws hiding behind the four plastic feets on the underside. 2. Connect the serial cable (See notes above) 3. Connect your router via one of the four LAN-ports (yellow) to a PC which can set the IP-Address and ssh and scp from. If possible set your PC's IPv4 Address to 192.168.1.70 (As this is the IP-Address the Router's bootloader expects for the tftp server) 4. power up the router and enter the u-boot choose option 1 to upload the initramfs image. And follow through the ipv4 setup. Wait for your router's status LED to stop blinking rapidly and glow just blue. (The LAN LED should also be glowing blue). 3. Connect to the OpenWrt running in RAM The default IPv4-Address of your router will be 192.168.1.1. 1. Copy over the openwrt-sysupgrade.bin image to your router's temporary directory # scp openwrt-sysupgrade.bin root@192.168.1.1:/tmp 2. ssh from your PC into your router as root. # ssh root@192.168.1.1 The default OpenWrt-Image won't ask for a password. Simply hit the Enter-Key. Once connected...: run the following commands on your temporary installation 3. delete the "jffs2" ubi partition to make room for your new root partition # ubirmvol /dev/ubi0 --name=jffs2 4. install OpenWrt on the NAND Flash. # sysupgrade -v /tmp/openwrt-sysupgrade.bin - This will will automatically reboot the router - Signed-off-by: Christian Lamparter --- package/firmware/ipq-wifi/Makefile | 3 +- .../firmware/ipq-wifi/board-asus_rt-ac58u.bin | 0 target/linux/ipq40xx/Makefile | 2 +- .../ipq40xx/base-files/etc/board.d/01_leds | 7 + .../ipq40xx/base-files/etc/board.d/02_network | 10 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 26 ++ .../base-files/lib/upgrade/platform.sh | 35 ++ target/linux/ipq40xx/config-4.14 | 2 + .../arm/boot/dts/qcom-ipq4018-rt-ac58u.dts | 314 ++++++++++++++++++ target/linux/ipq40xx/image/Makefile | 21 ++ .../069-arm-boot-add-dts-files.patch | 3 +- ...dd-quirk-to-autoload-ubi-on-rt-ac58u.patch | 29 ++ 12 files changed, 449 insertions(+), 3 deletions(-) create mode 100644 package/firmware/ipq-wifi/board-asus_rt-ac58u.bin create mode 100644 target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts create mode 100644 target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 3f929bc03d..39d29a4ff3 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -13,7 +13,7 @@ endef define Build/Compile endef -ALLWIFIBOARDS:=avm_fritzbox-4040 glinet_gl-b1300 +ALLWIFIBOARDS:=asus_rt-ac58u avm_fritzbox-4040 glinet_gl-b1300 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) define Package/ipq-wifi-default @@ -47,6 +47,7 @@ Don't install it for any other device! PREV_BOARD+=ipq-wifi-$(1) endef +$(eval $(call generate-ipq-wifi-package,asus_rt-ac58u,board-asus_rt-ac58u.bin,ASUS RT-AC58U)) $(eval $(call generate-ipq-wifi-package,avm_fritzbox-4040,board-avm_fritzbox-4040.bin,AVM FRITZ!Box 4040)) $(eval $(call generate-ipq-wifi-package,glinet_gl-b1300,board-glinet_gl-b1300.bin,GL.iNet GL-B1300)) diff --git a/package/firmware/ipq-wifi/board-asus_rt-ac58u.bin b/package/firmware/ipq-wifi/board-asus_rt-ac58u.bin new file mode 100644 index 0000000000..e69de29bb2 diff --git a/target/linux/ipq40xx/Makefile b/target/linux/ipq40xx/Makefile index 390426c18d..e5bbdf40c2 100644 --- a/target/linux/ipq40xx/Makefile +++ b/target/linux/ipq40xx/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk ARCH:=arm BOARD:=ipq40xx BOARDNAME:=Qualcomm Atheros IPQ40XX -FEATURES:=squashfs fpu +FEATURES:=squashfs fpu ramdisk nand CPU_TYPE:=cortex-a7 CPU_SUBTYPE:=neon-vfpv4 MAINTAINER:=John Crispin diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds index 31c6e32a06..6a493be3ec 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -11,6 +11,13 @@ board=$(board_name) boardname="${board##*,}" case "$board" in +asus,rt-ac58u) + ucidef_set_led_wlan "wlan2g" "WLAN2G" "${boardname}:blue:wlan2G" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WLAN5G" "${boardname}:blue:wlan5G" "phy1tpt" + ucidef_set_led_usbport "usb" "USB" "${boardname}:blue:usb" "usb1-port1" "usb2-port1" "usb3-port1" "usb4-port1" + ucidef_set_led_netdev "wan" "WAN" "${boardname}:blue:wan" "eth1" + ucidef_set_led_switch "lan" "LAN" "${boardname}:blue:lan" "switch0" "0x1e" + ;; avm,fritzbox-4040) ucidef_set_led_wlan "wlan" "WLAN" "fritz4040:green:wlan" "phy0tpt" "phy1tpt" ucidef_set_led_netdev "wan" "WAN" "fritz4040:green:wan" "eth1" diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index 7c83e2e754..8f8d67db32 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -12,6 +12,16 @@ board_config_update board=$(board_name) case "$board" in +asus,rt-ac58u) + CI_UBIPART=UBI_DEV + wan_mac_addr=$(mtd_get_mac_binary_ubi Factory 20486) + lan_mac_addr=$(mtd_get_mac_binary_ubi Factory 4102) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" \ + "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan" + ucidef_set_interface_macaddr "lan" "$lan_mac_addr" + ucidef_set_interface_macaddr "wan" "$wan_mac_addr" + ;; avm,fritzbox-4040) ucidef_set_interfaces_lan_wan "eth0" "eth1" ucidef_add_switch "switch0" \ diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 33ea9b426c..bc64d5b8ab 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -19,6 +19,24 @@ ath10kcal_extract() { ath10kcal_die "failed to extract calibration data from $mtd" } +ath10kcal_ubi_extract() { + local part=$1 + local offset=$2 + local count=$3 + local ubidev + local ubi + + . /lib/upgrade/nand.sh + + ubidev=$(nand_find_ubi $CI_UBIPART) + ubi=$(nand_find_volume $ubidev $part) + [ -n "$ubi" ] || \ + ath10kcal_die "no UBI volume found for $part" + + dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 2>/dev/null || \ + ath10kcal_die "failed to extract from $ubi" +} + [ -e /lib/firmware/$FIRMWARE ] && exit 0 . /lib/functions.sh @@ -30,6 +48,10 @@ board=$(board_name) case "$FIRMWARE" in "ath10k/pre-cal-ahb-a000000.wifi.bin") case "$board" in + asus,rt-ac58u) + CI_UBIPART=UBI_DEV + ath10kcal_ubi_extract "Factory" 4096 12064 + ;; avm,fritzbox-4040) /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") ;; @@ -44,6 +66,10 @@ case "$FIRMWARE" in ;; "ath10k/pre-cal-ahb-a800000.wifi.bin") case "$board" in + asus,rt-ac58u) + CI_UBIPART=UBI_DEV + ath10kcal_ubi_extract "Factory" 20480 12064 + ;; avm,fritzbox-4040) /usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config") ;; diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index defa04d880..261c468813 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -5,11 +5,37 @@ RAMFS_COPY_BIN='fw_printenv fw_setenv' RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock' platform_check_image() { + case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + local ubidev=$(nand_find_ubi $CI_UBIPART) + local asus_root=$(nand_find_volume $ubidev jffs2) + + [ -n "$asus_root" ] || return 0 + + cat << EOF +jffs2 partition is still present. +There's probably no space left +to install the filesystem. + +You need to delete the jffs2 partition first: +# ubirmvol /dev/ubi0 --name=jffs2 + +Once this is done. Retry. +EOF + return 1 + ;; + esac return 0; } platform_do_upgrade() { case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + CI_KERNPART="linux" + nand_do_upgrade "$1" + ;; openmesh,a42) PART_NAME="inactive" platform_do_upgrade_openmesh "$ARGV" @@ -20,6 +46,15 @@ platform_do_upgrade() { esac } +platform_nand_pre_upgrade() { + case "$(board_name)" in + asus,rt-ac58u) + CI_UBIPART="UBI_DEV" + CI_KERNPART="linux" + ;; + esac +} + blink_led() { . /etc/diag.sh; set_state upgrade } diff --git a/target/linux/ipq40xx/config-4.14 b/target/linux/ipq40xx/config-4.14 index b53015712a..fe01754d20 100644 --- a/target/linux/ipq40xx/config-4.14 +++ b/target/linux/ipq40xx/config-4.14 @@ -301,6 +301,8 @@ CONFIG_MTD_M25P80=y CONFIG_MTD_NAND=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_NAND_QCOM=y +CONFIG_MTD_SPINAND_MT29F=y +CONFIG_MTD_SPINAND_ONDIEECC=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts new file mode 100644 index 0000000000..7e5d12345a --- /dev/null +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-rt-ac58u.dts @@ -0,0 +1,314 @@ +/* Copyright (c) 2015, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "qcom-ipq4019.dtsi" +#include "qcom-ipq4019-bus.dtsi" +#include +#include +#include + +/ { + model = "ASUS RT-AC58U"; + compatible = "asus,rt-ac58u", "qcom,ipq4019"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x8000000>; + }; + + aliases { + led-boot = &power; + led-failsafe = &power; + led-running = &power; + led-upgrade = &power; + }; + + reserved-memory { + #address-cells = <0x1>; + #size-cells = <0x1>; + ranges; + + smem@87e00000 { + reg = <0x87e00000 0x080000>; + no-map; + }; + + tz@87e80000 { + reg = <0x87e80000 0x180000>; + no-map; + }; + }; + + soc { + mdio@90000 { + status = "okay"; + }; + + ess-psgmii@98000 { + status = "okay"; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = ; + }; + + tcsr@194b000 { + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = ; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = ; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = ; + }; + + usb2@60f8800 { + status = "ok"; + }; + + serial@78af000 { + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; + status = "ok"; + }; + + usb3@8af8800 { + status = "ok"; + }; + + crypto@8e3a000 { + status = "ok"; + }; + + wifi@a000000 { + status = "okay"; + qcom,ath10k-calibration-variant = "ASUS-RT-AC58U"; + }; + + wifi@a800000 { + status = "okay"; + qcom,ath10k-calibration-variant = "ASUS-RT-AC58U"; + }; + + watchdog@b017000 { + status = "ok"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&tlmm 63 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power: status { + label = "rt-ac58u:blue:status"; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "rt-ac58u:blue:wan"; + gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; + }; + + wlan2G { + label = "rt-ac58u:blue:wlan2G"; + gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>; + }; + + wan5G { + label = "rt-ac58u:blue:wlan5G"; + gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; + }; + + usb { + label = "rt-ac58u:blue:usb"; + gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; + }; + + lan { + label = "rt-ac58u:blue:lan"; + gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&cryptobam { + status = "ok"; +}; + +&blsp_dma { + status = "ok"; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio60", "gpio61"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + mux { + function = "blsp_spi0"; + pins = "gpio55", "gpio56", "gpio57"; + drive-strength = <12>; + bias-disable; + }; + + mux_cs { + function = "gpio"; + pins = "gpio54", "gpio59"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; +}; + +&spi_0 { /* BLSP1 QUP1 */ + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "ok"; + cs-gpios = <&tlmm 54 0>, + <&tlmm 59 0>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <0>; + /* + * U-boot looks for "n25q128a11" node, + * if we don't have it, it will spit out the following warning: + * "ipq: fdt fixup unable to find compatible node". + */ + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "mx25l1606e", "n25q128a11"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + partition1@40000 { + label = "MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + partition2@60000 { + label = "QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + partition3@c0000 { + label = "CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + partition4@d0000 { + label = "DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + partition5@e0000 { + label = "APPSBLENV"; /* uboot env*/ + reg = <0x000e0000 0x00010000>; + read-only; + }; + partition5@f0000 { + label = "APPSBL"; /* uboot */ + reg = <0x000f0000 0x00080000>; + read-only; + }; + partition5@170000 { + label = "ART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + /* 0x00180000 - 0x00200000 unused */ + }; + }; + + mt29f@1 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "spinand,mt29f"; + reg = <1>; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "ubi"; + reg = <0x00000000 0x08000000>; + }; + }; + }; +}; + +&usb3_ss_phy { + status = "ok"; +}; + +&usb3_hs_phy { + status = "ok"; +}; + +&usb2_hs_phy { + status = "ok"; +}; diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 218a80afa7..dd71746cc0 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -31,6 +31,27 @@ define Device/UbiFit IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata endef + +define Device/asus_rt-ac58u + $(call Device/FitImageLzma) + DEVICE_DTS := qcom-ipq4018-rt-ac58u + BLOCKSIZE := 128k + PAGESIZE := 2048 + DTB_SIZE := 65536 + DEVICE_TITLE := Asus RT-AC58U + IMAGE_SIZE := 20439364 + FILESYSTEMS := squashfs +# Someone - in their infinite wisdom - decided to put the firmware +# version in front of the image name \03\00\00\04 => Version 3.0.0.4 +# Since u-boot works with strings we either need another fixup step +# to add a version... or we are very careful not to add '\0' into that +# string and call it a day.... Yeah, we do the latter! + UIMAGE_NAME:=$(shell echo -e '\03\01\01\01RT-AC58U') + IMAGES := sysupgrade.bin + DEVICE_PACKAGES := ipq-wifi-asus_rt-ac58u kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += asus_rt-ac58u + define Device/avm_fritzbox-4040 $(call Device/FitImageLzma) DEVICE_DTS := qcom-ipq4019-fritz4040 diff --git a/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch index 1c88a6111a..745a39e05d 100644 --- a/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-4.14/069-arm-boot-add-dts-files.patch @@ -10,11 +10,12 @@ Signed-off-by: John Crispin --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -697,7 +697,11 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -697,7 +697,12 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ + qcom-ipq4018-a42.dtb \ ++ qcom-ipq4018-rt-ac58u.dtb \ qcom-ipq4019-ap.dk01.1-c1.dtb \ + qcom-ipq4019-ap.dk04.1-c1.dtb \ + qcom-ipq4019-fritz4040.dtb \ diff --git a/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch b/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch new file mode 100644 index 0000000000..86cb454619 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/400-mtd-ubi-add-quirk-to-autoload-ubi-on-rt-ac58u.patch @@ -0,0 +1,29 @@ +From b8f3a7ccbeca5bdbd1b6210b94b38d3fef2dd0bd Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Thu, 19 Jan 2017 01:57:22 +0100 +Subject: [PATCH 16/38] mtd: ubi: add auto_attach HACK for the ASUS RT-AC58U + +This patch adds a hack that allows UBI's autoattach feature +to work with the custom ASUS UBI_DEV partition name. + +This is necessary because the vendor's u-boot doesn't leave +the bootargs / cmdline alone, so the it can't be overwritten +easily otherwise. + +Signed-off-by: Christian Lamparter +--- + drivers/mtd/ubi/build.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/mtd/ubi/build.c ++++ b/drivers/mtd/ubi/build.c +@@ -1170,6 +1170,9 @@ static void __init ubi_auto_attach(void) + mtd = open_mtd_device("ubi"); + if (IS_ERR(mtd)) + mtd = open_mtd_device("data"); ++ /* Hack for the Asus RT-AC58U */ ++ if (IS_ERR(mtd)) ++ mtd = open_mtd_device("UBI_DEV"); + + if (!IS_ERR(mtd)) { + size_t len; -- 2.30.2