ht-jsh_0211.patch 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. From e56218bff2d67efe4192f7b8d87525b101861194 Mon Sep 17 00:00:00 2001
  2. From: AmadeusGhost <[email protected]>
  3. Date: Fri, 2 Jun 2023 23:03:25 +0800
  4. Subject: [PATCH] ramips: add HT-JSH-0211 support
  5. Replace the boot loader to the breed of K2P.
  6. ---
  7. target/linux/ramips/Makefile | 2 +-
  8. .../linux/ramips/dts/mt7621_ht-jsh_0211.dts | 105 ++++++++++++++++++
  9. target/linux/ramips/image/mt7621.mk | 9 ++
  10. .../mt7621/base-files/etc/board.d/02_network | 4 +
  11. 4 files changed, 119 insertions(+), 1 deletion(-)
  12. create mode 100644 target/linux/ramips/dts/mt7621_ht-jsh_0211.dts
  13. diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
  14. index 3053906f68496..b336489f4da00 100644
  15. --- a/target/linux/ramips/Makefile
  16. +++ b/target/linux/ramips/Makefile
  17. @@ -18,6 +18,6 @@ define Target/Description
  18. endef
  19. include $(INCLUDE_DIR)/target.mk
  20. -DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug
  21. +DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug -procd-ujail
  22. $(eval $(call BuildTarget))
  23. diff --git a/target/linux/ramips/dts/mt7621_ht-jsh_0211.dts b/target/linux/ramips/dts/mt7621_ht-jsh_0211.dts
  24. new file mode 100644
  25. index 0000000000000..fa4d209e80e20
  26. --- /dev/null
  27. +++ b/target/linux/ramips/dts/mt7621_ht-jsh_0211.dts
  28. @@ -0,0 +1,105 @@
  29. +// SPDX-License-Identifier: GPL-2.0-only
  30. +
  31. +#include "mt7621.dtsi"
  32. +
  33. +#include <dt-bindings/gpio/gpio.h>
  34. +#include <dt-bindings/input/input.h>
  35. +
  36. +/ {
  37. + compatible = "ht-jsh,0211", "mediatek,mt7621-soc";
  38. + model = "HT-JSH-0211";
  39. +
  40. + keys {
  41. + compatible = "gpio-keys";
  42. +
  43. + reset {
  44. + label = "reset";
  45. + gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
  46. + linux,code = <KEY_RESTART>;
  47. + };
  48. + };
  49. +};
  50. +
  51. +&spi0 {
  52. + status = "okay";
  53. +
  54. + flash@0 {
  55. + compatible = "jedec,spi-nor";
  56. + reg = <0>;
  57. + spi-max-frequency = <50000000>;
  58. +
  59. + partitions {
  60. + compatible = "fixed-partitions";
  61. + #address-cells = <1>;
  62. + #size-cells = <1>;
  63. +
  64. + partition@0 {
  65. + label = "Bootloader";
  66. + reg = <0x0 0x30000>;
  67. + read-only;
  68. + };
  69. +
  70. + partition@30000 {
  71. + label = "Config";
  72. + reg = <0x30000 0x10000>;
  73. + read-only;
  74. + };
  75. +
  76. + factory: partition@40000 {
  77. + label = "Factory";
  78. + reg = <0x40000 0x10000>;
  79. + read-only;
  80. + };
  81. +
  82. + partition@50000 {
  83. + compatible = "denx,uimage";
  84. + label = "firmware";
  85. + reg = <0x50000 0xfb0000>;
  86. + };
  87. + };
  88. + };
  89. +};
  90. +
  91. +&pcie {
  92. + status = "okay";
  93. +};
  94. +
  95. +&pcie0 {
  96. + mt76@0,0 {
  97. + reg = <0x0000 0 0 0 0>;
  98. + mediatek,mtd-eeprom = <&factory 0x0>;
  99. + };
  100. +};
  101. +
  102. +&gmac0 {
  103. + mtd-mac-address = <&factory 0xe000>;
  104. +};
  105. +
  106. +&gmac1 {
  107. + mtd-mac-address = <&factory 0xe006>;
  108. + status = "okay";
  109. +};
  110. +
  111. +&gsw {
  112. + mediatek,portmap = "wllll";
  113. + status = "okay";
  114. +};
  115. +
  116. +&hnat {
  117. + mtketh-wan = "eth1";
  118. + mtketh-ppd = "eth0";
  119. + mtketh-lan = "eth0";
  120. + mtketh-max-gmac = <2>;
  121. + /delete-property/ mtkdsa-wan-port;
  122. +};
  123. +
  124. +&switch0 {
  125. + status = "disabled";
  126. +};
  127. +
  128. +&state_default {
  129. + gpio {
  130. + groups = "i2c";
  131. + function = "gpio";
  132. + };
  133. +};
  134. diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
  135. index 1908f60bc37bc..bc6a3ac05ae3a 100644
  136. --- a/target/linux/ramips/image/mt7621.mk
  137. +++ b/target/linux/ramips/image/mt7621.mk
  138. @@ -802,6 +802,15 @@ define Device/hiwifi_hc5962
  139. endef
  140. TARGET_DEVICES += hiwifi_hc5962
  141. +define Device/ht-jsh_0211
  142. + $(Device/dsa-migration)
  143. + IMAGE_SIZE := 16064k
  144. + DEVICE_VENDOR := HT-JSH
  145. + DEVICE_MODEL := 0211
  146. + DEVICE_PACKAGES := kmod-mt7603
  147. +endef
  148. +TARGET_DEVICES += ht-jsh_0211
  149. +
  150. define Device/iodata_wn-ax1167gr
  151. $(Device/dsa-migration)
  152. $(Device/uimage-lzma-loader)
  153. diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  154. index 37037c666d980..816e7c3dd2f4b 100644
  155. --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  156. +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  157. @@ -65,6 +65,10 @@ ramips_setup_interfaces()
  158. hatlab,gateboard-one)
  159. ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth4" "eth5"
  160. ;;
  161. + ht-jsh,0211)
  162. + ucidef_add_switch "switch0" \
  163. + "0:wan" "2:lan" "3:lan" "6u@eth0" "5u@eth1"
  164. + ;;
  165. linksys,re6500|\
  166. netgear,wac104)
  167. ucidef_set_interface_lan "lan1 lan2 lan3 lan4"