PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/brcm80211/include/chipcommon.h

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