ctop.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Copyright(c) 2015 EZchip Technologies.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * The full GNU General Public License is included in this distribution in
  14. * the file called "COPYING".
  15. */
  16. #ifndef _PLAT_EZNPS_CTOP_H
  17. #define _PLAT_EZNPS_CTOP_H
  18. #ifndef CONFIG_ARC_PLAT_EZNPS
  19. #error "Incorrect ctop.h include"
  20. #endif
  21. #include <linux/types.h>
  22. #include <soc/nps/common.h>
  23. /* core auxiliary registers */
  24. #ifdef __ASSEMBLY__
  25. #define CTOP_AUX_BASE (-0x800)
  26. #else
  27. #define CTOP_AUX_BASE 0xFFFFF800
  28. #endif
  29. #define CTOP_AUX_GLOBAL_ID (CTOP_AUX_BASE + 0x000)
  30. #define CTOP_AUX_CLUSTER_ID (CTOP_AUX_BASE + 0x004)
  31. #define CTOP_AUX_CORE_ID (CTOP_AUX_BASE + 0x008)
  32. #define CTOP_AUX_THREAD_ID (CTOP_AUX_BASE + 0x00C)
  33. #define CTOP_AUX_LOGIC_GLOBAL_ID (CTOP_AUX_BASE + 0x010)
  34. #define CTOP_AUX_LOGIC_CLUSTER_ID (CTOP_AUX_BASE + 0x014)
  35. #define CTOP_AUX_LOGIC_CORE_ID (CTOP_AUX_BASE + 0x018)
  36. #define CTOP_AUX_MT_CTRL (CTOP_AUX_BASE + 0x020)
  37. #define CTOP_AUX_HW_COMPLY (CTOP_AUX_BASE + 0x024)
  38. #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030)
  39. #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080)
  40. #define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088)
  41. #define CTOP_AUX_GPA1 (CTOP_AUX_BASE + 0x08C)
  42. #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300)
  43. /* EZchip core instructions */
  44. #define CTOP_INST_HWSCHD_OFF_R3 0x3B6F00BF
  45. #define CTOP_INST_HWSCHD_OFF_R4 0x3C6F00BF
  46. #define CTOP_INST_HWSCHD_RESTORE_R3 0x3E6F70C3
  47. #define CTOP_INST_HWSCHD_RESTORE_R4 0x3E6F7103
  48. #define CTOP_INST_SCHD_RW 0x3E6F7004
  49. #define CTOP_INST_SCHD_RD 0x3E6F7084
  50. #define CTOP_INST_ASRI_0_R3 0x3B56003E
  51. #define CTOP_INST_XEX_DI_R2_R2_R3 0x4A664C00
  52. #define CTOP_INST_EXC_DI_R2_R2_R3 0x4A664C01
  53. #define CTOP_INST_AADD_DI_R2_R2_R3 0x4A664C02
  54. #define CTOP_INST_AAND_DI_R2_R2_R3 0x4A664C04
  55. #define CTOP_INST_AOR_DI_R2_R2_R3 0x4A664C05
  56. #define CTOP_INST_AXOR_DI_R2_R2_R3 0x4A664C06
  57. /* Do not use D$ for address in 2G-3G */
  58. #define HW_COMPLY_KRN_NOT_D_CACHED _BITUL(28)
  59. #define NPS_MSU_EN_CFG 0x80
  60. #define NPS_CRG_BLKID 0x480
  61. #define NPS_CRG_SYNC_BIT _BITUL(0)
  62. #define NPS_GIM_BLKID 0x5C0
  63. /* GIM registers and fields*/
  64. #define NPS_GIM_UART_LINE _BITUL(7)
  65. #define NPS_GIM_DBG_LAN_EAST_TX_DONE_LINE _BITUL(10)
  66. #define NPS_GIM_DBG_LAN_EAST_RX_RDY_LINE _BITUL(11)
  67. #define NPS_GIM_DBG_LAN_WEST_TX_DONE_LINE _BITUL(25)
  68. #define NPS_GIM_DBG_LAN_WEST_RX_RDY_LINE _BITUL(26)
  69. #ifndef __ASSEMBLY__
  70. /* Functional registers definition */
  71. struct nps_host_reg_mtm_cfg {
  72. union {
  73. struct {
  74. u32 gen:1, gdis:1, clk_gate_dis:1, asb:1,
  75. __reserved:9, nat:3, ten:16;
  76. };
  77. u32 value;
  78. };
  79. };
  80. struct nps_host_reg_mtm_cpu_cfg {
  81. union {
  82. struct {
  83. u32 csa:22, dmsid:6, __reserved:3, cs:1;
  84. };
  85. u32 value;
  86. };
  87. };
  88. struct nps_host_reg_thr_init {
  89. union {
  90. struct {
  91. u32 str:1, __reserved:27, thr_id:4;
  92. };
  93. u32 value;
  94. };
  95. };
  96. struct nps_host_reg_thr_init_sts {
  97. union {
  98. struct {
  99. u32 bsy:1, err:1, __reserved:26, thr_id:4;
  100. };
  101. u32 value;
  102. };
  103. };
  104. struct nps_host_reg_msu_en_cfg {
  105. union {
  106. struct {
  107. u32 __reserved1:11,
  108. rtc_en:1, ipc_en:1, gim_1_en:1,
  109. gim_0_en:1, ipi_en:1, buff_e_rls_bmuw:1,
  110. buff_e_alc_bmuw:1, buff_i_rls_bmuw:1, buff_i_alc_bmuw:1,
  111. buff_e_rls_bmue:1, buff_e_alc_bmue:1, buff_i_rls_bmue:1,
  112. buff_i_alc_bmue:1, __reserved2:1, buff_e_pre_en:1,
  113. buff_i_pre_en:1, pmuw_ja_en:1, pmue_ja_en:1,
  114. pmuw_nj_en:1, pmue_nj_en:1, msu_en:1;
  115. };
  116. u32 value;
  117. };
  118. };
  119. struct nps_host_reg_gim_p_int_dst {
  120. union {
  121. struct {
  122. u32 int_out_en:1, __reserved1:4,
  123. is:1, intm:2, __reserved2:4,
  124. nid:4, __reserved3:4, cid:4,
  125. __reserved4:4, tid:4;
  126. };
  127. u32 value;
  128. };
  129. };
  130. /* AUX registers definition */
  131. struct nps_host_reg_aux_udmc {
  132. union {
  133. struct {
  134. u32 dcp:1, cme:1, __reserved:19, nat:3,
  135. __reserved2:5, dcas:3;
  136. };
  137. u32 value;
  138. };
  139. };
  140. struct nps_host_reg_aux_mt_ctrl {
  141. union {
  142. struct {
  143. u32 mten:1, hsen:1, scd:1, sten:1,
  144. st_cnt:8, __reserved:8,
  145. hs_cnt:8, __reserved1:4;
  146. };
  147. u32 value;
  148. };
  149. };
  150. struct nps_host_reg_aux_hw_comply {
  151. union {
  152. struct {
  153. u32 me:1, le:1, te:1, knc:1, __reserved:28;
  154. };
  155. u32 value;
  156. };
  157. };
  158. struct nps_host_reg_aux_lpc {
  159. union {
  160. struct {
  161. u32 mep:1, __reserved:31;
  162. };
  163. u32 value;
  164. };
  165. };
  166. /* CRG registers */
  167. #define REG_GEN_PURP_0 nps_host_reg_non_cl(NPS_CRG_BLKID, 0x1BF)
  168. /* GIM registers */
  169. #define REG_GIM_P_INT_EN_0 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x100)
  170. #define REG_GIM_P_INT_POL_0 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x110)
  171. #define REG_GIM_P_INT_SENS_0 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x114)
  172. #define REG_GIM_P_INT_BLK_0 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x118)
  173. #define REG_GIM_P_INT_DST_10 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x13A)
  174. #define REG_GIM_P_INT_DST_11 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x13B)
  175. #define REG_GIM_P_INT_DST_25 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x149)
  176. #define REG_GIM_P_INT_DST_26 nps_host_reg_non_cl(NPS_GIM_BLKID, 0x14A)
  177. #else
  178. .macro GET_CPU_ID reg
  179. lr \reg, [CTOP_AUX_LOGIC_GLOBAL_ID]
  180. #ifndef CONFIG_EZNPS_MTM_EXT
  181. lsr \reg, \reg, 4
  182. #endif
  183. .endm
  184. #endif /* __ASSEMBLY__ */
  185. #endif /* _PLAT_EZNPS_CTOP_H */