[OpenWrt-Devel] [PATCH v4 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-10-06 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

Sorry for this last minute change, I had screwed with versioning and sent an 
old patch, which has a extra line in .dtsi file, which breaks the build.  Just 
removing the first 2 lines from HC5XXX.dtsi and everything work fine.

Sorry again.

v4 fix
  1: Fixed compilation problem caused by /dts-v1/; line in HC5XXX.dtsi file.

Signed-off-by: Xiaoning Kang 


diff --git a/target/linux/ramips/dts/HC5661.dts 
b/target/linux/ramips/dts/HC5661.dts
new file mode 100644
index 000..b9a717b
--- /dev/null
+++ b/target/linux/ramips/dts/HC5661.dts
@@ -0,0 +1,32 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5661", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5661";
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5661:blue:system";
+   gpios = < 9 1>;
+   };
+
+   internet {
+   label = "hc5661:blue:internet";
+   gpios = < 11 1>;
+   };
+
+   wlan2g {
+   label = "hc5661:blue:wlan2g";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5661:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+   };
+};
diff --git a/target/linux/ramips/dts/HC5761.dts 
b/target/linux/ramips/dts/HC5761.dts
new file mode 100644
index 000..a10904c
--- /dev/null
+++ b/target/linux/ramips/dts/HC5761.dts
@@ -0,0 +1,32 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5761", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5761";
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5761:blue:system";
+   gpios = < 9 1>;
+   };
+
+   internet {
+   label = "hc5761:blue:internet";
+   gpios = < 11 1>;
+   };
+
+   wlan2g {
+   label = "hc5761:blue:wlan2g";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5761:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+   };
+};
diff --git a/target/linux/ramips/dts/HC5861.dts 
b/target/linux/ramips/dts/HC5861.dts
new file mode 100644
index 000..05857ea
--- /dev/null
+++ b/target/linux/ramips/dts/HC5861.dts
@@ -0,0 +1,92 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5861", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5861";
+
+   ethernet@1010 {
+   status = "okay";
+   mtd-mac-address = < 0x4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins _pins _pins>;
+   ralink,port-map = "w";
+
+   port@4 {
+   status = "okay";
+   phy-handle = <>;
+   phy-mode = "rgmii";
+   };
+
+   port@5 {
+   status = "okay";
+   phy-handle = <>;
+   phy-mode = "rgmii";
+   };
+
+   mdio-bus {
+   status = "okay";
+
+   phy4: ethernet-phy@4 {
+   reg = <4>;
+   phy-mode = "rgmii";
+   };
+
+   phy5: ethernet-phy@5 {
+   reg = <5>;
+   phy-mode = "rgmii";
+   };
+   };
+   };
+
+   gsw@1011 {
+   ralink,port4 = "gmac";
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5861:blue:system";
+   gpios = < 9 1>;
+   };
+
+   wlan2g {
+   label = "hc5861:blue:wlan2g";
+   gpios = < 11 1>;
+   };
+
+   internet {
+   label = "hc5861:blue:internet";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5861:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+
+   turbo {
+   label = "hc5861:blue:turbo";
+   gpios = < 10 1>;
+   };
+   };
+
+   gpio_export {
+   compatible = "gpio-export";
+   #size-cells = <0>;
+
+   usbpower {
+

[OpenWrt-Devel] [PATCH v3 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-09-29 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

v3 fix
  1: Merged most stuff into dtsi file
  2: Remove unnecessary empty lines.

Signed-off-by: Xiaoning Kang 


diff --git a/target/linux/ramips/dts/HC5661.dts 
b/target/linux/ramips/dts/HC5661.dts
new file mode 100644
index 000..b9a717b
--- /dev/null
+++ b/target/linux/ramips/dts/HC5661.dts
@@ -0,0 +1,32 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5661", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5661";
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5661:blue:system";
+   gpios = < 9 1>;
+   };
+
+   internet {
+   label = "hc5661:blue:internet";
+   gpios = < 11 1>;
+   };
+
+   wlan2g {
+   label = "hc5661:blue:wlan2g";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5661:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+   };
+};
diff --git a/target/linux/ramips/dts/HC5761.dts 
b/target/linux/ramips/dts/HC5761.dts
new file mode 100644
index 000..a10904c
--- /dev/null
+++ b/target/linux/ramips/dts/HC5761.dts
@@ -0,0 +1,32 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5761", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5761";
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5761:blue:system";
+   gpios = < 9 1>;
+   };
+
+   internet {
+   label = "hc5761:blue:internet";
+   gpios = < 11 1>;
+   };
+
+   wlan2g {
+   label = "hc5761:blue:wlan2g";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5761:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+   };
+};
diff --git a/target/linux/ramips/dts/HC5861.dts 
b/target/linux/ramips/dts/HC5861.dts
new file mode 100644
index 000..05857ea
--- /dev/null
+++ b/target/linux/ramips/dts/HC5861.dts
@@ -0,0 +1,92 @@
+/dts-v1/;
+
+/include/ "HC5XXX.dtsi"
+
+/ {
+   compatible = "HC5861", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5861";
+
+   ethernet@1010 {
+   status = "okay";
+   mtd-mac-address = < 0x4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins _pins _pins>;
+   ralink,port-map = "w";
+
+   port@4 {
+   status = "okay";
+   phy-handle = <>;
+   phy-mode = "rgmii";
+   };
+
+   port@5 {
+   status = "okay";
+   phy-handle = <>;
+   phy-mode = "rgmii";
+   };
+
+   mdio-bus {
+   status = "okay";
+
+   phy4: ethernet-phy@4 {
+   reg = <4>;
+   phy-mode = "rgmii";
+   };
+
+   phy5: ethernet-phy@5 {
+   reg = <5>;
+   phy-mode = "rgmii";
+   };
+   };
+   };
+
+   gsw@1011 {
+   ralink,port4 = "gmac";
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5861:blue:system";
+   gpios = < 9 1>;
+   };
+
+   wlan2g {
+   label = "hc5861:blue:wlan2g";
+   gpios = < 11 1>;
+   };
+
+   internet {
+   label = "hc5861:blue:internet";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5861:blue:wlan5g";
+   gpios = < 7 1>;
+   };
+
+   turbo {
+   label = "hc5861:blue:turbo";
+   gpios = < 10 1>;
+   };
+   };
+
+   gpio_export {
+   compatible = "gpio-export";
+   #size-cells = <0>;
+
+   usbpower {
+   gpio-export,name = "usbpower";
+   gpio-export,output = <0>;
+   gpios = < 13 0>;
+   };
+
+   sdpower {
+   gpio-export,name = "sdpower";
+  

[OpenWrt-Devel] [PATCH V3 2/3] ramips: Add base-files for HiWiFi HC5x61 models

2015-09-29 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

v3 fix
   1: Fixed model order
   2: Remove manufacturer name from model name
   3: Use a hacky but prettier way to get mac address.


Signed-off-by: Xiaoning Kang 

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 a9959e3..c75a993 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -132,6 +132,24 @@ fonera20n)
set_usb_led "$board:orange:usb"
set_wifi_led "$board:orange:wifi"
;;
+hc5661)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ;;  
+hc5761)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0"
+   ;;
+hc5861)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0"
+   ucidef_set_led_default "turbo" "turbo" "$board:blue:turbo" "0"
+   ;;
 hg255d)
set_wifi_led "$board:green:wlan"
set_usb_led "$board:green:usb"
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 75cccae..94d69b9 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -170,6 +170,13 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
ucidef_add_switch_vlan "switch1" "2" "4 6t"
;;
+   hc5*61|\
+   y1s)
+   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
+   ucidef_add_switch_vlan "switch0" "2" "0 6t"
+   ;;
m2m)
ucidef_add_switch "switch0" "4"
ucidef_set_interface_lan "eth0"
@@ -224,12 +231,6 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
ucidef_add_switch_vlan "switch0" "2" "0 6t"
;;
-   y1s)
-   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-   ucidef_add_switch "switch0" "1" "1"
-   ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
-   ucidef_add_switch_vlan "switch0" "2" "0 6t"
-   ;;
zbt-wr8305rt)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
@@ -293,6 +294,11 @@ ramips_setup_macs()
e1700)
wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
;;
+   hc5*61)
+   lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
+   [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
+   wan_mac=$(macaddr_add "$lan_mac" 1)
+   ;;
ht-tm02)
lan_mac=$(cat /sys/class/net/eth0/address)
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 7fc6f29..5376759 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -104,6 +104,11 @@ get_status_led() {
f7c027)
status_led="$board:orange:status"
;;
+   hc5*61|\
+   mlw221|\
+   mlwg2)
+   status_led="$board:blue:system"
+   ;;
m2m)
status_led="$board:blue:wifi"
;;
@@ -115,10 +120,6 @@ get_status_led() {
zte-q7)
status_led="$board:red:status"
;;
-   mlw221|\
-   mlwg2)
-   status_led="$board:blue:system"
-   ;;
mr-102n)
status_led="$board:amber:status"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index d242235..b89a88c 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -169,6 +169,15 @@ ramips_board_detect() {
*"FreeStation5")
name="freestation5"

[OpenWrt-Devel] [PATCH V2 2/3] ramips: Add base-files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

v2 fix
   1: Renamed board name to remove manufacturer’s name
   2: Renamed led
   3: Merged network/led option with other existing models


Signed-off-by: Xiaoning Kang 


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 a9959e3..2374362 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -137,6 +137,24 @@ hg255d)
set_usb_led "$board:green:usb"
ucidef_set_led_interface "lan" "$board:green:internet"
;;
+hc5661)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ;;  
+hc5761)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0"
+   ;;
+hc5861)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan2g"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan5g" "rai0"
+   ucidef_set_led_default "turbo" "turbo" "$board:blue:turbo" "0"
+   ;;
 hpm)
ucidef_set_led_default "power" "POWER" "$board:orange:power" "1"
ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0"
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 75cccae..646f5f6 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -170,6 +170,13 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
ucidef_add_switch_vlan "switch1" "2" "4 6t"
;;
+   hc5*61|\
+   y1s)
+   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
+   ucidef_add_switch_vlan "switch0" "2" "0 6t"
+   ;;
m2m)
ucidef_add_switch "switch0" "4"
ucidef_set_interface_lan "eth0"
@@ -224,12 +231,6 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "1" "1 2 6t"
ucidef_add_switch_vlan "switch0" "2" "0 6t"
;;
-   y1s)
-   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
-   ucidef_add_switch "switch0" "1" "1"
-   ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
-   ucidef_add_switch_vlan "switch0" "2" "0 6t"
-   ;;
zbt-wr8305rt)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
@@ -293,6 +294,12 @@ ramips_setup_macs()
e1700)
wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
;;
+   hc5*61)
+   __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
..:..:..:..:..:..'`
+   lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
'[A-Z]' '[a-z]'`
+   [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
+   wan_mac=$(macaddr_add "$lan_mac" 1)
+   ;;
ht-tm02)
lan_mac=$(cat /sys/class/net/eth0/address)
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 7fc6f29..5376759 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -104,6 +104,11 @@ get_status_led() {
f7c027)
status_led="$board:orange:status"
;;
+   hc5*61|\
+   mlw221|\
+   mlwg2)
+   status_led="$board:blue:system"
+   ;;
m2m)
status_led="$board:blue:wifi"
;;
@@ -115,10 +120,6 @@ get_status_led() {
zte-q7)
status_led="$board:red:status"
;;
-   mlw221|\
-   mlwg2)
-   status_led="$board:blue:system"
-   ;;
mr-102n)
status_led="$board:amber:status"
;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index d242235..545ecf9 100755
--- 

[OpenWrt-Devel] [PATCH v2 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

v2 fix
  1: Renamed files to remove manufacturer’s name.
  2: styling work

Signed-off-by: Xiaoning Kang 


diff --git a/target/linux/ramips/dts/HC5661.dts 
b/target/linux/ramips/dts/HC5661.dts
new file mode 100644
index 000..b5b9d1a
--- /dev/null
+++ b/target/linux/ramips/dts/HC5661.dts
@@ -0,0 +1,172 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "HC5661", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5661";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   palmbus@1000 {
+   sysc@0 {
+   ralink,gpiomux = "i2c", "jtag";
+   ralink,uartmux = "gpio";
+   ralink,wdtmux = <1>;
+   };
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio2: gpio@660 {
+   status = "okay";
+   };
+
+   gpio3: gpio@688 {
+   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 = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   };
+
+   partition@5 {
+   label = "firmware";
+   reg = <0x5 0xf8>;
+   };
+
+   partition@fd {
+   label = "hwf_config";
+   reg = <0xfd 0x1>;
+   };
+
+   bdinfo: partition@fe {
+   label = "bdinfo";
+   reg = <0xfe 0x1>;
+   };
+
+   partition@ff {
+   label = "backup";
+   reg = <0xff 0x1>;
+   };
+   };
+   };
+   };
+
+   ehci@101c {
+   status = "okay";
+   };
+
+   ohci@101c1000 {
+   status = "okay";
+   };
+
+   ethernet@1010 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   mtd-mac-address = < 0x4>;
+   ralink,port-map = "w";
+   };
+
+   sdhci@1013 {
+   status = "okay";
+   };
+
+   wmac@1018 {
+   ralink,mtd-eeprom = < 0>;
+   };
+
+   pcie@1014 {
+   status = "okay";
+   };
+
+   pinctrl {
+   state_default: pinctrl0 {
+   gpio {
+   ralink,group = "uartf", "wled", "nd_sd";
+   ralink,function = "gpio";
+   };
+
+   pa {
+   ralink,group = "pa";
+   ralink,function = "pa";
+   };
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   system {
+   label = "hc5661:blue:system";
+   gpios = < 9 1>;
+   };
+
+   internet {
+   label = "hc5661:blue:internet";
+   gpios = < 11 1>;
+   };
+
+   wlan2g {
+   label = "hc5661:blue:wlan2g";
+   gpios = < 0 1>;
+   };
+
+   wlan5g {
+   label = "hc5661:blue:wlan5g";
+ 

Re: [OpenWrt-Devel] [PATCH 2/3] ramips: Add base-files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
Mostly done, except this one

>+   hiwifi-hc5*61)
>+   __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
>..:..:..:..:..:..'`
>+   lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
>'[A-Z]' '[a-z]'`

Is that really needed?

>+   [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
>+   wan_mac=$(macaddr_add "$lan_mac" 1)
>+   ;;



That is needed,  here is the result on my router.


root@Hiwifi:~# __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
..:..:..:..:..:..'`
root@Hiwifi:~# echo $__fac_mac
Vfac_mac = D4:EE:07:25:6C:D6
root@Hiwifi:~# lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
'[A-Z]' '[a-z]'`
root@Hiwifi:~# echo $lan_mac
d4:ee:07:25:6c:d6


So that line is needed,  __fac_mac itself is not a valid mac




V2 is uploaded, please take a look.  Thanks again~

在 15/9/28 下午7:48,“Piotr Dymacz”<pep...@gmail.com> 写入:

>Hello,
>
>Please, see my comments inline, below.
>
>PS. Sorry for being so pedantic :)
>
>Cheers,
>Piotr
>
>2015-09-28 12:46 GMT+02:00 Comman Kang <kan...@163.com>:
>> HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. 
>> These models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). 
>> This patch adds support for them.
>>
>> The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
>> trunk and submitted it here with his approval.
>>
>> Signed-off-by: Xiaoning Kang <kan...@163.com>
>>
>>
>>
>> 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 a9959e3..512fdc1 100755
>> --- a/target/linux/ramips/base-files/etc/board.d/01_leds
>> +++ b/target/linux/ramips/base-files/etc/board.d/01_leds
>> @@ -137,6 +137,24 @@ hg255d)
>> set_usb_led "$board:green:usb"
>> ucidef_set_led_interface "lan" "$board:green:internet"
>> ;;
>> +hiwifi-hc5661)
>> +   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
>> +   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
>> "eth0.2"
>> +   set_wifi_led "$board:blue:wlan-2p4"
>> +   ;;
>> +hiwifi-hc5761)
>> +   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
>> +   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
>> "eth0.2"
>> +   set_wifi_led "$board:blue:wlan-2p4"
>> +   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan-5p" "rai0"
>> +   ;;
>> +hiwifi-hc5861)
>> +   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
>> +   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
>> "eth0.2"
>> +   set_wifi_led "$board:blue:wlan-2p4"
>
>Why not something like "wlan2g", "wlan5g" like in other boards (not in
>ramips target, but take a look for example at ar71xx)?
>
>> +   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan-5p" "rai0"
>> +   ucidef_set_led_default "turbo" "turbo" "$board:blue:turbo" "0"
>> +   ;;
>
>General convention is to use only model name as board name.
>So, it would be better to use "hc5661" instead of "hiwifi-hc5661" etc.
>
>>  hpm)
>> ucidef_set_led_default "power" "POWER" "$board:orange:power" "1"
>> ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0"
>> 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 75cccae..33c0b35 100755
>> --- a/target/linux/ramips/base-files/etc/board.d/02_network
>> +++ b/target/linux/ramips/base-files/etc/board.d/02_network
>> @@ -170,6 +170,12 @@ ramips_setup_interfaces()
>> ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
>> ucidef_add_switch_vlan "switch1" "2" "4 6t"
>> ;;
>> +   hiwifi-hc5*61)
>> +   ucidef_set_interfaces_lan_wan "eth0.1" "eth

Re: [OpenWrt-Devel] [PATCH 3/3] ramips: Add build files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
Done, thanks




在 15/9/28 下午7:52,“Piotr Dymacz”<pep...@gmail.com> 写入:

>Hello,
>
>Please, follow the general convention and keep profiles for different
>boards from same manufacturer in one file named "manufacturer.mk".
>
>Cheers,
>Piotr
>
>2015-09-28 12:46 GMT+02:00 Comman Kang <kan...@163.com>:
>> HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com 
>> <http://www.hiwifi.com/>. These models have similar hardware specs(MT7620A + 
>> 128M DDR2 + 16M flash). This patch adds support for them.
>>
>> The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
>> trunk and submitted it here with his approval.
>>
>> Signed-off-by: Xiaoning Kang <kan...@163.com>
>>
>>
>>
>> diff --git a/target/linux/ramips/image/Makefile 
>> b/target/linux/ramips/image/Makefile
>> index c24d220..bc8d015 100644
>> --- a/target/linux/ramips/image/Makefile
>> +++ b/target/linux/ramips/image/Makefile
>> @@ -872,6 +872,9 @@ na930_mtd_size=20971520
>>  Image/Build/Profile/NA930=$(call 
>> BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
>>  Image/Build/Profile/DB-WRT01=$(call 
>> BuildFirmware/Default8M/$(1),$(1),db-wrt01,DB-WRT01)
>>  Image/Build/Profile/MZK-750DHP=$(call 
>> BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
>> +Image/Build/Profile/HiWiFi-HC5661=$(call 
>> BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5661,HiWiFi-HC5661)
>> +Image/Build/Profile/HiWiFi-HC5761=$(call 
>> BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5761,HiWiFi-HC5761)
>> +Image/Build/Profile/HiWiFi-HC5861=$(call 
>> BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5861,HiWiFi-HC5861)
>>  Image/Build/Profile/OY-0001=$(call 
>> BuildFirmware/Default16M/$(1),$(1),oy-0001,OY-0001)
>>  Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),y1,Y1)
>>  Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),y1s,Y1S)
>> @@ -907,6 +910,9 @@ define Image/Build/Profile/Default
>> $(call Image/Build/Profile/DB-WRT01,$(1))
>> $(call Image/Build/Profile/MZK-750DHP,$(1))
>> $(call Image/Build/Profile/NA930,$(1))
>> +   $(call Image/Build/Profile/HiWiFi-HC5661,$(1))
>> +   $(call Image/Build/Profile/HiWiFi-HC5761,$(1))
>> +   $(call Image/Build/Profile/HiWiFi-HC5861,$(1))
>> $(call Image/Build/Profile/OY-0001,$(1))
>> $(call Image/Build/Profile/Y1,$(1))
>> $(call Image/Build/Profile/Y1S,$(1))
>> diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk 
>> b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk
>> new file mode 100644
>> index 000..d3339a6
>> --- /dev/null
>> +++ b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk
>> @@ -0,0 +1,20 @@
>> +#
>> +# Copyright (C) 2015 OpenWrt.org
>> +#
>> +# This is free software, licensed under the GNU General Public License v2.
>> +# See /LICENSE for more information.
>> +#
>> +
>> +define Profile/HiWiFi-HC5661
>> + NAME:=HiWiFi HC5661
>> + PACKAGES:=\
>> +   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
>> +   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
>> +   fdisk
>> +endef
>> +
>> +define Profile/HiWiFi-HC5661/Description
>> + Default on SD cards support.
>> +endef
>> +$(eval $(call Profile,HiWiFi-HC5661))
>> +
>> diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk 
>> b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk
>> new file mode 100644
>> index 000..481c3e8
>> --- /dev/null
>> +++ b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk
>> @@ -0,0 +1,21 @@
>> +#
>> +# Copyright (C) 2015 OpenWrt.org
>> +#
>> +# This is free software, licensed under the GNU General Public License v2.
>> +# See /LICENSE for more information.
>> +#
>> +
>> +define Profile/HiWiFi-HC5761
>> + NAME:=HiWiFi HC5761
>> + PACKAGES:=\
>> +   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
>> +   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
>> +   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
>> +   kmod-ledtrig-usbdev fdisk
>> +endef
>> +
>> +define Profile/HiWiFi-HC5761/Description
>> + Default on SD cards and USB storage support.
>> +endef
>> +$(eval $(call Profile,HiWiFi-HC5761))
>> +
>> diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5861.mk 
>> b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5861.mk
>> new file mode 100644
>> index 000..07a0443
>> --- /

[OpenWrt-Devel] [PATCH V2 3/3] ramips: Add build files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com 
. These models have similar hardware specs(MT7620A + 
128M DDR2 + 16M flash). This patch adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

v2 fix
1: Modified profile name
2: Merged multiple models into one manufacturer file
3: Some description changes

Signed-off-by: Xiaoning Kang 


diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index c24d220..372fe3b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -872,6 +872,9 @@ na930_mtd_size=20971520
 Image/Build/Profile/NA930=$(call 
BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
 Image/Build/Profile/DB-WRT01=$(call 
BuildFirmware/Default8M/$(1),$(1),db-wrt01,DB-WRT01)
 Image/Build/Profile/MZK-750DHP=$(call 
BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
+Image/Build/Profile/HC5661=$(call 
BuildFirmware/Default16M/$(1),$(1),hc5661,HC5661)
+Image/Build/Profile/HC5761=$(call 
BuildFirmware/Default16M/$(1),$(1),hc5761,HC5761)
+Image/Build/Profile/HC5861=$(call 
BuildFirmware/Default16M/$(1),$(1),hc5861,HC5861)
 Image/Build/Profile/OY-0001=$(call 
BuildFirmware/Default16M/$(1),$(1),oy-0001,OY-0001)
 Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),y1,Y1)
 Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),y1s,Y1S)
@@ -907,6 +910,9 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/DB-WRT01,$(1))
$(call Image/Build/Profile/MZK-750DHP,$(1))
$(call Image/Build/Profile/NA930,$(1))
+   $(call Image/Build/Profile/HC5661,$(1))
+   $(call Image/Build/Profile/HC5761,$(1))
+   $(call Image/Build/Profile/HC5861,$(1))
$(call Image/Build/Profile/OY-0001,$(1))
$(call Image/Build/Profile/Y1,$(1))
$(call Image/Build/Profile/Y1S,$(1))
diff --git a/target/linux/ramips/mt7620/profiles/hiwifi.mk 
b/target/linux/ramips/mt7620/profiles/hiwifi.mk
new file mode 100644
index 000..3de99f3
--- /dev/null
+++ b/target/linux/ramips/mt7620/profiles/hiwifi.mk
@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/HC5661
+ NAME:=HiWiFi HC5661
+ PACKAGES:=\
+   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   kmod-ledtrig-usbdev fdisk
+endef
+
+define Profile/HC5661/Description
+ Support HiWiFi HC5661 model(J1S)
+endef
+$(eval $(call Profile,HC5661))
+
+define Profile/HC5761
+ NAME:=HiWiFi HC5761
+ PACKAGES:=\
+   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   kmod-ledtrig-usbdev fdisk
+endef
+
+define Profile/HC5761/Description
+ Support HiWiFi HC5761 model(J2)
+endef
+$(eval $(call Profile,HC5761))
+
+define Profile/HC5861
+ NAME:=HiWiFi HC5861
+ PACKAGES:=\
+   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   kmod-ledtrig-usbdev fdisk
+endef
+
+define Profile/HC5861/Description
+  Support HiWiFi HC5861 model(J3)
+endef
+$(eval $(call Profile,HC5861))
+
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
Done, Thanks for the comment, please take a look at V2




在 15/9/28 下午7:25,“Piotr Dymacz”<pep...@gmail.com> 写入:

>Hello,
>
>Please, take a look at other dts files in ramips target and follow the
>general convention, like:
>- use only model name for dts filename
>- keep empty lines between nodes and between nodes and properties (ex. [1])
>
>[1] 
>https://dev.openwrt.org/browser/trunk/target/linux/ramips/dts/WIZFI630A.dts#L126
>
>Cheers,
>Piotr
>
>2015-09-28 12:45 GMT+02:00 Comman Kang <kan...@163.com>:
>> HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. 
>> These models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). 
>> This patch adds support for them.
>>
>> The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
>> trunk and submitted it here with his approval.
>>
>> Signed-off-by: Xiaoning Kang <kan...@163.com>
>>
>>
>>
>> diff --git a/target/linux/ramips/dts/HiWiFi-HC5661.dts 
>> b/target/linux/ramips/dts/HiWiFi-HC5661.dts
>> new file mode 100644
>> index 000..f3ca70c
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/HiWiFi-HC5661.dts
>> @@ -0,0 +1,162 @@
>> +/dts-v1/;
>> +
>> +/include/ "mt7620a.dtsi"
>> +
>> +/ {
>> +   compatible = "HiWiFi-HC5661", "ralink,mt7620a-soc";
>> +   model = "HiWiFi HC5661";
>> +
>> +   chosen {
>> +   bootargs = "console=ttyS0,115200";
>> +   };
>> +
>> +   palmbus@1000 {
>> +   sysc@0 {
>> +   ralink,gpiomux = "i2c", "jtag";
>> +   ralink,uartmux = "gpio";
>> +   ralink,wdtmux = <1>;
>> +   };
>> +   gpio0: gpio@600 {
>> +   status = "okay";
>> +   };
>> +   gpio2: gpio@660 {
>> +   status = "okay";
>> +   };
>> +   gpio3: gpio@688 {
>> +   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 = <1000>;
>> +
>> +   partition@0 {
>> +   label = "u-boot";
>> +   reg = <0x0 0x3>;
>> +   };
>> +
>> +   partition@3 {
>> +   label = "u-boot-env";
>> +   reg = <0x3 0x1>;
>> +   read-only;
>> +   };
>> +
>> +   factory: partition@4 {
>> +   label = "factory";
>> +   reg = <0x4 0x1>;
>> +   };
>> +
>> +   partition@5 {
>> +   label = "firmware";
>> +   reg = <0x5 0xf8>;
>> +   };
>> +
>> +   partition@fd {
>> +   label = "hwf_config";
>> +   reg = <0xfd 0x1>;
>> +   };
>> +
>> +   bdinfo: partition@fe {
>> +   label = "bdinfo";
>> +   reg = <0xfe 0x1>;
>> +   };
>> +
>> +   partition@ff {
>> +   label = "backup";
>> +   reg = <0xff 0x1>;
>> + 

[OpenWrt-Devel] [PATCH 1/3] ramips: Add DTS files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

Signed-off-by: Xiaoning Kang 



diff --git a/target/linux/ramips/dts/HiWiFi-HC5661.dts 
b/target/linux/ramips/dts/HiWiFi-HC5661.dts
new file mode 100644
index 000..f3ca70c
--- /dev/null
+++ b/target/linux/ramips/dts/HiWiFi-HC5661.dts
@@ -0,0 +1,162 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "HiWiFi-HC5661", "ralink,mt7620a-soc";
+   model = "HiWiFi HC5661";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   palmbus@1000 {
+   sysc@0 {
+   ralink,gpiomux = "i2c", "jtag";
+   ralink,uartmux = "gpio";
+   ralink,wdtmux = <1>;
+   };
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+   gpio2: gpio@660 {
+   status = "okay";
+   };
+   gpio3: gpio@688 {
+   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 = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   };
+
+   partition@5 {
+   label = "firmware";
+   reg = <0x5 0xf8>;
+   };
+
+   partition@fd {
+   label = "hwf_config";
+   reg = <0xfd 0x1>;
+   };
+
+   bdinfo: partition@fe {
+   label = "bdinfo";
+   reg = <0xfe 0x1>;
+   };
+
+   partition@ff {
+   label = "backup";
+   reg = <0xff 0x1>;
+   };
+   };
+   };
+   };
+
+   ehci@101c {
+   status = "okay";
+   };
+
+   ohci@101c1000 {
+   status = "okay";
+   };
+
+   ethernet@1010 {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+   mtd-mac-address = < 0x4>;
+   ralink,port-map = "w";
+   };
+
+   sdhci@1013 {
+   status = "okay";
+   };
+
+   wmac@1018 {
+   ralink,mtd-eeprom = < 0>;
+   };
+
+   pcie@1014 {
+   status = "okay";
+   };
+
+   pinctrl {
+   state_default: pinctrl0 {
+   gpio {
+   ralink,group = "uartf", "wled", "nd_sd";
+   ralink,function = "gpio";
+   };
+   pa {
+   ralink,group = "pa";
+   ralink,function = "pa";
+   };
+   };
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+   system {
+   label = "hiwifi-5661:blue:system";
+   gpios = < 9 1>;
+   };
+   internet {
+   label = "hiwifi-5661:blue:internet";
+   gpios = < 11 1>;
+   };
+   wlan2p4 {
+   label = "hiwifi-5661:blue:wlan-2p4";
+   gpios = < 0 1>;
+   };
+   wlan5p {
+   label = "hiwifi-5661:blue:wlan-5p";
+   gpios = < 7 1>;

[OpenWrt-Devel] [PATCH 2/3] ramips: Add base-files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com. These 
models have similar hardware specs(MT7620A + 128M DDR2 + 16M flash). This patch 
adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

Signed-off-by: Xiaoning Kang 



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 a9959e3..512fdc1 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -137,6 +137,24 @@ hg255d)
set_usb_led "$board:green:usb"
ucidef_set_led_interface "lan" "$board:green:internet"
;;
+hiwifi-hc5661)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan-2p4"
+   ;;
+hiwifi-hc5761)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan-2p4"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan-5p" "rai0"
+   ;;
+hiwifi-hc5861)
+   ucidef_set_led_default "system" "system" "$board:blue:system" "1"
+   ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" 
"eth0.2"
+   set_wifi_led "$board:blue:wlan-2p4"
+   ucidef_set_led_netdev "wifi5g" "wifi5g" "$board:blue:wlan-5p" "rai0"
+   ucidef_set_led_default "turbo" "turbo" "$board:blue:turbo" "0"
+   ;;
 hpm)
ucidef_set_led_default "power" "POWER" "$board:orange:power" "1"
ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0"
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 75cccae..33c0b35 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -170,6 +170,12 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch1" "1" "0 1 2 3 6t"
ucidef_add_switch_vlan "switch1" "2" "4 6t"
;;
+   hiwifi-hc5*61)
+   ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+   ucidef_add_switch "switch0" "1" "1"
+   ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 5 6t"
+   ucidef_add_switch_vlan "switch0" "2" "0 6t"
+   ;;
m2m)
ucidef_add_switch "switch0" "4"
ucidef_set_interface_lan "eth0"
@@ -293,6 +299,12 @@ ramips_setup_macs()
e1700)
wan_mac=$(mtd_get_mac_ascii config WAN_MAC_ADDR)
;;
+   hiwifi-hc5*61)
+   __fac_mac=`strings /dev/mtd7 | grep 'fac_mac = 
..:..:..:..:..:..'`
+   lan_mac=`expr "$__fac_mac" : '.*\(..:..:..:..:..:..\)' | tr 
'[A-Z]' '[a-z]'`
+   [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
+   wan_mac=$(macaddr_add "$lan_mac" 1)
+   ;;
ht-tm02)
lan_mac=$(cat /sys/class/net/eth0/address)
;;
diff --git a/target/linux/ramips/base-files/etc/diag.sh 
b/target/linux/ramips/base-files/etc/diag.sh
index 7fc6f29..867b0fd 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -94,6 +94,9 @@ get_status_led() {
y1s)
status_led="$board:blue:power"
;;
+   hiwifi-hc5*61)
+   status_led="$board:blue:system"
+   ;;
db-wrt01|\
esr-9753)
status_led="$board:orange:power"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index d242235..a11d62e 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -169,6 +169,15 @@ ramips_board_detect() {
*"FreeStation5")
name="freestation5"
;;
+   *"HiWiFi HC5661")
+   name="hiwifi-hc5661"
+   ;;
+   *"HiWiFi HC5761")
+   name="hiwifi-hc5761"
+   ;;
+   *"HiWiFi HC5861")
+   name="hiwifi-hc5861"
+   ;;
*"HG255D")
name="hg255d"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 2f6c624..0dc051b 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -56,6 +56,7 @@ platform_check_image() {
fonera20n|\
freestation5|\
hg255d|\
+   hiwifi-hc5*61 |\
hlk-rm04|\
hpm|\
ht-tm02|\
___
openwrt-devel 

[OpenWrt-Devel] [PATCH 3/3] ramips: Add build files for HiWiFi HC5x61 models

2015-09-28 Thread Comman Kang
HiWiFi HC5661/5761/5861 models are manufactured by http://www.hiwifi.com 
. These models have similar hardware specs(MT7620A + 
128M DDR2 + 16M flash). This patch adds support for them.

The original author is Justin Liu (rss...@gmail.com). I ported the patch to 
trunk and submitted it here with his approval.

Signed-off-by: Xiaoning Kang 



diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index c24d220..bc8d015 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -872,6 +872,9 @@ na930_mtd_size=20971520
 Image/Build/Profile/NA930=$(call 
BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
 Image/Build/Profile/DB-WRT01=$(call 
BuildFirmware/Default8M/$(1),$(1),db-wrt01,DB-WRT01)
 Image/Build/Profile/MZK-750DHP=$(call 
BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
+Image/Build/Profile/HiWiFi-HC5661=$(call 
BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5661,HiWiFi-HC5661)
+Image/Build/Profile/HiWiFi-HC5761=$(call 
BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5761,HiWiFi-HC5761)
+Image/Build/Profile/HiWiFi-HC5861=$(call 
BuildFirmware/Default16M/$(1),$(1),hiwifi-hc5861,HiWiFi-HC5861)
 Image/Build/Profile/OY-0001=$(call 
BuildFirmware/Default16M/$(1),$(1),oy-0001,OY-0001)
 Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),y1,Y1)
 Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),y1s,Y1S)
@@ -907,6 +910,9 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/DB-WRT01,$(1))
$(call Image/Build/Profile/MZK-750DHP,$(1))
$(call Image/Build/Profile/NA930,$(1))
+   $(call Image/Build/Profile/HiWiFi-HC5661,$(1))
+   $(call Image/Build/Profile/HiWiFi-HC5761,$(1))
+   $(call Image/Build/Profile/HiWiFi-HC5861,$(1))
$(call Image/Build/Profile/OY-0001,$(1))
$(call Image/Build/Profile/Y1,$(1))
$(call Image/Build/Profile/Y1S,$(1))
diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk 
b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk
new file mode 100644
index 000..d3339a6
--- /dev/null
+++ b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5661.mk
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/HiWiFi-HC5661
+ NAME:=HiWiFi HC5661
+ PACKAGES:=\
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   fdisk
+endef
+
+define Profile/HiWiFi-HC5661/Description
+ Default on SD cards support.
+endef
+$(eval $(call Profile,HiWiFi-HC5661))
+
diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk 
b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk
new file mode 100644
index 000..481c3e8
--- /dev/null
+++ b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5761.mk
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/HiWiFi-HC5761
+ NAME:=HiWiFi HC5761
+ PACKAGES:=\
+   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   kmod-ledtrig-usbdev fdisk
+endef
+
+define Profile/HiWiFi-HC5761/Description
+ Default on SD cards and USB storage support.
+endef
+$(eval $(call Profile,HiWiFi-HC5761))
+
diff --git a/target/linux/ramips/mt7620/profiles/HiWiFi-HC5861.mk 
b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5861.mk
new file mode 100644
index 000..07a0443
--- /dev/null
+++ b/target/linux/ramips/mt7620/profiles/HiWiFi-HC5861.mk
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/HiWiFi-HC5861
+ NAME:=HiWiFi HC5861
+ PACKAGES:=\
+   kmod-usb-core kmod-usb-dwc2 kmod-usb2 kmod-usb-storage  \
+   kmod-mmc-spi kmod-sdhci kmod-sdhci-mt7620 \
+   block-mount mountd kmod-fs-ext4 ppp-mod-pppoe e2fsprogs \
+   kmod-ledtrig-usbdev fdisk
+endef
+
+define Profile/HiWiFi-HC5861/Description
+ Default on SD cards and USB storage support.
+endef
+$(eval $(call Profile,HiWiFi-HC5861))
+
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel