chipcommon.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. // SPDX-License-Identifier: ISC
  2. /*
  3. * Copyright (c) 2010 Broadcom Corporation
  4. */
  5. #ifndef _SBCHIPC_H
  6. #define _SBCHIPC_H
  7. #include "defs.h" /* for PAD macro */
  8. #define CHIPCREGOFFS(field) offsetof(struct chipcregs, field)
  9. struct chipcregs {
  10. u32 chipid; /* 0x0 */
  11. u32 capabilities;
  12. u32 corecontrol; /* corerev >= 1 */
  13. u32 bist;
  14. /* OTP */
  15. u32 otpstatus; /* 0x10, corerev >= 10 */
  16. u32 otpcontrol;
  17. u32 otpprog;
  18. u32 otplayout; /* corerev >= 23 */
  19. /* Interrupt control */
  20. u32 intstatus; /* 0x20 */
  21. u32 intmask;
  22. /* Chip specific regs */
  23. u32 chipcontrol; /* 0x28, rev >= 11 */
  24. u32 chipstatus; /* 0x2c, rev >= 11 */
  25. /* Jtag Master */
  26. u32 jtagcmd; /* 0x30, rev >= 10 */
  27. u32 jtagir;
  28. u32 jtagdr;
  29. u32 jtagctrl;
  30. /* serial flash interface registers */
  31. u32 flashcontrol; /* 0x40 */
  32. u32 flashaddress;
  33. u32 flashdata;
  34. u32 PAD[1];
  35. /* Silicon backplane configuration broadcast control */
  36. u32 broadcastaddress; /* 0x50 */
  37. u32 broadcastdata;
  38. /* gpio - cleared only by power-on-reset */
  39. u32 gpiopullup; /* 0x58, corerev >= 20 */
  40. u32 gpiopulldown; /* 0x5c, corerev >= 20 */
  41. u32 gpioin; /* 0x60 */
  42. u32 gpioout; /* 0x64 */
  43. u32 gpioouten; /* 0x68 */
  44. u32 gpiocontrol; /* 0x6C */
  45. u32 gpiointpolarity; /* 0x70 */
  46. u32 gpiointmask; /* 0x74 */
  47. /* GPIO events corerev >= 11 */
  48. u32 gpioevent;
  49. u32 gpioeventintmask;
  50. /* Watchdog timer */
  51. u32 watchdog; /* 0x80 */
  52. /* GPIO events corerev >= 11 */
  53. u32 gpioeventintpolarity;
  54. /* GPIO based LED powersave registers corerev >= 16 */
  55. u32 gpiotimerval; /* 0x88 */
  56. u32 gpiotimeroutmask;
  57. /* clock control */
  58. u32 clockcontrol_n; /* 0x90 */
  59. u32 clockcontrol_sb; /* aka m0 */
  60. u32 clockcontrol_pci; /* aka m1 */
  61. u32 clockcontrol_m2; /* mii/uart/mipsref */
  62. u32 clockcontrol_m3; /* cpu */
  63. u32 clkdiv; /* corerev >= 3 */
  64. u32 gpiodebugsel; /* corerev >= 28 */
  65. u32 capabilities_ext; /* 0xac */
  66. /* pll delay registers (corerev >= 4) */
  67. u32 pll_on_delay; /* 0xb0 */
  68. u32 fref_sel_delay;
  69. u32 slow_clk_ctl; /* 5 < corerev < 10 */
  70. u32 PAD;
  71. /* Instaclock registers (corerev >= 10) */
  72. u32 system_clk_ctl; /* 0xc0 */
  73. u32 clkstatestretch;
  74. u32 PAD[2];
  75. /* Indirect backplane access (corerev >= 22) */
  76. u32 bp_addrlow; /* 0xd0 */
  77. u32 bp_addrhigh;
  78. u32 bp_data;
  79. u32 PAD;
  80. u32 bp_indaccess;
  81. u32 PAD[3];
  82. /* More clock dividers (corerev >= 32) */
  83. u32 clkdiv2;
  84. u32 PAD[2];
  85. /* In AI chips, pointer to erom */
  86. u32 eromptr; /* 0xfc */
  87. /* ExtBus control registers (corerev >= 3) */
  88. u32 pcmcia_config; /* 0x100 */
  89. u32 pcmcia_memwait;
  90. u32 pcmcia_attrwait;
  91. u32 pcmcia_iowait;
  92. u32 ide_config;
  93. u32 ide_memwait;
  94. u32 ide_attrwait;
  95. u32 ide_iowait;
  96. u32 prog_config;
  97. u32 prog_waitcount;
  98. u32 flash_config;
  99. u32 flash_waitcount;
  100. u32 SECI_config; /* 0x130 SECI configuration */
  101. u32 PAD[3];
  102. /* Enhanced Coexistence Interface (ECI) registers (corerev >= 21) */
  103. u32 eci_output; /* 0x140 */
  104. u32 eci_control;
  105. u32 eci_inputlo;
  106. u32 eci_inputmi;
  107. u32 eci_inputhi;
  108. u32 eci_inputintpolaritylo;
  109. u32 eci_inputintpolaritymi;
  110. u32 eci_inputintpolarityhi;
  111. u32 eci_intmasklo;
  112. u32 eci_intmaskmi;
  113. u32 eci_intmaskhi;
  114. u32 eci_eventlo;
  115. u32 eci_eventmi;
  116. u32 eci_eventhi;
  117. u32 eci_eventmasklo;
  118. u32 eci_eventmaskmi;
  119. u32 eci_eventmaskhi;
  120. u32 PAD[3];
  121. /* SROM interface (corerev >= 32) */
  122. u32 sromcontrol; /* 0x190 */
  123. u32 sromaddress;
  124. u32 sromdata;
  125. u32 PAD[17];
  126. /* Clock control and hardware workarounds (corerev >= 20) */
  127. u32 clk_ctl_st; /* 0x1e0 */
  128. u32 hw_war;
  129. u32 PAD[70];
  130. /* UARTs */
  131. u8 uart0data; /* 0x300 */
  132. u8 uart0imr;
  133. u8 uart0fcr;
  134. u8 uart0lcr;
  135. u8 uart0mcr;
  136. u8 uart0lsr;
  137. u8 uart0msr;
  138. u8 uart0scratch;
  139. u8 PAD[248]; /* corerev >= 1 */
  140. u8 uart1data; /* 0x400 */
  141. u8 uart1imr;
  142. u8 uart1fcr;
  143. u8 uart1lcr;
  144. u8 uart1mcr;
  145. u8 uart1lsr;
  146. u8 uart1msr;
  147. u8 uart1scratch;
  148. u32 PAD[62];
  149. /* save/restore, corerev >= 48 */
  150. u32 sr_capability; /* 0x500 */
  151. u32 sr_control0; /* 0x504 */
  152. u32 sr_control1; /* 0x508 */
  153. u32 gpio_control; /* 0x50C */
  154. u32 PAD[60];
  155. /* PMU registers (corerev >= 20) */
  156. u32 pmucontrol; /* 0x600 */
  157. u32 pmucapabilities;
  158. u32 pmustatus;
  159. u32 res_state;
  160. u32 res_pending;
  161. u32 pmutimer;
  162. u32 min_res_mask;
  163. u32 max_res_mask;
  164. u32 res_table_sel;
  165. u32 res_dep_mask;
  166. u32 res_updn_timer;
  167. u32 res_timer;
  168. u32 clkstretch;
  169. u32 pmuwatchdog;
  170. u32 gpiosel; /* 0x638, rev >= 1 */
  171. u32 gpioenable; /* 0x63c, rev >= 1 */
  172. u32 res_req_timer_sel;
  173. u32 res_req_timer;
  174. u32 res_req_mask;
  175. u32 pmucapabilities_ext; /* 0x64c, pmurev >=15 */
  176. u32 chipcontrol_addr; /* 0x650 */
  177. u32 chipcontrol_data; /* 0x654 */
  178. u32 regcontrol_addr;
  179. u32 regcontrol_data;
  180. u32 pllcontrol_addr;
  181. u32 pllcontrol_data;
  182. u32 pmustrapopt; /* 0x668, corerev >= 28 */
  183. u32 pmu_xtalfreq; /* 0x66C, pmurev >= 10 */
  184. u32 retention_ctl; /* 0x670, pmurev >= 15 */
  185. u32 PAD[3];
  186. u32 retention_grpidx; /* 0x680 */
  187. u32 retention_grpctl; /* 0x684 */
  188. u32 PAD[94];
  189. u16 sromotp[768];
  190. };
  191. /* chipid */
  192. #define CID_ID_MASK 0x0000ffff /* Chip Id mask */
  193. #define CID_REV_MASK 0x000f0000 /* Chip Revision mask */
  194. #define CID_REV_SHIFT 16 /* Chip Revision shift */
  195. #define CID_PKG_MASK 0x00f00000 /* Package Option mask */
  196. #define CID_PKG_SHIFT 20 /* Package Option shift */
  197. #define CID_CC_MASK 0x0f000000 /* CoreCount (corerev >= 4) */
  198. #define CID_CC_SHIFT 24
  199. #define CID_TYPE_MASK 0xf0000000 /* Chip Type */
  200. #define CID_TYPE_SHIFT 28
  201. /* capabilities */
  202. #define CC_CAP_UARTS_MASK 0x00000003 /* Number of UARTs */
  203. #define CC_CAP_MIPSEB 0x00000004 /* MIPS is in big-endian mode */
  204. #define CC_CAP_UCLKSEL 0x00000018 /* UARTs clock select */
  205. /* UARTs are driven by internal divided clock */
  206. #define CC_CAP_UINTCLK 0x00000008
  207. #define CC_CAP_UARTGPIO 0x00000020 /* UARTs own GPIOs 15:12 */
  208. #define CC_CAP_EXTBUS_MASK 0x000000c0 /* External bus mask */
  209. #define CC_CAP_EXTBUS_NONE 0x00000000 /* No ExtBus present */
  210. #define CC_CAP_EXTBUS_FULL 0x00000040 /* ExtBus: PCMCIA, IDE & Prog */
  211. #define CC_CAP_EXTBUS_PROG 0x00000080 /* ExtBus: ProgIf only */
  212. #define CC_CAP_FLASH_MASK 0x00000700 /* Type of flash */
  213. #define CC_CAP_PLL_MASK 0x00038000 /* Type of PLL */
  214. #define CC_CAP_PWR_CTL 0x00040000 /* Power control */
  215. #define CC_CAP_OTPSIZE 0x00380000 /* OTP Size (0 = none) */
  216. #define CC_CAP_OTPSIZE_SHIFT 19 /* OTP Size shift */
  217. #define CC_CAP_OTPSIZE_BASE 5 /* OTP Size base */
  218. #define CC_CAP_JTAGP 0x00400000 /* JTAG Master Present */
  219. #define CC_CAP_ROM 0x00800000 /* Internal boot rom active */
  220. #define CC_CAP_BKPLN64 0x08000000 /* 64-bit backplane */
  221. #define CC_CAP_PMU 0x10000000 /* PMU Present, rev >= 20 */
  222. #define CC_CAP_SROM 0x40000000 /* Srom Present, rev >= 32 */
  223. /* Nand flash present, rev >= 35 */
  224. #define CC_CAP_NFLASH 0x80000000
  225. #define CC_CAP2_SECI 0x00000001 /* SECI Present, rev >= 36 */
  226. /* GSIO (spi/i2c) present, rev >= 37 */
  227. #define CC_CAP2_GSIO 0x00000002
  228. /* sr_control0, rev >= 48 */
  229. #define CC_SR_CTL0_ENABLE_MASK BIT(0)
  230. #define CC_SR_CTL0_ENABLE_SHIFT 0
  231. #define CC_SR_CTL0_EN_SR_ENG_CLK_SHIFT 1 /* sr_clk to sr_memory enable */
  232. #define CC_SR_CTL0_RSRC_TRIGGER_SHIFT 2 /* Rising edge resource trigger 0 to
  233. * sr_engine
  234. */
  235. #define CC_SR_CTL0_MIN_DIV_SHIFT 6 /* Min division value for fast clk
  236. * in sr_engine
  237. */
  238. #define CC_SR_CTL0_EN_SBC_STBY_SHIFT 16
  239. #define CC_SR_CTL0_EN_SR_ALP_CLK_MASK_SHIFT 18
  240. #define CC_SR_CTL0_EN_SR_HT_CLK_SHIFT 19
  241. #define CC_SR_CTL0_ALLOW_PIC_SHIFT 20 /* Allow pic to separate power
  242. * domains
  243. */
  244. #define CC_SR_CTL0_MAX_SR_LQ_CLK_CNT_SHIFT 25
  245. #define CC_SR_CTL0_EN_MEM_DISABLE_FOR_SLEEP 30
  246. /* pmucapabilities */
  247. #define PCAP_REV_MASK 0x000000ff
  248. #define PCAP_RC_MASK 0x00001f00
  249. #define PCAP_RC_SHIFT 8
  250. #define PCAP_TC_MASK 0x0001e000
  251. #define PCAP_TC_SHIFT 13
  252. #define PCAP_PC_MASK 0x001e0000
  253. #define PCAP_PC_SHIFT 17
  254. #define PCAP_VC_MASK 0x01e00000
  255. #define PCAP_VC_SHIFT 21
  256. #define PCAP_CC_MASK 0x1e000000
  257. #define PCAP_CC_SHIFT 25
  258. #define PCAP5_PC_MASK 0x003e0000 /* PMU corerev >= 5 */
  259. #define PCAP5_PC_SHIFT 17
  260. #define PCAP5_VC_MASK 0x07c00000
  261. #define PCAP5_VC_SHIFT 22
  262. #define PCAP5_CC_MASK 0xf8000000
  263. #define PCAP5_CC_SHIFT 27
  264. /* pmucapabilites_ext PMU rev >= 15 */
  265. #define PCAPEXT_SR_SUPPORTED_MASK (1 << 1)
  266. /* retention_ctl PMU rev >= 15 */
  267. #define PMU_RCTL_MACPHY_DISABLE_MASK (1 << 26)
  268. #define PMU_RCTL_LOGIC_DISABLE_MASK (1 << 27)
  269. /*
  270. * Maximum delay for the PMU state transition in us.
  271. * This is an upper bound intended for spinwaits etc.
  272. */
  273. #define PMU_MAX_TRANSITION_DLY 15000
  274. #endif /* _SBCHIPC_H */