hc5611.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. From a8f3c97ce83dc97cd7acb040a715ecd75d824161 Mon Sep 17 00:00:00 2001
  2. From: Senis John <[email protected]>
  3. Date: Sat, 19 Nov 2022 11:30:54 +0800
  4. Subject: [PATCH] ramips: add support for HiWiFi HC5611
  5. CPU: MediaTek MT7628AN @ 575 MHz
  6. Flash: 16 MB
  7. RAM: 128 MB
  8. Ethernet: 10/100Mbps x 1
  9. Wlan: 300 Mbps
  10. USB: USB 2.0 x 1
  11. LED: red/green x 1
  12. Button: reset x 1
  13. 1. Open https://www.hiwifi.wtf/, Get Cloud token and unlock ssh
  14. 2. Upload the openwrt firmware to the router via SCP
  15. 3. Login the router via SSH
  16. 4. Run `mtd -r write path_to_firmware.bin firmware`
  17. I have tested on my device.
  18. - The LED will display RED on power-on, After system start completed, trun GREEN
  19. - Reset button working now. Long press after 5s will reset factory. Short press less 1s will reboot the device
  20. - USB can working under official u-boot
  21. Signed-off-by: Senis John <[email protected]>
  22. ---
  23. .../ramips/dts/mt7628an_hiwifi_hc5611.dts | 30 +++++++++++++++++++
  24. target/linux/ramips/image/mt76x8.mk | 8 +++++
  25. .../mt76x8/base-files/etc/board.d/01_leds | 3 ++
  26. .../mt76x8/base-files/etc/board.d/02_network | 2 ++
  27. .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 1 +
  28. 5 files changed, 44 insertions(+)
  29. create mode 100644 target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts
  30. diff --git a/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts b/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts
  31. new file mode 100644
  32. index 0000000000000..17de299b3cbc4
  33. --- /dev/null
  34. +++ b/target/linux/ramips/dts/mt7628an_hiwifi_hc5611.dts
  35. @@ -0,0 +1,30 @@
  36. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  37. +
  38. +#include "mt7628an_hiwifi_hc5x61a.dtsi"
  39. +
  40. +/ {
  41. + compatible = "hiwifi,hc5611", "mediatek,mt7628an-soc";
  42. + model = "HiWiFi HC5611";
  43. +
  44. + leds {
  45. + compatible = "gpio-leds";
  46. +
  47. + led_system: system {
  48. + label = "green:system";
  49. + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
  50. + default-state = "on";
  51. + };
  52. +
  53. + internet {
  54. + label = "red:internet";
  55. + gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
  56. + };
  57. + };
  58. +};
  59. +
  60. +&state_default {
  61. + gpio {
  62. + groups = "gpio", "spi cs1", "wdt";
  63. + function = "gpio";
  64. + };
  65. +};
  66. diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
  67. index 5e8d05b04283f..1b7e786b52b88 100644
  68. --- a/target/linux/ramips/image/mt76x8.mk
  69. +++ b/target/linux/ramips/image/mt76x8.mk
  70. @@ -243,6 +243,14 @@ define Device/hilink_hlk-7688a
  71. endef
  72. TARGET_DEVICES += hilink_hlk-7688a
  73. +define Device/hiwifi_hc5611
  74. + IMAGE_SIZE := 15808k
  75. + DEVICE_VENDOR := HiWiFi
  76. + DEVICE_MODEL := GO (HC5611)
  77. + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
  78. +endef
  79. +TARGET_DEVICES += hiwifi_hc5611
  80. +
  81. define Device/hiwifi_hc5661a
  82. IMAGE_SIZE := 15808k
  83. DEVICE_VENDOR := HiWiFi
  84. diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
  85. index 8a21756225acf..66628cea09f8d 100644
  86. --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
  87. +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
  88. @@ -46,6 +46,9 @@ skylab,skw92a)
  89. hilink,hlk-7688a)
  90. ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
  91. ;;
  92. +hiwifi,hc5611)
  93. + ucidef_set_led_netdev "internet" "internet" "red:internet" "br-lan" "tx rx"
  94. + ;;
  95. hiwifi,hc5661a|\
  96. hiwifi,hc5761a)
  97. ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10"
  98. diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
  99. index 38ff38bac5fea..d85cdf3db7fac 100644
  100. --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
  101. +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
  102. @@ -14,6 +14,7 @@ ramips_setup_interfaces()
  103. glinet,microuter-n300|\
  104. glinet,vixmini|\
  105. hak5,wifi-pineapple-mk7|\
  106. + hiwifi,hc5611|\
  107. mediatek,linkit-smart-7688|\
  108. minew,g1-c|\
  109. onion,omega2p|\
  110. @@ -226,6 +227,7 @@ ramips_setup_macs()
  111. zyxel,keenetic-extra-ii)
  112. wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
  113. ;;
  114. + hiwifi,hc5611|\
  115. hiwifi,hc5661a|\
  116. hiwifi,hc5761a|\
  117. hiwifi,hc5861b)
  118. diff --git a/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
  119. index b8f8faee9ca28..c9e205a0fc143 100644
  120. --- a/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
  121. +++ b/target/linux/ramips/mt76x8/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
  122. @@ -10,6 +10,7 @@ PHYNBR=${DEVPATH##*/phy}
  123. board=$(board_name)
  124. case "$board" in
  125. + hiwifi,hc5611|\
  126. hiwifi,hc5661a|\
  127. hiwifi,hc5761a|\
  128. hiwifi,hc5861b)