mi-router-hd.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x
  2. index 443a0e13d40de..d43c6d32e909b 100644
  3. --- a/package/boot/uboot-envtools/files/ipq806x
  4. +++ b/package/boot/uboot-envtools/files/ipq806x
  5. @@ -56,6 +56,10 @@ qcom,ipq8064-ap148|\
  6. qcom,ipq8064-db149)
  7. ubootenv_add_uci_config $(ubootenv_mtdinfo)
  8. ;;
  9. +xiaomi,mi-router-hd)
  10. + ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x20000"
  11. + ubootenv_add_uci_sys_config "/dev/mtd12" "0x0" "0x10000" "0x20000"
  12. + ;;
  13. ubnt,unifi-ac-hd|\
  14. zyxel,nbg6817)
  15. ubootenv_add_uci_config "/dev/mtdblock9" "0x0" "0x10000" "0x10000"
  16. @@ -63,6 +67,6 @@ zyxel,nbg6817)
  17. esac
  18. config_load ubootenv
  19. -config_foreach ubootenv_add_app_config ubootenv
  20. +config_foreach ubootenv_add_app_config
  21. exit 0
  22. diff --git a/target/linux/ipq806x/base-files/etc/board.d/02_network b/target/linux/ipq806x/base-files/etc/board.d/02_network
  23. index a408fc14ac133..4993321296463 100644
  24. --- a/target/linux/ipq806x/base-files/etc/board.d/02_network
  25. +++ b/target/linux/ipq806x/base-files/etc/board.d/02_network
  26. @@ -66,6 +66,13 @@ ipq806x_setup_interfaces()
  27. meraki,mr52)
  28. ucidef_set_interfaces_lan_wan "eth0" "eth1"
  29. ;;
  30. + xiaomi,mi-router-hd)
  31. + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
  32. + ucidef_set_network_device_conduit "lan1" "eth1"
  33. + ucidef_set_network_device_conduit "lan2" "eth1"
  34. + ucidef_set_network_device_conduit "lan3" "eth1"
  35. + ucidef_set_network_device_conduit "wan" "eth0"
  36. + ;;
  37. *)
  38. echo "Unsupported hardware. Network interfaces not intialized"
  39. ;;
  40. diff --git a/target/linux/ipq806x/base-files/etc/board.d/05_compat-version b/target/linux/ipq806x/base-files/etc/board.d/05_compat-version
  41. index caf65b96d20cf..f6ab9b882eee1 100644
  42. --- a/target/linux/ipq806x/base-files/etc/board.d/05_compat-version
  43. +++ b/target/linux/ipq806x/base-files/etc/board.d/05_compat-version
  44. @@ -32,7 +32,8 @@ case "$(board_name)" in
  45. tplink,vr2600v |\
  46. zyxel,nbg6817 |\
  47. asus,onhub |\
  48. - tplink,onhub)
  49. + tplink,onhub|\
  50. + xiaomi,mi-router-hd)
  51. ucidef_set_compat_version "1.1"
  52. ;;
  53. linksys,ea7500-v1 |\
  54. diff --git a/target/linux/ipq806x/base-files/etc/init.d/bootcount b/target/linux/ipq806x/base-files/etc/init.d/bootcount
  55. index ef3c6894e44ad..e07b8eae8ce34 100755
  56. --- a/target/linux/ipq806x/base-files/etc/init.d/bootcount
  57. +++ b/target/linux/ipq806x/base-files/etc/init.d/bootcount
  58. @@ -19,5 +19,13 @@ boot() {
  59. linksys,ea8500)
  60. mtd resetbc s_env || true
  61. ;;
  62. + xiaomi,mi-router-hd)
  63. + local boot_wait=$( fw_printenv boot_wait | cut -d = -f 2 )
  64. + [ "$boot_wait" != "on" ] && fw_setenv boot_wait on
  65. + local bootdelay=$( fw_printenv bootdelay | cut -d = -f 2 )
  66. + [ "$bootdelay" != "3" ] && fw_setenv bootdelay 3
  67. + local uart_en=$( fw_printenv uart_en | cut -d = -f 2 )
  68. + [ "$uart_en" != "1" ] && fw_setenv uart_en 1
  69. + ;;
  70. esac
  71. }
  72. diff --git a/target/linux/ipq806x/base-files/etc/init.d/hwmon_fancontrol b/target/linux/ipq806x/base-files/etc/init.d/hwmon_fancontrol
  73. new file mode 100644
  74. index 0000000000000..9b5017888aa1a
  75. --- /dev/null
  76. +++ b/target/linux/ipq806x/base-files/etc/init.d/hwmon_fancontrol
  77. @@ -0,0 +1,20 @@
  78. +#!/bin/sh /etc/rc.common
  79. +
  80. +START=98
  81. +
  82. +boot() {
  83. + local path_to_hwmon
  84. + # configuring onboard temp/fan controller to run the fan on its own
  85. + # for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
  86. +
  87. + case $(board_name) in
  88. + xiaomi,mi-router-hd)
  89. + path_to_hwmon="$( grep -l emc230 /sys/class/hwmon/hwmon*/name )"
  90. + if [ -n "$path_to_hwmon" ]; then
  91. + path_to_hwmon=$( dirname "$path_to_hwmon" 2>/dev/null )
  92. + # Set FAN speed to 80%
  93. + echo "204" > "$path_to_hwmon/pwm1"
  94. + fi
  95. + ;;
  96. + esac
  97. +}
  98. diff --git a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
  99. index b3a615a511b6b..e13b2fa2212af 100644
  100. --- a/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
  101. +++ b/target/linux/ipq806x/base-files/lib/upgrade/platform.sh
  102. @@ -22,7 +22,8 @@ platform_do_upgrade() {
  103. netgear,xr500 |\
  104. nokia,ac400i |\
  105. qcom,ipq8064-ap148 |\
  106. - qcom,ipq8064-ap161)
  107. + qcom,ipq8064-ap161 |\
  108. + xiaomi,mi-router-hd)
  109. nand_do_upgrade "$1"
  110. ;;
  111. asrock,g10)
  112. diff --git a/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-mi-router-hd.dts b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-mi-router-hd.dts
  113. new file mode 100644
  114. index 0000000000000..dbddabea49792
  115. --- /dev/null
  116. +++ b/target/linux/ipq806x/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq8064-mi-router-hd.dts
  117. @@ -0,0 +1,555 @@
  118. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  119. +
  120. +#include "qcom-ipq8064-v2.0-smb208.dtsi"
  121. +
  122. +#include <dt-bindings/input/input.h>
  123. +#include <dt-bindings/leds/common.h>
  124. +
  125. +/ {
  126. + model = "Xiaomi Mi Router HD (R3D)";
  127. + compatible = "xiaomi,mi-router-hd", "qcom,ipq8064";
  128. +
  129. + memory@0 {
  130. + device_type = "memory";
  131. + reg = <0x42000000 0x1e000000>;
  132. + };
  133. +
  134. + reserved-memory {
  135. + ramoops@42100000 {
  136. + compatible = "ramoops";
  137. + reg = <0x42100000 0x40000>;
  138. + record-size = <0x4000>;
  139. + console-size = <0x4000>;
  140. + ftrace-size = <0x4000>;
  141. + pmsg-size = <0x4000>;
  142. + };
  143. + };
  144. +
  145. + aliases {
  146. + label-mac-device = &gmac1;
  147. +
  148. + mdio-gpio0 = &mdio0;
  149. +
  150. + led-boot = &led_status_yellow;
  151. + led-failsafe = &led_status_red;
  152. + led-running = &led_status_blue;
  153. + led-upgrade = &led_status_yellow;
  154. + };
  155. +
  156. + chosen {
  157. + bootargs = "rootfstype=squashfs noinitrd";
  158. + };
  159. +
  160. + keys {
  161. + compatible = "gpio-keys";
  162. + pinctrl-0 = <&button_pins>;
  163. + pinctrl-names = "default";
  164. +
  165. + reset {
  166. + label = "reset";
  167. + gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>;
  168. + linux,code = <KEY_RESTART>;
  169. + debounce-interval = <60>;
  170. + wakeup-source;
  171. + };
  172. +
  173. + power {
  174. + label = "power";
  175. + gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
  176. + linux,code = <KEY_POWER>;
  177. + debounce-interval = <60>;
  178. + wakeup-source;
  179. + };
  180. + };
  181. +
  182. + leds {
  183. + compatible = "gpio-leds";
  184. + pinctrl-0 = <&led_pins>;
  185. + pinctrl-names = "default";
  186. +
  187. + led_status_red: led_status_red {
  188. + function = LED_FUNCTION_STATUS;
  189. + color = <LED_COLOR_ID_RED>;
  190. + gpios = <&qcom_pinmux 7 GPIO_ACTIVE_HIGH>;
  191. + };
  192. +
  193. + led_status_blue: led_status_blue {
  194. + function = LED_FUNCTION_STATUS;
  195. + color = <LED_COLOR_ID_BLUE>;
  196. + gpios = <&qcom_pinmux 8 GPIO_ACTIVE_HIGH>;
  197. + };
  198. +
  199. + led_status_yellow: led_status_yellow {
  200. + function = LED_FUNCTION_STATUS;
  201. + color = <LED_COLOR_ID_YELLOW>;
  202. + gpios = <&qcom_pinmux 9 GPIO_ACTIVE_HIGH>;
  203. + };
  204. + };
  205. +
  206. + i2c_gpio_0 { /* GSBI1 */
  207. + compatible = "i2c-gpio";
  208. + #address-cells = <1>;
  209. + #size-cells = <0>;
  210. + pinctrl-0 = <&i2c1_pins>;
  211. + pinctrl-names = "default";
  212. + sda-gpios = <&qcom_pinmux 53 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  213. + scl-gpios = <&qcom_pinmux 54 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  214. + i2c-gpio,delay-us = <5>;
  215. +
  216. + fan@2f {
  217. + compatible = "microchip,emc2305";
  218. + reg = <0x2f>;
  219. + emc2305,pwm-channel = <0>;
  220. + emc2305,pwm-min = <0>;
  221. + emc2305,pwm-max = <255>;
  222. + };
  223. + };
  224. +
  225. + i2c_gpio_1 { /* GSBI2 */
  226. + compatible = "i2c-gpio";
  227. + #address-cells = <1>;
  228. + #size-cells = <0>;
  229. + pinctrl-0 = <&i2c2_pins>;
  230. + pinctrl-names = "default";
  231. + sda-gpios = <&qcom_pinmux 24 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  232. + scl-gpios = <&qcom_pinmux 25 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  233. + i2c-gpio,delay-us = <5>;
  234. +
  235. + temp-sensor@48 {
  236. + compatible = "ti,tmp75";
  237. + reg = <0x48>;
  238. + #thermal-sensor-cells = <0>;
  239. + status = "okay";
  240. + };
  241. + };
  242. +};
  243. +
  244. +&CPU_SPC {
  245. + status = "disabled";
  246. +};
  247. +
  248. +&adm_dma {
  249. + status = "okay";
  250. +};
  251. +
  252. +&qcom_pinmux {
  253. + i2c1_pins: i2c1_pins { /* GSBI1 - EMC2301 */
  254. + mux {
  255. + pins = "gpio53", "gpio54";
  256. + function = "gsbi1";
  257. + drive-strength = <12>;
  258. + bias-none;
  259. + input;
  260. + };
  261. + };
  262. +
  263. + i2c2_pins: i2c2_pins { /* GSBI2 - TMP75 */
  264. + mux {
  265. + pins = "gpio24", "gpio25";
  266. + function = "gsbi2";
  267. + drive-strength = <12>;
  268. + bias-none;
  269. + input;
  270. + };
  271. + };
  272. +
  273. + button_pins: button_pins {
  274. + mux {
  275. + pins = "gpio16", "gpio68";
  276. + function = "gpio";
  277. + drive-strength = <2>;
  278. + bias-pull-up;
  279. + };
  280. + };
  281. +
  282. + led_pins: led_pins {
  283. + mux {
  284. + pins = "gpio7", "gpio8", "gpio9";
  285. + function = "gpio";
  286. + drive-strength = <2>;
  287. + bias-pull-up;
  288. + };
  289. + };
  290. +
  291. + usb_pwr_en_pins: usb_pwr_en_pins {
  292. + mux {
  293. + pins = "gpio56";
  294. + function = "gpio";
  295. + drive-strength = <12>;
  296. + bias-pull-up;
  297. + output-high;
  298. + };
  299. + };
  300. +};
  301. +
  302. +&sata_phy {
  303. + status = "okay";
  304. +};
  305. +
  306. +&sata {
  307. + status = "okay";
  308. +};
  309. +
  310. +&hs_phy_0 {
  311. + status = "okay";
  312. +};
  313. +
  314. +&ss_phy_0 {
  315. + status = "okay";
  316. +};
  317. +
  318. +&usb3_0 {
  319. + status = "okay";
  320. +};
  321. +
  322. +&hs_phy_1 {
  323. + status = "okay";
  324. +};
  325. +
  326. +&ss_phy_1 {
  327. + status = "okay";
  328. +};
  329. +
  330. +&usb3_1 {
  331. + status = "okay";
  332. + pinctrl-0 = <&usb_pwr_en_pins>;
  333. + pinctrl-names = "default";
  334. +};
  335. +
  336. +&pcie0 {
  337. + status = "okay";
  338. + reset-gpios = <&qcom_pinmux 3 GPIO_ACTIVE_LOW>;
  339. + pinctrl-0 = <&pcie0_pins>;
  340. + pinctrl-names = "default";
  341. +
  342. + bridge@0,0 {
  343. + reg = <0x00000000 0 0 0 0>;
  344. + #address-cells = <3>;
  345. + #size-cells = <2>;
  346. + ranges;
  347. +
  348. + wifi@1,0 {
  349. + compatible = "pci168c,0046";
  350. + reg = <0x00010000 0 0 0 0>;
  351. +
  352. + nvmem-cells = <&precal_art_1000>, <&macaddr_art_1006>;
  353. + nvmem-cell-names = "pre-calibration", "mac-address";
  354. + };
  355. + };
  356. +};
  357. +
  358. +&pcie1 {
  359. + status = "okay";
  360. + reset-gpios = <&qcom_pinmux 48 GPIO_ACTIVE_LOW>;
  361. + pinctrl-0 = <&pcie1_pins>;
  362. + pinctrl-names = "default";
  363. + max-link-speed = <1>;
  364. +
  365. + bridge@0,0 {
  366. + reg = <0x00000000 0 0 0 0>;
  367. + #address-cells = <3>;
  368. + #size-cells = <2>;
  369. + ranges;
  370. +
  371. + wifi@1,0 {
  372. + compatible = "pci168c,0040";
  373. + reg = <0x00010000 0 0 0 0>;
  374. +
  375. + nvmem-cells = <&precal_art_5000>, <&macaddr_art_5006>;
  376. + nvmem-cell-names = "pre-calibration", "mac-address";
  377. + };
  378. + };
  379. +};
  380. +
  381. +&nand {
  382. + status = "okay";
  383. +
  384. + nand@0 {
  385. + reg = <0>;
  386. + compatible = "qcom,nandcs";
  387. +
  388. + nand-bus-width = <8>;
  389. + nand-ecc-strength = <4>;
  390. + nand-ecc-step-size = <512>;
  391. +
  392. + nand-is-boot-medium;
  393. + qcom,boot-partitions = <0 0xf0000000>;
  394. +
  395. + partitions {
  396. + compatible = "fixed-partitions";
  397. + #address-cells = <1>;
  398. + #size-cells = <1>;
  399. +
  400. + partition@0 {
  401. + label = "SBL1";
  402. + reg = <0x0 0x40000>;
  403. + read-only;
  404. + };
  405. +
  406. + partition@40000 {
  407. + label = "MIBIB";
  408. + reg = <0x40000 0x80000>;
  409. + read-only;
  410. + };
  411. +
  412. + partition@c0000 {
  413. + label = "SBL2";
  414. + reg = <0xc0000 0x80000>;
  415. + read-only;
  416. + };
  417. +
  418. + partition@140000 {
  419. + label = "SBL3";
  420. + reg = <0x140000 0x80000>;
  421. + read-only;
  422. + };
  423. +
  424. + partition@1c0000 {
  425. + label = "DDRCONFIG";
  426. + reg = <0x1c0000 0x80000>;
  427. + read-only;
  428. + };
  429. +
  430. + partition@240000 {
  431. + label = "SSD";
  432. + reg = <0x240000 0x80000>;
  433. + read-only;
  434. + };
  435. +
  436. + partition@2c0000 {
  437. + label = "TZ";
  438. + reg = <0x2c0000 0x80000>;
  439. + read-only;
  440. + };
  441. +
  442. + partition@340000 {
  443. + label = "RPM";
  444. + reg = <0x340000 0x80000>;
  445. + read-only;
  446. + };
  447. +
  448. + partition@3c0000 {
  449. + label = "APPSBL";
  450. + reg = <0x3c0000 0x100000>;
  451. + read-only;
  452. + };
  453. +
  454. + partition@4c0000 {
  455. + label = "APPSBLENV";
  456. + reg = <0x4c0000 0x80000>;
  457. + };
  458. +
  459. + art: partition@540000 {
  460. + label = "ART";
  461. + reg = <0x540000 0x80000>;
  462. + read-only;
  463. +
  464. + nvmem-layout {
  465. + compatible = "fixed-layout";
  466. + #address-cells = <1>;
  467. + #size-cells = <1>;
  468. +
  469. + macaddr_art_0: macaddr@0 { /* WAN (label) */
  470. + compatible = "mac-base";
  471. + reg = <0x0 0x6>;
  472. + #nvmem-cell-cells = <1>;
  473. + };
  474. +
  475. + macaddr_art_6: macaddr@6 { /* LAN */
  476. + reg = <0x6 0x6>;
  477. + };
  478. +
  479. + macaddr_art_1006: macaddr@1006 { /* WiFi 2g */
  480. + reg = <0x1006 0x6>;
  481. + };
  482. +
  483. + macaddr_art_5006: macaddr@5006 { /* WiFi 5g */
  484. + reg = <0x5006 0x6>;
  485. + };
  486. +
  487. + precal_art_1000: precal@1000 {
  488. + reg = <0x1000 0x2f20>;
  489. + };
  490. +
  491. + precal_art_5000: precal@5000 {
  492. + reg = <0x5000 0x2f20>;
  493. + };
  494. + };
  495. + };
  496. +
  497. + partition@5c0000 {
  498. + label = "BOOTCONFIG";
  499. + reg = <0x5c0000 0x40000>;
  500. + read-only;
  501. + };
  502. +
  503. + partition@600000 {
  504. + label = "bdata";
  505. + reg = <0x600000 0x80000>;
  506. + };
  507. +
  508. + partition@680000 {
  509. + label = "crash";
  510. + reg = <0x680000 0x80000>;
  511. + read-only;
  512. + };
  513. +
  514. + partition@700000 {
  515. + label = "crash_syslog";
  516. + reg = <0x700000 0x80000>;
  517. + read-only;
  518. + };
  519. +
  520. + partition@780000 {
  521. + label = "rsvd";
  522. + reg = <0x780000 0x80000>;
  523. + read-only;
  524. + };
  525. +
  526. + partition@800000 {
  527. + label = "kernel_dup";
  528. + reg = <0x800000 0x400000>;
  529. + };
  530. +
  531. + partition@c00000 {
  532. + label = "kernel";
  533. + reg = <0xc00000 0x400000>;
  534. + };
  535. +
  536. + partition@1000000 {
  537. + label = "ubi";
  538. + reg = <0x1000000 0xf000000>;
  539. + };
  540. + };
  541. + };
  542. +};
  543. +
  544. +&mdio0 {
  545. + status = "okay";
  546. +
  547. + pinctrl-0 = <&mdio0_pins>;
  548. + pinctrl-names = "default";
  549. +
  550. + switch@10 {
  551. + compatible = "qca,qca8337";
  552. + #address-cells = <1>;
  553. + #size-cells = <0>;
  554. + reg = <0x10>;
  555. +
  556. + ports {
  557. + #address-cells = <1>;
  558. + #size-cells = <0>;
  559. +
  560. + port@0 {
  561. + reg = <0>;
  562. + label = "cpu";
  563. + ethernet = <&gmac1>;
  564. + phy-mode = "rgmii";
  565. + tx-internal-delay-ps = <1000>;
  566. + rx-internal-delay-ps = <1000>;
  567. +
  568. + fixed-link {
  569. + speed = <1000>;
  570. + full-duplex;
  571. + };
  572. + };
  573. +
  574. + port@1 {
  575. + reg = <1>;
  576. + label = "lan3";
  577. + phy-mode = "internal";
  578. + phy-handle = <&phy_port1>;
  579. + };
  580. +
  581. + port@2 {
  582. + reg = <2>;
  583. + label = "lan2";
  584. + phy-mode = "internal";
  585. + phy-handle = <&phy_port2>;
  586. + };
  587. +
  588. + port@3 {
  589. + reg = <3>;
  590. + label = "lan1";
  591. + phy-mode = "internal";
  592. + phy-handle = <&phy_port3>;
  593. + };
  594. +
  595. + port@5 {
  596. + reg = <5>;
  597. + label = "wan";
  598. + phy-mode = "internal";
  599. + phy-handle = <&phy_port5>;
  600. + };
  601. +
  602. + port@6 {
  603. + reg = <6>;
  604. + label = "cpu";
  605. + ethernet = <&gmac2>;
  606. + phy-mode = "sgmii";
  607. + qca,sgmii-enable-pll;
  608. +
  609. + fixed-link {
  610. + speed = <1000>;
  611. + full-duplex;
  612. + };
  613. + };
  614. + };
  615. +
  616. + mdio {
  617. + #address-cells = <1>;
  618. + #size-cells = <0>;
  619. +
  620. + phy_port1: phy@0 {
  621. + reg = <0>;
  622. + };
  623. +
  624. + phy_port2: phy@1 {
  625. + reg = <1>;
  626. + };
  627. +
  628. + phy_port3: phy@2 {
  629. + reg = <2>;
  630. + };
  631. +
  632. + phy_port4: phy@3 {
  633. + reg = <3>;
  634. + };
  635. +
  636. + phy_port5: phy@4 {
  637. + reg = <4>;
  638. + };
  639. + };
  640. + };
  641. +};
  642. +
  643. +&gmac1 {
  644. + status = "okay";
  645. + phy-mode = "rgmii";
  646. + qcom,id = <1>;
  647. +
  648. + pinctrl-0 = <&rgmii2_pins>;
  649. + pinctrl-names = "default";
  650. +
  651. + nvmem-cells = <&macaddr_art_0 0>;
  652. + nvmem-cell-names = "mac-address";
  653. +
  654. + fixed-link {
  655. + speed = <1000>;
  656. + full-duplex;
  657. + };
  658. +};
  659. +
  660. +&gmac2 {
  661. + status = "okay";
  662. + phy-mode = "sgmii";
  663. + qcom,id = <2>;
  664. +
  665. + nvmem-cells = <&macaddr_art_6 0>;
  666. + nvmem-cell-names = "mac-address";
  667. +
  668. + fixed-link {
  669. + speed = <1000>;
  670. + full-duplex;
  671. + };
  672. +};
  673. diff --git a/target/linux/ipq806x/image/generic.mk b/target/linux/ipq806x/image/generic.mk
  674. index 98e74e5b114c2..8f4ef5b7baec6 100644
  675. --- a/target/linux/ipq806x/image/generic.mk
  676. +++ b/target/linux/ipq806x/image/generic.mk
  677. @@ -547,6 +547,29 @@ define Device/ubnt_unifi-ac-hd
  678. endef
  679. TARGET_DEVICES += ubnt_unifi-ac-hd
  680. +define Device/xiaomi_mi-router-hd
  681. + $(call Device/LegacyImage)
  682. + $(Device/dsa-migration)
  683. + DEVICE_VENDOR := Xiaomi
  684. + DEVICE_MODEL := Mi Router HD (R3D)
  685. + SOC := qcom-ipq8064
  686. + BLOCKSIZE := 128k
  687. + PAGESIZE := 2048
  688. + KERNEL_SIZE := 4096k
  689. + IMAGE_SIZE := 86016k
  690. + BOARD_NAME := mi-router-hd
  691. + SUPPORTED_DEVICES += xiaomi,r3d
  692. + UBINIZE_OPTS := -E 5
  693. + IMAGES += factory.bin
  694. + IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | \
  695. + append-ubi | pad-to $$$$(BLOCKSIZE) | check-size
  696. + DEVICE_PACKAGES := kmod-i2c-gpio kmod-thermal kmod-hwmon-lm75 \
  697. + kmod-hwmon-emc2305 hwmon-drivetemp kmod-usb-storage-uas \
  698. + kmod-ramoops \
  699. + ath10k-firmware-qca9984-ct ath10k-firmware-qca99x0-ct
  700. +endef
  701. +TARGET_DEVICES += xiaomi_mi-router-hd
  702. +
  703. define Device/zyxel_nbg6817
  704. $(Device/dsa-migration)
  705. DEVICE_VENDOR := ZyXEL