diff mbox

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

Message ID 1446962890-11756-1-git-send-email-countrysideboy@qq.com
State Changes Requested
Headers show

Commit Message

play4fun Nov. 8, 2015, 6:08 a.m. UTC
Signed-off-by: Shonn Lu <countrysideboy@qq.com>
---
 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

Comments

John Crispin Nov. 21, 2015, 6:05 p.m. UTC | #1
Hi

1 comment inline

On 08/11/2015 07:08, Shonn Lu wrote:
> Signed-off-by: Shonn Lu <countrysideboy@qq.com>
> ---
>  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"

the patch applies to a trunk prior to our cleanup. the patch wont apply
because of this. please rebase it on current trunk and resend

	John


>  		;;
> 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 0000000..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@10000000 {
> +
> +		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 = <10000000>;
> +
> +				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 = "firmware";
> +					reg = <0x50000 0x1fb0000>;
> +				};
> +			};
> +		};
> +	};
> +
> +	pinctrl {
> +		state_default: pinctrl0 {
> +			default {
> +				ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
> +				ralink,function = "gpio";
> +			};
> +		};
> +	};
> +
> +	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>;
> +	};
> +
> +	sdhci@b0130000 {
> +		status = "okay";
> +	};
> +
> +	ehci@101c0000 {
> +		status = "okay";
> +	};
> +
> +	ohci@101c1000 {
> +		status = "okay";
> +	};
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +		wan {
> +			label = "youku:blue:wan";
> +			gpios = <&gpio2 4 1>;
> +		};
> +		air {
> +			label = "youku:blue:air";
> +			gpios = <&gpio3 0 1>;
> +		};
> +		usb {
> +			label = "youku:blue:usb";
> +			gpios = <&gpio1 11 1>;
> +		};
> +		power {
> +			label = "youku:blue:power";
> +			gpios = <&gpio1 5 1>;
> +		};
> +	};
> +
> +	gpio-keys-polled {
> +		compatible = "gpio-keys-polled";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		poll-interval = <20>;
> +		reset {
> +			label = "reset";
> +			gpios = <&gpio0 1 1>;
> +			linux,code = <0x198>;
> +		};
> +	};
> +};
> diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
> index b4d0897..ca320d3 100644
> --- a/target/linux/ramips/image/Makefile
> +++ b/target/linux/ramips/image/Makefile
> @@ -884,6 +884,7 @@ Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WR
>  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/ZTE-Q7=$(call BuildFirmware/Default8M/$(1),$(1),zte-q7,ZTE-Q7)
> +Image/Build/Profile/Youku-YK1=$(call BuildFirmware/Default32M/$(1),$(1),youku-yk1,Youku-YK1)
>  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)
>  microwrt_mtd_size=16515072
> @@ -917,6 +918,7 @@ define Image/Build/Profile/Default
>  	$(call Image/Build/Profile/WT3020,$(1))
>  	$(call Image/Build/Profile/XIAOMI-MIWIFI-MINI,$(1))
>  	$(call Image/Build/Profile/ZTE-Q7,$(1))
> +	$(call Image/Build/Profile/Youku-YK1,$(1))
>  	$(call Image/Build/Profile/ZBT-WA05,$(1))
>  	$(call Image/Build/Profile/ArcherC20i,$(1))
>  	$(call Image/Build/Profile/MicroWRT,$(1))
>
diff mbox

Patch

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 0000000..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@10000000 {
+
+		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 = <10000000>;
+
+				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 = "firmware";
+					reg = <0x50000 0x1fb0000>;
+				};
+			};
+		};
+	};
+
+	pinctrl {
+		state_default: pinctrl0 {
+			default {
+				ralink,group = "i2c", "uartf", "rgmii1", "rgmii2", "ephy", "wled", "nd_sd";
+				ralink,function = "gpio";
+			};
+		};
+	};
+
+	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>;
+	};
+
+	sdhci@b0130000 {
+		status = "okay";
+	};
+
+	ehci@101c0000 {
+		status = "okay";
+	};
+
+	ohci@101c1000 {
+		status = "okay";
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		wan {
+			label = "youku:blue:wan";
+			gpios = <&gpio2 4 1>;
+		};
+		air {
+			label = "youku:blue:air";
+			gpios = <&gpio3 0 1>;
+		};
+		usb {
+			label = "youku:blue:usb";
+			gpios = <&gpio1 11 1>;
+		};
+		power {
+			label = "youku:blue:power";
+			gpios = <&gpio1 5 1>;
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 1>;
+			linux,code = <0x198>;
+		};
+	};
+};
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index b4d0897..ca320d3 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -884,6 +884,7 @@  Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WR
 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/ZTE-Q7=$(call BuildFirmware/Default8M/$(1),$(1),zte-q7,ZTE-Q7)
+Image/Build/Profile/Youku-YK1=$(call BuildFirmware/Default32M/$(1),$(1),youku-yk1,Youku-YK1)
 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)
 microwrt_mtd_size=16515072
@@ -917,6 +918,7 @@  define Image/Build/Profile/Default
 	$(call Image/Build/Profile/WT3020,$(1))
 	$(call Image/Build/Profile/XIAOMI-MIWIFI-MINI,$(1))
 	$(call Image/Build/Profile/ZTE-Q7,$(1))
+	$(call Image/Build/Profile/Youku-YK1,$(1))
 	$(call Image/Build/Profile/ZBT-WA05,$(1))
 	$(call Image/Build/Profile/ArcherC20i,$(1))
 	$(call Image/Build/Profile/MicroWRT,$(1))