zte_e8820s.patch 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. diff --git a/target/linux/ramips/dts/mt7621_zte_e8820s.dts b/target/linux/ramips/dts/mt7621_zte_e8820s.dts
  2. new file mode 100644
  3. index 000000000000..5a0012441509
  4. --- /dev/null
  5. +++ b/target/linux/ramips/dts/mt7621_zte_e8820s.dts
  6. @@ -0,0 +1,188 @@
  7. +#include "mt7621.dtsi"
  8. +
  9. +#include <dt-bindings/gpio/gpio.h>
  10. +#include <dt-bindings/input/input.h>
  11. +
  12. +/ {
  13. + compatible = "zte,e8820s", "mediatek,mt7621-soc";
  14. + model = "ZTE E8820S";
  15. +
  16. + aliases {
  17. + led-boot = &led_sys;
  18. + led-failsafe = &led_sys;
  19. + led-running = &led_sys;
  20. + led-upgrade = &led_sys;
  21. + };
  22. +
  23. + leds {
  24. + compatible = "gpio-leds";
  25. +
  26. + led_sys: sys {
  27. + label = "white:sys";
  28. + gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
  29. + };
  30. +
  31. + };
  32. +
  33. + keys {
  34. + compatible = "gpio-keys";
  35. +
  36. + reset {
  37. + label = "reset";
  38. + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
  39. + linux,code = <KEY_RESTART>;
  40. + };
  41. +
  42. + wps {
  43. + label = "wps";
  44. + gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
  45. + linux,code = <KEY_WPS_BUTTON>;
  46. + };
  47. +
  48. + wifi {
  49. + label = "wifi";
  50. + gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
  51. + linux,code = <KEY_RFKILL>;
  52. + };
  53. + };
  54. +};
  55. +
  56. +&nand {
  57. + status = "okay";
  58. +
  59. + partitions {
  60. + compatible = "fixed-partitions";
  61. + #address-cells = <1>;
  62. + #size-cells = <1>;
  63. +
  64. + partition@0 {
  65. + label = "u-boot";
  66. + reg = <0x0 0x80000>;
  67. + read-only;
  68. + };
  69. +
  70. + partition@80000 {
  71. + label = "u-boot-env";
  72. + reg = <0x80000 0x80000>;
  73. + read-only;
  74. + };
  75. +
  76. + factory: partition@100000 {
  77. + label = "factory";
  78. + reg = <0x100000 0x40000>;
  79. + read-only;
  80. + };
  81. +
  82. + partition@140000 {
  83. + label = "kernel";
  84. + reg = <0x140000 0x400000>;
  85. + };
  86. +
  87. + partition@540000 {
  88. + label = "ubi";
  89. + reg = <0x540000 0x7A00000>;
  90. + };
  91. + };
  92. +};
  93. +
  94. +&pcie {
  95. + status = "okay";
  96. + reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>,
  97. + <&gpio 4 GPIO_ACTIVE_LOW>;
  98. +};
  99. +
  100. +&pcie0 {
  101. + wifi@0,0 {
  102. + compatible = "mediatek,mt76";
  103. + reg = <0x0000 0 0 0 0>;
  104. + mediatek,mtd-eeprom = <&factory 0x0000>;
  105. + nvmem-cells = <&macaddr_factory_e000>;
  106. + nvmem-cell-names = "mac-address";
  107. +
  108. + led {
  109. + led-active-low;
  110. + };
  111. + };
  112. +};
  113. +
  114. +&pcie1 {
  115. + wifi@0,0 {
  116. + compatible = "mediatek,mt76";
  117. + reg = <0x0000 0 0 0 0>;
  118. + mediatek,mtd-eeprom = <&factory 0x8000>;
  119. + nvmem-cells = <&macaddr_factory_e006>;
  120. + nvmem-cell-names = "mac-address";
  121. + ieee80211-freq-limit = <5000000 6000000>;
  122. +
  123. + led {
  124. + led-sources = <2>;
  125. + led-active-low;
  126. + };
  127. + };
  128. +};
  129. +
  130. +&gmac0 {
  131. + nvmem-cells = <&macaddr_factory_e000>;
  132. + nvmem-cell-names = "mac-address";
  133. +};
  134. +
  135. +&gmac1 {
  136. + status = "okay";
  137. + label = "wan";
  138. + phy-handle = <&ethphy4>;
  139. +
  140. + nvmem-cells = <&macaddr_factory_e000>;
  141. + nvmem-cell-names = "mac-address";
  142. + mac-address-increment = <1>;
  143. +};
  144. +
  145. +&mdio {
  146. + ethphy4: ethernet-phy@4 {
  147. + reg = <4>;
  148. + };
  149. +};
  150. +
  151. +&switch0 {
  152. + ports {
  153. + port@0 {
  154. + status = "okay";
  155. + label = "lan1";
  156. + };
  157. +
  158. + port@1 {
  159. + status = "okay";
  160. + label = "lan2";
  161. + };
  162. +
  163. + port@2 {
  164. + status = "okay";
  165. + label = "lan3";
  166. + };
  167. +
  168. + port@3 {
  169. + status = "okay";
  170. + label = "lan4";
  171. + };
  172. + };
  173. +};
  174. +
  175. +&state_default {
  176. + gpio {
  177. + groups = "i2c", "jtag", "uart2", "uart3", "wdt";
  178. + function = "gpio";
  179. + };
  180. +};
  181. +
  182. +&factory {
  183. + compatible = "nvmem-cells";
  184. + #address-cells = <1>;
  185. + #size-cells = <1>;
  186. +
  187. + macaddr_factory_e000: macaddr@e000 {
  188. + reg = <0xe000 0x6>;
  189. + };
  190. +
  191. + macaddr_factory_e006: macaddr@e006 {
  192. + reg = <0xe006 0x6>;
  193. + };
  194. +};
  195. diff --git a/target/linux/ramips/dts/mt7621_zte_e8820v2.dts b/target/linux/ramips/dts/mt7621_zte_e8820v2.dts
  196. new file mode 100644
  197. index 000000000000..5a0012441509
  198. --- /dev/null
  199. +++ b/target/linux/ramips/dts/mt7621_zte_e8820v2.dts
  200. @@ -0,0 +1,181 @@
  201. +#include "mt7621.dtsi"
  202. +
  203. +#include <dt-bindings/gpio/gpio.h>
  204. +#include <dt-bindings/input/input.h>
  205. +
  206. +/ {
  207. + compatible = "zte,e8820v2", "mediatek,mt7621-soc";
  208. + model = "ZTE E8820V2";
  209. +
  210. + aliases {
  211. + led-boot = &led_sys;
  212. + led-failsafe = &led_sys;
  213. + led-running = &led_sys;
  214. + led-upgrade = &led_sys;
  215. + };
  216. +
  217. + leds {
  218. + compatible = "gpio-leds";
  219. +
  220. + led_sys: sys {
  221. + label = "white:sys";
  222. + gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
  223. + };
  224. +
  225. + led_power: power {
  226. + label = "white:power";
  227. + gpios = <&gpio 31 GPIO_ACTIVE_LOW>;
  228. + };
  229. + };
  230. +
  231. + keys {
  232. + compatible = "gpio-keys";
  233. +
  234. + reset {
  235. + label = "reset";
  236. + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
  237. + linux,code = <KEY_RESTART>;
  238. + };
  239. +
  240. + wps {
  241. + label = "wps";
  242. + gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
  243. + linux,code = <KEY_WPS_BUTTON>;
  244. + };
  245. + };
  246. +};
  247. +
  248. +&spi0 {
  249. + status = "okay";
  250. +
  251. + flash@0 {
  252. + compatible = "jedec,spi-nor";
  253. + reg = <0>;
  254. + spi-max-frequency = <10000000>;
  255. + broken-flash-reset;
  256. +
  257. + partitions {
  258. + compatible = "fixed-partitions";
  259. + #address-cells = <1>;
  260. + #size-cells = <1>;
  261. +
  262. + partition@0 {
  263. + label = "u-boot";
  264. + reg = <0x0 0x30000>;
  265. + read-only;
  266. + };
  267. +
  268. + partition@30000 {
  269. + label = "u-boot-env";
  270. + reg = <0x30000 0x10000>;
  271. + read-only;
  272. + };
  273. +
  274. + factory: partition@40000 {
  275. + label = "factory";
  276. + reg = <0x40000 0x10000>;
  277. + read-only;
  278. + };
  279. +
  280. + partition@50000 {
  281. + compatible = "denx,uimage";
  282. + label = "firmware";
  283. + reg = <0x50000 0xfb0000>;
  284. + };
  285. + };
  286. + };
  287. +};
  288. +
  289. +&pcie {
  290. + status = "okay";
  291. + reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>,
  292. + <&gpio 4 GPIO_ACTIVE_LOW>;
  293. +};
  294. +
  295. +&pcie0 {
  296. + wifi@0,0 {
  297. + compatible = "mediatek,mt76";
  298. + reg = <0x0000 0 0 0 0>;
  299. + mediatek,mtd-eeprom = <&factory 0x0000>;
  300. + nvmem-cells = <&macaddr_factory_e000>;
  301. + nvmem-cell-names = "mac-address";
  302. +
  303. + led {
  304. + led-active-low;
  305. + };
  306. + };
  307. +};
  308. +
  309. +&pcie1 {
  310. + wifi@0,0 {
  311. + compatible = "mediatek,mt76";
  312. + reg = <0x0000 0 0 0 0>;
  313. + mediatek,mtd-eeprom = <&factory 0x8000>;
  314. + nvmem-cells = <&macaddr_factory_e006>;
  315. + nvmem-cell-names = "mac-address";
  316. +
  317. + ieee80211-freq-limit = <5000000 6000000>;
  318. + led {
  319. + led-sources = <2>;
  320. + led-active-low;
  321. + };
  322. + };
  323. +};
  324. +
  325. +
  326. +&gmac0 {
  327. + nvmem-cells = <&macaddr_factory_e000>;
  328. + nvmem-cell-names = "mac-address";
  329. +};
  330. +
  331. +&switch0 {
  332. + ports {
  333. + port@0 {
  334. + status = "okay";
  335. + label = "lan1";
  336. + };
  337. +
  338. + port@1 {
  339. + status = "okay";
  340. + label = "lan2";
  341. + };
  342. +
  343. + port@2 {
  344. + status = "okay";
  345. + label = "lan3";
  346. + };
  347. +
  348. + port@3 {
  349. + status = "okay";
  350. + label = "lan4";
  351. + };
  352. +
  353. + port@4 {
  354. + status = "okay";
  355. + label = "wan";
  356. + nvmem-cells = <&macaddr_factory_e006>;
  357. + nvmem-cell-names = "mac-address";
  358. + };
  359. + };
  360. +};
  361. +
  362. +&state_default {
  363. + gpio {
  364. + groups = "i2c", "uart2", "uart3", "wdt";
  365. + function = "gpio";
  366. + };
  367. +};
  368. +
  369. +&factory {
  370. + compatible = "nvmem-cells";
  371. + #address-cells = <1>;
  372. + #size-cells = <1>;
  373. +
  374. + macaddr_factory_e000: macaddr@e000 {
  375. + reg = <0xe000 0x6>;
  376. + };
  377. +
  378. + macaddr_factory_e006: macaddr@e006 {
  379. + reg = <0xe006 0x6>;
  380. + };
  381. +};
  382. diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
  383. index aad2e32b36210..a6a4707fc295d 100644
  384. --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
  385. +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds
  386. @@ -157,6 +157,16 @@ zbtlink,zbt-wg1608-16m)
  387. ucidef_set_led_netdev "lan4" "LAN4" "green:lan-4" "lan4"
  388. ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
  389. ;;
  390. +zte,e8820s)
  391. + ucidef_set_led_netdev "sys" "SYS_LED" "white:sys" "eth0" "tx rx"
  392. + ucidef_set_led_timer "power" "POWER_LED" "white:sys" "100" "8000"
  393. + ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "ra0"
  394. + ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "rai0"
  395. + ;;
  396. +zte,e8820v2)
  397. + ucidef_set_led_netdev "sys" "SYS_LED" "white:sys" "eth0" "tx rx"
  398. + ucidef_set_led_timer "power" "POWER_LED" "white:power" "100" "8000"
  399. + ;;
  400. esac
  401. board_config_flush