asic3.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. /*
  2. * include/linux/mfd/asic3.h
  3. *
  4. * Compaq ASIC3 headers.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. *
  10. * Copyright 2001 Compaq Computer Corporation.
  11. * Copyright 2007 OpendHand.
  12. */
  13. #ifndef __ASIC3_H__
  14. #define __ASIC3_H__
  15. #include <linux/types.h>
  16. struct asic3_platform_data {
  17. struct {
  18. u32 dir;
  19. u32 init;
  20. u32 sleep_mask;
  21. u32 sleep_out;
  22. u32 batt_fault_out;
  23. u32 sleep_conf;
  24. u32 alt_function;
  25. } gpio_a, gpio_b, gpio_c, gpio_d;
  26. unsigned int bus_shift;
  27. unsigned int irq_base;
  28. unsigned int gpio_base;
  29. struct platform_device **children;
  30. unsigned int n_children;
  31. };
  32. #define ASIC3_NUM_GPIO_BANKS 4
  33. #define ASIC3_GPIOS_PER_BANK 16
  34. #define ASIC3_NUM_GPIOS 64
  35. #define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
  36. #define ASIC3_TO_GPIO(gpio) (NR_BUILTIN_GPIO + (gpio))
  37. #define ASIC3_GPIO_BANK_A 0
  38. #define ASIC3_GPIO_BANK_B 1
  39. #define ASIC3_GPIO_BANK_C 2
  40. #define ASIC3_GPIO_BANK_D 3
  41. #define ASIC3_GPIO(bank, gpio) \
  42. ((ASIC3_GPIOS_PER_BANK * ASIC3_GPIO_BANK_##bank) + (gpio))
  43. #define ASIC3_GPIO_bit(gpio) (1 << (gpio & 0xf))
  44. /* All offsets below are specified with this address bus shift */
  45. #define ASIC3_DEFAULT_ADDR_SHIFT 2
  46. #define ASIC3_OFFSET(base, reg) (ASIC3_##base##_Base + ASIC3_##base##_##reg)
  47. #define ASIC3_GPIO_OFFSET(base, reg) \
  48. (ASIC3_GPIO_##base##_Base + ASIC3_GPIO_##reg)
  49. #define ASIC3_GPIO_A_Base 0x0000
  50. #define ASIC3_GPIO_B_Base 0x0100
  51. #define ASIC3_GPIO_C_Base 0x0200
  52. #define ASIC3_GPIO_D_Base 0x0300
  53. #define ASIC3_GPIO_TO_BANK(gpio) ((gpio) >> 4)
  54. #define ASIC3_GPIO_TO_BIT(gpio) ((gpio) - \
  55. (ASIC3_GPIOS_PER_BANK * ((gpio) >> 4)))
  56. #define ASIC3_GPIO_TO_MASK(gpio) (1 << ASIC3_GPIO_TO_BIT(gpio))
  57. #define ASIC3_GPIO_TO_BASE(gpio) (ASIC3_GPIO_A_Base + (((gpio) >> 4) * 0x0100))
  58. #define ASIC3_BANK_TO_BASE(bank) (ASIC3_GPIO_A_Base + ((bank) * 0x100))
  59. #define ASIC3_GPIO_Mask 0x00 /* R/W 0:don't mask */
  60. #define ASIC3_GPIO_Direction 0x04 /* R/W 0:input */
  61. #define ASIC3_GPIO_Out 0x08 /* R/W 0:output low */
  62. #define ASIC3_GPIO_TriggerType 0x0c /* R/W 0:level */
  63. #define ASIC3_GPIO_EdgeTrigger 0x10 /* R/W 0:falling */
  64. #define ASIC3_GPIO_LevelTrigger 0x14 /* R/W 0:low level detect */
  65. #define ASIC3_GPIO_SleepMask 0x18 /* R/W 0:don't mask in sleep mode */
  66. #define ASIC3_GPIO_SleepOut 0x1c /* R/W level 0:low in sleep mode */
  67. #define ASIC3_GPIO_BattFaultOut 0x20 /* R/W level 0:low in batt_fault */
  68. #define ASIC3_GPIO_IntStatus 0x24 /* R/W 0:none, 1:detect */
  69. #define ASIC3_GPIO_AltFunction 0x28 /* R/W 1:LED register control */
  70. #define ASIC3_GPIO_SleepConf 0x2c /*
  71. * R/W bit 1: autosleep
  72. * 0: disable gposlpout in normal mode,
  73. * enable gposlpout in sleep mode.
  74. */
  75. #define ASIC3_GPIO_Status 0x30 /* R Pin status */
  76. #define ASIC3_SPI_Base 0x0400
  77. #define ASIC3_SPI_Control 0x0000
  78. #define ASIC3_SPI_TxData 0x0004
  79. #define ASIC3_SPI_RxData 0x0008
  80. #define ASIC3_SPI_Int 0x000c
  81. #define ASIC3_SPI_Status 0x0010
  82. #define SPI_CONTROL_SPR(clk) ((clk) & 0x0f) /* Clock rate */
  83. #define ASIC3_PWM_0_Base 0x0500
  84. #define ASIC3_PWM_1_Base 0x0600
  85. #define ASIC3_PWM_TimeBase 0x0000
  86. #define ASIC3_PWM_PeriodTime 0x0004
  87. #define ASIC3_PWM_DutyTime 0x0008
  88. #define PWM_TIMEBASE_VALUE(x) ((x)&0xf) /* Low 4 bits sets time base */
  89. #define PWM_TIMEBASE_ENABLE (1 << 4) /* Enable clock */
  90. #define ASIC3_LED_0_Base 0x0700
  91. #define ASIC3_LED_1_Base 0x0800
  92. #define ASIC3_LED_2_Base 0x0900
  93. #define ASIC3_LED_TimeBase 0x0000 /* R/W 7 bits */
  94. #define ASIC3_LED_PeriodTime 0x0004 /* R/W 12 bits */
  95. #define ASIC3_LED_DutyTime 0x0008 /* R/W 12 bits */
  96. #define ASIC3_LED_AutoStopCount 0x000c /* R/W 16 bits */
  97. /* LED TimeBase bits - match ASIC2 */
  98. #define LED_TBS 0x0f /* Low 4 bits sets time base, max = 13 */
  99. /* Note: max = 5 on hx4700 */
  100. /* 0: maximum time base */
  101. /* 1: maximum time base / 2 */
  102. /* n: maximum time base / 2^n */
  103. #define LED_EN (1 << 4) /* LED ON/OFF 0:off, 1:on */
  104. #define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */
  105. #define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */
  106. #define ASIC3_CLOCK_Base 0x0A00
  107. #define ASIC3_CLOCK_CDEX 0x00
  108. #define ASIC3_CLOCK_SEL 0x04
  109. #define CLOCK_CDEX_SOURCE (1 << 0) /* 2 bits */
  110. #define CLOCK_CDEX_SOURCE0 (1 << 0)
  111. #define CLOCK_CDEX_SOURCE1 (1 << 1)
  112. #define CLOCK_CDEX_SPI (1 << 2)
  113. #define CLOCK_CDEX_OWM (1 << 3)
  114. #define CLOCK_CDEX_PWM0 (1 << 4)
  115. #define CLOCK_CDEX_PWM1 (1 << 5)
  116. #define CLOCK_CDEX_LED0 (1 << 6)
  117. #define CLOCK_CDEX_LED1 (1 << 7)
  118. #define CLOCK_CDEX_LED2 (1 << 8)
  119. /* Clocks settings: 1 for 24.576 MHz, 0 for 12.288Mhz */
  120. #define CLOCK_CDEX_SD_HOST (1 << 9) /* R/W: SD host clock source */
  121. #define CLOCK_CDEX_SD_BUS (1 << 10) /* R/W: SD bus clock source ctrl */
  122. #define CLOCK_CDEX_SMBUS (1 << 11)
  123. #define CLOCK_CDEX_CONTROL_CX (1 << 12)
  124. #define CLOCK_CDEX_EX0 (1 << 13) /* R/W: 32.768 kHz crystal */
  125. #define CLOCK_CDEX_EX1 (1 << 14) /* R/W: 24.576 MHz crystal */
  126. #define CLOCK_SEL_SD_HCLK_SEL (1 << 0) /* R/W: SDIO host clock select */
  127. #define CLOCK_SEL_SD_BCLK_SEL (1 << 1) /* R/W: SDIO bus clock select */
  128. /* R/W: INT clock source control (32.768 kHz) */
  129. #define CLOCK_SEL_CX (1 << 2)
  130. #define ASIC3_INTR_Base 0x0B00
  131. #define ASIC3_INTR_IntMask 0x00 /* Interrupt mask control */
  132. #define ASIC3_INTR_PIntStat 0x04 /* Peripheral interrupt status */
  133. #define ASIC3_INTR_IntCPS 0x08 /* Interrupt timer clock pre-scale */
  134. #define ASIC3_INTR_IntTBS 0x0c /* Interrupt timer set */
  135. #define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */
  136. #define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */
  137. #define ASIC3_INTMASK_MASK0 (1 << 2)
  138. #define ASIC3_INTMASK_MASK1 (1 << 3)
  139. #define ASIC3_INTMASK_MASK2 (1 << 4)
  140. #define ASIC3_INTMASK_MASK3 (1 << 5)
  141. #define ASIC3_INTMASK_MASK4 (1 << 6)
  142. #define ASIC3_INTMASK_MASK5 (1 << 7)
  143. #define ASIC3_INTR_PERIPHERAL_A (1 << 0)
  144. #define ASIC3_INTR_PERIPHERAL_B (1 << 1)
  145. #define ASIC3_INTR_PERIPHERAL_C (1 << 2)
  146. #define ASIC3_INTR_PERIPHERAL_D (1 << 3)
  147. #define ASIC3_INTR_LED0 (1 << 4)
  148. #define ASIC3_INTR_LED1 (1 << 5)
  149. #define ASIC3_INTR_LED2 (1 << 6)
  150. #define ASIC3_INTR_SPI (1 << 7)
  151. #define ASIC3_INTR_SMBUS (1 << 8)
  152. #define ASIC3_INTR_OWM (1 << 9)
  153. #define ASIC3_INTR_CPS(x) ((x)&0x0f) /* 4 bits, max 14 */
  154. #define ASIC3_INTR_CPS_SET (1 << 4) /* Time base enable */
  155. /* Basic control of the SD ASIC */
  156. #define ASIC3_SDHWCTRL_Base 0x0E00
  157. #define ASIC3_SDHWCTRL_SDConf 0x00
  158. #define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */
  159. #define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */
  160. #define ASIC3_SDHWCTRL_PCLR (1 << 2) /* All registers of SDIO cleared */
  161. #define ASIC3_SDHWCTRL_LEVCD (1 << 3) /* SD card detection: 0:low */
  162. /* SD card write protection: 0=high */
  163. #define ASIC3_SDHWCTRL_LEVWP (1 << 4)
  164. #define ASIC3_SDHWCTRL_SDLED (1 << 5) /* SD card LED signal 0=disable */
  165. /* SD card power supply ctrl 1=enable */
  166. #define ASIC3_SDHWCTRL_SDPWR (1 << 6)
  167. #define ASIC3_EXTCF_Base 0x1100
  168. #define ASIC3_EXTCF_Select 0x00
  169. #define ASIC3_EXTCF_Reset 0x04
  170. #define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */
  171. #define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */
  172. #define ASIC3_EXTCF_SMOD2 (1 << 2) /* slot number of mode 2 */
  173. #define ASIC3_EXTCF_OWM_EN (1 << 4) /* enable onewire module */
  174. #define ASIC3_EXTCF_OWM_SMB (1 << 5) /* OWM bus selection */
  175. #define ASIC3_EXTCF_OWM_RESET (1 << 6) /* ?? used by OWM and CF */
  176. #define ASIC3_EXTCF_CF0_SLEEP_MODE (1 << 7) /* CF0 sleep state */
  177. #define ASIC3_EXTCF_CF1_SLEEP_MODE (1 << 8) /* CF1 sleep state */
  178. #define ASIC3_EXTCF_CF0_PWAIT_EN (1 << 10) /* CF0 PWAIT_n control */
  179. #define ASIC3_EXTCF_CF1_PWAIT_EN (1 << 11) /* CF1 PWAIT_n control */
  180. #define ASIC3_EXTCF_CF0_BUF_EN (1 << 12) /* CF0 buffer control */
  181. #define ASIC3_EXTCF_CF1_BUF_EN (1 << 13) /* CF1 buffer control */
  182. #define ASIC3_EXTCF_SD_MEM_ENABLE (1 << 14)
  183. #define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */
  184. /*********************************************
  185. * The Onewire interface registers
  186. *
  187. * OWM_CMD
  188. * OWM_DAT
  189. * OWM_INTR
  190. * OWM_INTEN
  191. * OWM_CLKDIV
  192. *
  193. *********************************************/
  194. #define ASIC3_OWM_Base 0xC00
  195. #define ASIC3_OWM_CMD 0x00
  196. #define ASIC3_OWM_DAT 0x04
  197. #define ASIC3_OWM_INTR 0x08
  198. #define ASIC3_OWM_INTEN 0x0C
  199. #define ASIC3_OWM_CLKDIV 0x10
  200. #define ASIC3_OWM_CMD_ONEWR (1 << 0)
  201. #define ASIC3_OWM_CMD_SRA (1 << 1)
  202. #define ASIC3_OWM_CMD_DQO (1 << 2)
  203. #define ASIC3_OWM_CMD_DQI (1 << 3)
  204. #define ASIC3_OWM_INTR_PD (1 << 0)
  205. #define ASIC3_OWM_INTR_PDR (1 << 1)
  206. #define ASIC3_OWM_INTR_TBE (1 << 2)
  207. #define ASIC3_OWM_INTR_TEMP (1 << 3)
  208. #define ASIC3_OWM_INTR_RBF (1 << 4)
  209. #define ASIC3_OWM_INTEN_EPD (1 << 0)
  210. #define ASIC3_OWM_INTEN_IAS (1 << 1)
  211. #define ASIC3_OWM_INTEN_ETBE (1 << 2)
  212. #define ASIC3_OWM_INTEN_ETMT (1 << 3)
  213. #define ASIC3_OWM_INTEN_ERBF (1 << 4)
  214. #define ASIC3_OWM_CLKDIV_PRE (3 << 0) /* two bits wide at bit 0 */
  215. #define ASIC3_OWM_CLKDIV_DIV (7 << 2) /* 3 bits wide at bit 2 */
  216. /*****************************************************************************
  217. * The SD configuration registers are at a completely different location
  218. * in memory. They are divided into three sets of registers:
  219. *
  220. * SD_CONFIG Core configuration register
  221. * SD_CTRL Control registers for SD operations
  222. * SDIO_CTRL Control registers for SDIO operations
  223. *
  224. *****************************************************************************/
  225. #define ASIC3_SD_CONFIG_Base 0x0400 /* Assumes 32 bit addressing */
  226. #define ASIC3_SD_CONFIG_Command 0x08 /* R/W: Command */
  227. /* [0:8] SD Control Register Base Address */
  228. #define ASIC3_SD_CONFIG_Addr0 0x20
  229. /* [9:31] SD Control Register Base Address */
  230. #define ASIC3_SD_CONFIG_Addr1 0x24
  231. /* R/O: interrupt assigned to pin */
  232. #define ASIC3_SD_CONFIG_IntPin 0x78
  233. /*
  234. * Set to 0x1f to clock SD controller, 0 otherwise.
  235. * At 0x82 - Gated Clock Ctrl
  236. */
  237. #define ASIC3_SD_CONFIG_ClkStop 0x80
  238. /* Control clock of SD controller */
  239. #define ASIC3_SD_CONFIG_ClockMode 0x84
  240. #define ASIC3_SD_CONFIG_SDHC_PinStatus 0x88 /* R/0: SD pins status */
  241. #define ASIC3_SD_CONFIG_SDHC_Power1 0x90 /* Power1 - manual pwr ctrl */
  242. /* auto power up after card inserted */
  243. #define ASIC3_SD_CONFIG_SDHC_Power2 0x92
  244. /* auto power down when card removed */
  245. #define ASIC3_SD_CONFIG_SDHC_Power3 0x94
  246. #define ASIC3_SD_CONFIG_SDHC_CardDetect 0x98
  247. #define ASIC3_SD_CONFIG_SDHC_Slot 0xA0 /* R/O: support slot number */
  248. #define ASIC3_SD_CONFIG_SDHC_ExtGateClk1 0x1E0 /* Not used */
  249. #define ASIC3_SD_CONFIG_SDHC_ExtGateClk2 0x1E2 /* Not used*/
  250. /* GPIO Output Reg. , at 0x1EA - GPIO Output Enable Reg. */
  251. #define ASIC3_SD_CONFIG_SDHC_GPIO_OutAndEnable 0x1E8
  252. #define ASIC3_SD_CONFIG_SDHC_GPIO_Status 0x1EC /* GPIO Status Reg. */
  253. /* Bit 1: double buffer/single buffer */
  254. #define ASIC3_SD_CONFIG_SDHC_ExtGateClk3 0x1F0
  255. /* Memory access enable (set to 1 to access SD Controller) */
  256. #define SD_CONFIG_COMMAND_MAE (1<<1)
  257. #define SD_CONFIG_CLK_ENABLE_ALL 0x1f
  258. #define SD_CONFIG_POWER1_PC_33V 0x0200 /* Set for 3.3 volts */
  259. #define SD_CONFIG_POWER1_PC_OFF 0x0000 /* Turn off power */
  260. /* two bits - number of cycles for card detection */
  261. #define SD_CONFIG_CARDDETECTMODE_CLK ((x) & 0x3)
  262. #define ASIC3_SD_CTRL_Base 0x1000
  263. #define ASIC3_SD_CTRL_Cmd 0x00
  264. #define ASIC3_SD_CTRL_Arg0 0x08
  265. #define ASIC3_SD_CTRL_Arg1 0x0C
  266. #define ASIC3_SD_CTRL_StopInternal 0x10
  267. #define ASIC3_SD_CTRL_TransferSectorCount 0x14
  268. #define ASIC3_SD_CTRL_Response0 0x18
  269. #define ASIC3_SD_CTRL_Response1 0x1C
  270. #define ASIC3_SD_CTRL_Response2 0x20
  271. #define ASIC3_SD_CTRL_Response3 0x24
  272. #define ASIC3_SD_CTRL_Response4 0x28
  273. #define ASIC3_SD_CTRL_Response5 0x2C
  274. #define ASIC3_SD_CTRL_Response6 0x30
  275. #define ASIC3_SD_CTRL_Response7 0x34
  276. #define ASIC3_SD_CTRL_CardStatus 0x38
  277. #define ASIC3_SD_CTRL_BufferCtrl 0x3C
  278. #define ASIC3_SD_CTRL_IntMaskCard 0x40
  279. #define ASIC3_SD_CTRL_IntMaskBuffer 0x44
  280. #define ASIC3_SD_CTRL_CardClockCtrl 0x48
  281. #define ASIC3_SD_CTRL_MemCardXferDataLen 0x4C
  282. #define ASIC3_SD_CTRL_MemCardOptionSetup 0x50
  283. #define ASIC3_SD_CTRL_ErrorStatus0 0x58
  284. #define ASIC3_SD_CTRL_ErrorStatus1 0x5C
  285. #define ASIC3_SD_CTRL_DataPort 0x60
  286. #define ASIC3_SD_CTRL_TransactionCtrl 0x68
  287. #define ASIC3_SD_CTRL_SoftwareReset 0x1C0
  288. #define SD_CTRL_SOFTWARE_RESET_CLEAR (1<<0)
  289. #define SD_CTRL_TRANSACTIONCONTROL_SET (1<<8)
  290. #define SD_CTRL_CARDCLOCKCONTROL_FOR_SD_CARD (1<<15)
  291. #define SD_CTRL_CARDCLOCKCONTROL_ENABLE_CLOCK (1<<8)
  292. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_512 (1<<7)
  293. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_256 (1<<6)
  294. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_128 (1<<5)
  295. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_64 (1<<4)
  296. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_32 (1<<3)
  297. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_16 (1<<2)
  298. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_8 (1<<1)
  299. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_4 (1<<0)
  300. #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_2 (0<<0)
  301. #define MEM_CARD_OPTION_REQUIRED 0x000e
  302. #define MEM_CARD_OPTION_DATA_RESPONSE_TIMEOUT(x) (((x) & 0x0f) << 4)
  303. #define MEM_CARD_OPTION_C2_MODULE_NOT_PRESENT (1<<14)
  304. #define MEM_CARD_OPTION_DATA_XFR_WIDTH_1 (1<<15)
  305. #define MEM_CARD_OPTION_DATA_XFR_WIDTH_4 0
  306. #define SD_CTRL_COMMAND_INDEX(x) ((x) & 0x3f)
  307. #define SD_CTRL_COMMAND_TYPE_CMD (0 << 6)
  308. #define SD_CTRL_COMMAND_TYPE_ACMD (1 << 6)
  309. #define SD_CTRL_COMMAND_TYPE_AUTHENTICATION (2 << 6)
  310. #define SD_CTRL_COMMAND_RESPONSE_TYPE_NORMAL (0 << 8)
  311. #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1 (4 << 8)
  312. #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1B (5 << 8)
  313. #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R2 (6 << 8)
  314. #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R3 (7 << 8)
  315. #define SD_CTRL_COMMAND_DATA_PRESENT (1 << 11)
  316. #define SD_CTRL_COMMAND_TRANSFER_READ (1 << 12)
  317. #define SD_CTRL_COMMAND_TRANSFER_WRITE (0 << 12)
  318. #define SD_CTRL_COMMAND_MULTI_BLOCK (1 << 13)
  319. #define SD_CTRL_COMMAND_SECURITY_CMD (1 << 14)
  320. #define SD_CTRL_STOP_INTERNAL_ISSSUE_CMD12 (1 << 0)
  321. #define SD_CTRL_STOP_INTERNAL_AUTO_ISSUE_CMD12 (1 << 8)
  322. #define SD_CTRL_CARDSTATUS_RESPONSE_END (1 << 0)
  323. #define SD_CTRL_CARDSTATUS_RW_END (1 << 2)
  324. #define SD_CTRL_CARDSTATUS_CARD_REMOVED_0 (1 << 3)
  325. #define SD_CTRL_CARDSTATUS_CARD_INSERTED_0 (1 << 4)
  326. #define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_0 (1 << 5)
  327. #define SD_CTRL_CARDSTATUS_WRITE_PROTECT (1 << 7)
  328. #define SD_CTRL_CARDSTATUS_CARD_REMOVED_3 (1 << 8)
  329. #define SD_CTRL_CARDSTATUS_CARD_INSERTED_3 (1 << 9)
  330. #define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_3 (1 << 10)
  331. #define SD_CTRL_BUFFERSTATUS_CMD_INDEX_ERROR (1 << 0)
  332. #define SD_CTRL_BUFFERSTATUS_CRC_ERROR (1 << 1)
  333. #define SD_CTRL_BUFFERSTATUS_STOP_BIT_END_ERROR (1 << 2)
  334. #define SD_CTRL_BUFFERSTATUS_DATA_TIMEOUT (1 << 3)
  335. #define SD_CTRL_BUFFERSTATUS_BUFFER_OVERFLOW (1 << 4)
  336. #define SD_CTRL_BUFFERSTATUS_BUFFER_UNDERFLOW (1 << 5)
  337. #define SD_CTRL_BUFFERSTATUS_CMD_TIMEOUT (1 << 6)
  338. #define SD_CTRL_BUFFERSTATUS_UNK7 (1 << 7)
  339. #define SD_CTRL_BUFFERSTATUS_BUFFER_READ_ENABLE (1 << 8)
  340. #define SD_CTRL_BUFFERSTATUS_BUFFER_WRITE_ENABLE (1 << 9)
  341. #define SD_CTRL_BUFFERSTATUS_ILLEGAL_FUNCTION (1 << 13)
  342. #define SD_CTRL_BUFFERSTATUS_CMD_BUSY (1 << 14)
  343. #define SD_CTRL_BUFFERSTATUS_ILLEGAL_ACCESS (1 << 15)
  344. #define SD_CTRL_INTMASKCARD_RESPONSE_END (1 << 0)
  345. #define SD_CTRL_INTMASKCARD_RW_END (1 << 2)
  346. #define SD_CTRL_INTMASKCARD_CARD_REMOVED_0 (1 << 3)
  347. #define SD_CTRL_INTMASKCARD_CARD_INSERTED_0 (1 << 4)
  348. #define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_0 (1 << 5)
  349. #define SD_CTRL_INTMASKCARD_UNK6 (1 << 6)
  350. #define SD_CTRL_INTMASKCARD_WRITE_PROTECT (1 << 7)
  351. #define SD_CTRL_INTMASKCARD_CARD_REMOVED_3 (1 << 8)
  352. #define SD_CTRL_INTMASKCARD_CARD_INSERTED_3 (1 << 9)
  353. #define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_3 (1 << 10)
  354. #define SD_CTRL_INTMASKBUFFER_CMD_INDEX_ERROR (1 << 0)
  355. #define SD_CTRL_INTMASKBUFFER_CRC_ERROR (1 << 1)
  356. #define SD_CTRL_INTMASKBUFFER_STOP_BIT_END_ERROR (1 << 2)
  357. #define SD_CTRL_INTMASKBUFFER_DATA_TIMEOUT (1 << 3)
  358. #define SD_CTRL_INTMASKBUFFER_BUFFER_OVERFLOW (1 << 4)
  359. #define SD_CTRL_INTMASKBUFFER_BUFFER_UNDERFLOW (1 << 5)
  360. #define SD_CTRL_INTMASKBUFFER_CMD_TIMEOUT (1 << 6)
  361. #define SD_CTRL_INTMASKBUFFER_UNK7 (1 << 7)
  362. #define SD_CTRL_INTMASKBUFFER_BUFFER_READ_ENABLE (1 << 8)
  363. #define SD_CTRL_INTMASKBUFFER_BUFFER_WRITE_ENABLE (1 << 9)
  364. #define SD_CTRL_INTMASKBUFFER_ILLEGAL_FUNCTION (1 << 13)
  365. #define SD_CTRL_INTMASKBUFFER_CMD_BUSY (1 << 14)
  366. #define SD_CTRL_INTMASKBUFFER_ILLEGAL_ACCESS (1 << 15)
  367. #define SD_CTRL_DETAIL0_RESPONSE_CMD_ERROR (1 << 0)
  368. #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 2)
  369. #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_CMD12 (1 << 3)
  370. #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_READ_DATA (1 << 4)
  371. #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_WRITE_CRC_STATUS (1 << 5)
  372. #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 8)
  373. #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_CMD12 (1 << 9)
  374. #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_READ_DATA (1 << 10)
  375. #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_WRITE_CMD (1 << 11)
  376. #define SD_CTRL_DETAIL1_NO_CMD_RESPONSE (1 << 0)
  377. #define SD_CTRL_DETAIL1_TIMEOUT_READ_DATA (1 << 4)
  378. #define SD_CTRL_DETAIL1_TIMEOUT_CRS_STATUS (1 << 5)
  379. #define SD_CTRL_DETAIL1_TIMEOUT_CRC_BUSY (1 << 6)
  380. #define ASIC3_SDIO_CTRL_Base 0x1200
  381. #define ASIC3_SDIO_CTRL_Cmd 0x00
  382. #define ASIC3_SDIO_CTRL_CardPortSel 0x04
  383. #define ASIC3_SDIO_CTRL_Arg0 0x08
  384. #define ASIC3_SDIO_CTRL_Arg1 0x0C
  385. #define ASIC3_SDIO_CTRL_TransferBlockCount 0x14
  386. #define ASIC3_SDIO_CTRL_Response0 0x18
  387. #define ASIC3_SDIO_CTRL_Response1 0x1C
  388. #define ASIC3_SDIO_CTRL_Response2 0x20
  389. #define ASIC3_SDIO_CTRL_Response3 0x24
  390. #define ASIC3_SDIO_CTRL_Response4 0x28
  391. #define ASIC3_SDIO_CTRL_Response5 0x2C
  392. #define ASIC3_SDIO_CTRL_Response6 0x30
  393. #define ASIC3_SDIO_CTRL_Response7 0x34
  394. #define ASIC3_SDIO_CTRL_CardStatus 0x38
  395. #define ASIC3_SDIO_CTRL_BufferCtrl 0x3C
  396. #define ASIC3_SDIO_CTRL_IntMaskCard 0x40
  397. #define ASIC3_SDIO_CTRL_IntMaskBuffer 0x44
  398. #define ASIC3_SDIO_CTRL_CardXferDataLen 0x4C
  399. #define ASIC3_SDIO_CTRL_CardOptionSetup 0x50
  400. #define ASIC3_SDIO_CTRL_ErrorStatus0 0x54
  401. #define ASIC3_SDIO_CTRL_ErrorStatus1 0x58
  402. #define ASIC3_SDIO_CTRL_DataPort 0x60
  403. #define ASIC3_SDIO_CTRL_TransactionCtrl 0x68
  404. #define ASIC3_SDIO_CTRL_CardIntCtrl 0x6C
  405. #define ASIC3_SDIO_CTRL_ClocknWaitCtrl 0x70
  406. #define ASIC3_SDIO_CTRL_HostInformation 0x74
  407. #define ASIC3_SDIO_CTRL_ErrorCtrl 0x78
  408. #define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
  409. #define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
  410. #define ASIC3_MAP_SIZE 0x2000
  411. #endif /* __ASIC3_H__ */