Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JonnyHuangHe/77c9d52655635ca7c4f4c826c3d0ed10 to your computer and use it in GitHub Desktop.
Save JonnyHuangHe/77c9d52655635ca7c4f4c826c3d0ed10 to your computer and use it in GitHub Desktop.
From e68c35408f03a2ecd9c6868049b1edde12fb3439 Mon Sep 17 00:00:00 2001
Message-Id: <e68c35408f03a2ecd9c6868049b1edde12fb3439.1539152864.git.uavana@gmail.com>
From: Kavana Sum <[email protected]>
Date: Wed, 10 Oct 2018 13:21:04 +0800
Subject: [PATCH] support HC5611
---
.../ramips/base-files/etc/board.d/01_leds | 3 +
.../ramips/base-files/etc/board.d/02_network | 5 +
target/linux/ramips/base-files/lib/ramips.sh | 3 +
.../ramips/base-files/lib/upgrade/platform.sh | 1 +
target/linux/ramips/dts/HC5611.dts | 126 ++++++++++++++++++
target/linux/ramips/image/mt76x8.mk | 7 +
6 files changed, 145 insertions(+)
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 54504c6ee8..a175546741 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -211,6 +211,9 @@ gl-mt750)
gl-mt300n-v2)
set_wifi_led "$boardname:red:wlan"
;;
+hc5611)
+ ucidef_set_led_default "system" "system" "$boardname:green:system" "1"
+ ;;
hc5661|\
hc5661a)
ucidef_set_led_default "system" "system" "$boardname:blue:system" "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 76b6fe9f50..35bc4edeac 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -37,6 +37,10 @@ ramips_setup_interfaces()
ucidef_add_switch "switch0" \
"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan:5" "6@eth0"
;;
+ hc5611)
+ ucidef_add_switch "switch0" \
+ "3:lan" "6@eth0"
+ ;;
3g150b|\
3g300m|\
a5-v11|\
@@ -465,6 +469,7 @@ ramips_setup_macs()
wan_mac=$(mtd_get_mac_binary factory 4)
;;
hc5*61|\
+ hc5611|\
hc5661a|\
hc5962)
lan_mac=`mtd_get_mac_ascii bdinfo "Vfac_mac "`
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 5741cbd2ee..c23abb986a 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -217,6 +217,9 @@ ramips_board_detect() {
*"GL-MT300N-V2")
name="gl-mt300n-v2"
;;
+ *"HC5611")
+ name="hc5611"
+ ;;
*"HC5661")
name="hc5661"
;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index ffdc5e73e0..7ea460b64e 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -70,6 +70,7 @@ platform_check_image() {
gl-mt750|\
gl-mt300n-v2|\
hc5*61|\
+ hc5611|\
hc5661a|\
hg255d|\
hlk-rm04|\
diff --git a/target/linux/ramips/dts/HC5611.dts b/target/linux/ramips/dts/HC5611.dts
new file mode 100644
index 0000000000..79699607f0
--- /dev/null
+++ b/target/linux/ramips/dts/HC5611.dts
@@ -0,0 +1,126 @@
+/dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ compatible = "hiwifi,hc5611", "mediatek,mt7628an-soc";
+ model = "HiWiFi HC5611";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x8000000>;
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ system {
+ label = "hc5611:green:system";
+ gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ gpio_export {
+ compatible = "gpio-export";
+ #size-cells = <0>;
+
+ power-led {
+ gpio-export,name = "power-led";
+ gpio-export,output = <1>;
+ gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys-polled";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ poll-interval = <20>;
+
+ reset {
+ label = "reset";
+ gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+ };
+};
+
+&pinctrl {
+ state_default: pinctrl0 {
+ gpio {
+ ralink,group = "i2c", "refclk", "wled_an";
+ ralink,function = "gpio";
+ };
+ };
+};
+
+&spi0 {
+ status = "okay";
+
+ m25p80@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ linux,modalias = "m25p80", "w25q128";
+ spi-max-frequency = <10000000>;
+ m25p,chunked-io = <32>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x30000>;
+ read-only;
+ };
+
+ partition@30000 {
+ label = "hw_panic";
+ reg = <0x30000 0x10000>;
+ read-only;
+ };
+
+ factory: partition@40000 {
+ label = "factory";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ partition@50000 {
+ label = "firmware";
+ reg = <0x50000 0xf70000>;
+ };
+
+ partition@fc0000 {
+ label = "oem";
+ reg = <0xfc0000 0x20000>;
+ read-only;
+ };
+
+ bdinfo: partition@fe0000 {
+ label = "bdinfo";
+ reg = <0xfe0000 0x10000>;
+ read-only;
+ };
+
+ partition@ff0000 {
+ label = "backup";
+ reg = <0xff0000 0x10000>;
+ read-only;
+ };
+ };
+};
+
+&ethernet {
+ mtd-mac-address = <&factory 0x4>;
+ mediatek,portmap = "wllll";
+};
+
+&wmac {
+ status = "okay";
+};
\ No newline at end of file
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 21c5357a08..4f168e3cc9 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -57,6 +57,13 @@ define Device/hc5661a
endef
TARGET_DEVICES += hc5661a
+define Device/hc5611
+ DTS := HC5611
+ IMAGE_SIZE := $(ralink_default_fw_size_16M)
+ DEVICE_TITLE := HiWiFi HC5611
+endef
+TARGET_DEVICES += hc5611
+
define Device/LinkIt7688
DTS := LINKIT7688
IMAGE_SIZE := $(ralink_default_fw_size_32M)
--
2.17.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment