You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

198 lines
6.1 KiB

3 months ago
  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
  2. index f743ce851a..1592644faa 100755
  3. --- a/target/linux/ramips/base-files/etc/board.d/02_network
  4. +++ b/target/linux/ramips/base-files/etc/board.d/02_network
  5. @@ -311,7 +311,8 @@ ramips_setup_interfaces()
  6. ucidef_add_switch "switch0" \
  7. "4:lan" "6t@eth0"
  8. ;;
  9. - cudy,wr1000)
  10. + cudy,wr1000|\
  11. + xiaomi,mir3g-v2))
  12. ucidef_add_switch "switch0" \
  13. "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
  14. ;;
  15. @@ -687,6 +688,9 @@ ramips_setup_macs()
  16. xiaomi,mir3p)
  17. lan_mac=$(mtd_get_mac_binary Factory 0xe006)
  18. ;;
  19. + xiaomi,mir3g-v2)
  20. + wan_mac=$(mtd_get_mac_binary factory 0xe006)
  21. + ;;
  22. zyxel,keenetic-start)
  23. wan_mac=$(mtd_get_mac_binary factory 40)
  24. ;;
  25. diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts
  26. new file mode 100644
  27. index 0000000000..6e06ed07e8
  28. --- /dev/null
  29. +++ b/target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts
  30. @@ -0,0 +1,145 @@
  31. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  32. +/dts-v1/;
  33. +
  34. +#include "mt7621.dtsi"
  35. +
  36. +#include <dt-bindings/gpio/gpio.h>
  37. +#include <dt-bindings/input/input.h>
  38. +
  39. +/ {
  40. + compatible = "xiaomi,mir3g-v2", "mediatek,mt7621-soc";
  41. + model = "Xiaomi Mi Router 3G v2";
  42. +
  43. + aliases {
  44. + led-boot = &led_status_yellow;
  45. + led-failsafe = &led_status_yellow;
  46. + led-running = &led_status_blue;
  47. + led-upgrade = &led_status_yellow;
  48. + };
  49. +
  50. + chosen {
  51. + bootargs = "console=ttyS0,115200n8";
  52. + };
  53. +
  54. + leds {
  55. + compatible = "gpio-leds";
  56. +
  57. + led_status_blue: status_blue {
  58. + label = "mir3gv2:blue:status";
  59. + gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
  60. + };
  61. +
  62. + led_status_yellow: status_yellow {
  63. + label = "mir3gv2:yellow:status";
  64. + gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
  65. + };
  66. + };
  67. +
  68. + keys {
  69. + compatible = "gpio-keys";
  70. +
  71. + reset {
  72. + label = "reset";
  73. + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
  74. + linux,code = <KEY_RESTART>;
  75. + };
  76. + };
  77. +};
  78. +
  79. +&spi0 {
  80. + status = "okay";
  81. +
  82. + m25p80@0 {
  83. + compatible = "jedec,spi-nor";
  84. + reg = <0>;
  85. + spi-max-frequency = <80000000>;
  86. +
  87. + partitions {
  88. + compatible = "fixed-partitions";
  89. + #address-cells = <1>;
  90. + #size-cells = <1>;
  91. +
  92. + partition@0 {
  93. + label = "u-boot";
  94. + reg = <0x0 0x30000>;
  95. + read-only;
  96. + };
  97. +
  98. + partition@30000 {
  99. + label = "u-boot-env";
  100. + reg = <0x30000 0x10000>;
  101. + read-only;
  102. + };
  103. +
  104. + partition@40000 {
  105. + label = "Bdata";
  106. + reg = <0x40000 0x10000>;
  107. + read-only;
  108. + };
  109. +
  110. + factory: partition@50000 {
  111. + label = "factory";
  112. + reg = <0x50000 0x10000>;
  113. + read-only;
  114. + };
  115. +
  116. + partition@60000 {
  117. + label = "crash";
  118. + reg = <0x60000 0x10000>;
  119. + read-only;
  120. + };
  121. +
  122. + partition@70000 {
  123. + label = "cfg_bak";
  124. + reg = <0x70000 0x10000>;
  125. + read-only;
  126. + };
  127. +
  128. + partition@80000 {
  129. + label = "overlay";
  130. + reg = <0x80000 0x100000>;
  131. + read-only;
  132. + };
  133. +
  134. + firmware: partition@180000 {
  135. + compatible = "denx,uimage";
  136. + label = "firmware";
  137. + reg = <0x180000 0xe80000>;
  138. + };
  139. + };
  140. + };
  141. +};
  142. +
  143. +&pcie {
  144. + status = "okay";
  145. +};
  146. +
  147. +&pcie0 {
  148. + wifi@0,0 {
  149. + compatible = "pci14c3,7662";
  150. + reg = <0x0000 0 0 0 0>;
  151. + mediatek,mtd-eeprom = <&factory 0x8000>;
  152. + ieee80211-freq-limit = <5000000 6000000>;
  153. + };
  154. +};
  155. +
  156. +&pcie1 {
  157. + wifi@0,0 {
  158. + compatible = "pci14c3,7603";
  159. + reg = <0x0000 0 0 0 0>;
  160. + mediatek,mtd-eeprom = <&factory 0x0000>;
  161. + ieee80211-freq-limit = <2400000 2500000>;
  162. + };
  163. +};
  164. +
  165. +&ethernet {
  166. + mtd-mac-address = <&factory 0xe000>;
  167. + mediatek,portmap = "llllw";
  168. +};
  169. +
  170. +&state_default {
  171. + gpio {
  172. + ralink,group = "jtag", "uart2", "uart3", "wdt";
  173. + ralink,function = "gpio";
  174. + };
  175. +};
  176. diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
  177. index 28ae0d451f..1ac8691f42 100644
  178. --- a/target/linux/ramips/image/mt7621.mk
  179. +++ b/target/linux/ramips/image/mt7621.mk
  180. @@ -298,6 +298,18 @@ define Device/xiaomi_mir3g
  181. endef
  182. TARGET_DEVICES += xiaomi_mir3g
  183. +define Device/xiaomi_mir3g-v2
  184. + DTS := mt7621_xiaomi_mir3g-v2
  185. + IMAGE_SIZE := 14848k
  186. + KERNEL_SIZE := 4096k
  187. + BOARD_NAME := mir3g-v2
  188. + DEVICE_TITLE := Xiaomi Mi Router 3G v2
  189. + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 wpad-basic
  190. + IMAGES += factory.bin
  191. + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-rootfs | pad-rootfs
  192. +endef
  193. +TARGET_DEVICES += xiaomi_mir3g-v2
  194. +
  195. define Device/mt7621
  196. DTS := MT7621
  197. BLOCKSIZE := 64k