16-komi-a31.patch 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. From 7c939560f726f6cc5ebb2750a7dbd58bc36f2ecf Mon Sep 17 00:00:00 2001
  2. From: abandon-xyz <[email protected]>
  3. Date: Thu, 10 Aug 2023 17:07:43 +0800
  4. Subject: [PATCH] mediatek: filogic: add support for KONKA KOMI A31
  5. Signed-off-by: Chen Minqiang <[email protected]>
  6. ---
  7. .../mediatek/dts/mt7981b-konka-komi-a31.dts | 8 +
  8. .../filogic/base-files/etc/board.d/01_leds | 4 +
  9. .../filogic/base-files/etc/board.d/02_network | 2 +
  10. .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 6 +
  11. .../base-files/lib/upgrade/platform.sh | 1 +
  12. target/linux/mediatek/image/filogic.mk | 47 ++++
  13. 8 files changed, 322 insertions(+)
  14. create mode 100644 target/linux/mediatek/dts/mt7981b-konka-komi-a31.dts
  15. diff --git a/target/linux/mediatek/dts/mt7981b-konka-komi-a31.dts b/target/linux/mediatek/dts/mt7981b-konka-komi-a31.dts
  16. new file mode 100644
  17. index 0000000000000..6b1a260d9519e
  18. --- /dev/null
  19. +++ b/target/linux/mediatek/dts/mt7981b-konka-komi-a31.dts
  20. @@ -0,0 +1,247 @@
  21. +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
  22. +
  23. +/dts-v1/;
  24. +#include <dt-bindings/gpio/gpio.h>
  25. +#include <dt-bindings/input/input.h>
  26. +#include "mt7981.dtsi"
  27. +
  28. +/ {
  29. + model = "KONKA KOMI A31";
  30. + compatible = "konka,komi-a31", "mediatek,mt7981";
  31. +
  32. + aliases {
  33. + serial0 = &uart0;
  34. + led-boot = &status_red_led;
  35. + led-failsafe = &status_red_led;
  36. + led-running = &status_green_led;
  37. + led-upgrade = &status_green_led;
  38. + };
  39. +
  40. + chosen {
  41. + stdout-path = "serial0:115200n8";
  42. + };
  43. +
  44. + memory {
  45. + reg = <0 0x40000000 0 0x10000000>;
  46. + };
  47. +
  48. + leds {
  49. + compatible = "gpio-leds";
  50. +
  51. + status_green_led: led-0 {
  52. + label = "green:status";
  53. + gpios = <&pio 8 GPIO_ACTIVE_LOW>;
  54. + };
  55. +
  56. + status_blue_led: led-1 {
  57. + label = "blue:status";
  58. + gpios = <&pio 13 GPIO_ACTIVE_LOW>;
  59. + };
  60. +
  61. + status_red_led: led-2 {
  62. + label = "red:status";
  63. + gpios = <&pio 34 GPIO_ACTIVE_LOW>;
  64. + };
  65. + };
  66. +
  67. + gpio-keys {
  68. + compatible = "gpio-keys";
  69. +
  70. + button-reset {
  71. + label = "reset";
  72. + linux,code = <KEY_RESTART>;
  73. + gpios = <&pio 1 GPIO_ACTIVE_LOW>;
  74. + };
  75. +
  76. + button-mesh {
  77. + label = "mesh";
  78. + gpios = <&pio 0 GPIO_ACTIVE_LOW>;
  79. + linux,code = <BTN_9>;
  80. + linux,input-type = <EV_SW>;
  81. + };
  82. + };
  83. +};
  84. +
  85. +&eth {
  86. + status = "okay";
  87. +
  88. + gmac0: mac@0 {
  89. + compatible = "mediatek,eth-mac";
  90. + reg = <0>;
  91. + phy-mode = "2500base-x";
  92. +
  93. + nvmem-cells = <&macaddr_factory_2a>;
  94. + nvmem-cell-names = "mac-address";
  95. +
  96. + fixed-link {
  97. + speed = <2500>;
  98. + full-duplex;
  99. + pause;
  100. + };
  101. + };
  102. +
  103. + gmac1: mac@1 {
  104. + compatible = "mediatek,eth-mac";
  105. + reg = <1>;
  106. + phy-mode = "gmii";
  107. + phy-handle = <&int_gbe_phy>;
  108. +
  109. + nvmem-cells = <&macaddr_factory_24>;
  110. + nvmem-cell-names = "mac-address";
  111. + };
  112. +};
  113. +
  114. +&mdio_bus {
  115. + switch: switch@1f {
  116. + compatible = "mediatek,mt7531";
  117. + reg = <31>;
  118. + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
  119. + interrupt-controller;
  120. + #interrupt-cells = <1>;
  121. + interrupt-parent = <&pio>;
  122. + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
  123. + };
  124. +};
  125. +
  126. +&spi0 {
  127. + pinctrl-names = "default";
  128. + pinctrl-0 = <&spi0_flash_pins>;
  129. + status = "okay";
  130. +
  131. + spi_nand: spi_nand@0 {
  132. + #address-cells = <1>;
  133. + #size-cells = <1>;
  134. + compatible = "spi-nand";
  135. + reg = <0>;
  136. + spi-max-frequency = <52000000>;
  137. +
  138. + spi-tx-bus-width = <4>;
  139. + spi-rx-bus-width = <4>;
  140. +
  141. + spi-cal-enable;
  142. + spi-cal-mode = "read-data";
  143. + spi-cal-datalen = <7>;
  144. + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
  145. + spi-cal-addrlen = <5>;
  146. + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
  147. +
  148. + mediatek,nmbm;
  149. + mediatek,bmt-max-ratio = <1>;
  150. + mediatek,bmt-max-reserved-blocks = <64>;
  151. +
  152. + partitions {
  153. + compatible = "fixed-partitions";
  154. + #address-cells = <1>;
  155. + #size-cells = <1>;
  156. +
  157. + partition@0 {
  158. + label = "BL2";
  159. + reg = <0x00 0x100000>;
  160. + };
  161. +
  162. + partition@100000 {
  163. + label = "u-boot-env";
  164. + reg = <0x100000 0x80000>;
  165. + };
  166. +
  167. + factory: partition@180000 {
  168. + label = "Factory";
  169. + reg = <0x180000 0x200000>;
  170. +
  171. + nvmem-layout {
  172. + compatible = "fixed-layout";
  173. + #address-cells = <1>;
  174. + #size-cells = <1>;
  175. +
  176. + macaddr_factory_2a: macaddr@2a {
  177. + reg = <0x2a 0x6>;
  178. + };
  179. +
  180. + macaddr_factory_24: macaddr@24 {
  181. + reg = <0x24 0x6>;
  182. + };
  183. + };
  184. + };
  185. +
  186. + partition@380000 {
  187. + label = "FIP";
  188. + reg = <0x380000 0x200000>;
  189. + };
  190. +
  191. + partition@580000 {
  192. + label = "ubi";
  193. + reg = <0x580000 0x7000000>;
  194. + };
  195. + };
  196. + };
  197. +};
  198. +
  199. +&switch {
  200. + ports {
  201. + #address-cells = <1>;
  202. + #size-cells = <0>;
  203. +
  204. + port@0 {
  205. + reg = <0>;
  206. + label = "lan1";
  207. + };
  208. +
  209. + port@1 {
  210. + reg = <1>;
  211. + label = "lan2";
  212. + };
  213. +
  214. + port@2 {
  215. + reg = <2>;
  216. + label = "lan3";
  217. + };
  218. +
  219. + port@6 {
  220. + reg = <6>;
  221. + label = "cpu";
  222. + ethernet = <&gmac0>;
  223. + phy-mode = "2500base-x";
  224. +
  225. + fixed-link {
  226. + speed = <2500>;
  227. + full-duplex;
  228. + pause;
  229. + };
  230. + };
  231. + };
  232. +};
  233. +
  234. +&pio {
  235. + spi0_flash_pins: spi0-pins {
  236. + mux {
  237. + function = "spi";
  238. + groups = "spi0", "spi0_wp_hold";
  239. + };
  240. +
  241. + conf-pu {
  242. + pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
  243. + drive-strength = <8>;
  244. + mediatek,pull-up-adv = <0>; /* bias-disable */
  245. + };
  246. +
  247. + conf-pd {
  248. + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
  249. + drive-strength = <8>;
  250. + mediatek,pull-up-adv = <0>; /* bias-disable */
  251. + };
  252. + };
  253. +};
  254. +
  255. +&uart0 {
  256. + status = "okay";
  257. +};
  258. +
  259. +&watchdog {
  260. + status = "okay";
  261. +};
  262. +
  263. +&wifi {
  264. + status = "okay";
  265. +
  266. + mediatek,mtd-eeprom = <&factory 0x0>;
  267. +};
  268. diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
  269. index b5e5eca6afd12..33e52743d5bfe 100644
  270. --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
  271. +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
  272. @@ -40,6 +40,8 @@
  273. ;;
  274. abt,asr3000|\
  275. cmcc,rax3000m*|\
  276. + konka,komi-a31|\
  277. + imou,lc-hx3001|\
  278. h3c,magic-nx30-pro|\
  279. zbtlink,zbt-z8103ax)
  280. ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
  281. diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
  282. index 794944d1aa918..2ca44b55c21fa 100644
  283. --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
  284. +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
  285. @@ -121,6 +121,13 @@ case "$board" in
  286. [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress
  287. [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress
  288. ;;
  289. + imou,lc-hx3001)
  290. + addr=$(mtd_get_mac_ascii u-boot-env mac)
  291. + [ -n "$addr" ] || addr=$(macaddr_add $(mtd_get_mac_binary Factory 0x4) -1)
  292. + [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress
  293. + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress
  294. + ;;
  295. + konka,komi-a31|\
  296. nokia,ea0326gmp)
  297. addr=$(cat /sys/class/net/eth0/address)
  298. [ "$PHYNBR" = "0" ] && macaddr_add $addr 1 > /sys${DEVPATH}/macaddress