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..e87014f 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -48,6 +48,7 @@ ramips_setup_interfaces() ht-tm02|\ microwrt|\ ncs601w|\ + tp-c516w|\ w150m|\ wnce2001|\ zte-q7) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 7fc6f29..3b2d04c 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -173,6 +173,9 @@ get_status_led() { wsr-600) status_led="$board:orange:diag" ;; + tp-c516w) + status_led="$board:green:camera" + ;; esac } diff --git a/target/linux/ramips/base-files/etc/uci-defaults/01_leds b/target/linux/ramips/base-files/etc/uci-defaults/01_leds new file mode 100644 index 0000000..9a43eba --- /dev/null +++ b/target/linux/ramips/base-files/etc/uci-defaults/01_leds @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Copyright (C) 2011 OpenWrt.org +# + +. /lib/functions/uci-defaults.sh +. /lib/ramips.sh + +board=$(ramips_board_name) + +case "$board" in +tp-c516w) + ucidef_set_led_netdev "lan" "LAN" "$board:orange:ethernet" "eth0" + ;; +esac + +ucidef_commit_leds + +exit 0 diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index d242235..3261cef 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -259,6 +259,9 @@ ramips_board_detect() { *"NCS601W") name="ncs601w" ;; + *"TP-C516W") + name="tp-c516w" + ;; *"NW718") name="nw718" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index 2f6c624..059aae2 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -15,6 +15,8 @@ platform_check_image() { case "$board" in 3g150b|\ + ncs601w|\ + tp-c516w|\ 3g300m|\ 3g-6200n|\ 3g-6200nl|\ diff --git a/target/linux/ramips/dts/TP-C516W-16M.dts b/target/linux/ramips/dts/TP-C516W-16M.dts new file mode 100644 index 0000000..61c1b23 --- /dev/null +++ b/target/linux/ramips/dts/TP-C516W-16M.dts @@ -0,0 +1,49 @@ +/dts-v1/; + +/include/ "rt5350.dtsi" + +/ { + compatible = "TP-C516W", "ralink,rt5350-soc"; + model = "KKMoon TP-C516W"; + + palmbus@10000000 { + spi@b00 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "s25sl12801"; + reg = <0 0>; + linux,modalias = "m25p80", "s25sl12801"; + 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 0xfb0000>; + }; + }; + }; + }; + +/include/ "TP-C516W-common.dtsi" + +}; diff --git a/target/linux/ramips/dts/TP-C516W-8M.dts b/target/linux/ramips/dts/TP-C516W-8M.dts new file mode 100644 index 0000000..d80b4d4 --- /dev/null +++ b/target/linux/ramips/dts/TP-C516W-8M.dts @@ -0,0 +1,49 @@ +/dts-v1/; + +/include/ "rt5350.dtsi" + +/ { + compatible = "TP-C516W", "ralink,rt5350-soc"; + model = "KKMoon TP-C516W"; + + palmbus@10000000 { + spi@b00 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "s25fl064k"; + reg = <0 0>; + linux,modalias = "m25p80", "s25fl064k"; + 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 0x7b0000>; + }; + }; + }; + }; + + +/include/ "TP-C516W-common.dtsi" +}; diff --git a/target/linux/ramips/dts/TP-C516W-common.dtsi b/target/linux/ramips/dts/TP-C516W-common.dtsi new file mode 100644 index 0000000..675f83a --- /dev/null +++ b/target/linux/ramips/dts/TP-C516W-common.dtsi @@ -0,0 +1,81 @@ +/*Common definitions for TP-C516W */ + + palmbus@10000000 { + gpio1: gpio@660 { + status = "ok"; + }; + + spi@b00 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>; + }; + + }; + + pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "jtag", "rgmii", "mdio", "led", "spi_cs1", "uartf"; + ralink,function = "gpio"; + }; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + camera { + label = "tp-c516w:green:camera"; + gpios = <&gpio0 12 0>; + }; + + wifi { + label = "tp-c516w:orange:ethernet"; + gpios = <&gpio0 13 1>; + }; + + alarm_out { + label = "tp-c516w::alarm_out"; + gpios = <&gpio1 5 0>; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + + reset { + label = "reset"; + gpios = <&gpio0 0 1>; + linux,code = <0x198>; + }; + + alarm_in { + label = "alarm_in"; + gpios = <&gpio0 21 0>; + }; + }; + + + ethernet@10100000 { + mtd-mac-address = <&factory 0x4>; + }; + + esw@10110000 { + ralink,portmap = <0x2f>; + }; + + wmac@10180000 { + ralink,mtd-eeprom = <&factory 0>; + }; + + ehci@101c0000 { + status = "okay"; + }; + + ohci@101c1000 { + status = "okay"; + }; diff --git a/target/linux/ramips/dts/rt5350.dtsi b/target/linux/ramips/dts/rt5350.dtsi index 5282e5b..22d0e36 100644 --- a/target/linux/ramips/dts/rt5350.dtsi +++ b/target/linux/ramips/dts/rt5350.dtsi @@ -119,6 +119,9 @@ compatible = "ralink,rt5350-gpio", "ralink,rt2880-gpio"; reg = <0x660 0x24>; + resets = <&rstctrl 13>; + reset-names = "pio"; + interrupt-parent = <&intc>; interrupts = <6>; @@ -135,7 +138,7 @@ }; i2c@900 { - compatible = "link,rt5350-i2c", "ralink,rt2880-i2c"; + compatible = "ralink,rt5350-i2c", "ralink,rt2880-i2c"; reg = <0x900 0x100>; resets = <&rstctrl 16>; @@ -150,6 +153,16 @@ status = "disabled"; }; + i2s@a00 { + compatible = "ralink,rt5350-i2s"; + reg = <0xa00 0x28>; + + resets = <&rstctrl 17>; + reset-names = "i2s"; + + status = "disabled"; + }; + spi@b00 { compatible = "ralink,rt5350-spi"; reg = <0xb00 0x100>; @@ -189,6 +202,9 @@ interrupt-parent = <&cpuintc>; interrupts = <7>; }; + + + }; pinctrl { @@ -214,8 +230,8 @@ }; }; - phy_led_pins: phy_led { - phy_led { + led_pins: led { + led { ralink,group = "led"; ralink,function = "led"; }; @@ -241,6 +257,7 @@ ralink,function = "spi_cs1"; }; }; + }; rstctrl: rstctrl { @@ -309,4 +326,11 @@ interrupt-parent = <&intc>; interrupts = <18>; }; + + ephy { + compatible = "ralink,ephy"; + + pinctrl-names = "default"; + pinctrl-0 = <&led_pins>; + }; }; diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index c24d220..c8c2cc1 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -193,6 +193,7 @@ BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$( # $(4) = uImage header name field ralink_default_fw_size_8M=8060928 BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4)) +BuildFirmware/Default8M/jffs2=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4)) BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4)) BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4)) BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4)) @@ -569,6 +570,17 @@ Image/Build/Profile/MZKW300NH2=$(call BuildFirmware/Edimax/$(1),$(1),mzk-w300nh2 Image/Build/Profile/NCS601W=$(call BuildFirmware/Default8M/$(1),$(1),ncs601W,NCS601W) +define BuildFirmware/TP-C516W/squashfs + $(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M) + $(call BuildFirmware/Default16M/$(1),$(1),$(2)-16M,$(3)-16M) +endef +define BuildFirmware/TP-C516W/initramfs + $(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M) + $(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M) +endef + +Image/Build/Profile/TP-C516W=$(call BuildFirmware/TP-C516W/$(1),$(1),tp-c516w,TP-C516W) + nw718_mtd_size=3801088 Image/Build/Profile/NW718=$(call BuildFirmware/CustomFlashFactory/$(1),$(1),nw718m,NW718,$(nw718_mtd_size),ARA1B4NCRNW718;1,factory) @@ -742,6 +754,7 @@ define Image/Build/Profile/Default $(call Image/Build/Profile/MZKW300NH2,$(1)) $(call Image/Build/Profile/NBG-419N,$(1)) $(call Image/Build/Profile/NCS601W,$(1)) + $(call Image/Build/Profile/TP-C516W,$(1)) $(call Image/Build/Profile/NW718,$(1)) $(call Image/Build/Profile/MINIEMBWIFI,$(1)) $(call Image/Build/Profile/MINIEMBPLUG,$(1)) diff --git a/target/linux/ramips/patches-3.18/9997-alarm-out.patch b/target/linux/ramips/patches-3.18/9997-alarm-out.patch new file mode 100644 index 0000000..64fb4fc --- /dev/null +++ b/target/linux/ramips/patches-3.18/9997-alarm-out.patch @@ -0,0 +1,16 @@ +Index: linux-3.18.21/drivers/pinctrl/pinctrl-rt2880.c +=================================================================== +--- linux-3.18.21.orig/drivers/pinctrl/pinctrl-rt2880.c ++++ linux-3.18.21/drivers/pinctrl/pinctrl-rt2880.c +@@ -372,6 +372,11 @@ static int rt2880_pinmux_pins(struct rt2 + /* pin 0 is always a gpio */ + p->gpio[0] = 1; + ++ /* ditto pin 27 as we don't have a driver to represent spi_cs1 ++ * so we can't get pinmux to export them otherwise */ ++ ++ p->gpio[27] = 1; ++ + /* set the pads */ + for (i = 0; i < p->max_pins; i++) { + /* strlen("ioXY") + 1 = 5 */ diff --git a/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch b/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch new file mode 100644 index 0000000..d02829c --- /dev/null +++ b/target/linux/ramips/patches-3.18/9997-rt5350-pinmux.patch @@ -0,0 +1,18 @@ +Index: linux-3.18.21/arch/mips/ralink/rt305x.c +=================================================================== +--- linux-3.18.21.orig/arch/mips/ralink/rt305x.c ++++ linux-3.18.21/arch/mips/ralink/rt305x.c +@@ -35,7 +35,12 @@ static struct rt2880_pmx_func uartf_func + static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 15, 2) }; + static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) }; + static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) }; +-static struct rt2880_pmx_func rt5350_led_func[] = { FUNC("led", 0, 22, 5) }; ++static struct rt2880_pmx_func rt5350_led_func[] = { ++ FUNC("led", 0, 22, 5) , ++ FUNC("gpio", 1, 22, 5) , ++ FUNC("btmode", 2, 22, 5), ++}; ++ + static struct rt2880_pmx_func rt5350_cs1_func[] = { + FUNC("spi_cs1", 0, 27, 1), + FUNC("wdg_cs1", 1, 27, 1), diff --git a/target/linux/ramips/rt305x/profiles/kkmoon.mk b/target/linux/ramips/rt305x/profiles/kkmoon.mk new file mode 100644 index 0000000..65ed584 --- /dev/null +++ b/target/linux/ramips/rt305x/profiles/kkmoon.mk @@ -0,0 +1,18 @@ +# +# Copyright (C) 2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +define Profile/TP-C516W + NAME:=KKMoon TP-C516W + PACKAGES:=kmod-video-core kmod-video-uvc \ + kmod-usb-core kmod-usb-ohci \ + mjg-streamer +endef + +define Profile/TP-C516W/Description + Package set for KKMoon TP-C516W board +endef +$(eval $(call Profile,TP-C516W))