ramips: add support for Phicomm K2P
authorChuanhong Guo <gch981213@gmail.com>
Tue, 18 Jul 2017 05:02:51 +0000 (13:02 +0800)
committerMathias Kresin <dev@kresin.me>
Thu, 20 Jul 2017 17:10:29 +0000 (19:10 +0200)
It uses one MT7615D radio chip with DBDC mode enabled. This mode allows
this single chip act as an 2x2 11n radio and an 2x2 11ac radio at the
same time. However mt76 doesn't  support it currently so there is no
wireless available.

Specification:
- SoC: MediaTek MT7621AT
- Flash: 16 MB
- RAM: 128 MB
- Ethernet: 1 x WAN (10/100/1000Mbps) and 4 x LAN (10/100/1000 Mbps)
- Wireless radio: MT7615D on PCIE0
- UART: 1 x UART on PCB - 57600 8N1

Issue:
- Wireless radio doesn't work due to the lack of driver.

Flash instruction:
Using UART:
1. Configure PC with a static IP address and setup an TFTP server.
2. Put the firmware into the tftp directory.
3. Connect the UART line as described on the PCB.
4. Power up the device and press 2,then follow the instruction to
   set device and tftp server IP address and input the firmware
   file name.U-boot will then load the firmware and write it into
   the flash.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/base-files/lib/upgrade/platform.sh
target/linux/ramips/dts/K2P.dts [new file with mode: 0644]
target/linux/ramips/image/mt7621.mk

index 78ba10342b3d6b18844554df81d0b5ae22ad0df2..d0f3fce135907857e93f9ad5a63d28fb8536c34c 100755 (executable)
@@ -83,6 +83,7 @@ ramips_setup_interfaces()
        hc5661a|\
        hc5962|\
        hlk-rm04|\
+       k2p|\
        kn|\
        kn_rc|\
        mac1200rv2|\
index 531c8e055f26eab5cd18ebfce43135f713676070..1349c00b321dbcd83a68a7ac7a14e35d614262d9 100644 (file)
@@ -157,6 +157,11 @@ get_status_led() {
        hc5962)
                status_led="$board:white:status"
                ;;
+       k2p|\
+       m3|\
+       miwifi-nano)
+               status_led="$board:blue:status"
+               ;;
        linkits7688| \
        linkits7688d)
                [ "$1" = "upgrade" ] && status_led="mediatek:orange:wifi"
@@ -164,10 +169,6 @@ get_status_led() {
        m2m)
                status_led="$board:blue:wifi"
                ;;
-       m3|\
-       miwifi-nano)
-               status_led="$board:blue:status"
-               ;;
        gl-mt300n-v2)
                status_led="$board:red:wlan"
                ;;
index 056fab9defceff8548ccac97723a2ee989ca3db6..e2d7b07ecb59b3d91b1bd5453dc2dff1de264e72 100755 (executable)
@@ -262,6 +262,9 @@ ramips_board_detect() {
        *"JHR-N926R")
                name="jhr-n926r"
                ;;
+       *"K2P")
+               name="k2p"
+               ;;
        *"M3")
                name="m3"
                ;;
index e0a260216d510e7954f2b4e4afe9af374d7d4443..36469ca704cd177213b4cd2ac396f62ec2f9fedf 100755 (executable)
@@ -74,6 +74,7 @@ platform_check_image() {
        jhr-n805r|\
        jhr-n825r|\
        jhr-n926r|\
+       k2p|\
        kn|\
        kn_rc|\
        kn_rf|\
diff --git a/target/linux/ramips/dts/K2P.dts b/target/linux/ramips/dts/K2P.dts
new file mode 100644 (file)
index 0000000..4089ce6
--- /dev/null
@@ -0,0 +1,119 @@
+/dts-v1/;
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "phicomm,k2p", "mediatek,mt7621-soc";
+       model = "Phicomm K2P";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x0 0x8000000>;
+       };
+
+       chosen {
+               bootargs = "console=ttyS0,57600";
+       };
+
+       gpio-leds {
+               compatible = "gpio-leds";
+
+               stat_r {
+                       label = "k2p:red:status";
+                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+               };
+
+               stat_y {
+                       label = "k2p:yellow:status";
+                       gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+               };
+
+               stat_b {
+                       label = "k2p:blue:status";
+                       gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               poll-interval = <20>;
+
+               reset {
+                       label = "reset";
+                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_RESTART>;
+               };
+       };
+};
+
+&spi0 {
+       status = "okay";
+
+       m25p80@0 {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <10000000>;
+               m25p,chunked-io = <32>;
+
+               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 = "permanent_config";
+                       reg = <0x50000 0x50000>;
+                       read-only;
+               };
+
+               partition@a0000 {
+                       label = "firmware";
+                       reg = <0xa0000 0xf60000>;
+               };
+       };
+};
+
+&pcie {
+       status = "okay";
+
+       pcie0 {
+               mt76@0,0 {
+                       reg = <0x0000 0 0 0 0>;
+                       device_type = "pci";
+                       mediatek,mtd-eeprom = <&factory 0x0>;
+               };
+       };
+};
+
+&ethernet {
+       mtd-mac-address = <&factory 0xe000>;
+};
+
+&pinctrl {
+       state_default: pinctrl0 {
+               gpio {
+                       ralink,group = "i2c", "jtag";
+                       ralink,function = "gpio";
+               };
+       };
+};
index 940b9d5a334587afff65339fffa76d3d55480dcd..103534e060ca0b38618448bb14b3efee060bd0d6 100644 (file)
@@ -88,6 +88,13 @@ define Device/hc5962
 endef
 TARGET_DEVICES += hc5962
 
+define Device/k2p
+  DTS := K2P
+  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  DEVICE_TITLE := Phicomm K2P
+endef
+TARGET_DEVICES += k2p
+
 define Device/mt7621
   DTS := MT7621
   BLOCKSIZE := 64k