452-add-xiaomi-redmi-ax6s.patch 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. From 57dc777bddf0baf3c27177576c40b5113309ce54 Mon Sep 17 00:00:00 2001
  2. From: Chuanhong Guo <[email protected]>
  3. Date: Sat, 2 Mar 2024 20:30:16 +0800
  4. Subject: [PATCH] add xiaomi redmi ax6s
  5. ---
  6. arch/arm/dts/Makefile | 1 +
  7. .../dts/mt7622-xiaomi-redmi-router-ax6s.dts | 166 ++++++++++++++++++
  8. ...omi_redmi-router-ax6s-ubi-loader_defconfig | 98 +++++++++++
  9. xiaomi-redmi-router-ax6s-ubi-loader_env | 22 +++
  10. 4 files changed, 287 insertions(+)
  11. create mode 100644 arch/arm/dts/mt7622-xiaomi-redmi-router-ax6s.dts
  12. create mode 100644 configs/mt7622_xiaomi_redmi-router-ax6s-ubi-loader_defconfig
  13. create mode 100644 xiaomi-redmi-router-ax6s-ubi-loader_env
  14. --- a/arch/arm/dts/Makefile
  15. +++ b/arch/arm/dts/Makefile
  16. @@ -1425,6 +1425,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
  17. mt7622-linksys-e8450-ubi.dtb \
  18. mt7622-ubnt-unifi-6-lr.dtb \
  19. mt7622-ubnt-unifi-6-lr-v3.dtb \
  20. + mt7622-xiaomi-redmi-router-ax6s.dtb \
  21. mt7623n-bananapi-bpi-r2.dtb \
  22. mt7629-rfb.dtb \
  23. mt7981-rfb.dtb \
  24. --- /dev/null
  25. +++ b/arch/arm/dts/mt7622-xiaomi-redmi-router-ax6s.dts
  26. @@ -0,0 +1,166 @@
  27. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  28. +
  29. +/dts-v1/;
  30. +#include <dt-bindings/input/linux-event-codes.h>
  31. +#include <dt-bindings/leds/common.h>
  32. +#include "mt7622.dtsi"
  33. +#include "mt7622-u-boot.dtsi"
  34. +
  35. +/ {
  36. + #address-cells = <1>;
  37. + #size-cells = <1>;
  38. + model = "Xiaomi Redmi Router AX6S";
  39. + compatible = "xiaomi,redmi-router-ax6s", "mediatek,mt7622";
  40. +
  41. + chosen {
  42. + stdout-path = &uart0;
  43. + tick-timer = &timer0;
  44. + };
  45. +
  46. + aliases {
  47. + spi0 = &snand;
  48. + ethernet0 = &eth;
  49. + };
  50. +
  51. + memory@40000000 {
  52. + device_type = "memory";
  53. + reg = <0x40000000 0x8000000>;
  54. + };
  55. +
  56. + leds {
  57. + compatible = "gpio-leds";
  58. +
  59. + led_power_blue: power_blue {
  60. + function = LED_FUNCTION_POWER;
  61. + color = <LED_COLOR_ID_BLUE>;
  62. + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
  63. + };
  64. +
  65. + led_power_amber: power_amber {
  66. + function = LED_FUNCTION_POWER;
  67. + color = <LED_COLOR_ID_AMBER>;
  68. + gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
  69. + };
  70. +
  71. + led_net_blue: net_blue {
  72. + label = "blue:net";
  73. + gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
  74. + };
  75. +
  76. + led_net_amber: net_amber {
  77. + label = "amber:net";
  78. + gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
  79. + };
  80. +
  81. + };
  82. +
  83. + keys {
  84. + compatible = "gpio-keys";
  85. +
  86. + reset {
  87. + label = "reset";
  88. + gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
  89. + linux,code = <KEY_RESTART>;
  90. + };
  91. +
  92. + mesh {
  93. + label = "mesh";
  94. + gpios = <&gpio 102 GPIO_ACTIVE_LOW>;
  95. + linux,code = <BTN_9>;
  96. + linux,input-type = <EV_SW>;
  97. + };
  98. + };
  99. +
  100. + reg_1p8v: regulator-1p8v {
  101. + compatible = "regulator-fixed";
  102. + regulator-name = "fixed-1.8V";
  103. + regulator-min-microvolt = <1800000>;
  104. + regulator-max-microvolt = <1800000>;
  105. + regulator-boot-on;
  106. + regulator-always-on;
  107. + };
  108. +
  109. + reg_3p3v: regulator-3p3v {
  110. + compatible = "regulator-fixed";
  111. + regulator-name = "fixed-3.3V";
  112. + regulator-min-microvolt = <3300000>;
  113. + regulator-max-microvolt = <3300000>;
  114. + regulator-boot-on;
  115. + regulator-always-on;
  116. + };
  117. +};
  118. +
  119. +&pcie {
  120. + pinctrl-names = "default";
  121. + pinctrl-0 = <&pcie0_pins>;
  122. + status = "okay";
  123. +
  124. + pcie@0,0 {
  125. + status = "okay";
  126. + };
  127. +};
  128. +
  129. +&pinctrl {
  130. + pcie0_pins: pcie0-pins {
  131. + mux {
  132. + function = "pcie";
  133. + groups = "pcie0_pad_perst",
  134. + "pcie0_1_waken",
  135. + "pcie0_1_clkreq";
  136. + };
  137. + };
  138. +
  139. + snfi_pins: snfi-pins {
  140. + mux {
  141. + function = "flash";
  142. + groups = "snfi";
  143. + };
  144. + };
  145. +
  146. + uart0_pins: uart0 {
  147. + mux {
  148. + function = "uart";
  149. + groups = "uart0_0_tx_rx" ;
  150. + };
  151. + };
  152. +
  153. + watchdog_pins: watchdog-default {
  154. + mux {
  155. + function = "watchdog";
  156. + groups = "watchdog";
  157. + };
  158. + };
  159. +};
  160. +
  161. +&snand {
  162. + pinctrl-names = "default";
  163. + pinctrl-0 = <&snfi_pins>;
  164. + quad-spi;
  165. + status = "okay";
  166. +};
  167. +
  168. +&uart0 {
  169. + pinctrl-names = "default";
  170. + pinctrl-0 = <&uart0_pins>;
  171. + mediatek,force-highspeed;
  172. + status = "okay";
  173. +};
  174. +
  175. +&watchdog {
  176. + pinctrl-names = "default";
  177. + pinctrl-0 = <&watchdog_pins>;
  178. + status = "okay";
  179. +};
  180. +
  181. +&eth {
  182. + status = "okay";
  183. + mediatek,gmac-id = <0>;
  184. + phy-mode = "2500base-x";
  185. + mediatek,switch = "mt7531";
  186. + reset-gpios = <&gpio 54 GPIO_ACTIVE_HIGH>;
  187. +
  188. + fixed-link {
  189. + speed = <2500>;
  190. + full-duplex;
  191. + };
  192. +};
  193. --- /dev/null
  194. +++ b/configs/mt7622_xiaomi_redmi-router-ax6s-ubi-loader_defconfig
  195. @@ -0,0 +1,98 @@
  196. +CONFIG_ARM=y
  197. +CONFIG_SYS_HAS_NONCACHED_MEMORY=y
  198. +CONFIG_POSITION_INDEPENDENT=y
  199. +CONFIG_ARCH_MEDIATEK=y
  200. +CONFIG_TEXT_BASE=0x41e00000
  201. +CONFIG_SYS_MALLOC_F_LEN=0x4000
  202. +CONFIG_NR_DRAM_BANKS=1
  203. +CONFIG_DEFAULT_DEVICE_TREE="mt7622-xiaomi-redmi-router-ax6s"
  204. +CONFIG_PRE_CON_BUF_ADDR=0x4007EF00
  205. +CONFIG_DEBUG_UART_BASE=0x11002000
  206. +CONFIG_DEBUG_UART_CLOCK=25000000
  207. +CONFIG_SYS_LOAD_ADDR=0x40080000
  208. +CONFIG_PCI=y
  209. +CONFIG_DEBUG_UART=y
  210. +CONFIG_FIT=y
  211. +CONFIG_BOOTDELAY=30
  212. +CONFIG_AUTOBOOT_KEYED=y
  213. +CONFIG_DEFAULT_FDT_FILE="mediatek/mt7622-xiaomi-redmi-router-ax6s"
  214. +CONFIG_LOGLEVEL=7
  215. +CONFIG_PRE_CONSOLE_BUFFER=y
  216. +CONFIG_LOG=y
  217. +CONFIG_BOARD_LATE_INIT=y
  218. +CONFIG_LAST_STAGE_INIT=y
  219. +CONFIG_HUSH_PARSER=y
  220. +# CONFIG_AUTO_COMPLETE is not set
  221. +CONFIG_SYS_PROMPT="MT7622> "
  222. +CONFIG_CMD_LICENSE=y
  223. +CONFIG_CMD_ASKENV=y
  224. +CONFIG_CMD_ERASEENV=y
  225. +CONFIG_CMD_ENV_FLAGS=y
  226. +# CONFIG_CMD_UNLZ4 is not set
  227. +# CONFIG_CMD_UNZIP is not set
  228. +CONFIG_CMD_GPIO=y
  229. +CONFIG_CMD_MTD=y
  230. +# CONFIG_CMD_BOOTP is not set
  231. +CONFIG_CMD_TFTPSRV=y
  232. +CONFIG_CMD_PING=y
  233. +CONFIG_CMD_HASH=y
  234. +CONFIG_CMD_SMC=y
  235. +CONFIG_CMD_FS_GENERIC=y
  236. +CONFIG_CMD_FS_UUID=y
  237. +CONFIG_CMD_MTDPARTS=y
  238. +CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-nand0:512k(preloader),2816k(reserved),117248k(ubi)"
  239. +CONFIG_CMD_UBI=y
  240. +CONFIG_CMD_UBI_RENAME=y
  241. +CONFIG_DOS_PARTITION=y
  242. +CONFIG_EFI_PARTITION=y
  243. +CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
  244. +CONFIG_SYS_RELOC_GD_ENV_ADDR=y
  245. +CONFIG_USE_DEFAULT_ENV_FILE=y
  246. +CONFIG_DEFAULT_ENV_FILE="xiaomi-redmi-router-ax6s-ubi-loader_env"
  247. +CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
  248. +CONFIG_VERSION_VARIABLE=y
  249. +CONFIG_PROT_UDP=y
  250. +CONFIG_BOOTP_SEND_HOSTNAME=y
  251. +CONFIG_NET_RANDOM_ETHADDR=y
  252. +CONFIG_NETCONSOLE=y
  253. +CONFIG_USE_IPADDR=y
  254. +CONFIG_IPADDR="192.168.1.1"
  255. +CONFIG_USE_SERVERIP=y
  256. +CONFIG_SERVERIP="192.168.1.254"
  257. +CONFIG_REGMAP=y
  258. +CONFIG_SYSCON=y
  259. +CONFIG_BUTTON=y
  260. +CONFIG_BUTTON_GPIO=y
  261. +CONFIG_CLK=y
  262. +CONFIG_GPIO_HOG=y
  263. +CONFIG_LED=y
  264. +CONFIG_LED_BLINK=y
  265. +CONFIG_LED_GPIO=y
  266. +# CONFIG_MMC is not set
  267. +CONFIG_MTD=y
  268. +CONFIG_DM_MTD=y
  269. +CONFIG_MTK_SPI_NAND=y
  270. +CONFIG_MTK_SPI_NAND_MTD=y
  271. +CONFIG_UBI_SILENCE_MSG=y
  272. +CONFIG_MTD_UBI_FASTMAP=y
  273. +CONFIG_PHY_FIXED=y
  274. +CONFIG_MEDIATEK_ETH=y
  275. +CONFIG_PCIE_MEDIATEK=y
  276. +CONFIG_PHY=y
  277. +CONFIG_PINCTRL=y
  278. +CONFIG_PINCONF=y
  279. +CONFIG_PINCTRL_MT7622=y
  280. +CONFIG_POWER_DOMAIN=y
  281. +CONFIG_MTK_POWER_DOMAIN=y
  282. +CONFIG_DM_REGULATOR=y
  283. +CONFIG_DM_REGULATOR_FIXED=y
  284. +CONFIG_DM_REGULATOR_GPIO=y
  285. +CONFIG_RAM=y
  286. +CONFIG_DM_SERIAL=y
  287. +CONFIG_MTK_SERIAL=y
  288. +CONFIG_SPI=y
  289. +CONFIG_DM_SPI=y
  290. +CONFIG_UBIFS_SILENCE_MSG=y
  291. +CONFIG_LZ4=y
  292. +CONFIG_ZSTD=y
  293. +CONFIG_HEXDUMP=y
  294. --- /dev/null
  295. +++ b/xiaomi-redmi-router-ax6s-ubi-loader_env
  296. @@ -0,0 +1,22 @@
  297. +ipaddr=192.168.1.1
  298. +serverip=192.168.1.254
  299. +loadaddr=0x46000000
  300. +console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0
  301. +bootled_pwr=power_blue
  302. +bootled_rec=power_amber
  303. +bootcmd=run boot_or_recovery
  304. +bootconf=config-1
  305. +bootdelay=0
  306. +bootfile=openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-initramfs-recovery.itb
  307. +bootfile_upg=openwrt-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-sysupgrade.itb
  308. +boot_or_recovery=run boot_production ; led $bootled_pwr off ; led $bootled_rec on ; if ubi check fit ; then run boot_tftp_forever ; else run tftp_production ; fi
  309. +boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf
  310. +boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done
  311. +boot_production=run ubi_read_production && bootm $loadaddr#$bootconf
  312. +ubi_format=ubi detach ; mtd erase ubi && ubi part ubi
  313. +ubi_init=ubi part ubi || run ubi_format
  314. +ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
  315. +ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
  316. +ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic 2 && ubi write $loadaddr fit $filesize
  317. +ubi_read_production=run ubi_init && ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
  318. +tftp_production=tftpboot $loadaddr $bootfile_upg && iminfo $loadaddr && run ubi_write_production && reset