From patchwork Sun Feb 1 22:59:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Roger Pueyo Centelles | Guifi.net" X-Patchwork-Id: 435309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5B2A91402B3 for ; Mon, 2 Feb 2015 10:00:22 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A8B9F28BED3; Sun, 1 Feb 2015 23:57:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,RDNS_DYNAMIC, T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 447362804B1 for ; Sun, 1 Feb 2015 23:57:40 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_FROM_MX=-3.1; rate: -7.6 Received: from smtp1.elserrat.org (109-69-9-53-guifi-gurb.ip4.guifi.net [109.69.9.53]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 1 Feb 2015 23:57:36 +0100 (CET) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.elserrat.org (Postfix) with ESMTP id E875C4B4007E for ; Sun, 1 Feb 2015 23:59:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=guifi.net; h= x-mailer:message-id:date:date:subject:subject:from:from:received :received:received; s=dkim; t=1422831564; x=1424645965; bh=1/Yaw gHjHallC5p5Crkih45qP9vMKbTTTQxPDN9sbFQ=; b=agOwTBf/Ln19xFyIWy1gn gx75ZpbGiQDgE1PI6ohJiZIWE5l+RIEQFx0uhSPo7iMtXxVle3vNTHeF9+Kh29MN pnozU12ScwXFDecYsFPC3cAkSjDwXavfFUIJxZodgSP29rsfjZTc7WqYXB3wJpLs ddoeB/mZr4uWCc3DbnMYkjWDvqbZ7fKh1Ny86NUqcPt3LwuZfLmSTD3/e8Kcv7A6 WaKPYi8SMX7q3OIRBj3hcYBSQ+uJzGVoCM3B6KQ2OdX1rodp9lcKPKC6D7D1BVtS gBUi8AHvIsiUPLdYV0czAw5vUg5NBcU0cMiaqvo8fse9edJQ3sMl9rzONPoCeq5k w== X-Amavis-Modified: Mail body modified (using disclaimer) - smtp1.elserrat.org X-Virus-Scanned: Scrollout F1 on Debian amavisd-new at elserrat.org Received: from smtp1.elserrat.org ([127.0.0.1]) by localhost (smtp1.elserrat.org [127.0.0.1]) (amavisd-new, port 10024) with LMTP id TcEL4b0Z-xT3 for ; Sun, 1 Feb 2015 23:59:24 +0100 (CET) Received: from mail.elserrat.org (109-69-9-9-guifi-gurb.ip4.guifi.net [109.69.9.9]) by smtp1.elserrat.org (Postfix) with ESMTP id 0D2354B400A7 for ; Sun, 1 Feb 2015 23:59:22 +0100 (CET) Received: from localhost.localdomain (unknown [84.88.85.1]) by mail.elserrat.org (Postfix) with ESMTPSA id BD62A6A549B; Sun, 1 Feb 2015 23:59:21 +0100 (CET) From: roger.pueyo@guifi.net To: openwrt-devel@lists.openwrt.org Date: Sun, 1 Feb 2015 23:59:05 +0100 Message-Id: <1422831545-6345-1-git-send-email-roger.pueyo@guifi.net> X-Mailer: git-send-email 2.1.4 Cc: Roger Pueyo Centelles Subject: [OpenWrt-Devel] [PATCH] ramips: add support for Xiaomi MiWiFi Mini devices X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" From: Roger Pueyo Centelles This patch adds support for Xiaomi MiWiFi Mini, a 802.11a/b/g/n/ac dual radio wireless router based on the MediaTek MT7620a SoC. Signed-off-by: Roger Pueyo Centelles --- target/linux/ramips/base-files/etc/board.d/01_leds | 3 + .../linux/ramips/base-files/etc/board.d/02_network | 1 + target/linux/ramips/base-files/etc/diag.sh | 3 + target/linux/ramips/base-files/lib/ramips.sh | 3 + .../ramips/base-files/lib/upgrade/platform.sh | 1 + target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts | 148 +++++++++++++++++++++ target/linux/ramips/image/Makefile | 2 + .../ramips/mt7620/profiles/xiaomi-miwifi-mini.mk | 18 +++ 8 files changed, 179 insertions(+) create mode 100644 target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts create mode 100644 target/linux/ramips/mt7620/profiles/xiaomi-miwifi-mini.mk 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 af3dddc..cfc782e 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -231,6 +231,9 @@ case $board in wt3020) ucidef_set_led_default "power" "power" "nexx:blue:power" "0" ;; + xiaomi-miwifi-mini) + ucidef_set_led_default "power" "power" "xiaomi:red:status" "1" + ;; y1 |\ y1s) ucidef_set_led_default "power" "power" "lenovo:blue:power" "1" 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 7724c3e..f298aa4 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -130,6 +130,7 @@ ramips_setup_interfaces() wsr-600 | \ wsr-1166 | \ wt1520 | \ + xiaomi-miwifi-mini |\ y1) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "switch0" "1" "1" diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 808177b..e9b3997 100755 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -210,6 +210,9 @@ get_status_led() { xdxrn502j) status_led="xdxrn502j:green:power" ;; + xiaomi-mini) + status_led="xiaomi:red:status" + ;; f7c027) status_led="belkin:orange:status" ;; diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index f43725e..4527414 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -367,6 +367,9 @@ ramips_board_detect() { *"Wansview NCS601W") name="ncs601w" ;; + *"Xiaomi MiWiFi Mini") + name="xiaomi-miwifi-mini" + ;; *"Sercomm NA930") name="na930" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 0dfdf9d..356a085 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -110,6 +110,7 @@ platform_check_image() { wt3020 |\ x5 |\ x8 |\ + xiaomi-miwifi-mini |\ y1 |\ y1s |\ zbt-wa05) diff --git a/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts b/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts new file mode 100644 index 0000000..fda3325 --- /dev/null +++ b/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts @@ -0,0 +1,148 @@ +/dts-v1/; + +/include/ "mt7620a.dtsi" + +/ { + compatible = "XIAOMI MIWIFI MINI", "ralink,mt7620a-soc"; + model = "Xiaomi MiWiFi Mini"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + palmbus@10000000 { + gpio0: gpio@600 { + status = "okay"; + }; + + gpio1: gpio@638 { + status = "okay"; + }; + + gpio2: gpio@660 { + status = "okay"; + }; + + spi@b00 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "w25q128"; + reg = <0 0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <10000000>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + }; + + 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 0xf80000>; + }; + + partition@fd0000 { + label = "crash"; + reg = <0xfd0000 0x10000>; + }; + + partition@fe0000 { + label = "reserved"; + reg = <0xfe0000 0x10000>; + read-only; + }; + + partition@ff0000 { + label = "Bdata"; + reg = <0xff0000 0x10000>; + }; + }; + }; + }; + + ehci@101c0000 { + status = "okay"; + }; + + ohci@101c1000 { + status = "okay"; + }; + + ethernet@10100000 { + pinctrl-names = "default"; + pinctrl-0 = <&ephy_pins>; + mtd-mac-address = <&factory 0x4>; + ralink,port-map = "llllw"; + }; + + wmac@10180000 { + ralink,mtd-eeprom = <&factory 0>; + }; + + pcie@10140000 { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + }; + }; + }; + + pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "i2c", "rgmii1"; + ralink,function = "gpio"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + blue { + label = "xiaomi:blue:status"; + gpios = <&gpio1 0 1>; + }; + + yellow { + label = "xiaomi:yellow:status"; + gpios = <&gpio1 2 1>; + }; + + red { + label = "xiaomi:red:status"; + gpios = <&gpio1 5 1>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + reset { + label = "reset"; + gpios = <&gpio1 6 0>; + linux,code = <0x198>; + }; + }; +}; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index d35c420..7363730 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -858,6 +858,7 @@ Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT- Image/Build/Profile/WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),wr8305rt,WR8305RT) Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE) Image/Build/Profile/WT3020=$(call BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020) +Image/Build/Profile/XIAOMI-MIWIFI-MINI=$(call BuildFirmware/Default16M/$(1),$(1),xiaomi-miwifi-mini,XIAOMI-MIWIFI-MINI) Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05) Image/Build/Profile/ArcherC20i=$(call BuildFirmware/Tplink/$(1),$(1),ArcherC20i,ArcherC20i) @@ -886,6 +887,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/WR8305RT,$(1)) $(call Image/Build/Profile/WRTNODE,$(1)) $(call Image/Build/Profile/WT3020,$(1)) + $(call Image/Build/Profile/XIAOMI-MIWIFI-MINI,$(1)) $(call Image/Build/Profile/ZBT-WA05,$(1)) $(call Image/Build/Profile/ArcherC20i,$(1)) endef diff --git a/target/linux/ramips/mt7620/profiles/xiaomi-miwifi-mini.mk b/target/linux/ramips/mt7620/profiles/xiaomi-miwifi-mini.mk new file mode 100644 index 0000000..47819b2 --- /dev/null +++ b/target/linux/ramips/mt7620/profiles/xiaomi-miwifi-mini.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/XIAOMI-MIWIFI-MINI + NAME:=Xiaomi MiWiFi Mini + PACKAGES:=\ + kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-ohci \ + kmod-mt76 +endef + +define Profile/XIAOMI-MIWIFI-MINI/Description + Support for Xiaomi MiWiFi Mini routers +endef +$(eval $(call Profile,XIAOMI-MIWIFI-MINI))