mt_gic_v3.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #include <reg.h>
  32. #include <platform/mt_typedefs.h>
  33. #include <platform/mt_reg_base.h>
  34. #include <mt_gic.h>
  35. #include <mt_gic_v3.h>
  36. #include <debug.h>
  37. #define GICD_CTLR_RWP (1U << 31)
  38. #define GICD_CTLR_ARE (1 << 4)
  39. #define GICD_CTLR_ENGRP1S (1 << 2)
  40. #define GICD_CTLR_ENGRP1NS (1 << 1)
  41. #define GICR_WAKER_ProcessorSleep (1 << 1)
  42. #define GICR_WAKER_ChildrenAsleep (1 << 2)
  43. extern void dsb(void);
  44. extern void isb(void);
  45. extern uint32_t mt_interrupt_needed_for_secure(void);
  46. extern uint64_t mt_irq_get_affinity(void);
  47. static void mt_gic_icc_primask_write(uint32_t reg)
  48. {
  49. __asm__ volatile("MCR p15, 0, %0, c4, c6, 0" :: "r" (reg));
  50. }
  51. static uint32_t mt_gic_icc_primask_read(void)
  52. {
  53. uint32_t reg;
  54. __asm__ volatile("MRC p15, 0, %0, c4, c6, 0" : "=r" (reg));
  55. return reg;
  56. }
  57. static void mt_gic_icc_igrpen1_write(uint32_t reg)
  58. {
  59. __asm__ volatile("MCR p15, 0, %0, c12, c12, 7" :: "r" (reg));
  60. }
  61. static uint32_t mt_gic_icc_igrpen1_read(void)
  62. {
  63. uint32_t reg;
  64. __asm__ volatile("MRC p15, 0, %0, c12, c12, 7" : "=r" (reg));
  65. return reg;
  66. }
  67. static uint32_t mt_gic_icc_iar1_read(void)
  68. {
  69. uint32_t reg;
  70. __asm__ volatile("MRC p15, 0, %0, c12, c12, 0" : "=r" (reg));
  71. return reg;
  72. }
  73. static void mt_gic_icc_msre_write(void)
  74. {
  75. uint32_t reg;
  76. #define MON_MODE "#22"
  77. #define SVC_MODE "#19"
  78. /*
  79. * switch to monitor mode and mark ICC_MSRE.
  80. */
  81. __asm__ volatile("CPS " MON_MODE "\n"
  82. "MRC p15, 6, %0, c12, c12, 5\n"
  83. "ORR %0, %0, #9\n"
  84. "MCR p15, 6, %0, c12, c12, 5\n"
  85. "CPS " SVC_MODE "\n" : "=r" (reg));
  86. dsb();
  87. }
  88. static void mt_gic_icc_sre_write(uint32_t reg)
  89. {
  90. __asm__ volatile("MCR p15, 0, %0, c12, c12, 5" :: "r" (reg));
  91. dsb();
  92. }
  93. static uint32_t mt_gic_icc_sre_read(void)
  94. {
  95. uint32_t reg;
  96. __asm__ volatile("MRC p15, 0, %0, c12, c12, 5" : "=r" (reg));
  97. return reg;
  98. }
  99. static void mt_gic_icc_eoir1_write(uint32_t reg)
  100. {
  101. __asm__ volatile("MCR p15, 0, %0, c12, c12, 1" :: "r" (reg));
  102. }
  103. uint32_t mt_mpidr_read(void)
  104. {
  105. uint32_t reg;
  106. __asm__ volatile("MRC p15, 0, %0, c0, c0, 5" : "=r" (reg));
  107. return reg;
  108. }
  109. #ifdef GIC600
  110. /* GIC600-specific accessor functions */
  111. static void gicr_write_pwrr(uintptr_t base, unsigned int val)
  112. {
  113. DRV_WriteReg32(base + GICR_PWRR, val);
  114. }
  115. static uint32_t gicr_read_pwrr(uintptr_t base)
  116. {
  117. return DRV_Reg32(base + GICR_PWRR);
  118. }
  119. static void gic600_rdistif_init(void)
  120. {
  121. unsigned int rdist_base = GIC_REDIS_BASE;
  122. unsigned int ret;
  123. do {
  124. /* Check group not transitioning (polling for PWRR_RDGPO == PWRR_RDGPD) */
  125. ret = gicr_read_pwrr(rdist_base);
  126. while (((ret & PWRR_RDGPD) >> PWRR_RDGPD_SHIFT)
  127. != ((ret & PWRR_RDGPO) >> PWRR_RDGPO_SHIFT))
  128. ret = gicr_read_pwrr(rdist_base);
  129. /* Power on redistributor */
  130. gicr_write_pwrr(rdist_base, PWRR_ON);
  131. /* Keep retrying until the power on state is reflected (PWRR_RDGPO == 0)*/
  132. } while (gicr_read_pwrr(rdist_base) & PWRR_RDGPO);
  133. }
  134. #endif
  135. static void mt_gic_cpu_init(void)
  136. {
  137. mt_gic_icc_sre_write(0x01);
  138. mt_gic_icc_primask_write(0xF0);
  139. mt_gic_icc_igrpen1_write(0x01);
  140. dsb();
  141. }
  142. static void mt_gic_redist_init(void)
  143. {
  144. unsigned int value;
  145. #ifdef GIC600
  146. gic600_rdistif_init();
  147. #endif
  148. /* Wake up this CPU redistributor */
  149. value = DRV_Reg32(GIC_REDIS_BASE + GIC_REDIS_WAKER);
  150. value &= ~GICR_WAKER_ProcessorSleep;
  151. DRV_WriteReg32(GIC_REDIS_BASE + GIC_REDIS_WAKER, value);
  152. while (DRV_Reg32(GIC_REDIS_BASE + GIC_REDIS_WAKER) & GICR_WAKER_ChildrenAsleep);
  153. }
  154. static void mt_git_dist_rwp(void)
  155. {
  156. /*
  157. * check GICD_CTLR.RWP for done check
  158. */
  159. while (DRV_Reg32(GIC_DIST_BASE + GIC_DIST_CTRL) & GICD_CTLR_RWP) {
  160. }
  161. }
  162. static void mt_gic_dist_init(void)
  163. {
  164. unsigned int i;
  165. uint64_t affinity;
  166. affinity = mt_irq_get_affinity();
  167. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_CTRL, GICD_CTLR_ARE);
  168. mt_git_dist_rwp();
  169. /*
  170. * Set all global interrupts to be level triggered, active low.
  171. */
  172. for (i = 32; i < (MT_NR_SPI + 32); i += 16) {
  173. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_CONFIG + i * 4 / 16, 0);
  174. }
  175. /*
  176. * Set all global interrupts to this CPU only.
  177. */
  178. for (i = 0; i < MT_NR_SPI; i++) {
  179. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ROUTE + i * 8, (affinity & 0xFFFFFFFF));
  180. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ROUTE + i * 8 + 4, (affinity >> 32));
  181. }
  182. /*
  183. * Set all interrupts to G1S. Leave the PPI and SGIs alone
  184. * as they are set by redistributor registers.
  185. */
  186. for (i = 0; i < NR_IRQ_LINE; i += 32)
  187. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_IGRPMODR + i / 8, 0xFFFFFFFF);
  188. /*
  189. * Set priority on all interrupts.
  190. */
  191. for (i = 0; i < NR_IRQ_LINE; i += 4) {
  192. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_PRI + i * 4 / 4, 0xA0A0A0A0);
  193. }
  194. /*
  195. * Disable all interrupts.
  196. */
  197. for (i = 0; i < NR_IRQ_LINE; i += 32) {
  198. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_CLEAR + i * 4 / 32, 0xFFFFFFFF);
  199. }
  200. /*
  201. * Clear all active status
  202. */
  203. for (i = 0; i < NR_IRQ_LINE; i += 32) {
  204. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ACTIVE_CLEAR + i * 4 / 32, 0xFFFFFFFF);
  205. }
  206. /*
  207. * Clear all pending status
  208. */
  209. for (i = 0; i < NR_IRQ_LINE; i += 32) {
  210. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_PENDING_CLEAR + i * 4 / 32, 0xFFFFFFFF);
  211. }
  212. dsb();
  213. mt_git_dist_rwp();
  214. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_CTRL, GICD_CTLR_ARE | GICD_CTLR_ENGRP1S | GICD_CTLR_ENGRP1NS);
  215. mt_git_dist_rwp();
  216. }
  217. unsigned int gicd_read_iidr(unsigned int gicd_base)
  218. {
  219. return DRV_Reg32(gicd_base + GIC_DIST_IIDR);
  220. }
  221. void platform_init_interrupts(void)
  222. {
  223. uint32_t sec;
  224. sec = mt_interrupt_needed_for_secure();
  225. if (sec)
  226. mt_gic_icc_msre_write();
  227. mt_gic_dist_init();
  228. if (sec)
  229. mt_gic_redist_init();
  230. mt_gic_cpu_init();
  231. }
  232. void platform_deinit_interrupts(void)
  233. {
  234. unsigned int irq;
  235. for (irq = 0; irq < NR_IRQ_LINE; irq += 32) {
  236. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_CLEAR + irq * 4 / 32, 0xFFFFFFFF);
  237. }
  238. dsb();
  239. while ((irq = mt_gic_icc_iar1_read()) != 1023 ) {
  240. mt_gic_icc_eoir1_write(irq);
  241. }
  242. }
  243. uint32_t mt_irq_get(void)
  244. {
  245. return mt_gic_icc_iar1_read();
  246. }
  247. #ifdef GIC600
  248. #ifdef MTK_INDIRECT_ACCESS_SUPPORT
  249. void mt_irq_set_mask(unsigned int irq)
  250. {
  251. unsigned int value;
  252. if (irq < GIC_PRIVATE_SIGNALS)
  253. return;
  254. /* set mask */
  255. value = 1;
  256. /* select spi id */
  257. value |= ((irq - GIC_PRIVATE_SIGNALS) << 16);
  258. /* select mask control */
  259. value |= (1 << 30);
  260. DRV_WriteReg32(INT_CFG_INDIRECT_ACCESS, value);
  261. dsb();
  262. }
  263. void mt_irq_set_unmask(unsigned int irq)
  264. {
  265. unsigned int value;
  266. if (irq < GIC_PRIVATE_SIGNALS)
  267. return;
  268. /* set unmask */
  269. value = 0;
  270. /* select spi id */
  271. value |= ((irq - GIC_PRIVATE_SIGNALS) << 16);
  272. /* select mask control */
  273. value |= (1 << 30);
  274. DRV_WriteReg32(INT_CFG_INDIRECT_ACCESS, value);
  275. dsb();
  276. }
  277. #else
  278. void mt_irq_set_mask(unsigned int irq)
  279. {
  280. unsigned int offset;
  281. unsigned int reg_index;
  282. unsigned int value;
  283. if (irq < GIC_PRIVATE_SIGNALS)
  284. return;
  285. offset = (irq - GIC_PRIVATE_SIGNALS) & 0x1F;
  286. reg_index = (irq - GIC_PRIVATE_SIGNALS) >> 5;
  287. value = DRV_Reg32(INT_MSK_CTL0 + (reg_index * 4));
  288. value |= (0x1 << offset);
  289. DRV_WriteReg32(INT_MSK_CTL0 + (reg_index * 4), value);
  290. dsb();
  291. }
  292. void mt_irq_set_unmask(unsigned int irq)
  293. {
  294. unsigned int offset;
  295. unsigned int reg_index;
  296. unsigned int value;
  297. if (irq < GIC_PRIVATE_SIGNALS)
  298. return;
  299. offset = (irq - GIC_PRIVATE_SIGNALS) & 0x1F;
  300. reg_index = (irq - GIC_PRIVATE_SIGNALS) >> 5;
  301. value = DRV_Reg32(INT_MSK_CTL0 + (reg_index * 4));
  302. value &= ~(0x1 << offset);
  303. DRV_WriteReg32(INT_MSK_CTL0 + (reg_index * 4), value);
  304. dsb();
  305. }
  306. #endif
  307. #endif
  308. void mt_irq_set_polarity(unsigned int irq, unsigned int polarity)
  309. {
  310. #ifndef MTK_POL_DEPRECATED
  311. unsigned int value;
  312. unsigned int result;
  313. #ifndef MTK_INDIRECT_ACCESS_SUPPORT
  314. unsigned int offset, reg_index;
  315. #endif
  316. // peripheral device's IRQ line is using GIC's SPI, and line ID >= GIC_PRIVATE_SIGNALS
  317. if (irq < GIC_PRIVATE_SIGNALS) {
  318. return;
  319. }
  320. #ifndef MTK_INDIRECT_ACCESS_SUPPORT
  321. offset = (irq - GIC_PRIVATE_SIGNALS) & 0x1F;
  322. reg_index = (irq - GIC_PRIVATE_SIGNALS) >> 5;
  323. if (polarity == 0) {
  324. value = DRV_Reg32(INT_POL_CTL0 + (reg_index * 4));
  325. value |= (1 << offset); // always invert the incoming IRQ's polarity
  326. DRV_WriteReg32((INT_POL_CTL0 + (reg_index * 4)), value);
  327. } else {
  328. value = DRV_Reg32(INT_POL_CTL0 + (reg_index * 4));
  329. value &= ~(0x1 << offset);
  330. DRV_WriteReg32(INT_POL_CTL0 + (reg_index * 4), value);
  331. }
  332. #else
  333. if (polarity == 0)
  334. value = 1; /* active low */
  335. else
  336. value = 0; /* active high */
  337. /* select spi id */
  338. value |= ((irq - GIC_PRIVATE_SIGNALS) << 16);
  339. /* select mask control*/
  340. value |= (1 << 29);
  341. DRV_WriteReg32(INT_CFG_INDIRECT_ACCESS, value);
  342. #endif
  343. #ifdef GIC600
  344. result = gicd_read_iidr(GIC_DIST_BASE);
  345. /* unmask irq for gic600 */
  346. if ((result >> GICD_V3_IIDR_PROD_ID) == GICD_V3_IIDR_GIC600)
  347. mt_irq_set_unmask(irq);
  348. #endif
  349. #endif //MTK_POL_DEPRECATED
  350. }
  351. void mt_irq_set_sens(unsigned int irq, unsigned int sens)
  352. {
  353. unsigned int config;
  354. if (sens == MT65xx_EDGE_SENSITIVE) {
  355. config = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_CONFIG + (irq / 16) * 4);
  356. config |= (0x2 << (irq % 16) * 2);
  357. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_CONFIG + (irq / 16) * 4, config);
  358. } else {
  359. config = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_CONFIG + (irq / 16) * 4);
  360. config &= ~(0x2 << (irq % 16) * 2);
  361. DRV_WriteReg32( GIC_DIST_BASE + GIC_DIST_CONFIG + (irq / 16) * 4, config);
  362. }
  363. dsb();
  364. }
  365. /*
  366. * mt_irq_mask: mask one IRQ
  367. * @irq: IRQ line of the IRQ to mask
  368. */
  369. void mt_irq_mask(unsigned int irq)
  370. {
  371. unsigned int mask = 1 << (irq % 32);
  372. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_CLEAR + irq / 32 * 4, mask);
  373. dsb();
  374. }
  375. /*
  376. * mt_irq_unmask: unmask one IRQ
  377. * @irq: IRQ line of the IRQ to unmask
  378. */
  379. void mt_irq_unmask(unsigned int irq)
  380. {
  381. unsigned int mask = 1 << (irq % 32);
  382. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_SET + irq / 32 * 4, mask);
  383. dsb();
  384. }
  385. /*
  386. * mt_irq_ack: ack IRQ
  387. * @irq: IRQ line of the IRQ to mask
  388. */
  389. void mt_irq_ack(unsigned int irq)
  390. {
  391. mt_gic_icc_eoir1_write(irq);
  392. dsb();
  393. }
  394. /*
  395. * mt_irq_mask_all: mask all IRQ lines. (This is ONLY used for the sleep driver)
  396. * @mask: pointer to struct mtk_irq_mask for storing the original mask value.
  397. * Return 0 for success; return negative values for failure.
  398. */
  399. int mt_irq_mask_all(struct mtk_irq_mask *mask)
  400. {
  401. unsigned int i;
  402. if (mask) {
  403. for (i = 0; i < IRQ_REGS; i++) {
  404. mask->mask[i] = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_ENABLE_SET + i * 4);
  405. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_CLEAR + i * 4, 0xFFFFFFFF);
  406. }
  407. dsb();
  408. mask->header = IRQ_MASK_HEADER;
  409. mask->footer = IRQ_MASK_FOOTER;
  410. return 0;
  411. } else {
  412. return -1;
  413. }
  414. }
  415. /*
  416. * mt_irq_mask_restore: restore all IRQ lines' masks. (This is ONLY used for the sleep driver)
  417. * @mask: pointer to struct mtk_irq_mask for storing the original mask value.
  418. * Return 0 for success; return negative values for failure.
  419. */
  420. int mt_irq_mask_restore(struct mtk_irq_mask *mask)
  421. {
  422. unsigned int i;
  423. if (!mask) {
  424. return -1;
  425. }
  426. if (mask->header != IRQ_MASK_HEADER) {
  427. return -1;
  428. }
  429. if (mask->footer != IRQ_MASK_FOOTER) {
  430. return -1;
  431. }
  432. for (i = 0; i < IRQ_REGS; i++) {
  433. DRV_WriteReg32(GIC_DIST_BASE + GIC_DIST_ENABLE_SET + i * 4, mask->mask[i]);
  434. }
  435. dsb();
  436. return 0;
  437. }
  438. void mt_irq_register_dump(void)
  439. {
  440. int i;
  441. uint32_t reg, reg2;
  442. dprintf(CRITICAL, "%s(): do irq register dump\n", __func__);
  443. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_CTRL);
  444. dprintf(CRITICAL, "GICD_CTLR: 0x%08x\n", reg);
  445. for (i = 0; i < MT_NR_SPI; i++) {
  446. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_ROUTE + i * 8);
  447. reg2 = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_ROUTE + i * 8 + 4);
  448. dprintf(CRITICAL, "GICD_IROUTER[%d]: 0x%08x, 0x%08x\n", i, reg, reg2);
  449. }
  450. for (i = 0; i < NR_IRQ_LINE; i += 32) {
  451. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_IGRPMODR + i / 8);
  452. dprintf(CRITICAL, "GICD_IGRPMODR[%d]: 0x%08x\n", i >> 5, reg);
  453. }
  454. for (i = 0; i < NR_IRQ_LINE; i += 4) {
  455. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_PRI + i * 4 / 4);
  456. dprintf(CRITICAL, "GICD_IPRIORITYR[%d]: 0x%08x\n", i >> 2, reg);
  457. }
  458. for (i = 32; i < (MT_NR_SPI + 32); i += 16) {
  459. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_CONFIG + i * 4 / 16);
  460. dprintf(CRITICAL, "DIST_ICFGR[%d]: 0x%08x\n", (i >> 4) - 2, reg);
  461. }
  462. for (i = 0; i < IRQ_REGS; i++) {
  463. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_ENABLE_SET + i * 4);
  464. dprintf(CRITICAL, "GICD_ISENABLER[%d]: 0x%08x\n", i, reg);
  465. }
  466. for (i = 0; i < IRQ_REGS; i++) {
  467. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_PENDING_SET + i * 4);
  468. dprintf(CRITICAL, "GICD_ISPENDR[%d]: 0x%08x\n", i, reg);
  469. }
  470. for (i = 0; i < IRQ_REGS; i++) {
  471. reg = DRV_Reg32(GIC_DIST_BASE + GIC_DIST_ACTIVE_SET + i * 4);
  472. dprintf(CRITICAL, "GICD_ISACTIVER[%d]: 0x%08x\n", i, reg);
  473. }
  474. reg = mt_gic_icc_sre_read();
  475. dprintf(CRITICAL, "ICC_SRE: 0x%08x\n", reg);
  476. reg = mt_gic_icc_primask_read();
  477. dprintf(CRITICAL, "ICC_PMR: 0x%08x\n", reg);
  478. reg = mt_gic_icc_igrpen1_read();
  479. dprintf(CRITICAL, "ICC_IGRPEN1: 0x%08x\n", reg);
  480. reg = mt_gic_icc_iar1_read();
  481. dprintf(CRITICAL, "ICC_IAR1: 0x%08x\n", reg);
  482. reg = mt_mpidr_read();
  483. dprintf(CRITICAL, "MPIDR: 0x%08x\n", reg);
  484. }