hc5611.patch 4.5 KB

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