[LEDE-DEV] [PATCH] ramips: Improve Archer C20i support

p.wassi at gmx.at p.wassi at gmx.at
Thu Jul 28 03:10:32 PDT 2016


From: P.Wassi <p.wassi at gmx.at>

Improve / finalise TP-Link Archer C20i support.

Signed-off-by: P.Wassi <p.wassi at gmx.at>
---
This patch adds proper LED and Button support and
sets up a correct switch configuration.
The only missing thing (which is likely to never be fixed) is
the 5GHz phy (Mediatek MT7610) - due to the missing driver.
Additional info: https://pwassi.privatedns.org/lede/archerc20i/
The added define in kernel config is needed for the LEDs
to work properly (some are triggered by the switch0 device)

linux/ramips/base-files/etc/board.d/01_leds    |    6 +
linux/ramips/base-files/etc/board.d/02_network |    1 
linux/ramips/dts/ArcherC20i.dts                |   46 +++++++++++++--
linux/ramips/mt7620/config-4.4                 |    1 
4 files changed, 49 insertions(+), 5 deletions(-)

diff -rupN a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -78,6 +78,12 @@ broadway)
        set_usb_led "$board:red:diskmounted"
        set_wifi_led "$board:red:wps_active"
        ;;
+c20i)
+       ucidef_set_led_switch "lan" "lan" "tp-link:blue:lan" "switch0" "0x1e"
+       ucidef_set_led_switch "wan" "wan" "tp-link:blue:wan" "switch0" "0x01"
+       set_usb_led "tp-link:blue:usb" "2-1"
+       ucidef_set_led_wlan "wlan" "wlan" "tp-link:blue:wlan" "phy0radio"
+       ;;
 c50)
        ucidef_set_led_default "power" "power" "tp-link:blue:power" "0"
        ucidef_set_led_netdev "lan" "lan" "tp-link:blue:lan" "eth0.2"
diff -rupN a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -114,6 +114,7 @@ ramips_setup_interfaces()
        atp-52b|\
        awm002-evb|\
        awm003-evb|\
+       c20i|\
        c50|\
        dir-645|\
        dir-860l-b1|\
diff -rupN a/target/linux/ramips/dts/ArcherC20i.dts b/target/linux/ramips/dts/ArcherC20i.dts
--- a/target/linux/ramips/dts/ArcherC20i.dts
+++ b/target/linux/ramips/dts/ArcherC20i.dts
@@ -12,20 +12,57 @@
 
        gpio-leds {
                compatible = "gpio-leds";
+               lan {
+                       label = "tp-link:blue:lan";
+                       gpios = <&gpio0 1 1>;
+               };
+               usb {
+                       label = "tp-link:blue:usb";
+                       gpios = <&gpio0 11 1>;
+               };
+               wps {
+                       label = "tp-link:blue:wps";
+                       gpios = <&gpio1 15 1>;
+               };
+               wan {
+                       label = "tp-link:blue:wan";
+                       gpios = <&gpio2 0 1>;
+               };
+               wlan {
+                       label = "tp-link:blue:wlan";
+                       gpios = <&gpio3 0 1>;
+               };
        };
 
-       gpio-keys-polled {
-               compatible = "gpio-keys-polled";
+       gpio-keys {
+               compatible = "gpio-keys";
                #address-cells = <1>;
                #size-cells = <0>;
-               poll-interval = <20>;
+               rfkill {
+                       label = "rfkill";
+                       gpios = <&gpio0 2 1>;
+                       linux,code = <0xf7>;
+               };
+               reset_wps {
+                       label = "reset_wps";
+                       gpios = <&gpio0 13 1>;
+                       linux,code = <0x198>;
+               };
        };
 };
 
+&gpio1 {
+       status = "okay";
+};
+
 &gpio2 {
        status = "okay";
 };
 
+&gpio3 {
+       status = "okay";
+};
+
 &spi0 {
        status = "okay";
 
@@ -73,7 +110,7 @@
 &pinctrl {
        state_default: pinctrl0 {
                gpio {
-                       ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd";
+                       ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "wled", "nd_sd", "ephy", "spi refclk";
                        ralink,function = "gpio";
                };
        };
@@ -81,7 +118,6 @@
 
 &ethernet {
                pinctrl-names = "default";
-               pinctrl-0 = <&ephy_pins>;
                mtd-mac-address = <&rom 0xf100>;
                mediatek,portmap = "wllll";
        };
diff -rupN a/target/linux/ramips/mt7620/config-4.4 b/target/linux/ramips/mt7620/config-4.4
--- a/target/linux/ramips/mt7620/config-4.4
+++ b/target/linux/ramips/mt7620/config-4.4
@@ -194,6 +194,7 @@ CONFIG_SPI_MASTER=y
 CONFIG_SPI_RT2880=y
 CONFIG_SRCU=y
 CONFIG_SWCONFIG=y
+CONFIG_SWCONFIG_LEDS=y
 CONFIG_SYSCTL_EXCEPTION_TRACE=y
 CONFIG_SYS_HAS_CPU_MIPS32_R1=y
 CONFIG_SYS_HAS_CPU_MIPS32_R2=y



More information about the Lede-dev mailing list