From 9fe833e1d020748fa92e485aeb08b1ac9a6fdb09 Mon Sep 17 00:00:00 2001 From: BangLang Huang Date: Tue, 27 Sep 2016 14:23:27 +0800 Subject: [PATCH] ramips : add support for PandoraBox D1 Signed-off-by: BangLang Huang --- .../ramips/base-files/etc/board.d/01_leds | 3 + .../ramips/base-files/etc/board.d/02_network | 1 + target/linux/ramips/base-files/etc/diag.sh | 3 +- target/linux/ramips/base-files/lib/ramips.sh | 3 + .../ramips/base-files/lib/upgrade/platform.sh | 1 + target/linux/ramips/dts/PBR-D1.dts | 159 ++++++++++++++++++ target/linux/ramips/image/mt7688.mk | 8 + 7 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 target/linux/ramips/dts/PBR-D1.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 29bba0b26d..5dee0d5a69 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -242,6 +242,9 @@ oy-0001) ucidef_set_led_default "power" "power" "$board:green:power" "1" set_wifi_led "$board:green:wifi" ;; +pbr-d1) + set_usb_led "$board:orange:usb" + ;; pbr-m1) ucidef_set_led_netdev "internet" "internet" "$board:blue:internet" "eth0.2" ucidef_set_led_default "power" "power" "$board:blue:power" "1" 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 e757acb6ab..70297de6f8 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -178,6 +178,7 @@ ramips_setup_interfaces() mzk-ex300np|\ mzk-ex750np|\ na930|\ + pbr-d1|\ wli-tx4-ag300n|\ wmr-300|\ wrh-300cr) diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 1eb4036aab..e604d7f51d 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -113,7 +113,8 @@ get_status_led() { status_led="$board:blue:power" ;; db-wrt01|\ - esr-9753) + esr-9753|\ + pbr-d1) status_led="$board:orange:power" ;; f5d8235-v2) diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 3a72835dbd..7429816675 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -337,6 +337,9 @@ ramips_board_detect() { *"OY-0001") name="oy-0001" ;; + *"PBR-D1") + name="pbr-d1" + ;; *"PBR-M1") name="pbr-m1" ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index a71d806a78..162a69e3d8 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -99,6 +99,7 @@ platform_check_image() { nixcore|\ nw718|\ oy-0001|\ + pbr-d1|\ pbr-m1|\ psg1208|\ psr-680w|\ diff --git a/target/linux/ramips/dts/PBR-D1.dts b/target/linux/ramips/dts/PBR-D1.dts new file mode 100644 index 0000000000..30477a0ddf --- /dev/null +++ b/target/linux/ramips/dts/PBR-D1.dts @@ -0,0 +1,159 @@ +/dts-v1/; + +#include "mt7628an.dtsi" + +/ { + compatible = "mediatek,pbr-d1", "mediatek,mt7628an-soc"; + model = "PBR-D1"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + serial0 = &uart2; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + usb { + label = "pbr-d1:orange:usb"; + gpios = <&gpio0 0 1>; + default-state = "off"; + }; + + power { + label = "pbr-d1:orange:power"; + gpios = <&gpio0 14 1>; + default-state = "on"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + wps { + label = "reset"; + gpios = <&gpio1 38 1>; + linux,code = <0x211>; + }; + }; + + wgpio: gpio-wifi { + compatible = "mediatek,gpio-wifi"; + #address-cells = <1>; + #size-cells = <0>; + gpio-controller; + #gpio-cells = <2>; + }; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "gpio"; + ralink,function = "gpio"; + }; + + i2c { + ralink,group = "i2c"; + ralink,function = "gpio"; + }; + + i2s { + ralink,group = "i2s"; + ralink,function = "gpio"; + }; + + spis { + ralink,group = "spis"; + ralink,function = "gpio"; + }; + + wdt { + ralink,group = "wdt"; + ralink,function = "gpio"; + }; + }; +}; + +&spi0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "w25q128"; + spi-max-frequency = <40000000>; + m25p,chunked-io = <31>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0x0fb0000>; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <40000000>; + }; +}; + +&i2c { + status = "okay"; +}; + +&uart1 { + status = "okay"; +}; + +&uart2 { + status = "okay"; +}; + +&pwm { + status = "okay"; +}; + +ðernet { + mtd-mac-address = <&factory 0x28>; +}; + +&sdhci { + status = "okay"; + mediatek,cd-high; +}; diff --git a/target/linux/ramips/image/mt7688.mk b/target/linux/ramips/image/mt7688.mk index ffd92d21c6..406af69504 100644 --- a/target/linux/ramips/image/mt7688.mk +++ b/target/linux/ramips/image/mt7688.mk @@ -10,6 +10,14 @@ define Device/LinkIt7688 endef TARGET_DEVICES += LinkIt7688 +define Device/pbr-d1 + DTS := PBR-D1 + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := PBR-D1 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci +endef +TARGET_DEVICES += pbr-d1 + define Device/wrtnode2r DTS := WRTNODE2R IMAGE_SIZE := $(ralink_default_fw_size_16M)