24-nradio-c8-660.patch 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. From 3d31be189645a68591b59c855b885fdbca77c7af Mon Sep 17 00:00:00 2001
  2. From: Chen Minqiang <[email protected]>
  3. Date: Sun, 8 Sep 2024 15:16:16 +0800
  4. Subject: [PATCH] mediatek: init add NRadio C8-660
  5. Signed-off-by: Chen Minqiang <[email protected]>
  6. ---
  7. .../mediatek/dts/mt7981b-nradio-c8-660.dts | 283 ++++++++++++++++++
  8. .../filogic/base-files/etc/board.d/01_leds | 4 +
  9. .../filogic/base-files/etc/board.d/02_network | 3 +
  10. target/linux/mediatek/image/filogic.mk | 16 +
  11. 4 files changed, 306 insertions(+)
  12. create mode 100644 target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts
  13. diff --git a/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts b/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts
  14. new file mode 100644
  15. index 0000000000000..576456f2f6e7c
  16. --- /dev/null
  17. +++ b/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts
  18. @@ -0,0 +1,283 @@
  19. +/dts-v1/;
  20. +
  21. +#include "mt7981.dtsi"
  22. +
  23. +/ {
  24. + model = "NRadio C8-660";
  25. + compatible = "nradio,c8-660", "mediatek,mt7981";
  26. +
  27. + aliases {
  28. + label-mac-device = &gmac0;
  29. + led-boot = &status_blue;
  30. + led-failsafe = &status_blue;
  31. + led-running = &status_blue;
  32. + led-upgrade = &status_blue;
  33. + serial0 = &uart0;
  34. + };
  35. +
  36. + chosen {
  37. + stdout-path = "serial0:115200n8";
  38. + };
  39. +
  40. + gpio-keys {
  41. + compatible = "gpio-keys";
  42. +
  43. + reset {
  44. + label = "reset";
  45. + linux,code = <KEY_RESTART>;
  46. + gpios = <&pio 1 GPIO_ACTIVE_LOW>;
  47. + };
  48. +
  49. + wps {
  50. + label = "wps";
  51. + linux,code = <KEY_WPS_BUTTON>;
  52. + gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
  53. + };
  54. + };
  55. +
  56. + gpio-export {
  57. + compatible = "gpio-export";
  58. +
  59. + cpepower {
  60. + gpio-export,name = "cpe-pwr";
  61. + gpio-export,output = <0>;
  62. + gpios = <&pio 25 GPIO_ACTIVE_LOW>;
  63. + };
  64. +
  65. + cpesel0 {
  66. + gpio-export,name = "cpe-sel0";
  67. + gpio-export,output = <1>;
  68. + gpios = <&pio 24 GPIO_ACTIVE_HIGH>;
  69. + };
  70. + };
  71. +
  72. + gpio-leds {
  73. + compatible = "gpio-leds";
  74. +
  75. + status_blue: status {
  76. + label = "blue:status";
  77. + gpios = <&pio 10 GPIO_ACTIVE_LOW>;
  78. + };
  79. +
  80. + cmode5 {
  81. + label = "blue:cmode5";
  82. + gpios = <&pio 11 GPIO_ACTIVE_LOW>;
  83. + };
  84. +
  85. + cmode4 {
  86. + label = "blue:cmode4";
  87. + gpios = <&pio 12 GPIO_ACTIVE_LOW>;
  88. + };
  89. +
  90. + wifi {
  91. + label = "blue:wifi";
  92. + gpios = <&pio 13 GPIO_ACTIVE_LOW>;
  93. + };
  94. + };
  95. +};
  96. +
  97. +&uart0 {
  98. + status = "okay";
  99. +};
  100. +
  101. +&watchdog {
  102. + status = "okay";
  103. +};
  104. +
  105. +&eth {
  106. + status = "okay";
  107. +
  108. + gmac0: mac@0 {
  109. + compatible = "mediatek,eth-mac";
  110. + reg = <0>;
  111. + phy-mode = "2500base-x";
  112. + nvmem-cells = <&macaddr_factory_4 (-1)>;
  113. + nvmem-cell-names = "mac-address";
  114. +
  115. + fixed-link {
  116. + speed = <2500>;
  117. + full-duplex;
  118. + pause;
  119. + };
  120. + };
  121. +
  122. + gmac1: mac@1 {
  123. + compatible = "mediatek,eth-mac";
  124. + reg = <1>;
  125. + phy-mode = "2500base-x";
  126. + phy-handle = <&phy21>;
  127. + nvmem-cells = <&macaddr_factory_4 (-2)>;
  128. + nvmem-cell-names = "mac-address";
  129. + };
  130. +};
  131. +
  132. +&mdio_bus {
  133. + reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>, <&pio 8 GPIO_ACTIVE_LOW>;
  134. + reset-delay-us = <600>;
  135. + reset-post-delay-us = <20000>;
  136. +
  137. + phy5: ethernet-phy@5 {
  138. + reg = <5>;
  139. + compatible = "ethernet-phy-ieee802.3-c45";
  140. + };
  141. +
  142. + phy21: ethernet-phy@21 {
  143. + reg = <21>;
  144. + compatible = "ethernet-phy-ieee802.3-c45";
  145. + };
  146. +
  147. + switch0: switch@1f {
  148. + compatible = "mediatek,mt7531";
  149. + reg = <31>;
  150. + dsa,member = <0 0>;
  151. + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>;
  152. + interrupt-controller;
  153. + #interrupt-cells = <1>;
  154. + interrupt-parent = <&pio>;
  155. + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
  156. + };
  157. +};
  158. +
  159. +&switch0 {
  160. + ports {
  161. + #address-cells = <1>;
  162. + #size-cells = <0>;
  163. +
  164. + port@1 {
  165. + reg = <1>;
  166. + label = "lan1";
  167. + };
  168. +
  169. + port@2 {
  170. + reg = <2>;
  171. + label = "lan2";
  172. + };
  173. +
  174. + port@3 {
  175. + reg = <3>;
  176. + label = "lan3";
  177. + };
  178. +
  179. + port@5 {
  180. + reg = <5>;
  181. + label = "lan4";
  182. + phy-mode = "2500base-x";
  183. + phy-handle = <&phy5>;
  184. + };
  185. +
  186. + port@6 {
  187. + reg = <6>;
  188. + ethernet = <&gmac0>;
  189. + phy-mode = "2500base-x";
  190. +
  191. + fixed-link {
  192. + speed = <2500>;
  193. + full-duplex;
  194. + pause;
  195. + };
  196. + };
  197. + };
  198. +};
  199. +
  200. +&spi0 {
  201. + pinctrl-names = "default";
  202. + pinctrl-0 = <&spi0_flash_pins>;
  203. + status = "okay";
  204. +
  205. + spi_nand: flash@0 {
  206. + #address-cells = <1>;
  207. + #size-cells = <1>;
  208. + compatible = "spi-nand";
  209. + reg = <0>;
  210. + spi-max-frequency = <52000000>;
  211. +
  212. + spi-cal-enable;
  213. + spi-cal-mode = "read-data";
  214. + spi-cal-datalen = <7>;
  215. + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>;
  216. + spi-cal-addrlen = <5>;
  217. + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
  218. +
  219. + spi-tx-bus-width = <4>;
  220. + spi-rx-bus-width = <4>;
  221. + mediatek,nmbm;
  222. + mediatek,bmt-max-ratio = <1>;
  223. + mediatek,bmt-max-reserved-blocks = <64>;
  224. +
  225. + partitions {
  226. + compatible = "fixed-partitions";
  227. + #address-cells = <1>;
  228. + #size-cells = <1>;
  229. +
  230. + partition@0 {
  231. + label = "BL2";
  232. + reg = <0x00000 0x0100000>;
  233. + read-only;
  234. + };
  235. +
  236. + partition@100000 {
  237. + label = "u-boot-env";
  238. + reg = <0x0100000 0x0080000>;
  239. + };
  240. +
  241. + factory: partition@180000 {
  242. + label = "Factory";
  243. + reg = <0x180000 0x0180000>;
  244. + read-only;
  245. +
  246. + nvmem-layout {
  247. + compatible = "fixed-layout";
  248. + #address-cells = <1>;
  249. + #size-cells = <1>;
  250. +
  251. + macaddr_factory_4: macaddr@4 {
  252. + compatible = "mac-base";
  253. + reg = <0x4 0x6>;
  254. + #nvmem-cell-cells = <1>;
  255. + };
  256. + };
  257. + };
  258. +
  259. + partition@300000 {
  260. + label = "bdinfo";
  261. + reg = <0x300000 0x0080000>;
  262. + };
  263. +
  264. + partition@380000 {
  265. + label = "FIP";
  266. + reg = <0x380000 0x0200000>;
  267. + read-only;
  268. + };
  269. +
  270. + partition@580000 {
  271. + label = "ubi";
  272. + //reg = <0x580000 0x7000000>;
  273. + reg = <0x580000 0x1f400000>;
  274. + compatible = "linux,ubi";
  275. + };
  276. + };
  277. + };
  278. +};
  279. +
  280. +&pio {
  281. + spi0_flash_pins: spi0-pins {
  282. + mux {
  283. + function = "spi";
  284. + groups = "spi0", "spi0_wp_hold";
  285. + };
  286. + };
  287. +};
  288. +
  289. +&usb_phy {
  290. + status = "okay";
  291. +};
  292. +
  293. +&xhci {
  294. + status = "okay";
  295. +};
  296. +
  297. +&wifi {
  298. + mediatek,mtd-eeprom = <&factory 0x0>;
  299. +
  300. + status = "okay";
  301. +};
  302. diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
  303. index ad274ea08f2e1..b4ed153266441 100644
  304. --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
  305. +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds
  306. @@ -75,6 +75,10 @@ nokia,ea0326gmp)
  307. ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link"
  308. ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "phy1-ap0" "link"
  309. ;;
  310. +nradio,c8-660)
  311. + ucidef_set_led_netdev "wifi" "WIFI" "blue:wifi" "phy0-ap0"
  312. + ucidef_set_led_netdev "5g" "5G" "blue:cmode5" "eth1" "link tx rx"
  313. + ;;
  314. openembed,som7981)
  315. ucidef_set_led_netdev "lanact" "LANACT" "green:lan" "eth1" "rx tx"
  316. ucidef_set_led_netdev "lanlink" "LANLINK" "amber:lan" "eth1" "link"
  317. 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
  318. index 96d58db867a96..198a84da3192c 100644
  319. --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
  320. +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
  321. @@ -100,6 +100,9 @@ mediatek_setup_interfaces()
  322. mercusys,mr90x-v1)
  323. ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1
  324. ;;
  325. + nradio,c8-660)
  326. + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1
  327. + ;;
  328. cudy,ap3000outdoor-v1|\
  329. cudy,re3000-v1|\
  330. netgear,wax220|\
  331. diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
  332. index e99d944a8603c..0275e25b974db 100644
  333. --- a/target/linux/mediatek/image/filogic.mk
  334. +++ b/target/linux/mediatek/image/filogic.mk
  335. @@ -1237,6 +1237,22 @@ define Device/nokia_ea0326gmp
  336. endef
  337. TARGET_DEVICES += nokia_ea0326gmp
  338. +define Device/nradio_c8-660
  339. + DEVICE_VENDOR := NRadio
  340. + DEVICE_MODEL := C8-660
  341. + DEVICE_DTS := mt7981b-nradio-c8-660
  342. + DEVICE_DTS_DIR := ../dts
  343. + UBINIZE_OPTS := -E 5
  344. + BLOCKSIZE := 128k
  345. + PAGESIZE := 2048
  346. + IMAGE_SIZE := 131072k
  347. + KERNEL_IN_UBI := 1
  348. + IMAGES += factory.bin
  349. + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
  350. + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  351. +endef
  352. +TARGET_DEVICES += nradio_c8-660
  353. +
  354. define Device/openembed_som7981
  355. DEVICE_VENDOR := OpenEmbed
  356. DEVICE_MODEL := SOM7981