16-komi-a31.patch 7.2 KB

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