mi-4a-gigabit-v2.patch 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. --- /dev/null
  2. +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit-v2.dts
  3. @@ -0,0 +1,157 @@
  4. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  5. +
  6. +#include "mt7621.dtsi"
  7. +
  8. +#include <dt-bindings/gpio/gpio.h>
  9. +#include <dt-bindings/input/input.h>
  10. +
  11. +/ {
  12. + compatible = "xiaomi,mi-router-4a-gigabit-v2", "mediatek,mt7621-soc";
  13. + model = "Xiaomi Mi Router 4A Gigabit Edition V2";
  14. +
  15. + aliases {
  16. + led-boot = &led_status_yellow;
  17. + led-failsafe = &led_status_yellow;
  18. + led-running = &led_status_blue;
  19. + led-upgrade = &led_status_yellow;
  20. + label-mac-device = &wan;
  21. + };
  22. +
  23. + chosen {
  24. + bootargs = "console=ttyS0,115200n8";
  25. + };
  26. +
  27. + leds {
  28. + compatible = "gpio-leds";
  29. +
  30. + led_status_blue: status_blue {
  31. + label = "blue:status";
  32. + gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
  33. + };
  34. +
  35. + led_status_yellow: status_yellow {
  36. + label = "yellow:status";
  37. + gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
  38. + };
  39. + };
  40. +
  41. + keys {
  42. + compatible = "gpio-keys";
  43. +
  44. + reset {
  45. + label = "reset";
  46. + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
  47. + linux,code = <KEY_RESTART>;
  48. + };
  49. + };
  50. +};
  51. +
  52. +&spi0 {
  53. + status = "okay";
  54. +
  55. + flash@0 {
  56. + compatible = "jedec,spi-nor";
  57. + reg = <0>;
  58. + spi-max-frequency = <50000000>;
  59. + m25p,fast-read;
  60. +
  61. + partitions {
  62. + compatible = "fixed-partitions";
  63. + #address-cells = <1>;
  64. + #size-cells = <1>;
  65. +
  66. + partition@0 {
  67. + label = "u-boot";
  68. + reg = <0x0 0x30000>;
  69. + read-only;
  70. + };
  71. +
  72. + partition@30000 {
  73. + label = "u-boot-env";
  74. + reg = <0x30000 0x10000>;
  75. + read-only;
  76. + };
  77. +
  78. + factory: partition@40000 {
  79. + label = "factory";
  80. + reg = <0x40000 0x10000>;
  81. + read-only;
  82. + };
  83. +
  84. + partition@50000 {
  85. + compatible = "denx,uimage";
  86. + label = "firmware";
  87. + reg = <0x50000 0xfb0000>;
  88. + };
  89. + };
  90. + };
  91. +};
  92. +
  93. +&pcie {
  94. + status = "okay";
  95. +};
  96. +
  97. +&pcie0 {
  98. + wifi@0,0 {
  99. + compatible = "pci14c3,7603";
  100. + reg = <0x0000 0 0 0 0>;
  101. + mediatek,mtd-eeprom = <&factory 0x0000>;
  102. + ieee80211-freq-limit = <2400000 2500000>;
  103. + };
  104. +};
  105. +
  106. +&pcie1 {
  107. + wifi@0,0 {
  108. + compatible = "pci14c3,7663";
  109. + reg = <0x0000 0 0 0 0>;
  110. + mediatek,mtd-eeprom = <&factory 0x8000>;
  111. + ieee80211-freq-limit = <5000000 6000000>;
  112. + };
  113. +};
  114. +
  115. +&gmac0 {
  116. + nvmem-cells = <&macaddr_factory_e000>;
  117. + nvmem-cell-names = "mac-address";
  118. +};
  119. +
  120. +&switch0 {
  121. + ports {
  122. + port@1 {
  123. + status = "okay";
  124. + label = "lan1";
  125. + };
  126. +
  127. + port@2 {
  128. + status = "okay";
  129. + label = "lan2";
  130. + };
  131. +
  132. + wan: port@3 {
  133. + status = "okay";
  134. + label = "wan";
  135. + nvmem-cells = <&macaddr_factory_e006>;
  136. + nvmem-cell-names = "mac-address";
  137. + };
  138. + };
  139. +};
  140. +
  141. +&state_default {
  142. + gpio {
  143. + groups = "jtag", "uart2", "uart3", "wdt";
  144. + function = "gpio";
  145. + };
  146. +};
  147. +
  148. +&factory {
  149. + compatible = "nvmem-cells";
  150. + #address-cells = <1>;
  151. + #size-cells = <1>;
  152. +
  153. + macaddr_factory_e000: macaddr@e000 {
  154. + reg = <0xe000 0x6>;
  155. + };
  156. +
  157. + macaddr_factory_e006: macaddr@e006 {
  158. + reg = <0xe006 0x6>;
  159. + };
  160. +};
  161. diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
  162. index 795f567c2bdb..40b56c58bb74 100644
  163. --- a/target/linux/ramips/image/mt7621.mk
  164. +++ b/target/linux/ramips/image/mt7621.mk
  165. @@ -1770,6 +1770,17 @@ define Device/xiaomi_mi-router-4a-gigabit
  166. endef
  167. TARGET_DEVICES += xiaomi_mi-router-4a-gigabit
  168. +define Device/xiaomi_mi-router-4a-gigabit-v2
  169. + $(Device/dsa-migration)
  170. + $(Device/uimage-lzma-loader)
  171. + IMAGE_SIZE := 16064k
  172. + DEVICE_VENDOR := Xiaomi
  173. + DEVICE_MODEL := Mi Router 4A
  174. + DEVICE_VARIANT := Gigabit Edition V2
  175. + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap
  176. +endef
  177. +TARGET_DEVICES += xiaomi_mi-router-4a-gigabit-v2
  178. +
  179. define Device/xiaomi_mi-router-ac2100
  180. $(Device/xiaomi_nand_separate)
  181. DEVICE_MODEL := Mi Router AC2100
  182. 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
  183. index dab53124c6ef..51d7af4eb787 100644
  184. --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  185. +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  186. @@ -38,7 +38,8 @@ ramips_setup_interfaces()
  187. xiaomi,mi-router-3g|\
  188. xiaomi,mi-router-3g-v2|\
  189. xiaomi,mi-router-4|\
  190. - xiaomi,mi-router-4a-gigabit)
  191. + xiaomi,mi-router-4a-gigabit|\
  192. + xiaomi,mi-router-4a-gigabit-v2)
  193. ucidef_set_interfaces_lan_wan "lan1 lan2" "wan"
  194. ;;
  195. beeline,smartbox-turbo-plus)