From 6e9299a6b39cef9f594ee28155e84b1b1bfadf86 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 28 Nov 2018 18:40:04 +0800 Subject: [PATCH] ramips: add support for more model --- .../ramips/base-files/etc/board.d/01_leds | 20 +- .../ramips/base-files/etc/board.d/02_network | 20 +- .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 3 +- target/linux/ramips/base-files/lib/ramips.sh | 3 - .../ramips/base-files/lib/upgrade/platform.sh | 11 +- target/linux/ramips/dts/BDCOM-WAP2100-SK.dts | 138 ++++++++++++++ target/linux/ramips/dts/D240.dts | 16 ++ target/linux/ramips/dts/DIR-810L.dts | 8 + target/linux/ramips/dts/F5D8235_V2.dts | 13 +- target/linux/ramips/dts/GB-PC1.dts | 5 - target/linux/ramips/dts/GB-PC2.dts | 5 - target/linux/ramips/dts/LR-25G001.dts | 180 ++++++++++++++++++ target/linux/ramips/dts/RT-AC51U.dts | 11 ++ target/linux/ramips/dts/SKW92A.dts | 122 ++++++++++++ target/linux/ramips/dts/U7621-06-512M-64M.dts | 92 +++++++++ target/linux/ramips/dts/WD03.dts | 2 +- target/linux/ramips/dts/WL-WN570HA1.dts | 136 +++++++++++++ target/linux/ramips/dts/rt2880.dtsi | 4 +- target/linux/ramips/dts/rt3883.dtsi | 2 +- .../net/ethernet/mediatek/gsw_mt7620.c | 3 + target/linux/ramips/image/mt7620.mk | 27 ++- target/linux/ramips/image/mt7621.mk | 25 ++- target/linux/ramips/image/mt76x8.mk | 22 ++- target/linux/ramips/image/rt305x.mk | 1 + target/linux/ramips/mt7620/config-4.14 | 2 + ...-MIPS-ralink-Fix-mt7620-nd_sd-pinmux.patch | 29 +++ ...support-for-GPIO-as-interrupt-contro.patch | 51 +++++ ...d-Remove-unused-chip-write_page-hook.patch | 67 +++++++ .../ramips/patches-4.14/0040-nand-hack.patch | 30 +-- 29 files changed, 977 insertions(+), 71 deletions(-) create mode 100644 target/linux/ramips/dts/BDCOM-WAP2100-SK.dts create mode 100644 target/linux/ramips/dts/LR-25G001.dts create mode 100644 target/linux/ramips/dts/SKW92A.dts create mode 100644 target/linux/ramips/dts/U7621-06-512M-64M.dts create mode 100644 target/linux/ramips/dts/WL-WN570HA1.dts create mode 100644 target/linux/ramips/patches-4.14/0008-MIPS-ralink-Fix-mt7620-nd_sd-pinmux.patch create mode 100644 target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch create mode 100644 target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds index 2644bc015..4330254c8 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -17,6 +17,7 @@ case $board in set_wifi_led "$boardname:amber:wlan" ;; 3g-6200nl|\ +skylab,skw92a|\ wnce2001) set_wifi_led "$boardname:green:wlan" ;; @@ -55,6 +56,10 @@ asl26555-16M) ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0" set_wifi_led "asl26555:green:wlan" ;; +bdcom,wap2100-sk|\ +hiwifi,hc5861b) + set_wifi_led "$boardname:green:wlan2g" + ;; broadway) set_wifi_led "$boardname:red:wps_active" ;; @@ -171,9 +176,6 @@ hg255d) set_wifi_led "$boardname:green:wlan" ucidef_set_led_netdev "internet" "internet" "$boardname:green:internet" "eth0.2" ;; -hiwifi,hc5861b) - set_wifi_led "$boardname:green:wlan2g" - ;; hpm) ucidef_set_led_netdev "eth" "ETH" "$boardname:green:eth" "eth0" set_wifi_led "$boardname:green:wifi" @@ -195,6 +197,10 @@ kn_rf|\ kng_rc) set_wifi_led "$boardname:green:wifi" ;; +lava,lr-25g001) + ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "wlan1" + ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "$boardname:green:wlan5g" "wlan0" + ;; linkits7688) ucidef_set_led_wlan "wifi" "wifi" "linkit-smart-7688:orange:wifi" "phy0tpt" ;; @@ -364,6 +370,14 @@ vocore-16M) w502u) set_wifi_led "rt2800pci-phy0::radio" ;; +wavlink,wl-wn570ha1) + ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_led_rssi "wifi-low" "wifi-low" "$boardname:green:wifi-low" "wlan0" "1" "49" + ucidef_set_led_rssi "wifi-med" "wifi-med" "$boardname:green:wifi-med" "wlan0" "50" "84" + ucidef_set_led_rssi "wifi-high" "wifi-high" "$boardname:green:wifi-high" "wlan0" "85" "100" + set_wifi_led "$boardname:green:wifi" + ;; we1026-5g-16m) ucidef_set_led_netdev "lan" "LAN" "we1026-5g:green:lan" "eth0" set_wifi_led "we1026-5g:green:wifi" diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network index 9e9ecbcb5..0d8855c32 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -32,6 +32,7 @@ ramips_setup_interfaces() case $board in 11acnas|\ + d-team,newifi-d2|\ w2914nsv2|\ zbt-we2026) ucidef_add_switch "switch0" \ @@ -103,7 +104,6 @@ ramips_setup_interfaces() mt7628|\ mzk-750dhp|\ mzk-w300nh2|\ - d-team,newifi-d2|\ netgear,r6120|\ nixcore-x1-8M|\ nixcore-x1-16M|\ @@ -115,8 +115,10 @@ ramips_setup_interfaces() rt-n12p|\ sap-g3200u3|\ sk-wb8|\ - u7621-06-256M-16M|\ + unielec,u7621-06-256m-16m|\ + unielec,u7621-06-512m-64m|\ vr500|\ + wavlink,wl-wn570ha1|\ wf-2881|\ whr-g300n|\ mqmaker,witi-256m|\ @@ -198,13 +200,12 @@ ramips_setup_interfaces() atp-52b|\ awm002-evb-4M|\ awm002-evb-8M|\ + bdcom,wap2100-sk|\ c20i|\ dir-645|\ - f5d8235-v2|\ gl-mt300a|\ gl-mt300n|\ gl-mt750|\ - hg255d|\ hiwifi,hc5861b|\ jhr-n805r|\ jhr-n825r|\ @@ -213,6 +214,7 @@ ramips_setup_interfaces() mzk-wdpr|\ rb750gr3|\ rt-n14u|\ + skylab,skw92a|\ tplink,c20-v4|\ tplink,c50-v3|\ tplink,tl-mr3420-v5|\ @@ -242,6 +244,7 @@ ramips_setup_interfaces() elecom,wrc-1167ghbk2-s|\ elecom,wrc-2533gst|\ elecom,wrc-1900gst|\ + hg255d|\ iodata,wn-ax1167gr|\ iodata,wn-gx300gr) ucidef_add_switch "switch0" \ @@ -349,6 +352,7 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "4:lan" "6@eth0" ;; + lava,lr-25g001|\ tew-691gr|\ tew-692gr|\ wlr-6000) @@ -371,6 +375,7 @@ ramips_setup_interfaces() "0:lan" "2:lan" "6t@eth0" ;; f5d8235-v1|\ + f5d8235-v2|\ tew-714tru|\ v11st-fe|\ wzr-agl300nh) @@ -470,7 +475,8 @@ ramips_setup_macs() ;; dlink,dwr-116-a1|\ dlink,dwr-118-a2|\ - dlink,dwr-921-c1) + dlink,dwr-921-c1|\ + lava,lr-25g001) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) lan_mac=$(macaddr_add "$wan_mac" 1) ;; @@ -554,6 +560,10 @@ ramips_setup_macs() lan_mac=$(macaddr_setbit_la "$lan_mac") wan_mac=$(mtd_get_mac_binary factory 32772) ;; + skylab,skw92a) + lan_mac=$(mtd_get_mac_binary factory 40) + wan_mac=$(mtd_get_mac_binary factory 46) + ;; tew-691gr) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 4)" 3) ;; diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index 711b8388b..aee446d15 100644 --- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -56,7 +56,8 @@ case "$FIRMWARE" in case $board in dlink,dwr-116-a1|\ dlink,dwr-118-a2|\ - dlink,dwr-921-c1) + dlink,dwr-921-c1|\ + lava,lr-25g001) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) jboot_eeprom_extract "config" 0xE000 diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 5741cbd2e..307ab35c3 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -502,9 +502,6 @@ ramips_board_detect() { *"U25AWF-H1") name="u25awf-h1" ;; - *"U7621-06 (256M RAM/16M flash)") - name="u7621-06-256M-16M" - ;; *"U7628-01 (128M RAM/16M flash)") name="u7628-01-128M-16M" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 7558b4e31..e28f06665 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -31,6 +31,7 @@ platform_check_image() { awm002-evb-4M|\ awm002-evb-8M|\ bc2|\ + bdcom,wap2100-sk|\ bocco|\ broadway|\ c108|\ @@ -151,6 +152,7 @@ platform_check_image() { rut5xx|\ sap-g3200u3|\ sk-wb8|\ + skylab,skw92a|\ sl-r7205|\ tama,w06|\ tew-638apb-v2|\ @@ -160,7 +162,8 @@ platform_check_image() { timecloud|\ tiny-ac|\ u25awf-h1|\ - u7621-06-256M-16M|\ + unielec,u7621-06-256m-16m|\ + unielec,u7621-06-512m-64m|\ u7628-01-128M-16M|\ ur-326n4g|\ ur-336un|\ @@ -176,6 +179,7 @@ platform_check_image() { w306r-v20|\ w502u|\ ravpower,wd03|\ + wavlink,wl-wn570ha1|\ wf-2881|\ whr-1166d|\ whr-300hp2|\ @@ -185,6 +189,7 @@ platform_check_image() { widora,neo-32m|\ mqmaker,witi-256m|\ mqmaker,witi-512m|\ + we1026-5g-16m|\ wizfi630a|\ wl-330n|\ wl-330n3g|\ @@ -216,7 +221,6 @@ platform_check_image() { y1|\ y1s|\ youhua,wr1200js|\ - we1026-5g-16m|\ zbt-ape522ii|\ zbt-cpe102|\ zbt-wa05|\ @@ -293,7 +297,8 @@ platform_check_image() { dlink,dwr-116-a1|\ dlink,dwr-118-a2|\ dlink,dwr-921-c1|\ - dwr-512-b) + dwr-512-b|\ + lava,lr-25g001) [ "$magic" != "0404242b" ] && { echo "Invalid image type." return 1 diff --git a/target/linux/ramips/dts/BDCOM-WAP2100-SK.dts b/target/linux/ramips/dts/BDCOM-WAP2100-SK.dts new file mode 100644 index 000000000..62a87c844 --- /dev/null +++ b/target/linux/ramips/dts/BDCOM-WAP2100-SK.dts @@ -0,0 +1,138 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "bdcom,wap2100-sk", "ralink,mt7620a-soc"; + model = "BDCOM WAP2100-SK"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "wap2100-sk:green:usb"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + trigger-sources = <&ohci_port1>, <&ehci_port1>; + linux,default-trigger = "usbport"; + }; + + led_power: wps { + label = "wap2100-sk:green:wps"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + wlan2g { + label = "wap2100-sk:green:wlan2g"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xf70000>; + }; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mediatek,portmap = "llllw"; +}; + +&wmac { + ralink,mtd-eeprom = <&factory 0>; +}; + +&pinctrl { + state_default: pinctrl0 { + default { + ralink,group = "spi refclk", "uartf", "wled"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/D240.dts b/target/linux/ramips/dts/D240.dts index 134ebdda5..576f3caf3 100644 --- a/target/linux/ramips/dts/D240.dts +++ b/target/linux/ramips/dts/D240.dts @@ -156,6 +156,8 @@ &sdhci { status = "okay"; + /* the pins function is already set during pinmux driver load */ + /delete-property/ pinctrl-0; }; &ehci { @@ -181,6 +183,20 @@ ralink,group = "i2c", "uartf", "wled", "spi refclk", "pa"; ralink,function = "gpio"; }; + + /* + * 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. + */ + gpio_sd { + ralink,group = "nd_sd"; + ralink,function = "sd"; + }; }; }; diff --git a/target/linux/ramips/dts/DIR-810L.dts b/target/linux/ramips/dts/DIR-810L.dts index b38290af5..c6d437820 100644 --- a/target/linux/ramips/dts/DIR-810L.dts +++ b/target/linux/ramips/dts/DIR-810L.dts @@ -143,3 +143,11 @@ &wmac { ralink,mtd-eeprom = <&factory 0>; }; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; diff --git a/target/linux/ramips/dts/F5D8235_V2.dts b/target/linux/ramips/dts/F5D8235_V2.dts index a3a125594..1a86557ca 100644 --- a/target/linux/ramips/dts/F5D8235_V2.dts +++ b/target/linux/ramips/dts/F5D8235_V2.dts @@ -111,7 +111,7 @@ &pinctrl { state_default: pinctrl0 { gpio { - ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf"; + ralink,group = "spi", "i2c", "jtag", "mdio", "uartf"; ralink,function = "gpio"; }; }; @@ -119,10 +119,21 @@ ðernet { mtd-mac-address = <&uboot 0x40004>; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii_pins>; }; &esw { + ralink,rgmii = <1>; mediatek,portmap = <0x3f>; + ralink,fct2 = <0x0002500c>; + /* + * ext phy base addr 31, rx/tx clock skew 0, + * turbo mii off, rgmi 3.3v off, port 5 polling off + * port5: enabled, gige, full-duplex, rx/tx-flow-control + * port6: enabled, gige, full-duplex, rx/tx-flow-control + */ + ralink,fpa2 = <0x1f003fff>; }; &wmac { diff --git a/target/linux/ramips/dts/GB-PC1.dts b/target/linux/ramips/dts/GB-PC1.dts index 49262cc6a..6f92f9a53 100644 --- a/target/linux/ramips/dts/GB-PC1.dts +++ b/target/linux/ramips/dts/GB-PC1.dts @@ -105,11 +105,6 @@ }; }; -&cpuclock { - compatible = "fixed-clock"; - clock-frequency = <900000000>; -}; - &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/GB-PC2.dts b/target/linux/ramips/dts/GB-PC2.dts index 9049e7387..2c90975b8 100644 --- a/target/linux/ramips/dts/GB-PC2.dts +++ b/target/linux/ramips/dts/GB-PC2.dts @@ -115,11 +115,6 @@ }; }; -&cpuclock { - compatible = "fixed-clock"; - clock-frequency = <900000000>; -}; - &pcie { status = "okay"; }; diff --git a/target/linux/ramips/dts/LR-25G001.dts b/target/linux/ramips/dts/LR-25G001.dts new file mode 100644 index 000000000..37fe52354 --- /dev/null +++ b/target/linux/ramips/dts/LR-25G001.dts @@ -0,0 +1,180 @@ +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "lava,lr-25g001", "ralink,mt7620a-soc"; + model = "LAVA LR-25G001"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_status: status { + label = "lr-25g001:green:status"; + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + }; + + wifi2g { + label = "lr-25g001:green:wifi2g"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + wifi5g { + label = "lr-25g001:green:wifi5g"; + gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usbpower { + gpio-export,name = "usbpower"; + gpio-export,output = <1>; + gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; + + partition@10000 { + label = "firmware"; + reg = <0x10000 0xfe0000>; + }; + + config: partition@ff0000 { + label = "config"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +ðernet { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&rgmii1_pins &rgmii2_pins &mdio_pins>; + + port@5 { + status = "okay"; + phy-mode = "rgmii"; + mediatek,fixed-link = <1000 1 1 1>; + }; + + mdio-bus { + status = "okay"; + mediatek,mdio-mode = <1>; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + qca,ar8327-initvals = < + 0x04 0x87300000 /* PORT0 PAD MODE CTRL */ + 0x0c 0x00000000 /* PORT6 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x00000000 /* PORT6_STATUS */ + >; + }; + + phy1: ethernet-phy@1 { + reg = <1>; + phy-mode = "rgmii"; + }; + + phy2: ethernet-phy@2 { + reg = <2>; + phy-mode = "rgmii"; + }; + + phy3: ethernet-phy@3 { + reg = <3>; + phy-mode = "rgmii"; + }; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76x0e@0,0 { + reg = <0x0000 0 0 0 0>; + mtd-mac-address = <&config 0xe07e>; + mtd-mac-address-increment = <(2)>; + mediatek,mtd-eeprom = <&config 0xe08a>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "uartf", "i2c"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/dts/RT-AC51U.dts b/target/linux/ramips/dts/RT-AC51U.dts index 6bed8446e..683f17bb7 100644 --- a/target/linux/ramips/dts/RT-AC51U.dts +++ b/target/linux/ramips/dts/RT-AC51U.dts @@ -135,3 +135,14 @@ }; }; }; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; +}; diff --git a/target/linux/ramips/dts/SKW92A.dts b/target/linux/ramips/dts/SKW92A.dts new file mode 100644 index 000000000..5aaf3ce16 --- /dev/null +++ b/target/linux/ramips/dts/SKW92A.dts @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7628an.dtsi" + +#include +#include + +/{ + compatible = "skylab,skw92a", "mediatek,mt7628an-soc"; + model = "SKYLAB SKW92A"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_power: wps { + label = "skw92a:green:wps"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "skw92a:green:wlan"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "refclk", "wled_an"; + ralink,function = "gpio"; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&wmac { + status = "okay"; + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + compatible = "denx,uimage"; + }; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/dts/U7621-06-512M-64M.dts b/target/linux/ramips/dts/U7621-06-512M-64M.dts new file mode 100644 index 000000000..4b064b2b3 --- /dev/null +++ b/target/linux/ramips/dts/U7621-06-512M-64M.dts @@ -0,0 +1,92 @@ +/* + * BSD LICENSE + * + * Copyright(c) 2017 Kristian Evensen . + * Copyright(c) 2017 Piotr Dymacz . + * Copyright(c) 2018 Nishant Sharma . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Broadcom Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/dts-v1/; + +#include "U7621-06.dtsi" + +#include +#include + +/ { + compatible = "unielec,u7621-06-512m-64m", "unielec,u7621-06", "mediatek,mt7621-soc"; + model = "UniElec U7621-06 (512M RAM/64M flash)"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x1c000000>, <0x20000000 0x4000000>; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x3fb0000>; + }; + }; + }; +}; diff --git a/target/linux/ramips/dts/WD03.dts b/target/linux/ramips/dts/WD03.dts index 1c9548c3a..13e9bb332 100644 --- a/target/linux/ramips/dts/WD03.dts +++ b/target/linux/ramips/dts/WD03.dts @@ -1,6 +1,6 @@ /dts-v1/; -#include "mt7620a.dtsi" +#include "mt7620n.dtsi" #include #include diff --git a/target/linux/ramips/dts/WL-WN570HA1.dts b/target/linux/ramips/dts/WL-WN570HA1.dts new file mode 100644 index 000000000..14ca11560 --- /dev/null +++ b/target/linux/ramips/dts/WL-WN570HA1.dts @@ -0,0 +1,136 @@ +/dts-v1/; +#include +#include + +#include "mt7628an.dtsi" + +/ { + compatible = "wavlink,wl-wn570ha1", "mediatek,mt7628an-soc"; + model = "Wavlink WL-WN570HA1"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x4000000>; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio1 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + power { + label = "wl-wn570ha1:green:power"; + gpios = <&gpio1 5 GPIO_ACTIVE_LOW>; + default-state = "keep"; + }; + + wan { + label = "wl-wn570ha1:green:wan"; + gpios = <&gpio1 11 GPIO_ACTIVE_LOW>; + }; + + wifi-high { + label = "wl-wn570ha1:green:wifi-high"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + wifi-med { + label = "wl-wn570ha1:green:wifi-med"; + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + }; + + wifi-low { + label = "wl-wn570ha1:green:wifi-low"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "wl-wn570ha1:green:wifi"; + gpios = <&gpio1 12 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "wled_an", "p0led_an", "wdt", "refclk"; + ralink,function = "gpio"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&wmac { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x2e>; + mediatek,portmap = "llllw"; +}; diff --git a/target/linux/ramips/dts/rt2880.dtsi b/target/linux/ramips/dts/rt2880.dtsi index 0d7a97faf..c163657ed 100644 --- a/target/linux/ramips/dts/rt2880.dtsi +++ b/target/linux/ramips/dts/rt2880.dtsi @@ -193,8 +193,8 @@ pci: pci@440000 { compatible = "ralink,rt288x-pci"; reg = <0x00440000 0x20000>; - #address-cells = <1>; - #size-cells = <1>; + #address-cells = <3>; + #size-cells = <2>; status = "disabled"; }; diff --git a/target/linux/ramips/dts/rt3883.dtsi b/target/linux/ramips/dts/rt3883.dtsi index ce71c915c..599b3723e 100644 --- a/target/linux/ramips/dts/rt3883.dtsi +++ b/target/linux/ramips/dts/rt3883.dtsi @@ -310,7 +310,7 @@ pci_pins: pci { pci { ralink,group = "pci"; - ralink,function = "pci-host1"; + ralink,function = "pci-fnc"; }; }; }; diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c index ffcf70c45..5fc5080aa 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.c @@ -69,6 +69,9 @@ static int mt7620_mdio_mode(struct device_node *eth_node) mdiobus_node = of_get_child_by_name(eth_node, "mdio-bus"); if (mdiobus_node) { + if (of_property_read_bool(mdiobus_node, "mediatek,mdio-mode")) + ret = 1; + for_each_child_of_node(mdiobus_node, phy_node) { id = of_get_property(phy_node, "reg", NULL); if (id && (be32_to_cpu(*id) == 0x1f)) diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index b0d2b2a8f..a7aeaf130 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -49,6 +49,7 @@ define Device/ArcherC20i TPLINK_HWID := 0xc2000001 TPLINK_HWREV := 58 IMAGES += factory.bin + DEVICE_PACKAGES := kmod-mt76x0e DEVICE_TITLE := TP-Link ArcherC20i endef TARGET_DEVICES += ArcherC20i @@ -79,6 +80,14 @@ define Device/ArcherMR200 endef TARGET_DEVICES += ArcherMR200 +define Device/bdcom_wap2100-sk + DTS := BDCOM-WAP2100-SK + IMAGE_SIZE := 15808k + DEVICE_TITLE := BDCOM WAP2100-SK (ZTE ZXECS EBG3130) + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-mt76 kmod-sdhci-mt7620 kmod-usb-ledtrig-usbport +endef +TARGET_DEVICES += bdcom_wap2100-sk + define Device/bocco DTS := BOCCO DEVICE_TITLE := YUKAI Engineering BOCCO @@ -145,8 +154,9 @@ TARGET_DEVICES += dch-m225 define Device/dir-810l DTS := DIR-810L - IMAGE_SIZE := 6720k + DEVICE_PACKAGES := kmod-mt76x0e DEVICE_TITLE := D-Link DIR-810L + IMAGE_SIZE := 6720k endef TARGET_DEVICES += dir-810l @@ -342,6 +352,21 @@ define Device/microwrt endef TARGET_DEVICES += microwrt +define Device/lava_lr-25g001 + DTS := LR-25G001 + DEVICE_TITLE := LAVA LR-25G001 + DLINK_ROM_ID := LVA6E3804001 + DLINK_FAMILY_MEMBER := 0x6E38 + DLINK_FIRMWARE_SIZE := 0xFE0000 + KERNEL := $(KERNEL_DTB) + IMAGES += factory.bin + IMAGE/sysupgrade.bin := mkdlinkfw | pad-rootfs | append-metadata + IMAGE/factory.bin := mkdlinkfw | pad-rootfs | mkdlinkfw-factory + DEVICE_PACKAGES := jboot-tools kmod-usb2 kmod-mt76 kmod-mt76x0-common \ + kmod-mt76x0e +endef +TARGET_DEVICES += lava_lr-25g001 + define Device/miwifi-mini DTS := MIWIFI-MINI IMAGE_SIZE := $(ralink_default_fw_size_16M) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index e0c2f55ad..47ff85f24 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -366,14 +366,6 @@ define Device/timecloud endef TARGET_DEVICES += timecloud -define Device/u7621-06-256M-16M - DTS := U7621-06-256M-16M - IMAGE_SIZE := 16064k - DEVICE_TITLE := UniElec U7621-06 (256M RAM/16M flash) - DEVICE_PACKAGES := kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 -endef -TARGET_DEVICES += u7621-06-256M-16M - define Device/ubnt-erx DTS := UBNT-ERX FILESYSTEMS := squashfs @@ -394,6 +386,23 @@ define Device/ubnt-erx-sfp endef TARGET_DEVICES += ubnt-erx-sfp +define Device/unielec_u7621-06-256m-16m + DTS := U7621-06-256M-16M + IMAGE_SIZE := 16064k + DEVICE_TITLE := UniElec U7621-06 (256M RAM/16M flash) + DEVICE_PACKAGES := kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 + SUPPORTED_DEVICES += u7621-06-256M-16M +endef +TARGET_DEVICES += unielec_u7621-06-256m-16m + +define Device/unielec_u7621-06-512m-64m + DTS := U7621-06-512M-64M + IMAGE_SIZE := 65216k + DEVICE_TITLE := UniElec U7621-06 (512M RAM/64M flash) + DEVICE_PACKAGES := kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 +endef +TARGET_DEVICES += unielec_u7621-06-512m-64m + define Device/vr500 DTS := VR500 IMAGE_SIZE := 66453504 diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 15bc1ee70..af5b0f6d6 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -115,10 +115,10 @@ define Device/netgear_r6120 IMAGE_SIZE := $(ralink_default_fw_size_16M) DEVICE_TITLE := Netgear AC1200 R6120 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci - SERCOMM_KERNEL_OFFSET := 90000 + SERCOMM_KERNEL_OFFSET := 0x90000 SERCOMM_HWID := CGQ SERCOMM_HWVER := A001 - SERCOMM_SWVER := 0040 + SERCOMM_SWVER := 0x0040 IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | pad-rootfs IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE) @@ -150,6 +150,14 @@ define Device/pbr-d1 endef TARGET_DEVICES += pbr-d1 +define Device/skylab_skw92a + DTS := SKW92A + IMAGE_SIZE := 16064k + DEVICE_TITLE := Skylab SKW92A + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += skylab_skw92a + define Device/tplink_tl-wa801nd-v5 $(Device/tplink) DTS := TL-WA801NDV5 @@ -283,7 +291,7 @@ define Device/tplink_tl-wr902ac-v3 TPLINK_HWREV := 0x89 TPLINK_HWREVADD := 0x1 TPLINK_HVERSION := 3 - DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := kmod-mt76x0e kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport endef TARGET_DEVICES += tplink_tl-wr902ac-v3 @@ -313,6 +321,14 @@ define Device/vocore2lite endef TARGET_DEVICES += vocore2lite +define Device/wavlink_wl-wn570ha1 + DTS := WL-WN570HA1 + IMAGE_SIZE := $(ralink_default_fw_size_8M) + DEVICE_TITLE := Wavlink WL-WN570HA1 + DEVICE_PACKAGES := kmod-mt76x0e +endef +TARGET_DEVICES += wavlink_wl-wn570ha1 + define Device/wcr-1166ds DTS := WCR-1166DS BUFFALO_TAG_PLATFORM := MTK diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index 066cef23c..cc743c609 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -329,6 +329,7 @@ define Device/f5d8235-v2 DTS := F5D8235_V2 IMAGE_SIZE := 7744k DEVICE_TITLE := Belkin F5D8235 v2 + DEVICE_PACKAGES := kmod-switch-rtl8366rb endef TARGET_DEVICES += f5d8235-v2 diff --git a/target/linux/ramips/mt7620/config-4.14 b/target/linux/ramips/mt7620/config-4.14 index 1162ed47b..e1a8e0c73 100644 --- a/target/linux/ramips/mt7620/config-4.14 +++ b/target/linux/ramips/mt7620/config-4.14 @@ -1,3 +1,4 @@ +CONFIG_AR8216_PHY=y CONFIG_ARCH_BINFMT_ELF_STATE=y CONFIG_ARCH_CLOCKSOURCE_DATA=y CONFIG_ARCH_DISCARD_MEMBLOCK=y @@ -57,6 +58,7 @@ CONFIG_DTB_RT_NONE=y # CONFIG_DTB_VOCORE2 is not set CONFIG_DTC=y CONFIG_EARLY_PRINTK=y +CONFIG_ETHERNET_PACKET_MANGLE=y CONFIG_FIXED_PHY=y CONFIG_GENERIC_ATOMIC64=y CONFIG_GENERIC_CLOCKEVENTS=y diff --git a/target/linux/ramips/patches-4.14/0008-MIPS-ralink-Fix-mt7620-nd_sd-pinmux.patch b/target/linux/ramips/patches-4.14/0008-MIPS-ralink-Fix-mt7620-nd_sd-pinmux.patch new file mode 100644 index 000000000..acfda58f3 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0008-MIPS-ralink-Fix-mt7620-nd_sd-pinmux.patch @@ -0,0 +1,29 @@ +From d41237229464ae03fe116b591e8a2fda4ffea48e Mon Sep 17 00:00:00 2001 +From: Mathias Kresin +Date: Sun, 28 Oct 2018 12:46:55 +0100 +Subject: [PATCH] MIPS: 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. + +Signed-off-by: Mathias Kresin +Reported-by: Kristian Evensen +Fixes: f576fb6a0700 ("MIPS: ralink: cleanup the soc specific pinmux +data") +Cc: stable@vger.kernel.org # v3.18+ +--- + arch/mips/ralink/mt7620.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/ralink/mt7620.c ++++ b/arch/mips/ralink/mt7620.c +@@ -84,7 +84,7 @@ static struct rt2880_pmx_func pcie_rst_g + }; + static struct rt2880_pmx_func nd_sd_grp[] = { + FUNC("nand", MT7620_GPIO_MODE_NAND, 45, 15), +- FUNC("sd", MT7620_GPIO_MODE_SD, 45, 15) ++ FUNC("sd", MT7620_GPIO_MODE_SD, 47, 13) + }; + + static struct rt2880_pmx_group mt7620a_pinmux_data[] = { diff --git a/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch b/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch new file mode 100644 index 000000000..d93f39c74 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0029-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch @@ -0,0 +1,51 @@ +From 57fa7f2f4ef6f78ce1d30509c0d111aa3791b524 Mon Sep 17 00:00:00 2001 +From: Daniel Santos +Date: Sun, 4 Nov 2018 20:24:32 -0600 +Subject: gpio-ralink: Add support for GPIO as interrupt-controller + +Signed-off-by: Daniel Santos +--- + Documentation/devicetree/bindings/gpio/gpio-ralink.txt | 6 ++++++ + drivers/gpio/gpio-ralink.c | 2 +- + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/gpio/gpio-ralink.txt b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt +index 5cd17f225fe3..2775449614d4 100644 +--- a/Documentation/devicetree/bindings/gpio/gpio-ralink.txt ++++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt +@@ -17,6 +17,9 @@ Required properties: + + Optional properties: + - ralink,gpio-base : Specify the GPIO chips base number ++- interrupt-controller : marks this as an interrupt controller ++- #interrupt-cells : a standard two-cell interrupt flag, see ++ interrupt-controller/interrupts.txt + + Example: + +@@ -28,6 +31,9 @@ Example: + + reg = <0x600 0x34>; + ++ interrupt-controller; ++ #interrupt-cells = <2>; ++ + interrupt-parent = <&intc>; + interrupts = <6>; + +diff --git a/drivers/gpio/gpio-ralink.c b/drivers/gpio/gpio-ralink.c +index 27910e384013..b6e30083d012 100644 +--- a/drivers/gpio/gpio-ralink.c ++++ b/drivers/gpio/gpio-ralink.c +@@ -220,7 +220,7 @@ static int gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) + } + + static const struct irq_domain_ops irq_domain_ops = { +- .xlate = irq_domain_xlate_onecell, ++ .xlate = irq_domain_xlate_twocell, + .map = gpio_map, + }; + +-- +2.16.4 + diff --git a/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch b/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch new file mode 100644 index 000000000..4758f1855 --- /dev/null +++ b/target/linux/ramips/patches-4.14/0038-Revert-mtd-nand-Remove-unused-chip-write_page-hook.patch @@ -0,0 +1,67 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Subject: [PATCH] Revert "mtd: nand: Remove unused chip->write_page() hook" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit f107d7a43923a83d837b3ea3c7b7de58cd014bbd. + +OpenWrt's downstream driver mtk_nand2 still uses that callback. + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/mtd/nand/nand_base.c ++++ b/drivers/mtd/nand/nand_base.c +@@ -2577,7 +2577,7 @@ static int nand_write_page_syndrome(stru + } + + /** +- * nand_write_page - write one page ++ * nand_write_page - [REPLACEABLE] write one page + * @mtd: MTD device structure + * @chip: NAND chip descriptor + * @offset: address offset within the page +@@ -2761,9 +2761,9 @@ static int nand_do_write_ops(struct mtd_ + memset(chip->oob_poi, 0xff, mtd->oobsize); + } + +- ret = nand_write_page(mtd, chip, column, bytes, wbuf, +- oob_required, page, +- (ops->mode == MTD_OPS_RAW)); ++ ret = chip->write_page(mtd, chip, column, bytes, wbuf, ++ oob_required, page, ++ (ops->mode == MTD_OPS_RAW)); + if (ret) + break; + +@@ -4719,6 +4719,9 @@ int nand_scan_tail(struct mtd_info *mtd) + } + } + ++ if (!chip->write_page) ++ chip->write_page = nand_write_page; ++ + /* + * Check ECC mode, default to software if 3byte/512byte hardware ECC is + * selected and we have 256 byte pagesize fallback to software ECC +--- a/include/linux/mtd/rawnand.h ++++ b/include/linux/mtd/rawnand.h +@@ -862,6 +862,7 @@ struct nand_manufacturer_ops { + * structure which is shared among multiple independent + * devices. + * @priv: [OPTIONAL] pointer to private chip data ++ * @write_page: [REPLACEABLE] High-level page write function + * @manufacturer: [INTERN] Contains manufacturer information + */ + +@@ -885,6 +886,9 @@ struct nand_chip { + int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); + int (*erase)(struct mtd_info *mtd, int page); + int (*scan_bbt)(struct mtd_info *mtd); ++ int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, ++ uint32_t offset, int data_len, const uint8_t *buf, ++ int oob_required, int page, int raw); + int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, + int feature_addr, uint8_t *subfeature_para); + int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, diff --git a/target/linux/ramips/patches-4.14/0040-nand-hack.patch b/target/linux/ramips/patches-4.14/0040-nand-hack.patch index c906d7fa6..58cdf1bce 100644 --- a/target/linux/ramips/patches-4.14/0040-nand-hack.patch +++ b/target/linux/ramips/patches-4.14/0040-nand-hack.patch @@ -18,37 +18,9 @@ if (ret < 0) { if (use_bufpoi) /* Invalidate page cache */ -@@ -2761,9 +2765,14 @@ static int nand_do_write_ops(struct mtd_ - memset(chip->oob_poi, 0xff, mtd->oobsize); - } - -- ret = nand_write_page(mtd, chip, column, bytes, wbuf, -- oob_required, page, -- (ops->mode == MTD_OPS_RAW)); -+ if (chip->write_page) -+ ret = chip->write_page(mtd, chip, column, bytes, wbuf, -+ oob_required, page, -+ (ops->mode == MTD_OPS_RAW)); -+ else -+ ret = nand_write_page(mtd, chip, column, bytes, wbuf, -+ oob_required, page, -+ (ops->mode == MTD_OPS_RAW)); - if (ret) - break; - --- a/include/linux/mtd/rawnand.h +++ b/include/linux/mtd/rawnand.h -@@ -885,6 +885,9 @@ struct nand_chip { - int(*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); - int (*erase)(struct mtd_info *mtd, int page); - int (*scan_bbt)(struct mtd_info *mtd); -+ int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, -+ uint32_t offset, int data_len, const uint8_t *buf, -+ int oob_required, int page, int raw); - int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, - int feature_addr, uint8_t *subfeature_para); - int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, -@@ -893,6 +896,9 @@ struct nand_chip { +@@ -897,6 +897,9 @@ struct nand_chip { int (*setup_data_interface)(struct mtd_info *mtd, int chipnr, const struct nand_data_interface *conf);