[OpenWrt-Devel] [PATCH 1/4] oxnas: fix the incorrect board names

2016-01-18 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/oxnas/base-files/etc/board.d/01_leds | 2 +-
 target/linux/oxnas/base-files/etc/diag.sh | 4 ++--
 target/linux/oxnas/base-files/lib/oxnas.sh| 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/linux/oxnas/base-files/etc/board.d/01_leds 
b/target/linux/oxnas/base-files/etc/board.d/01_leds
index 52da945..f29ccff 100755
--- a/target/linux/oxnas/base-files/etc/board.d/01_leds
+++ b/target/linux/oxnas/base-files/etc/board.d/01_leds
@@ -14,7 +14,7 @@ case $board in
kd20)
ucidef_set_led_default "power" "power" "kd20:blue:status" "1"
;;
-   pogoplugpro | pogoplugv3)
+   pogoplug-pro | pogoplug-v3)
ucidef_set_led_default "power" "power" "pogoplug:blue:internal" 
"1"
;;
 
diff --git a/target/linux/oxnas/base-files/etc/diag.sh 
b/target/linux/oxnas/base-files/etc/diag.sh
index 5370696..8f484ae 100644
--- a/target/linux/oxnas/base-files/etc/diag.sh
+++ b/target/linux/oxnas/base-files/etc/diag.sh
@@ -6,13 +6,13 @@
 
 get_status_led() {
case $(oxnas_board_name) in
-   stg212)
+   stg-212)
status_led="zyxel:blue:status"
;;
kd20)
status_led="kd20:blue:status"
;;
-   pogoplugpro | pogoplugv3)
+   pogoplug-pro | pogoplug-v3)
status_led="pogoplug:blue:internal"
;;
esac
diff --git a/target/linux/oxnas/base-files/lib/oxnas.sh 
b/target/linux/oxnas/base-files/lib/oxnas.sh
index 1a04d55..2a07928 100755
--- a/target/linux/oxnas/base-files/lib/oxnas.sh
+++ b/target/linux/oxnas/base-files/lib/oxnas.sh
@@ -14,16 +14,16 @@ oxnas_board_detect() {
 
case "$machine" in
*"MitraStar Technology Corp. STG-212"*)
-   name="stg212"
+   name="stg-212"
;;
*"Shuttle KD20"*)
name="kd20"
;;
*"Pogoplug Pro"*)
-   name="pogoplugpro"
+   name="pogoplug-pro"
;;
*"Pogoplug V3"*)
-   name="pogoplugv3"
+   name="pogoplug-v3"
;;
esac
 
-- 
2.7.0
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] oxnas: fix the incorrect board names which cause sysupgradefailed

2015-11-07 Thread Shonn Lu
This patch fix the incorrect board name which cause sysupgrade failed.
The CONTROL file in xxx-squashfs-sysupgrade.tar says BOARD=pogoplug-pro,
instead of pogoplugpro. A few days ago I submitted this patch failed
because of the email re-formatted. Let me try gmail once more because I
really accustomed to using the command line.

Signed-off-by:  Shonn Lu 
---
diff --git a/target/linux/oxnas/base-files/etc/board.d/01_leds
b/target/linux/oxnas/base-files/etc/board.d/01_leds
index 17e37cd..f075764 100755
--- a/target/linux/oxnas/base-files/etc/board.d/01_leds
+++ b/target/linux/oxnas/base-files/etc/board.d/01_leds
@@ -14,7 +14,7 @@ case $board in
  kd20)
  ucidef_set_led_default "power" "power" "kd20:blue:status" "1"
  ;;
- pogoplugpro | pogoplugv3)
+ pogoplug-pro | pogoplug-v3)
  ucidef_set_led_default "power" "power" "pogoplug:blue:internal" "1"
  ;;

diff --git a/target/linux/oxnas/base-files/etc/diag.sh
b/target/linux/oxnas/base-files/etc/diag.sh
index 5370696..8f484ae 100644
--- a/target/linux/oxnas/base-files/etc/diag.sh
+++ b/target/linux/oxnas/base-files/etc/diag.sh
@@ -6,13 +6,13 @@

 get_status_led() {
  case $(oxnas_board_name) in
- stg212)
+ stg-212)
  status_led="zyxel:blue:status"
  ;;
  kd20)
  status_led="kd20:blue:status"
  ;;
- pogoplugpro | pogoplugv3)
+ pogoplug-pro | pogoplug-v3)
  status_led="pogoplug:blue:internal"
  ;;
  esac
diff --git a/target/linux/oxnas/base-files/lib/oxnas.sh
b/target/linux/oxnas/base-files/lib/oxnas.sh
index 1a04d55..2a07928 100755
--- a/target/linux/oxnas/base-files/lib/oxnas.sh
+++ b/target/linux/oxnas/base-files/lib/oxnas.sh
@@ -14,16 +14,16 @@ oxnas_board_detect() {

  case "$machine" in
  *"MitraStar Technology Corp. STG-212"*)
- name="stg212"
+ name="stg-212"
  ;;
  *"Shuttle KD20"*)
  name="kd20"
  ;;
  *"Pogoplug Pro"*)
- name="pogoplugpro"
+ name="pogoplug-pro"
  ;;
  *"Pogoplug V3"*)
- name="pogoplugv3"
+ name="pogoplug-v3"
  ;;
  esac
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] oxnas: set irq of usb&sata to cpu1

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 .../linux/oxnas/base-files/init.d/set-irq-affinity  | 21 +
 1 file changed, 21 insertions(+)
 create mode 100755 target/linux/oxnas/base-files/init.d/set-irq-affinity

diff --git a/target/linux/oxnas/base-files/init.d/set-irq-affinity 
b/target/linux/oxnas/base-files/init.d/set-irq-affinity
new file mode 100755
index 000..89c1622
--- /dev/null
+++ b/target/linux/oxnas/base-files/init.d/set-irq-affinity
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+get_irq() {
+   local name="$1"
+   grep -m 1 "$name" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
+}
+
+set_irq_affinity() {
+   local name="$1"
+   local val="$2"
+   local irq="$(get_irq "$name")"
+   [ -n "$irq" ] || return
+   echo "$val" > "/proc/irq/$irq/smp_affinity"
+}
+
+start() {
+   set_irq_affinity sata 2
+   set_irq_affinity usb 2
+}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] oxnas: fix the incorrect board names

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/oxnas/base-files/etc/board.d/01_leds | 2 +-
 target/linux/oxnas/base-files/etc/diag.sh | 4 ++--
 target/linux/oxnas/base-files/lib/oxnas.sh| 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/target/linux/oxnas/base-files/etc/board.d/01_leds 
b/target/linux/oxnas/base-files/etc/board.d/01_leds
index 17e37cd..f075764 100755
--- a/target/linux/oxnas/base-files/etc/board.d/01_leds
+++ b/target/linux/oxnas/base-files/etc/board.d/01_leds
@@ -14,7 +14,7 @@ case $board in
kd20)
ucidef_set_led_default "power" "power" "kd20:blue:status" "1"
;;
-   pogoplugpro | pogoplugv3)
+   pogoplug-pro | pogoplug-v3)
ucidef_set_led_default "power" "power" "pogoplug:blue:internal" 
"1"
;;
 
diff --git a/target/linux/oxnas/base-files/etc/diag.sh 
b/target/linux/oxnas/base-files/etc/diag.sh
index 5370696..8f484ae 100644
--- a/target/linux/oxnas/base-files/etc/diag.sh
+++ b/target/linux/oxnas/base-files/etc/diag.sh
@@ -6,13 +6,13 @@
 
 get_status_led() {
case $(oxnas_board_name) in
-   stg212)
+   stg-212)
status_led="zyxel:blue:status"
;;
kd20)
status_led="kd20:blue:status"
;;
-   pogoplugpro | pogoplugv3)
+   pogoplug-pro | pogoplug-v3)
status_led="pogoplug:blue:internal"
;;
esac
diff --git a/target/linux/oxnas/base-files/lib/oxnas.sh 
b/target/linux/oxnas/base-files/lib/oxnas.sh
index 1a04d55..2a07928 100755
--- a/target/linux/oxnas/base-files/lib/oxnas.sh
+++ b/target/linux/oxnas/base-files/lib/oxnas.sh
@@ -14,16 +14,16 @@ oxnas_board_detect() {
 
case "$machine" in
*"MitraStar Technology Corp. STG-212"*)
-   name="stg212"
+   name="stg-212"
;;
*"Shuttle KD20"*)
name="kd20"
;;
*"Pogoplug Pro"*)
-   name="pogoplugpro"
+   name="pogoplug-pro"
;;
*"Pogoplug V3"*)
-   name="pogoplugv3"
+   name="pogoplug-v3"
;;
esac
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] generic :add-missing-ubi*-in-ramfs-when-sysupgrade

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 package/base-files/files/lib/upgrade/common.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/base-files/files/lib/upgrade/common.sh 
b/package/base-files/files/lib/upgrade/common.sh
index 761b4c1..78bd65f 100644
--- a/package/base-files/files/lib/upgrade/common.sh
+++ b/package/base-files/files/lib/upgrade/common.sh
@@ -67,6 +67,7 @@ run_ramfs() { #  [...]
install_bin /usr/sbin/ubirsvol
install_bin /usr/sbin/ubirmvol
install_bin /usr/sbin/ubimkvol
+   install_bin /usr/sbin/ubi*
for file in $RAMFS_COPY_BIN; do
install_bin ${file//:/ }
done
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] oxnas: add some default packages of router

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/oxnas/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/linux/oxnas/Makefile b/target/linux/oxnas/Makefile
index 32bcab8..87b9489 100644
--- a/target/linux/oxnas/Makefile
+++ b/target/linux/oxnas/Makefile
@@ -22,7 +22,8 @@ include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
kmod-ata-core kmod-ata-oxnas-sata kmod-button-hotplug \
kmod-input-gpio-keys-polled kmod-leds-gpio kmod-usb2-oxnas \
-   uboot-envtools uboot-oxnas-ox820
+   uboot-envtools uboot-oxnas-ox820 \
+   dnsmasq iptables ip6tables ppp ppp-mod-pppoe kmod-nf-nathelper firewall 
odhcpd odhcp6c
 
 KERNELNAME:=zImage dtbs
 
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: reset m25p80 when shutdown

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 .../0064-reset-m25p80-when-shutdown.patch  | 24 ++
 1 file changed, 24 insertions(+)
 create mode 100644 
target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch

diff --git 
a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch 
b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch
new file mode 100644
index 000..76f916a
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch
@@ -0,0 +1,24 @@
+--- a/drivers/mtd/devices/m25p80.c
 b/drivers/mtd/devices/m25p80.c
+@@ -319,6 +319,12 @@
+ {
+   struct m25p *flash = spi_get_drvdata(spi);
+ 
++//play4fun: add spi flash reset code  
++  flash->command[0] = 0x66;  
++  spi_write(flash->spi, flash->command, 1);  
++  flash->command[0] = 0x99;  
++  spi_write(flash->spi, flash->command, 1);
++ 
+   /* Clean up MTD stuff. */
+   return mtd_device_unregister(&flash->mtd);
+ }
+@@ -382,6 +388,8 @@
+   .id_table   = m25p_ids,
+   .probe  = m25p_probe,
+   .remove = m25p_remove,
++  //  play4fun add shutdown method to reset spi flash
++  .shutdown = m25p_remove,
+ 
+   /* REVISIT: many of these chips have deep power-down modes, which
+* should clearly be entered on suspend() to minimize power use.
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: init usb power for Lenovo Y1S

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/ramips/dts/Y1S.dts | 21 +
 1 file changed, 21 insertions(+)

diff --git a/target/linux/ramips/dts/Y1S.dts b/target/linux/ramips/dts/Y1S.dts
index 9ecac37..2423a2c 100644
--- a/target/linux/ramips/dts/Y1S.dts
+++ b/target/linux/ramips/dts/Y1S.dts
@@ -41,6 +41,27 @@
};
};
 
+   gpio_export {
+   compatible = "gpio-export";
+   #size-cells = <0>;
+   /* GPIO 54、55、56 USB1、2、3 */
+   usb0 {
+   gpio-export,name = "usb0";
+   gpio-export,output = <1>; // GPIOF_OUT_INIT_HIGH
+   gpios = <&gpio2 14 0>; // GPIO2:40+14=GPIO 54
+   };
+   usb1 {
+   gpio-export,name = "usb1";
+   gpio-export,output = <1>;
+   gpios = <&gpio2 15 0>;
+   };
+   usb2 {
+   gpio-export,name = "usb2";
+   gpio-export,output = <1>;
+   gpios = <&gpio2 16 0>;
+   };
+   };
+
gsw@1011 {
ralink,port4 = "gmac";
};
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: add support for Youku YK1

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/Youku-YK1.dts  | 127 +
 target/linux/ramips/image/Makefile |   2 +
 5 files changed, 134 insertions(+)
 create mode 100644 target/linux/ramips/dts/Youku-YK1.dts

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 19ef3f7..3c87971 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -145,6 +145,7 @@ ramips_setup_interfaces()
wsr-1166 | \
wt1520 | \
xiaomi-miwifi-mini |\
+   yk1 |\
y1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index a9a6664..bdd6d4e 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -409,6 +409,9 @@ ramips_board_detect() {
*"ZTE Q7")
name="zte-q7"
;;
+   *"Youku YK1")
+   name="yk1"
+   ;;
*"Lenovo Y1")
name="y1"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 11fee85..66fcd04 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -127,6 +127,7 @@ platform_check_image() {
y1 |\
y1s |\
zte-q7 |\
+   yk1 |\
zbt-wa05)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
diff --git a/target/linux/ramips/dts/Youku-YK1.dts 
b/target/linux/ramips/dts/Youku-YK1.dts
new file mode 100644
index 000..10662d3
--- /dev/null
+++ b/target/linux/ramips/dts/Youku-YK1.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "Youku-YK1", "ralink,mt7620a-soc";
+   model = "Youku YK1";
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   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 = "w25q256";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q256";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+   partition@5 {
+   label = "firmware";
+   reg = <0x5 0x1fb>;
+   };
+   };
+   };
+   };
+
+   pinctrl {
+   state_default: pinctrl0 {
+   default {
+   ralink,group = "i2c", "uartf", "rgmii1", 
"rgmii2", "ephy", "wled", "nd_sd";
+   ralink,function = "gpio";
+   };
+   };
+   

[OpenWrt-Devel] [PATCH] ramips: add support for Youku YK1

2015-11-07 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   5 +
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   1 +
 target/linux/ramips/dts/Youku-YK1.dts  | 127 +
 target/linux/ramips/image/Makefile |   2 +
 6 files changed, 139 insertions(+)
 create mode 100644 target/linux/ramips/dts/Youku-YK1.dts

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 545bd70..bc86bd3 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -261,6 +261,11 @@ case $board in
zte-q7)
set_wifi_led "zte:blue:status"
;;
+   yk1)
+   ucidef_set_led_default "power" "power" "youku:blue:power" "1"
+   set_wifi_led "youku:blue:air"
+   set_usb_led "youku:blue:usb"
+   ;;
 esac
 
 board_config_flush
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 19ef3f7..3c87971 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -145,6 +145,7 @@ ramips_setup_interfaces()
wsr-1166 | \
wt1520 | \
xiaomi-miwifi-mini |\
+   yk1 |\
y1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index a9a6664..bdd6d4e 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -409,6 +409,9 @@ ramips_board_detect() {
*"ZTE Q7")
name="zte-q7"
;;
+   *"Youku YK1")
+   name="yk1"
+   ;;
*"Lenovo Y1")
name="y1"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 11fee85..66fcd04 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -127,6 +127,7 @@ platform_check_image() {
y1 |\
y1s |\
zte-q7 |\
+   yk1 |\
zbt-wa05)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
diff --git a/target/linux/ramips/dts/Youku-YK1.dts 
b/target/linux/ramips/dts/Youku-YK1.dts
new file mode 100644
index 000..10662d3
--- /dev/null
+++ b/target/linux/ramips/dts/Youku-YK1.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "Youku-YK1", "ralink,mt7620a-soc";
+   model = "Youku YK1";
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   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 = "w25q256";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q256";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   

[OpenWrt-Devel] [PATCH] ramips: reset m25p80 when shutdown

2015-11-16 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 .../0064-reset-m25p80-when-shutdown.patch  | 27 ++
 1 file changed, 27 insertions(+)
 create mode 100644 
target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch

diff --git 
a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch 
b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch
new file mode 100644
index 000..aca758d
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch
@@ -0,0 +1,27 @@
+--- a/drivers/mtd/devices/m25p80.c
 b/drivers/mtd/devices/m25p80.c
+@@ -322,6 +322,16 @@
+ {
+   struct m25p *flash = spi_get_drvdata(spi);
+ 
++  if ((&flash->spi_nor)->addr_width > 3) {
++  printk(KERN_INFO "m25p80: exit 4-byte address mode\n");
++  flash->command[0] = SPINOR_OP_EX4B;  // exit 4-byte address mode: 0xe9
++  spi_write(flash->spi, flash->command, 1);
++  flash->command[0] = 0x66;  // enable reset
++  spi_write(flash->spi, flash->command, 1);  
++  flash->command[0] = 0x99;  // reset
++  spi_write(flash->spi, flash->command, 1);
++  }
++
+   /* Clean up MTD stuff. */
+   return mtd_device_unregister(&flash->mtd);
+ }
+@@ -385,6 +395,7 @@
+   .id_table   = m25p_ids,
+   .probe  = m25p_probe,
+   .remove = m25p_remove,
++  .shutdown = m25p_remove, // add shutdown method to reset spi flash
+ 
+   /* REVISIT: many of these chips have deep power-down modes, which
+* should clearly be entered on suspend() to minimize power use.
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] oxnas: set irq of usb&sata to cpu1

2015-11-22 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 .../linux/oxnas/base-files/init.d/set-irq-affinity | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100755 target/linux/oxnas/base-files/init.d/set-irq-affinity

diff --git a/target/linux/oxnas/base-files/init.d/set-irq-affinity 
b/target/linux/oxnas/base-files/init.d/set-irq-affinity
new file mode 100755
index 000..8ab066f
--- /dev/null
+++ b/target/linux/oxnas/base-files/init.d/set-irq-affinity
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+get_irq() {
+   local name="$1"
+   grep -m 1 "$name" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
+}
+
+set_irq_affinity() {
+   local name="$1"
+   local val="$2"
+   local irq="$(get_irq "$name")"
+   [ -n "$irq" ] || return
+   echo "$val" > "/proc/irq/$irq/smp_affinity"
+}
+
+start() {
+   set_irq_affinity ehci_hcd 2
+   set_irq_affinity xhci_hcd 2
+   set_irq_affinity sata 2
+}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] ramips: add support for Youku YK1

2015-11-22 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   5 +
 .../linux/ramips/base-files/etc/board.d/02_network |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   3 +-
 target/linux/ramips/dts/YOUKU-YK1.dts  | 127 +
 target/linux/ramips/image/Makefile |   2 +
 6 files changed, 141 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/YOUKU-YK1.dts

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 5627c8c..1c18ded 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -268,6 +268,11 @@ zbt-wr8305rt)
 zte-q7)
set_wifi_led "$board:blue:status"
;;
+youku-yk1)
+   ucidef_set_led_default "power" "power" "$board:blue:power" "1"
+   set_wifi_led "$board:blue:air"
+   set_usb_led "$board:blue:usb"
+   ;;
 esac
 
 board_config_flush
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 3821742..22809d1 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -84,7 +84,8 @@ ramips_setup_interfaces()
wsr-600|\
wt1520|\
y1|\
-   zbt-wg2626)
+   zbt-wg2626|\
+   youku-yk1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index a1bcb72..d6fdeb9 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -460,6 +460,9 @@ ramips_board_detect() {
*"ZBT-WR8305RT")
name="zbt-wr8305rt"
;;
+   *"YK1")
+   name="youku-yk1"
+   ;;
*)
name="generic"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0e8d619..0b9dd43 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -134,7 +134,8 @@ platform_check_image() {
zbt-wa05|\
zbt-wg2626|\
zbt-wr8305rt|\
-   zte-q7)
+   zte-q7|\
+   youku-yk1)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
return 1
diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts 
b/target/linux/ramips/dts/YOUKU-YK1.dts
new file mode 100644
index 000..418351c
--- /dev/null
+++ b/target/linux/ramips/dts/YOUKU-YK1.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "YOUKU-YK1", "ralink,mt7620a-soc";
+   model = "YOUKU YK1";
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   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 = "w25q256";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q256";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+  

[OpenWrt-Devel] [PATCH] ramips: add support for Youku YK1

2015-11-22 Thread Shonn Lu
Signed-off-by: Shonn Lu 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   5 +
 .../linux/ramips/base-files/etc/board.d/02_network |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   3 +-
 target/linux/ramips/dts/YOUKU-YK1.dts  | 127 +
 target/linux/ramips/image/Makefile |   2 +
 6 files changed, 141 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/YOUKU-YK1.dts

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 5627c8c..1c18ded 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -268,6 +268,11 @@ zbt-wr8305rt)
 zte-q7)
set_wifi_led "$board:blue:status"
;;
+youku-yk1)
+   ucidef_set_led_default "power" "power" "$board:blue:power" "1"
+   set_wifi_led "$board:blue:air"
+   set_usb_led "$board:blue:usb"
+   ;;
 esac
 
 board_config_flush
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 3821742..22809d1 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -84,7 +84,8 @@ ramips_setup_interfaces()
wsr-600|\
wt1520|\
y1|\
-   zbt-wg2626)
+   zbt-wg2626|\
+   youku-yk1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index a1bcb72..d6fdeb9 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -460,6 +460,9 @@ ramips_board_detect() {
*"ZBT-WR8305RT")
name="zbt-wr8305rt"
;;
+   *"YK1")
+   name="youku-yk1"
+   ;;
*)
name="generic"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0e8d619..0b9dd43 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -134,7 +134,8 @@ platform_check_image() {
zbt-wa05|\
zbt-wg2626|\
zbt-wr8305rt|\
-   zte-q7)
+   zte-q7|\
+   youku-yk1)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
return 1
diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts 
b/target/linux/ramips/dts/YOUKU-YK1.dts
new file mode 100644
index 000..418351c
--- /dev/null
+++ b/target/linux/ramips/dts/YOUKU-YK1.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "YOUKU-YK1", "ralink,mt7620a-soc";
+   model = "YOUKU YK1";
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   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 = "w25q256";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q256";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+  

[OpenWrt-Devel] [PATCH V2] ramips: add support for Youku YK1

2015-11-22 Thread Shonn Lu
Changes since V1:
I resend this patch for current trunk.The former V1 patch is for CC branch.

Signed-off-by: Shonn Lu 
---
 target/linux/ramips/base-files/etc/board.d/01_leds |   5 +
 .../linux/ramips/base-files/etc/board.d/02_network |   3 +-
 target/linux/ramips/base-files/lib/ramips.sh   |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh  |   3 +-
 target/linux/ramips/dts/YOUKU-YK1.dts  | 127 +
 target/linux/ramips/image/Makefile |   2 +
 6 files changed, 141 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ramips/dts/YOUKU-YK1.dts

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 5627c8c..1c18ded 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -268,6 +268,11 @@ zbt-wr8305rt)
 zte-q7)
set_wifi_led "$board:blue:status"
;;
+youku-yk1)
+   ucidef_set_led_default "power" "power" "$board:blue:power" "1"
+   set_wifi_led "$board:blue:air"
+   set_usb_led "$board:blue:usb"
+   ;;
 esac
 
 board_config_flush
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 3821742..22809d1 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -84,7 +84,8 @@ ramips_setup_interfaces()
wsr-600|\
wt1520|\
y1|\
-   zbt-wg2626)
+   zbt-wg2626|\
+   youku-yk1)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
diff --git a/target/linux/ramips/base-files/lib/ramips.sh 
b/target/linux/ramips/base-files/lib/ramips.sh
index a1bcb72..d6fdeb9 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -460,6 +460,9 @@ ramips_board_detect() {
*"ZBT-WR8305RT")
name="zbt-wr8305rt"
;;
+   *"YK1")
+   name="youku-yk1"
+   ;;
*)
name="generic"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh 
b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 0e8d619..0b9dd43 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -134,7 +134,8 @@ platform_check_image() {
zbt-wa05|\
zbt-wg2626|\
zbt-wr8305rt|\
-   zte-q7)
+   zte-q7|\
+   youku-yk1)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
return 1
diff --git a/target/linux/ramips/dts/YOUKU-YK1.dts 
b/target/linux/ramips/dts/YOUKU-YK1.dts
new file mode 100644
index 000..418351c
--- /dev/null
+++ b/target/linux/ramips/dts/YOUKU-YK1.dts
@@ -0,0 +1,127 @@
+/dts-v1/;
+
+/include/ "mt7620a.dtsi"
+
+/ {
+   compatible = "YOUKU-YK1", "ralink,mt7620a-soc";
+   model = "YOUKU YK1";
+
+   palmbus@1000 {
+
+   gpio0: gpio@600 {
+   status = "okay";
+   };
+
+   gpio1: gpio@638 {
+   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 = "w25q256";
+   reg = <0 0>;
+   linux,modalias = "m25p80", "w25q256";
+   spi-max-frequency = <1000>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+ 

[OpenWrt-Devel] [PATCH V2] oxnas: set irq of usb&sata to cpu1

2015-11-22 Thread Shonn Lu
V2:
The KD-20 also has USB 3.0.I modiy the set_irq_affinity usb 2 to 
set_irq_affinity ?hci_hcd 2 to bind usb 2.0&3.0 to cpu1.

Signed-off-by: Shonn Lu 
---
 .../linux/oxnas/base-files/init.d/set-irq-affinity | 22 ++
 1 file changed, 22 insertions(+)
 create mode 100755 target/linux/oxnas/base-files/init.d/set-irq-affinity

diff --git a/target/linux/oxnas/base-files/init.d/set-irq-affinity 
b/target/linux/oxnas/base-files/init.d/set-irq-affinity
new file mode 100755
index 000..8ab066f
--- /dev/null
+++ b/target/linux/oxnas/base-files/init.d/set-irq-affinity
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+
+get_irq() {
+   local name="$1"
+   grep -m 1 "$name" /proc/interrupts | cut -d: -f1 | sed 's, *,,'
+}
+
+set_irq_affinity() {
+   local name="$1"
+   local val="$2"
+   local irq="$(get_irq "$name")"
+   [ -n "$irq" ] || return
+   echo "$val" > "/proc/irq/$irq/smp_affinity"
+}
+
+start() {
+   set_irq_affinity ehci_hcd 2
+   set_irq_affinity xhci_hcd 2
+   set_irq_affinity sata 2
+}
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel