From 57f4eab6771c5b099a09cea4e661bf5ccebbbb95 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Wed, 8 Apr 2020 12:47:14 +0200 Subject: [PATCH 1/8] ramips: mt7621: add label mac address to rbm11g The rbm11g has a label with printed on mac address similar to the rbm33g. Signed-off-by: Tobias Schramm --- target/linux/ramips/mt7621/base-files/etc/board.d/02_network | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index d73305981f..f654574e14 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -90,6 +90,7 @@ ramips_setup_macs() label_mac=$wan_mac ;; mikrotik,rb750gr3|\ + mikrotik,rbm11g|\ mikrotik,rbm33g) label_mac=$(mtd_get_mac_binary hard_config 0x10) ;; From 48b4aab80cd34682616bf7f12c41e35e27a49504 Mon Sep 17 00:00:00 2001 From: Tobias Schramm Date: Wed, 8 Apr 2020 12:47:15 +0200 Subject: [PATCH 2/8] ramips: mt7621: reenable rbm11g I have a rbm11g and can confirm that the LAN port is indeed switch port 0. Signed-off-by: Tobias Schramm --- target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts | 1 - target/linux/ramips/image/mt7621.mk | 1 - 2 files changed, 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts b/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts index bcfce33a16..aae899c9a6 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts @@ -145,7 +145,6 @@ &switch0 { ports { - /* FIXME: Is LAN port at switch port 0? */ port@0 { status = "okay"; label = "lan"; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 30552ebee1..0ecd70685b 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -506,7 +506,6 @@ TARGET_DEVICES += mikrotik_rb750gr3 define Device/mikrotik_rbm11g $(Device/MikroTik) DEVICE_MODEL := RouterBOARD M11G - DEFAULT := n # disabled due to unknown port assignment endef TARGET_DEVICES += mikrotik_rbm11g From f761f4052c411bababed2d2e9d8dc3f43380e4ee Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 7 Apr 2020 10:34:33 +0200 Subject: [PATCH 3/8] ramips: mt7621: harmonize naming scheme for Mikrotik So far, image/device/board names for Mikrotik devices in mt7621 have been used quite inconsistently. This patch harmonizes the naming scheme by applying the same style as used lately in ath79, i.e. using "RouterBOARD" as separate word in the model name (instead of RB prefix for the number) and deriving the board/device name from that (= make lower case and replace spaces by hyphens). This style has already been used for most the model/DEVICE_MODEL variables in mt7621, so this is essentially just adjusting the remaining variables to that. Signed-off-by: Adrian Schmutzler --- ... => mt7621_mikrotik_routerboard-750gr3.dts} | 6 +++--- ...ts => mt7621_mikrotik_routerboard-m11g.dts} | 14 +++++++------- ...ts => mt7621_mikrotik_routerboard-m33g.dts} | 4 ++-- target/linux/ramips/image/mt7621.mk | 18 ++++++++++-------- .../mt7621/base-files/etc/board.d/01_leds | 2 +- .../mt7621/base-files/etc/board.d/02_network | 12 ++++++------ .../base-files/etc/board.d/03_gpio_switches | 2 +- .../etc/uci-defaults/04_led_migration | 10 +++++++++- .../mt7621/base-files/lib/upgrade/platform.sh | 6 +++--- 9 files changed, 42 insertions(+), 32 deletions(-) rename target/linux/ramips/dts/{mt7621_mikrotik_rb750gr3.dts => mt7621_mikrotik_routerboard-750gr3.dts} (94%) rename target/linux/ramips/dts/{mt7621_mikrotik_rbm11g.dts => mt7621_mikrotik_routerboard-m11g.dts} (88%) rename target/linux/ramips/dts/{mt7621_mikrotik_rbm33g.dts => mt7621_mikrotik_routerboard-m33g.dts} (97%) diff --git a/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts similarity index 94% rename from target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts rename to target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts index e268b233d4..3f37155f24 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts @@ -7,7 +7,7 @@ #include / { - compatible = "mikrotik,rb750gr3", "mediatek,mt7621-soc"; + compatible = "mikrotik,routerboard-750gr3", "mediatek,mt7621-soc"; model = "MikroTik RouterBOARD 750Gr3"; aliases { @@ -25,13 +25,13 @@ compatible = "gpio-leds"; pwr { - label = "rb750gr3:blue:pwr"; + label = "routerboard-750gr3:blue:pwr"; gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; default-state = "on"; }; led_usr: usr { - label = "rb750gr3:green:usr"; + label = "routerboard-750gr3:green:usr"; gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts similarity index 88% rename from target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts rename to target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts index aae899c9a6..bd58aea951 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_rbm11g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts @@ -6,7 +6,7 @@ #include / { - compatible = "mikrotik,rbm11g", "mediatek,mt7621-soc"; + compatible = "mikrotik,routerboard-m11g", "mediatek,mt7621-soc"; model = "MikroTik RouterBOARD M11G"; aliases { @@ -24,32 +24,32 @@ compatible = "gpio-leds"; led_usr: usr { - label = "rbm11g:green:usr"; + label = "routerboard-m11g:green:usr"; gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; }; rssi0 { - label = "rbm11g:green:rssi0"; + label = "routerboard-m11g:green:rssi0"; gpios = <&gpio 22 GPIO_ACTIVE_LOW>; }; rssi1 { - label = "rbm11g:green:rssi1"; + label = "routerboard-m11g:green:rssi1"; gpios = <&gpio 23 GPIO_ACTIVE_LOW>; }; rssi2 { - label = "rbm11g:green:rssi2"; + label = "routerboard-m11g:green:rssi2"; gpios = <&gpio 24 GPIO_ACTIVE_LOW>; }; rssi3 { - label = "rbm11g:green:rssi3"; + label = "routerboard-m11g:green:rssi3"; gpios = <&gpio 25 GPIO_ACTIVE_LOW>; }; rssi4 { - label = "rbm11g:green:rssi4"; + label = "routerboard-m11g:green:rssi4"; gpios = <&gpio 26 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_rbm33g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts similarity index 97% rename from target/linux/ramips/dts/mt7621_mikrotik_rbm33g.dts rename to target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts index f7889bd68a..19e1a71e99 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_rbm33g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts @@ -6,7 +6,7 @@ #include / { - compatible = "mikrotik,rbm33g", "mediatek,mt7621-soc"; + compatible = "mikrotik,routerboard-m33g", "mediatek,mt7621-soc"; model = "MikroTik RouterBOARD M33G"; aliases { @@ -24,7 +24,7 @@ compatible = "gpio-leds"; led_usr: usr { - label = "rbm33g:green:usr"; + label = "routerboard-m33g:green:usr"; gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 0ecd70685b..ec9d8aacae 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -495,25 +495,27 @@ define Device/MikroTik check-size endef -define Device/mikrotik_rb750gr3 +define Device/mikrotik_routerboard-750gr3 $(Device/MikroTik) - DEVICE_MODEL := RouterBOARD RB750G - DEVICE_VARIANT := r3 + DEVICE_MODEL := RouterBOARD 750Gr3 DEVICE_PACKAGES += kmod-gpio-beeper + SUPPORTED_DEVICES += mikrotik,rb750gr3 endef -TARGET_DEVICES += mikrotik_rb750gr3 +TARGET_DEVICES += mikrotik_routerboard-750gr3 -define Device/mikrotik_rbm11g +define Device/mikrotik_routerboard-m11g $(Device/MikroTik) DEVICE_MODEL := RouterBOARD M11G + SUPPORTED_DEVICES += mikrotik,rbm11g endef -TARGET_DEVICES += mikrotik_rbm11g +TARGET_DEVICES += mikrotik_routerboard-m11g -define Device/mikrotik_rbm33g +define Device/mikrotik_routerboard-m33g $(Device/MikroTik) DEVICE_MODEL := RouterBOARD M33G + SUPPORTED_DEVICES += mikrotik,rbm33g endef -TARGET_DEVICES += mikrotik_rbm33g +TARGET_DEVICES += mikrotik_routerboard-m33g define Device/mqmaker_witi IMAGE_SIZE := 16064k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 66739a7536..cc114da4ee 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -34,7 +34,7 @@ gnubee,gb-pc2) ucidef_set_led_netdev "lan1" "lan1" "$boardname:green:lan1" "lan1" ucidef_set_led_netdev "lan2" "lan2" "$boardname:green:lan2" "lan2" ;; -mikrotik,rbm11g) +mikrotik,routerboard-m11g) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "RSSILOW" "$boardname:green:rssi0" "wlan0" "1" "100" ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "$boardname:green:rssi1" "wlan0" "20" "100" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index f654574e14..f573a049ce 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -14,7 +14,7 @@ ramips_setup_interfaces() ;; asiarf,ap7621-nv1|\ lenovo,newifi-d1|\ - mikrotik,rbm33g|\ + mikrotik,routerboard-m33g|\ xiaomi,mir3g|\ xiaomi,mir3g-v2) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" @@ -31,7 +31,7 @@ ramips_setup_interfaces() linksys,re6500) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ;; - mikrotik,rbm11g|\ + mikrotik,routerboard-m11g|\ netgear,ex6150|\ thunder,timecloud|\ tplink,re350-v1|\ @@ -39,7 +39,7 @@ ramips_setup_interfaces() ubnt,unifi-nanohd) ucidef_set_interface_lan "lan" ;; - mikrotik,rb750gr3) + mikrotik,routerboard-750gr3) ucidef_set_interfaces_lan_wan "lan2 lan3 lan4 lan5" "wan" ;; ubiquiti,edgerouterx|\ @@ -89,9 +89,9 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; - mikrotik,rb750gr3|\ - mikrotik,rbm11g|\ - mikrotik,rbm33g) + mikrotik,routerboard-750gr3|\ + mikrotik,routerboard-m11g|\ + mikrotik,routerboard-m33g) label_mac=$(mtd_get_mac_binary hard_config 0x10) ;; zbtlink,zbt-we1326|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches index d3bc85f827..511d9deed8 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/03_gpio_switches @@ -7,7 +7,7 @@ board_config_update board=$(board_name) case "$board" in -mikrotik,rb750gr3) +mikrotik,routerboard-750gr3) ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "17" ;; telco-electronics,x1) diff --git a/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration b/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration index e745c2c5d4..73140fd7d5 100644 --- a/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration +++ b/target/linux/ramips/mt7621/base-files/etc/uci-defaults/04_led_migration @@ -4,11 +4,19 @@ . /lib/functions/migrations.sh board=$(board_name) +boardonly="${board##*,}" case "$board" in +mikrotik,routerboard-750gr3) + migrate_leds "^rb750gr3:=$boardonly:" +mikrotik,routerboard-m11g) + migrate_leds "^rbm11g:=$boardonly:" +mikrotik,routerboard-m33g) + migrate_leds "^rbm33g:=$boardonly:" netgear,wndr3700-v5) - migrate_leds "^wndr3700v5:=wndr3700-v5:" + migrate_leds "^wndr3700v5:=$boardonly:" ;; + esac migrations_apply system diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index ad10dcbdaa..afb3a52a82 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -27,9 +27,9 @@ platform_do_upgrade() { fi } ;; - mikrotik,rb750gr3|\ - mikrotik,rbm11g|\ - mikrotik,rbm33g) + mikrotik,routerboard-750gr3|\ + mikrotik,routerboard-m11g|\ + mikrotik,routerboard-m33g) [ -z "$(rootfs_type)" ] && mtd erase firmware ;; asus,rt-ac65p|\ From aff965a415899efbd7ea409f5dbe5945227e245b Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Thu, 19 Apr 2018 09:08:38 +0200 Subject: [PATCH 4/8] generic: backport Wistron Neweb D19Q1 patches Backport patches which adds suport for the Wistron Neweb D19Q1 3G/4G modem, used in D-Link DWR-960. Signed-off-by: Pawel Dembicki --- ...net-qmi_wwan-add-Wistron-Neweb-D19Q1.patch | 54 ++++++++++++++++++ ...erial-option-add-Wistron-Neweb-D19Q1.patch | 55 +++++++++++++++++++ ...erial-option-add-Wistron-Neweb-D19Q1.patch | 55 +++++++++++++++++++ ...erial-option-add-Wistron-Neweb-D19Q1.patch | 55 +++++++++++++++++++ 4 files changed, 219 insertions(+) create mode 100644 target/linux/generic/backport-4.14/183-net-qmi_wwan-add-Wistron-Neweb-D19Q1.patch create mode 100644 target/linux/generic/pending-4.14/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch create mode 100644 target/linux/generic/pending-4.19/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch create mode 100644 target/linux/generic/pending-5.4/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch diff --git a/target/linux/generic/backport-4.14/183-net-qmi_wwan-add-Wistron-Neweb-D19Q1.patch b/target/linux/generic/backport-4.14/183-net-qmi_wwan-add-Wistron-Neweb-D19Q1.patch new file mode 100644 index 0000000000..25987dbac8 --- /dev/null +++ b/target/linux/generic/backport-4.14/183-net-qmi_wwan-add-Wistron-Neweb-D19Q1.patch @@ -0,0 +1,54 @@ +From eb5a26bcaddb35fd42a978ad37831e58b1118853 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Tue, 17 Apr 2018 19:53:59 +0200 +Subject: [PATCH] net: qmi_wwan: add Wistron Neweb D19Q1 + +This modem is embedded on dlink dwr-960 router. +The oem configuration states: + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1435 ProdID=d191 Rev=ff.ff +S: Manufacturer=Android +S: Product=Android +S: SerialNumber=0123456789ABCDEF +C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) +E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us + +Tested on openwrt distribution + +Signed-off-by: Pawel Dembicki +--- + drivers/net/usb/qmi_wwan.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/usb/qmi_wwan.c ++++ b/drivers/net/usb/qmi_wwan.c +@@ -1142,6 +1142,7 @@ static const struct usb_device_id produc + {QMI_FIXED_INTF(0x1435, 0xd181, 3)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 4)}, /* Wistron NeWeb D18Q1 */ + {QMI_FIXED_INTF(0x1435, 0xd181, 5)}, /* Wistron NeWeb D18Q1 */ ++ {QMI_FIXED_INTF(0x1435, 0xd191, 4)}, /* Wistron NeWeb D19Q1 */ + {QMI_QUIRK_SET_DTR(0x1508, 0x1001, 4)}, /* Fibocom NL668 series */ + {QMI_FIXED_INTF(0x16d8, 0x6003, 0)}, /* CMOTech 6003 */ + {QMI_FIXED_INTF(0x16d8, 0x6007, 0)}, /* CMOTech CHE-628S */ diff --git a/target/linux/generic/pending-4.14/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch b/target/linux/generic/pending-4.14/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch new file mode 100644 index 0000000000..525f3b1813 --- /dev/null +++ b/target/linux/generic/pending-4.14/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch @@ -0,0 +1,55 @@ +From 9d2e23253eb5fabff02a7ce4be9c4a7fc23562e8 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Fri, 20 Mar 2020 22:56:28 +0100 +Subject: [PATCH v2 3/3] USB: serial: option: add Wistron Neweb D19Q1 + +This modem is embedded on dlink dwr-960 router. +The oem configuration states: + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1435 ProdID=d191 Rev=ff.ff +S: Manufacturer=Android +S: Product=Android +S: SerialNumber=0123456789ABCDEF +C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) +E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us + +Tested on openwrt distribution + +Signed-off-by: Pawel Dembicki +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1993,6 +1993,8 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */ ++ .driver_info = RSVD(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ diff --git a/target/linux/generic/pending-4.19/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch b/target/linux/generic/pending-4.19/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch new file mode 100644 index 0000000000..a37e76d350 --- /dev/null +++ b/target/linux/generic/pending-4.19/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch @@ -0,0 +1,55 @@ +From 9d2e23253eb5fabff02a7ce4be9c4a7fc23562e8 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Fri, 20 Mar 2020 22:56:28 +0100 +Subject: [PATCH v2 3/3] USB: serial: option: add Wistron Neweb D19Q1 + +This modem is embedded on dlink dwr-960 router. +The oem configuration states: + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1435 ProdID=d191 Rev=ff.ff +S: Manufacturer=Android +S: Product=Android +S: SerialNumber=0123456789ABCDEF +C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) +E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us + +Tested on openwrt distribution + +Signed-off-by: Pawel Dembicki +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1990,6 +1990,8 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */ ++ .driver_info = RSVD(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ diff --git a/target/linux/generic/pending-5.4/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch b/target/linux/generic/pending-5.4/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch new file mode 100644 index 0000000000..a37e76d350 --- /dev/null +++ b/target/linux/generic/pending-5.4/184-USB-serial-option-add-Wistron-Neweb-D19Q1.patch @@ -0,0 +1,55 @@ +From 9d2e23253eb5fabff02a7ce4be9c4a7fc23562e8 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Fri, 20 Mar 2020 22:56:28 +0100 +Subject: [PATCH v2 3/3] USB: serial: option: add Wistron Neweb D19Q1 + +This modem is embedded on dlink dwr-960 router. +The oem configuration states: + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1435 ProdID=d191 Rev=ff.ff +S: Manufacturer=Android +S: Product=Android +S: SerialNumber=0123456789ABCDEF +C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none) +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none) +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=84(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) +E: Ad=86(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=88(I) Atr=03(Int.) MxPS= 8 Ivl=32ms +E: Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=(none) +E: Ad=89(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=125us + +Tested on openwrt distribution + +Signed-off-by: Pawel Dembicki +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1990,6 +1990,8 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x7e11, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/A3 */ ++ { USB_DEVICE_INTERFACE_CLASS(0x1435, 0xd191, 0xff), /* Wistron Neweb D19Q1 */ ++ .driver_info = RSVD(1) | RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2031, 0xff), /* Olicard 600 */ + .driver_info = RSVD(4) }, + { USB_DEVICE_INTERFACE_CLASS(0x2020, 0x2060, 0xff), /* BroadMobi BM818 */ From 5410a8e2959a9560cdb89231aafa23c71070721d Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Tue, 24 Mar 2020 06:23:49 +0100 Subject: [PATCH 5/8] ramips: mt7620: add rgmii delays support At this moment mt7620 ethernet driver doesn't support rgmii delays configuration. SoC MT7620 have bits 2 and 3 in GPC1 an GPC2 to configure delays for rx and tx rgmii interface. This patch adds rx/tx rgmii delay configuration from dts. Signed-off-by: Pawel Dembicki --- .../net/ethernet/mediatek/gsw_mt7620.h | 4 +++ .../net/ethernet/mediatek/soc_mt7620.c | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h index 555a586c40..03d030446a 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/gsw_mt7620.h @@ -46,6 +46,10 @@ #define GSW_REG_IMR 0x7008 #define GSW_REG_ISR 0x700c #define GSW_REG_GPC1 0x7014 +#define GSW_REG_GPC2 0x701c + +#define GSW_REG_GPCx_TXDELAY BIT(3) +#define GSW_REG_GPCx_RXDELAY BIT(2) #define GSW_REG_MAC_P0_MCR 0x100 #define GSW_REG_MAC_P1_MCR 0x200 diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c index fb2d45a56e..c4684d02d6 100644 --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/soc_mt7620.c @@ -146,6 +146,8 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) int phy_mode, size, id; int shift = 12; u32 val, mask = 0; + u32 val_delay = 0; + u32 mask_delay = GSW_REG_GPCx_TXDELAY | GSW_REG_GPCx_RXDELAY; int min = (gsw->port4 == PORT4_EPHY) ? (5) : (4); if (!_id || (be32_to_cpu(*_id) < min) || (be32_to_cpu(*_id) > 5)) { @@ -175,6 +177,25 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) switch (phy_mode) { case PHY_INTERFACE_MODE_RGMII: mask = 0; + /* Do not touch rx/tx delay in this state to avoid problems with + * backward compability. + */ + mask_delay = 0; + break; + case PHY_INTERFACE_MODE_RGMII_ID: + mask = 0; + val_delay |= GSW_REG_GPCx_TXDELAY; + val_delay &= ~GSW_REG_GPCx_RXDELAY; + break; + case PHY_INTERFACE_MODE_RGMII_RXID: + mask = 0; + val_delay &= ~GSW_REG_GPCx_TXDELAY; + val_delay &= ~GSW_REG_GPCx_RXDELAY; + break; + case PHY_INTERFACE_MODE_RGMII_TXID: + mask = 0; + val_delay &= ~GSW_REG_GPCx_TXDELAY; + val_delay |= GSW_REG_GPCx_RXDELAY; break; case PHY_INTERFACE_MODE_MII: mask = 1; @@ -196,6 +217,19 @@ static void mt7620_port_init(struct fe_priv *priv, struct device_node *np) val |= mask << shift; rt_sysc_w32(val, SYSC_REG_CFG1); + if (id == 4) { + val = mtk_switch_r32(gsw, GSW_REG_GPC2); + val &= ~(mask_delay); + val |= val_delay & mask_delay; + mtk_switch_w32(gsw, val, GSW_REG_GPC2); + } + else if (id == 5) { + val = mtk_switch_r32(gsw, GSW_REG_GPC1); + val &= ~(mask_delay); + val |= val_delay & mask_delay; + mtk_switch_w32(gsw, val, GSW_REG_GPC1); + } + if (priv->phy->phy_fixed[id]) { const __be32 *link = priv->phy->phy_fixed[id]; int tx_fc, rx_fc; From 5a5a9b7a7500379e79410a8a955381ec0fa486ae Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 25 Mar 2020 07:08:37 +0100 Subject: [PATCH 6/8] packages: mt76: add 14c3:7610 pci id to list This commit add patch with 14c3:7610 pci id addition. It was sent upstream. Signed-off-by: Pawel Dembicki [bumped PKG_RELEASE] Signed-off-by: Daniel Golle --- package/kernel/mt76/Makefile | 2 +- ...01-mt76-mt76x0-pci-add-mt7610-PCI-ID.patch | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 package/kernel/mt76/patches/0001-mt76-mt76x0-pci-add-mt7610-PCI-ID.patch diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 4ee79fe042..965eafb6f8 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= diff --git a/package/kernel/mt76/patches/0001-mt76-mt76x0-pci-add-mt7610-PCI-ID.patch b/package/kernel/mt76/patches/0001-mt76-mt76x0-pci-add-mt7610-PCI-ID.patch new file mode 100644 index 0000000000..a2aa0ec36d --- /dev/null +++ b/package/kernel/mt76/patches/0001-mt76-mt76x0-pci-add-mt7610-PCI-ID.patch @@ -0,0 +1,30 @@ +From 9b082c3fd3fc954937444220995cb05662ab2e82 Mon Sep 17 00:00:00 2001 +From: Pawel Dembicki +Date: Wed, 25 Mar 2020 06:51:29 +0100 +Subject: [PATCH] mt76: mt76x0: pci: add mt7610 PCI ID + +Add mt7610 PCI id found on D-Link DWR-960 to pci_device_id table. + +Run-tested on D-Link DWR-960 with no-name half-size mPCIE card +with mt7610e. + +Signed-off-by: Pawel Dembicki +--- + mt76x0/pci.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mt76x0/pci.c b/mt76x0/pci.c +index e2974e0ae1fc..3bd753cda190 100644 +--- a/mt76x0/pci.c ++++ b/mt76x0/pci.c +@@ -215,6 +215,7 @@ mt76x0e_remove(struct pci_dev *pdev) + } + + static const struct pci_device_id mt76x0e_device_table[] = { ++ { PCI_DEVICE(0x14c3, 0x7610) }, + { PCI_DEVICE(0x14c3, 0x7630) }, + { PCI_DEVICE(0x14c3, 0x7650) }, + { }, +-- +2.20.1 + From c948a4782ba9e99f690a75ddf95ad76add95b5fa Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Thu, 19 Apr 2018 09:20:58 +0200 Subject: [PATCH 7/8] ramips: add support for D-Link DWR-960 The DWR-960 Wireless Router is based on the MT7620A SoC. Specification: - MediaTek MT7620A (580 Mhz) - 128 MB of RAM - 16 MB of FLASH - 1x 802.11bgn radio - 1x 802.11ac radio (MT7610 mpcie card) - 4x 10/100 Mbps Ethernet (1 WAN and 3 LAN) - 1x 10/100/1000 Mbps Ethernet (1 LAN) (AR8035) - 2x internal, non-detachable antennas (Wifi 2.4G) - 3x external, detachable antennas (2x LTE, 1x Wifi 5G) - 1x LTE modem - UART (J4) header on PCB (57600 8n1) - 9x LED, 2x button - JBOOT bootloader Known issues: - Flash is extremely slow. Installation: Apply factory image via http web-gui or JBOOT recovery page How to revert to OEM firmware: - push the reset button and turn on the power. Wait until LED start blinking (~10sec.) - upload original factory image via JBOOT http (IP: 192.168.123.254) Signed-off-by: Pawel Dembicki --- .../ramips/dts/mt7620a_dlink_dwr-960.dts | 190 ++++++++++++++++++ target/linux/ramips/image/mt7620.mk | 14 ++ .../mt7620/base-files/etc/board.d/01_leds | 3 + .../mt7620/base-files/etc/board.d/02_network | 5 + .../base-files/etc/board.d/03_gpio_switches | 3 + .../etc/hotplug.d/firmware/10-rt2x00-eeprom | 1 + 6 files changed, 216 insertions(+) create mode 100644 target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts new file mode 100644 index 0000000000..063d65a70d --- /dev/null +++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-960.dts @@ -0,0 +1,190 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include "mt7620a.dtsi" + +#include +#include + +/ { + compatible = "dlink,dwr-960", "ralink,mt7620a-soc"; + model = "D-Link DWR-960"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: status { + label = "dwr-960:green:status"; + gpios = <&gpio0 7 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "dwr-960:green:wan"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + }; + + lan { + label = "dwr-960:green:lan"; + gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + + sms { + label = "dwr-960:green:sms"; + gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; + }; + + signal_green { + label = "dwr-960:green:signal"; + gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; + }; + + signal_red { + label = "dwr-960:red:signal"; + gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>; + }; + + 4g { + label = "dwr-960:green:4g"; + gpios = <&gpio2 2 GPIO_ACTIVE_LOW>; + }; + + 3g { + label = "dwr-960:green:3g"; + gpios = <&gpio2 3 GPIO_ACTIVE_LOW>; + }; + + wlan5g { + label = "dwr-960:green:wlan5g"; + gpios = <&gpio2 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wlan2g { + label = "dwr-960:green:wlan2g"; + gpios = <&gpio3 0 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; +}; + +ðernet { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&rgmii2_pins &mdio_pins>; + mediatek,portmap = "wllll"; + + port@5 { + status = "okay"; + phy-mode = "rgmii-txid"; + phy-handle = <&phy7>; + }; + + mdio-bus { + status = "okay"; + + phy7: ethernet-phy@7 { + reg = <7>; + phy-mode = "rgmii-id"; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&gpio2 { + status = "okay"; +}; + +&gpio3 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "jboot"; + reg = <0x0 0x10000>; + read-only; + }; + + partition@10000 { + compatible = "amit,jimage"; + label = "firmware"; + reg = <0x10000 0xfe0000>; + }; + + config: partition@ff0000 { + label = "config"; + reg = <0xff0000 0x10000>; + read-only; + }; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + mediatek,mtd-eeprom = <&config 0xe08e>; + mtd-mac-address = <&config 0xe50e>; + mtd-mac-address-increment = <2>; + }; +}; + +&state_default { + default { + ralink,group = "i2c", "wled", "spi refclk", "uartf", "ephy"; + ralink,function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 552879e02f..d5365ac70e 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -279,6 +279,20 @@ define Device/dlink_dwr-922-e2 endef TARGET_DEVICES += dlink_dwr-922-e2 +define Device/dlink_dwr-960 + $(Device/amit_jboot) + SOC := mt7620a + IMAGE_SIZE := 16256k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DWR-960 + DLINK_ROM_ID := DLK6E2429001 + DLINK_FAMILY_MEMBER := 0x6E24 + DLINK_FIRMWARE_SIZE := 0xFE0000 + DEVICE_PACKAGES += kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi \ + kmod-mt76x0e +endef +TARGET_DEVICES += dlink_dwr-960 + define Device/dovado_tiny-ac SOC := mt7620a IMAGE_SIZE := 7872k diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds index fe6dfac50e..e4fd875019 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/01_leds @@ -87,6 +87,9 @@ dlink,dwr-922-e2) ucidef_set_led_netdev "signalstrength" "signalstrength" "$boardname:green:sigstrength" "wwan0" "link" ucidef_set_led_netdev "4g" "4g" "$boardname:green:4g" "wwan0" "tx rx" ;; +dlink,dwr-960) + ucidef_set_led_switch "lan" "lan" "$boardname:green:lan" "switch0" "0x2e" + ucidef_set_led_switch "wan" "wan" "$boardname:green:wan" "switch0" "0x01" dovado,tiny-ac) set_wifi_led "$boardname:orange:wifi" ;; diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network index 76e1d56bd3..d870b5c11c 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/02_network @@ -100,6 +100,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan:2" "2:lan:1" "3:lan:3" "4:lan" "0:wan" "6@eth0" ;; + dlink,dwr-960) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "5:lan" "0:wan" "6@eth0" + ;; edimax,br-6478ac-v2|\ tplink,archer-c2-v1) ucidef_add_switch "switch1" \ @@ -273,6 +277,7 @@ ramips_setup_macs() dlink,dwr-118-a2|\ dlink,dwr-921-c1|\ dlink,dwr-922-e2|\ + dlink,dwr-960|\ lava,lr-25g001) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) lan_mac=$(macaddr_add "$wan_mac" 1) diff --git a/target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches index 85380d84a8..f2355fdb97 100755 --- a/target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches @@ -11,6 +11,9 @@ dlink,dir-510l) ucidef_add_gpio_switch "usb_enable1" "USB 1A enable" "12" "0" ucidef_add_gpio_switch "usb_enable05" "USB 0.5A enable" "13" "1" ;; +dlink,dwr-960) + ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "0" "1" + ;; head-weblink,hdrm200) ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "0" ucidef_add_gpio_switch "io1" "I/O 1" "1" diff --git a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom index f33ed82f62..291f89f41d 100644 --- a/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom +++ b/target/linux/ramips/mt7620/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom @@ -28,6 +28,7 @@ case "$FIRMWARE" in dlink,dwr-118-a2|\ dlink,dwr-921-c1|\ dlink,dwr-922-e2|\ + dlink,dwr-960|\ lava,lr-25g001) wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000) wifi_mac=$(macaddr_add "$wan_mac" 1) From 85aef6f627040cd0909bd549abb721eafa511353 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 7 Apr 2020 12:31:48 +0200 Subject: [PATCH 8/8] ath79: fix MAC addresses for ethernet on ZyXEL NBG6716 MAC addresses of the ethernet devices (eth0 & eth1) are randomly set at boot time by the ag71xx driver, because it is currently not possible to retrieve MAC addresses in ASCII format within the DTS file. This commit works around this behaviour by setting the MAC addresses during the preinit phase. The same has been implemented recently for the Siemens WS-AP3610 in d2b8ccb1c04d ("ath79: add support for Siemens WS-AP3610"). MAC assignment in vendor firmware is as follows: use vendor address OpenWrt 2g wifi0 ethaddr -> wlan1 5g wifi1 ethaddr +1 -> wlan0 lan eth1 ethaddr +2 -> eth0 wan eth0 ethaddr +3 -> eth1 ethaddr is retrieved by $(mtd_get_mac_ascii u-boot-env ethaddr) Note that both Wifi and ethernet indexing is swapped in OpenWrt compared to vendor firmware. Suggested-by: Guillaume Lefebvre Signed-off-by: Adrian Schmutzler Tested-by: Kevin Gagnon --- .../ath79/nand/base-files/etc/board.d/02_network | 4 ---- .../nand/base-files/lib/preinit/10_fix_eth_mac.sh | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 target/linux/ath79/nand/base-files/lib/preinit/10_fix_eth_mac.sh diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 1626ec31ca..b2191eed92 100755 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -48,10 +48,6 @@ ath79_setup_macs() netgear,wndr4500-v3) wan_mac=$(mtd_get_mac_binary caldata 0x6) ;; - zyxel,nbg6716) - lan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) - wan_mac=$(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) - ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac diff --git a/target/linux/ath79/nand/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/nand/base-files/lib/preinit/10_fix_eth_mac.sh new file mode 100644 index 0000000000..fdd8381f56 --- /dev/null +++ b/target/linux/ath79/nand/base-files/lib/preinit/10_fix_eth_mac.sh @@ -0,0 +1,14 @@ +. /lib/functions.sh +. /lib/functions/system.sh + +preinit_set_mac_address() { + case $(board_name) in + zyxel,nbg6716) + ethaddr=$(mtd_get_mac_ascii u-boot-env ethaddr) + ip link set dev eth0 address $(macaddr_add $ethaddr 2) + ip link set dev eth1 address $(macaddr_add $ethaddr 3) + ;; + esac +} + +boot_hook_add preinit_main preinit_set_mac_address