002-0001-arm-mediatek-add-support-for-MediaTek-MT7986-SoC.patch 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. From 13d81db4723241e33316d7d134e4d279116e3158 Mon Sep 17 00:00:00 2001
  2. From: Weijie Gao <[email protected]>
  3. Date: Wed, 31 Aug 2022 19:00:17 +0800
  4. Subject: [PATCH 01/32] arm: mediatek: add support for MediaTek MT7986 SoC
  5. This patch adds basic support for MediaTek MT7986 SoC.
  6. This include the file that will initialize the SoC after boot and its
  7. device tree.
  8. Signed-off-by: Weijie Gao <[email protected]>
  9. ---
  10. arch/arm/dts/mt7986-u-boot.dtsi | 33 ++
  11. arch/arm/dts/mt7986.dtsi | 346 ++++++++++++++++++
  12. arch/arm/mach-mediatek/Kconfig | 12 +
  13. arch/arm/mach-mediatek/Makefile | 1 +
  14. arch/arm/mach-mediatek/mt7986/Makefile | 4 +
  15. arch/arm/mach-mediatek/mt7986/init.c | 45 +++
  16. arch/arm/mach-mediatek/mt7986/lowlevel_init.S | 32 ++
  17. 7 files changed, 473 insertions(+)
  18. create mode 100644 arch/arm/dts/mt7986-u-boot.dtsi
  19. create mode 100644 arch/arm/dts/mt7986.dtsi
  20. create mode 100644 arch/arm/mach-mediatek/mt7986/Makefile
  21. create mode 100644 arch/arm/mach-mediatek/mt7986/init.c
  22. create mode 100644 arch/arm/mach-mediatek/mt7986/lowlevel_init.S
  23. --- /dev/null
  24. +++ b/arch/arm/dts/mt7986-u-boot.dtsi
  25. @@ -0,0 +1,33 @@
  26. +// SPDX-License-Identifier: GPL-2.0
  27. +/*
  28. + * Copyright (c) 2022 MediaTek Inc.
  29. + * Author: Sam Shih <[email protected]>
  30. + */
  31. +
  32. +&topckgen {
  33. + u-boot,dm-pre-reloc;
  34. +};
  35. +
  36. +&pericfg {
  37. + u-boot,dm-pre-reloc;
  38. +};
  39. +
  40. +&apmixedsys {
  41. + u-boot,dm-pre-reloc;
  42. +};
  43. +
  44. +&timer0 {
  45. + u-boot,dm-pre-reloc;
  46. +};
  47. +
  48. +&uart0 {
  49. + u-boot,dm-pre-reloc;
  50. +};
  51. +
  52. +&snand {
  53. + u-boot,dm-pre-reloc;
  54. +};
  55. +
  56. +&pinctrl {
  57. + u-boot,dm-pre-reloc;
  58. +};
  59. --- /dev/null
  60. +++ b/arch/arm/dts/mt7986.dtsi
  61. @@ -0,0 +1,346 @@
  62. +// SPDX-License-Identifier: GPL-2.0
  63. +/*
  64. + * Copyright (c) 2022 MediaTek Inc.
  65. + * Author: Sam Shih <[email protected]>
  66. + */
  67. +
  68. +#include <dt-bindings/interrupt-controller/irq.h>
  69. +#include <dt-bindings/interrupt-controller/arm-gic.h>
  70. +#include <dt-bindings/phy/phy.h>
  71. +#include <dt-bindings/clock/mt7986-clk.h>
  72. +#include <dt-bindings/reset/mt7629-reset.h>
  73. +#include <dt-bindings/pinctrl/mt65xx.h>
  74. +
  75. +/ {
  76. + compatible = "mediatek,mt7986";
  77. + interrupt-parent = <&gic>;
  78. + #address-cells = <1>;
  79. + #size-cells = <1>;
  80. +
  81. + config {
  82. + u-boot,mmc-env-partition = "u-boot-env";
  83. + };
  84. +
  85. + cpus {
  86. + #address-cells = <1>;
  87. + #size-cells = <0>;
  88. + cpu0: cpu@0 {
  89. + device_type = "cpu";
  90. + compatible = "arm,cortex-a53";
  91. + reg = <0x0>;
  92. + };
  93. + cpu1: cpu@1 {
  94. + device_type = "cpu";
  95. + compatible = "arm,cortex-a53";
  96. + reg = <0x1>;
  97. + };
  98. + cpu2: cpu@2 {
  99. + device_type = "cpu";
  100. + compatible = "arm,cortex-a53";
  101. + reg = <0x1>;
  102. + };
  103. + cpu3: cpu@3 {
  104. + device_type = "cpu";
  105. + compatible = "arm,cortex-a53";
  106. + reg = <0x1>;
  107. + };
  108. + };
  109. +
  110. + dummy_clk: dummy12m {
  111. + compatible = "fixed-clock";
  112. + clock-frequency = <12000000>;
  113. + #clock-cells = <0>;
  114. + /* must need this line, or uart uanable to get dummy_clk */
  115. + u-boot,dm-pre-reloc;
  116. + };
  117. +
  118. + hwver: hwver {
  119. + compatible = "mediatek,hwver";
  120. + reg = <0x8000000 0x1000>;
  121. + };
  122. +
  123. + timer {
  124. + compatible = "arm,armv8-timer";
  125. + interrupt-parent = <&gic>;
  126. + clock-frequency = <13000000>;
  127. + interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_LOW>,
  128. + <GIC_PPI 14 IRQ_TYPE_LEVEL_LOW>,
  129. + <GIC_PPI 11 IRQ_TYPE_LEVEL_LOW>,
  130. + <GIC_PPI 10 IRQ_TYPE_LEVEL_LOW>;
  131. + arm,cpu-registers-not-fw-configured;
  132. + };
  133. +
  134. + timer0: timer@10008000 {
  135. + compatible = "mediatek,mt7986-timer";
  136. + reg = <0x10008000 0x1000>;
  137. + interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
  138. + clocks = <&infracfg CK_INFRA_CK_F26M>;
  139. + clock-names = "gpt-clk";
  140. + u-boot,dm-pre-reloc;
  141. + };
  142. +
  143. + watchdog: watchdog@1001c000 {
  144. + compatible = "mediatek,mt7986-wdt";
  145. + reg = <0x1001c000 0x1000>;
  146. + interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
  147. + #reset-cells = <1>;
  148. + status = "disabled";
  149. + };
  150. +
  151. + gic: interrupt-controller@c000000 {
  152. + compatible = "arm,gic-v3";
  153. + #interrupt-cells = <3>;
  154. + interrupt-parent = <&gic>;
  155. + interrupt-controller;
  156. + reg = <0x0c000000 0x40000>, /* GICD */
  157. + <0x0c080000 0x200000>; /* GICR */
  158. +
  159. + interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>;
  160. + };
  161. +
  162. + fixed_plls: apmixedsys@1001E000 {
  163. + compatible = "mediatek,mt7986-fixed-plls";
  164. + reg = <0x1001E000 0x1000>;
  165. + #clock-cells = <1>;
  166. + };
  167. +
  168. + topckgen: topckgen@1001B000 {
  169. + compatible = "mediatek,mt7986-topckgen";
  170. + reg = <0x1001B000 0x1000>;
  171. + clock-parent = <&fixed_plls>;
  172. + #clock-cells = <1>;
  173. + };
  174. +
  175. + infracfg_ao: infracfg_ao@10001000 {
  176. + compatible = "mediatek,mt7986-infracfg_ao";
  177. + reg = <0x10001000 0x68>;
  178. + clock-parent = <&infracfg>;
  179. + #clock-cells = <1>;
  180. + };
  181. +
  182. + infracfg: infracfg@10001040 {
  183. + compatible = "mediatek,mt7986-infracfg";
  184. + reg = <0x10001000 0x1000>;
  185. + clock-parent = <&topckgen>;
  186. + #clock-cells = <1>;
  187. + };
  188. +
  189. + pinctrl: pinctrl@1001f000 {
  190. + compatible = "mediatek,mt7986-pinctrl";
  191. + reg = <0x1001f000 0x1000>,
  192. + <0x11c30000 0x1000>,
  193. + <0x11c40000 0x1000>,
  194. + <0x11e20000 0x1000>,
  195. + <0x11e30000 0x1000>,
  196. + <0x11f00000 0x1000>,
  197. + <0x11f10000 0x1000>,
  198. + <0x1000b000 0x1000>;
  199. + reg-names = "gpio_base", "iocfg_rt_base", "iocfg_rb_base",
  200. + "iocfg_lt_base", "iocfg_lb_base", "iocfg_tr_base",
  201. + "iocfg_tl_base", "eint";
  202. + gpio: gpio-controller {
  203. + gpio-controller;
  204. + #gpio-cells = <2>;
  205. + };
  206. + };
  207. +
  208. + pwm: pwm@10048000 {
  209. + compatible = "mediatek,mt7986-pwm";
  210. + reg = <0x10048000 0x1000>;
  211. + #clock-cells = <1>;
  212. + #pwm-cells = <2>;
  213. + interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>;
  214. + clocks = <&infracfg CK_INFRA_PWM>,
  215. + <&infracfg_ao CK_INFRA_PWM_BSEL>,
  216. + <&infracfg_ao CK_INFRA_PWM1_CK>,
  217. + <&infracfg_ao CK_INFRA_PWM2_CK>;
  218. + assigned-clocks = <&topckgen CK_TOP_PWM_SEL>,
  219. + <&infracfg CK_INFRA_PWM_BSEL>,
  220. + <&infracfg CK_INFRA_PWM1_SEL>,
  221. + <&infracfg CK_INFRA_PWM2_SEL>;
  222. + assigned-clock-parents = <&topckgen CK_TOP_CB_M_D4>,
  223. + <&infracfg CK_INFRA_PWM>,
  224. + <&infracfg CK_INFRA_PWM>,
  225. + <&infracfg CK_INFRA_PWM>;
  226. + clock-names = "top", "main", "pwm1", "pwm2";
  227. + status = "disabled";
  228. + u-boot,dm-pre-reloc;
  229. + };
  230. +
  231. + uart0: serial@11002000 {
  232. + compatible = "mediatek,hsuart";
  233. + reg = <0x11002000 0x400>;
  234. + interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
  235. + clocks = <&infracfg_ao CK_INFRA_UART0_CK>;
  236. + assigned-clocks = <&topckgen CK_TOP_UART_SEL>,
  237. + <&infracfg_ao CK_INFRA_UART0_SEL>;
  238. + assigned-clock-parents = <&topckgen CK_TOP_CB_CKSQ_40M>,
  239. + <&infracfg CK_INFRA_UART>;
  240. + mediatek,force-highspeed;
  241. + status = "disabled";
  242. + u-boot,dm-pre-reloc;
  243. + };
  244. +
  245. + uart1: serial@11003000 {
  246. + compatible = "mediatek,hsuart";
  247. + reg = <0x11003000 0x400>;
  248. + interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
  249. + clocks = <&infracfg_ao CK_INFRA_UART1_CK>;
  250. + assigned-clocks = <&infracfg CK_INFRA_UART1_SEL>;
  251. + assigned-clock-parents = <&infracfg CK_INFRA_CK_F26M>;
  252. + mediatek,force-highspeed;
  253. + status = "disabled";
  254. + };
  255. +
  256. + uart2: serial@11004000 {
  257. + compatible = "mediatek,hsuart";
  258. + reg = <0x11004000 0x400>;
  259. + interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
  260. + clocks = <&infracfg_ao CK_INFRA_UART2_CK>;
  261. + assigned-clocks = <&infracfg CK_INFRA_UART2_SEL>;
  262. + assigned-clock-parents = <&infracfg CK_INFRA_CK_F26M>;
  263. + mediatek,force-highspeed;
  264. + status = "disabled";
  265. + };
  266. +
  267. + snand: snand@11005000 {
  268. + compatible = "mediatek,mt7986-snand";
  269. + reg = <0x11005000 0x1000>,
  270. + <0x11006000 0x1000>;
  271. + reg-names = "nfi", "ecc";
  272. + clocks = <&infracfg_ao CK_INFRA_SPINFI1_CK>,
  273. + <&infracfg_ao CK_INFRA_NFI1_CK>,
  274. + <&infracfg_ao CK_INFRA_NFI_HCK_CK>;
  275. + clock-names = "pad_clk", "nfi_clk", "nfi_hclk";
  276. + assigned-clocks = <&topckgen CK_TOP_SPINFI_SEL>,
  277. + <&topckgen CK_TOP_NFI1X_SEL>;
  278. + assigned-clock-parents = <&topckgen CK_TOP_CB_M_D8>,
  279. + <&topckgen CK_TOP_CB_M_D8>;
  280. + status = "disabled";
  281. + };
  282. +
  283. + ethsys: syscon@15000000 {
  284. + compatible = "mediatek,mt7986-ethsys", "syscon";
  285. + reg = <0x15000000 0x1000>;
  286. + clock-parent = <&topckgen>;
  287. + #clock-cells = <1>;
  288. + #reset-cells = <1>;
  289. + };
  290. +
  291. + eth: ethernet@15100000 {
  292. + compatible = "mediatek,mt7986-eth", "syscon";
  293. + reg = <0x15100000 0x20000>;
  294. + resets = <&ethsys ETHSYS_FE_RST>;
  295. + reset-names = "fe";
  296. + mediatek,ethsys = <&ethsys>;
  297. + mediatek,sgmiisys = <&sgmiisys0>;
  298. + #address-cells = <1>;
  299. + #size-cells = <0>;
  300. + status = "disabled";
  301. + };
  302. +
  303. + sgmiisys0: syscon@10060000 {
  304. + compatible = "mediatek,mt7986-sgmiisys", "syscon";
  305. + reg = <0x10060000 0x1000>;
  306. + #clock-cells = <1>;
  307. + };
  308. +
  309. + sgmiisys1: syscon@10070000 {
  310. + compatible = "mediatek,mt7986-sgmiisys", "syscon";
  311. + reg = <0x10070000 0x1000>;
  312. + #clock-cells = <1>;
  313. + };
  314. +
  315. + spi0: spi@1100a000 {
  316. + compatible = "mediatek,ipm-spi";
  317. + reg = <0x1100a000 0x100>;
  318. + clocks = <&infracfg_ao CK_INFRA_SPI0_CK>,
  319. + <&topckgen CK_TOP_SPI_SEL>;
  320. + assigned-clocks = <&topckgen CK_TOP_SPI_SEL>,
  321. + <&infracfg CK_INFRA_SPI0_SEL>;
  322. + assigned-clock-parents = <&topckgen CK_TOP_CB_M_D2>,
  323. + <&topckgen CK_INFRA_ISPI0>;
  324. + clock-names = "sel-clk", "spi-clk";
  325. + interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
  326. + status = "disabled";
  327. + };
  328. +
  329. + spi1: spi@1100b000 {
  330. + compatible = "mediatek,ipm-spi";
  331. + reg = <0x1100b000 0x100>;
  332. + interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
  333. + status = "disabled";
  334. + };
  335. +
  336. + mmc0: mmc@11230000 {
  337. + compatible = "mediatek,mt7986-mmc";
  338. + reg = <0x11230000 0x1000>,
  339. + <0x11C20000 0x1000>;
  340. + interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
  341. + clocks = <&topckgen CK_TOP_EMMC_416M>,
  342. + <&topckgen CK_TOP_EMMC_250M>,
  343. + <&infracfg_ao CK_INFRA_MSDC_CK>;
  344. + assigned-clocks = <&topckgen CK_TOP_EMMC_416M_SEL>,
  345. + <&topckgen CK_TOP_EMMC_250M_SEL>;
  346. + assigned-clock-parents = <&topckgen CK_TOP_CB_M_416M>,
  347. + <&topckgen CK_TOP_NET1_D5_D2>;
  348. + clock-names = "source", "hclk", "source_cg";
  349. + status = "disabled";
  350. + };
  351. +
  352. + xhci: xhci@11200000 {
  353. + compatible = "mediatek,mt7986-xhci",
  354. + "mediatek,mtk-xhci";
  355. + reg = <0x11200000 0x2e00>,
  356. + <0x11203e00 0x0100>;
  357. + reg-names = "mac", "ippc";
  358. + interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
  359. + phys = <&u2port0 PHY_TYPE_USB2>,
  360. + <&u3port0 PHY_TYPE_USB3>,
  361. + <&u2port1 PHY_TYPE_USB2>;
  362. + clocks = <&dummy_clk>,
  363. + <&dummy_clk>,
  364. + <&dummy_clk>,
  365. + <&dummy_clk>,
  366. + <&dummy_clk>;
  367. + clock-names = "sys_ck",
  368. + "xhci_ck",
  369. + "ref_ck",
  370. + "mcu_ck",
  371. + "dma_ck";
  372. + tpl-support;
  373. + status = "okay";
  374. + };
  375. +
  376. + usbtphy: usb-phy@11e10000 {
  377. + compatible = "mediatek,mt7986",
  378. + "mediatek,generic-tphy-v2";
  379. + #address-cells = <1>;
  380. + #size-cells = <1>;
  381. + status = "okay";
  382. +
  383. + u2port0: usb-phy@11e10000 {
  384. + reg = <0x11e10000 0x700>;
  385. + clocks = <&dummy_clk>;
  386. + clock-names = "ref";
  387. + #phy-cells = <1>;
  388. + status = "okay";
  389. + };
  390. +
  391. + u3port0: usb-phy@11e10700 {
  392. + reg = <0x11e10700 0x900>;
  393. + clocks = <&dummy_clk>;
  394. + clock-names = "ref";
  395. + #phy-cells = <1>;
  396. + status = "okay";
  397. + };
  398. +
  399. + u2port1: usb-phy@11e11000 {
  400. + reg = <0x11e11000 0x700>;
  401. + clocks = <&dummy_clk>;
  402. + clock-names = "ref";
  403. + #phy-cells = <1>;
  404. + status = "okay";
  405. + };
  406. + };
  407. +};
  408. --- a/arch/arm/mach-mediatek/Kconfig
  409. +++ b/arch/arm/mach-mediatek/Kconfig
  410. @@ -40,6 +40,15 @@ config TARGET_MT7629
  411. including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,
  412. switch, USB3.0, PCIe, UART, SPI, I2C and PWM.
  413. +config TARGET_MT7986
  414. + bool "MediaTek MT7986 SoC"
  415. + select ARM64
  416. + select CPU
  417. + help
  418. + The MediaTek MT7986 is a ARM64-based SoC with a quad-core Cortex-A53.
  419. + including UART, SPI, SPI flash, USB3.0, MMC, NAND, SNFI, PWM, PCIe,
  420. + Gigabit Ethernet, I2C, built-in 4x4 Wi-Fi, and PCIe.
  421. +
  422. config TARGET_MT8183
  423. bool "MediaTek MT8183 SoC"
  424. select ARM64
  425. @@ -84,6 +93,7 @@ config SYS_BOARD
  426. default "mt7622" if TARGET_MT7622
  427. default "mt7623" if TARGET_MT7623
  428. default "mt7629" if TARGET_MT7629
  429. + default "mt7986" if TARGET_MT7986
  430. default "mt8183" if TARGET_MT8183
  431. default "mt8512" if TARGET_MT8512
  432. default "mt8516" if TARGET_MT8516
  433. @@ -99,6 +109,7 @@ config SYS_CONFIG_NAME
  434. default "mt7622" if TARGET_MT7622
  435. default "mt7623" if TARGET_MT7623
  436. default "mt7629" if TARGET_MT7629
  437. + default "mt7986" if TARGET_MT7986
  438. default "mt8183" if TARGET_MT8183
  439. default "mt8512" if TARGET_MT8512
  440. default "mt8516" if TARGET_MT8516
  441. @@ -113,6 +124,7 @@ config MTK_BROM_HEADER_INFO
  442. string
  443. default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
  444. default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
  445. + default "media=snand;nandinfo=2k+64" if TARGET_MT7986
  446. default "lk=1" if TARGET_MT7623
  447. endif
  448. --- a/arch/arm/mach-mediatek/Makefile
  449. +++ b/arch/arm/mach-mediatek/Makefile
  450. @@ -7,6 +7,7 @@ obj-$(CONFIG_MT8512) += mt8512/
  451. obj-$(CONFIG_TARGET_MT7622) += mt7622/
  452. obj-$(CONFIG_TARGET_MT7623) += mt7623/
  453. obj-$(CONFIG_TARGET_MT7629) += mt7629/
  454. +obj-$(CONFIG_TARGET_MT7986) += mt7986/
  455. obj-$(CONFIG_TARGET_MT8183) += mt8183/
  456. obj-$(CONFIG_TARGET_MT8516) += mt8516/
  457. obj-$(CONFIG_TARGET_MT8518) += mt8518/
  458. --- /dev/null
  459. +++ b/arch/arm/mach-mediatek/mt7986/Makefile
  460. @@ -0,0 +1,4 @@
  461. +# SPDX-License-Identifier: GPL-2.0
  462. +
  463. +obj-y += init.o
  464. +obj-y += lowlevel_init.o
  465. --- /dev/null
  466. +++ b/arch/arm/mach-mediatek/mt7986/init.c
  467. @@ -0,0 +1,45 @@
  468. +// SPDX-License-Identifier: GPL-2.0
  469. +/*
  470. + * Copyright (C) 2022 MediaTek Inc.
  471. + * Author: Sam Shih <[email protected]>
  472. + */
  473. +
  474. +#include <init.h>
  475. +#include <asm/armv8/mmu.h>
  476. +#include <asm/system.h>
  477. +#include <asm/global_data.h>
  478. +
  479. +DECLARE_GLOBAL_DATA_PTR;
  480. +
  481. +int dram_init(void)
  482. +{
  483. + gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, SZ_2G);
  484. +
  485. + return 0;
  486. +}
  487. +
  488. +void reset_cpu(ulong addr)
  489. +{
  490. + psci_system_reset();
  491. +}
  492. +
  493. +static struct mm_region mt7986_mem_map[] = {
  494. + {
  495. + /* DDR */
  496. + .virt = 0x40000000UL,
  497. + .phys = 0x40000000UL,
  498. + .size = 0x80000000UL,
  499. + .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
  500. + }, {
  501. + .virt = 0x00000000UL,
  502. + .phys = 0x00000000UL,
  503. + .size = 0x40000000UL,
  504. + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
  505. + PTE_BLOCK_NON_SHARE |
  506. + PTE_BLOCK_PXN | PTE_BLOCK_UXN
  507. + }, {
  508. + 0,
  509. + }
  510. +};
  511. +
  512. +struct mm_region *mem_map = mt7986_mem_map;
  513. --- /dev/null
  514. +++ b/arch/arm/mach-mediatek/mt7986/lowlevel_init.S
  515. @@ -0,0 +1,32 @@
  516. +/* SPDX-License-Identifier: GPL-2.0 */
  517. +/*
  518. + * Copyright (C) 2022 MediaTek Inc.
  519. + * Author: Sam Shih <[email protected]>
  520. + */
  521. +
  522. +/*
  523. + * Switch from AArch64 EL2 to AArch32 EL2
  524. + * @param inputs:
  525. + * x0: argument, zero
  526. + * x1: machine nr
  527. + * x2: fdt address
  528. + * x3: input argument
  529. + * x4: kernel entry point
  530. + * @param outputs for secure firmware:
  531. + * x0: function id
  532. + * x1: kernel entry point
  533. + * x2: machine nr
  534. + * x3: fdt address
  535. + *
  536. + * [1] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/plat/mediatek/common/mtk_sip_svc.c
  537. +*/
  538. +
  539. +.global armv8_el2_to_aarch32
  540. +armv8_el2_to_aarch32:
  541. + mov x3, x2
  542. + mov x2, x1
  543. + mov x1, x4
  544. + mov x4, #0
  545. + ldr x0, =0x82000200 /* MTK_SIP_KERNEL_BOOT_AARCH32 */
  546. + SMC #0
  547. + ret