mfd: add ASIC3_CONFIG_GPIO templates
[linux-2.6/libata-dev.git] / include / linux / mfd / asic3.h
blob0eae3083da43a974e88b40d7c68d1efca50dca1b
1 /*
2 * include/linux/mfd/asic3.h
4 * Compaq ASIC3 headers.
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.
10 * Copyright 2001 Compaq Computer Corporation.
11 * Copyright 2007-2008 OpenedHand Ltd.
14 #ifndef __ASIC3_H__
15 #define __ASIC3_H__
17 #include <linux/types.h>
19 struct asic3_platform_data {
20 u16 *gpio_config;
21 unsigned int gpio_config_num;
23 unsigned int bus_shift;
25 unsigned int irq_base;
27 unsigned int gpio_base;
30 #define ASIC3_NUM_GPIO_BANKS 4
31 #define ASIC3_GPIOS_PER_BANK 16
32 #define ASIC3_NUM_GPIOS 64
33 #define ASIC3_NR_IRQS ASIC3_NUM_GPIOS + 6
35 #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
42 #define ASIC3_GPIO(bank, gpio) \
43 ((ASIC3_GPIOS_PER_BANK * ASIC3_GPIO_BANK_##bank) + (gpio))
44 #define ASIC3_GPIO_bit(gpio) (1 << (gpio & 0xf))
45 /* All offsets below are specified with this address bus shift */
46 #define ASIC3_DEFAULT_ADDR_SHIFT 2
48 #define ASIC3_OFFSET(base, reg) (ASIC3_##base##_BASE + ASIC3_##base##_##reg)
49 #define ASIC3_GPIO_OFFSET(base, reg) \
50 (ASIC3_GPIO_##base##_BASE + ASIC3_GPIO_##reg)
52 #define ASIC3_GPIO_A_BASE 0x0000
53 #define ASIC3_GPIO_B_BASE 0x0100
54 #define ASIC3_GPIO_C_BASE 0x0200
55 #define ASIC3_GPIO_D_BASE 0x0300
57 #define ASIC3_GPIO_TO_BANK(gpio) ((gpio) >> 4)
58 #define ASIC3_GPIO_TO_BIT(gpio) ((gpio) - \
59 (ASIC3_GPIOS_PER_BANK * ((gpio) >> 4)))
60 #define ASIC3_GPIO_TO_MASK(gpio) (1 << ASIC3_GPIO_TO_BIT(gpio))
61 #define ASIC3_GPIO_TO_BASE(gpio) (ASIC3_GPIO_A_BASE + (((gpio) >> 4) * 0x0100))
62 #define ASIC3_BANK_TO_BASE(bank) (ASIC3_GPIO_A_BASE + ((bank) * 0x100))
64 #define ASIC3_GPIO_MASK 0x00 /* R/W 0:don't mask */
65 #define ASIC3_GPIO_DIRECTION 0x04 /* R/W 0:input */
66 #define ASIC3_GPIO_OUT 0x08 /* R/W 0:output low */
67 #define ASIC3_GPIO_TRIGGER_TYPE 0x0c /* R/W 0:level */
68 #define ASIC3_GPIO_EDGE_TRIGGER 0x10 /* R/W 0:falling */
69 #define ASIC3_GPIO_LEVEL_TRIGGER 0x14 /* R/W 0:low level detect */
70 #define ASIC3_GPIO_SLEEP_MASK 0x18 /* R/W 0:don't mask in sleep mode */
71 #define ASIC3_GPIO_SLEEP_OUT 0x1c /* R/W level 0:low in sleep mode */
72 #define ASIC3_GPIO_BAT_FAULT_OUT 0x20 /* R/W level 0:low in batt_fault */
73 #define ASIC3_GPIO_INT_STATUS 0x24 /* R/W 0:none, 1:detect */
74 #define ASIC3_GPIO_ALT_FUNCTION 0x28 /* R/W 1:LED register control */
75 #define ASIC3_GPIO_SLEEP_CONF 0x2c /*
76 * R/W bit 1: autosleep
77 * 0: disable gposlpout in normal mode,
78 * enable gposlpout in sleep mode.
80 #define ASIC3_GPIO_STATUS 0x30 /* R Pin status */
83 * ASIC3 GPIO config
85 * Bits 0..6 gpio number
86 * Bits 7..13 Alternate function
87 * Bit 14 Direction
88 * Bit 15 Initial value
91 #define ASIC3_CONFIG_GPIO_PIN(config) ((config) & 0x7f)
92 #define ASIC3_CONFIG_GPIO_ALT(config) (((config) & (0x7f << 7)) >> 7)
93 #define ASIC3_CONFIG_GPIO_DIR(config) ((config & (1 << 14)) >> 14)
94 #define ASIC3_CONFIG_GPIO_INIT(config) ((config & (1 << 15)) >> 15)
95 #define ASIC3_CONFIG_GPIO(gpio, alt, dir, init) (((gpio) & 0x7f) \
96 | (((alt) & 0x7f) << 7) | (((dir) & 0x1) << 14) \
97 | (((init) & 0x1) << 15))
98 #define ASIC3_CONFIG_GPIO_DEFAULT(gpio, dir, init) \
99 ASIC3_CONFIG_GPIO((gpio), 0, (dir), (init))
100 #define ASIC3_CONFIG_GPIO_DEFAULT_OUT(gpio, init) \
101 ASIC3_CONFIG_GPIO((gpio), 0, 1, (init))
104 * Alternate functions
106 #define ASIC3_GPIOA11_PWM0 ASIC3_CONFIG_GPIO(11, 1, 1, 0)
107 #define ASIC3_GPIOA12_PWM1 ASIC3_CONFIG_GPIO(12, 1, 1, 0)
108 #define ASIC3_GPIOA15_CONTROL_CX ASIC3_CONFIG_GPIO(15, 1, 1, 0)
109 #define ASIC3_GPIOC0_LED0 ASIC3_CONFIG_GPIO(32, 1, 1, 0)
110 #define ASIC3_GPIOC1_LED1 ASIC3_CONFIG_GPIO(33, 1, 1, 0)
111 #define ASIC3_GPIOC2_LED2 ASIC3_CONFIG_GPIO(34, 1, 1, 0)
112 #define ASIC3_GPIOC3_SPI_RXD ASIC3_CONFIG_GPIO(35, 1, 0, 0)
113 #define ASIC3_GPIOC4_CF_nCD ASIC3_CONFIG_GPIO(36, 1, 0, 0)
114 #define ASIC3_GPIOC4_SPI_TXD ASIC3_CONFIG_GPIO(36, 1, 1, 0)
115 #define ASIC3_GPIOC5_SPI_CLK ASIC3_CONFIG_GPIO(37, 1, 1, 0)
116 #define ASIC3_GPIOC5_nCIOW ASIC3_CONFIG_GPIO(37, 1, 1, 0)
117 #define ASIC3_GPIOC6_nCIOR ASIC3_CONFIG_GPIO(38, 1, 1, 0)
118 #define ASIC3_GPIOC7_nPCE_1 ASIC3_CONFIG_GPIO(39, 1, 0, 0)
119 #define ASIC3_GPIOC8_nPCE_2 ASIC3_CONFIG_GPIO(40, 1, 0, 0)
120 #define ASIC3_GPIOC9_nPOE ASIC3_CONFIG_GPIO(41, 1, 0, 0)
121 #define ASIC3_GPIOC10_nPWE ASIC3_CONFIG_GPIO(42, 1, 0, 0)
122 #define ASIC3_GPIOC11_PSKTSEL ASIC3_CONFIG_GPIO(43, 1, 0, 0)
123 #define ASIC3_GPIOC12_nPREG ASIC3_CONFIG_GPIO(44, 1, 0, 0)
124 #define ASIC3_GPIOC13_nPWAIT ASIC3_CONFIG_GPIO(45, 1, 1, 0)
125 #define ASIC3_GPIOC14_nPIOIS16 ASIC3_CONFIG_GPIO(46, 1, 1, 0)
126 #define ASIC3_GPIOC15_nPIOR ASIC3_CONFIG_GPIO(47, 1, 0, 0)
127 #define ASIC3_GPIOD11_nCIOIS16 ASIC3_CONFIG_GPIO(59, 1, 0, 0)
128 #define ASIC3_GPIOD12_nCWAIT ASIC3_CONFIG_GPIO(60, 1, 0, 0)
129 #define ASIC3_GPIOD15_nPIOW ASIC3_CONFIG_GPIO(63, 1, 0, 0)
132 #define ASIC3_SPI_Base 0x0400
133 #define ASIC3_SPI_Control 0x0000
134 #define ASIC3_SPI_TxData 0x0004
135 #define ASIC3_SPI_RxData 0x0008
136 #define ASIC3_SPI_Int 0x000c
137 #define ASIC3_SPI_Status 0x0010
139 #define SPI_CONTROL_SPR(clk) ((clk) & 0x0f) /* Clock rate */
141 #define ASIC3_PWM_0_Base 0x0500
142 #define ASIC3_PWM_1_Base 0x0600
143 #define ASIC3_PWM_TimeBase 0x0000
144 #define ASIC3_PWM_PeriodTime 0x0004
145 #define ASIC3_PWM_DutyTime 0x0008
147 #define PWM_TIMEBASE_VALUE(x) ((x)&0xf) /* Low 4 bits sets time base */
148 #define PWM_TIMEBASE_ENABLE (1 << 4) /* Enable clock */
150 #define ASIC3_LED_0_Base 0x0700
151 #define ASIC3_LED_1_Base 0x0800
152 #define ASIC3_LED_2_Base 0x0900
153 #define ASIC3_LED_TimeBase 0x0000 /* R/W 7 bits */
154 #define ASIC3_LED_PeriodTime 0x0004 /* R/W 12 bits */
155 #define ASIC3_LED_DutyTime 0x0008 /* R/W 12 bits */
156 #define ASIC3_LED_AutoStopCount 0x000c /* R/W 16 bits */
158 /* LED TimeBase bits - match ASIC2 */
159 #define LED_TBS 0x0f /* Low 4 bits sets time base, max = 13 */
160 /* Note: max = 5 on hx4700 */
161 /* 0: maximum time base */
162 /* 1: maximum time base / 2 */
163 /* n: maximum time base / 2^n */
165 #define LED_EN (1 << 4) /* LED ON/OFF 0:off, 1:on */
166 #define LED_AUTOSTOP (1 << 5) /* LED ON/OFF auto stop 0:disable, 1:enable */
167 #define LED_ALWAYS (1 << 6) /* LED Interrupt Mask 0:No mask, 1:mask */
169 #define ASIC3_CLOCK_BASE 0x0A00
170 #define ASIC3_CLOCK_CDEX 0x00
171 #define ASIC3_CLOCK_SEL 0x04
173 #define CLOCK_CDEX_SOURCE (1 << 0) /* 2 bits */
174 #define CLOCK_CDEX_SOURCE0 (1 << 0)
175 #define CLOCK_CDEX_SOURCE1 (1 << 1)
176 #define CLOCK_CDEX_SPI (1 << 2)
177 #define CLOCK_CDEX_OWM (1 << 3)
178 #define CLOCK_CDEX_PWM0 (1 << 4)
179 #define CLOCK_CDEX_PWM1 (1 << 5)
180 #define CLOCK_CDEX_LED0 (1 << 6)
181 #define CLOCK_CDEX_LED1 (1 << 7)
182 #define CLOCK_CDEX_LED2 (1 << 8)
184 /* Clocks settings: 1 for 24.576 MHz, 0 for 12.288Mhz */
185 #define CLOCK_CDEX_SD_HOST (1 << 9) /* R/W: SD host clock source */
186 #define CLOCK_CDEX_SD_BUS (1 << 10) /* R/W: SD bus clock source ctrl */
187 #define CLOCK_CDEX_SMBUS (1 << 11)
188 #define CLOCK_CDEX_CONTROL_CX (1 << 12)
190 #define CLOCK_CDEX_EX0 (1 << 13) /* R/W: 32.768 kHz crystal */
191 #define CLOCK_CDEX_EX1 (1 << 14) /* R/W: 24.576 MHz crystal */
193 #define CLOCK_SEL_SD_HCLK_SEL (1 << 0) /* R/W: SDIO host clock select */
194 #define CLOCK_SEL_SD_BCLK_SEL (1 << 1) /* R/W: SDIO bus clock select */
196 /* R/W: INT clock source control (32.768 kHz) */
197 #define CLOCK_SEL_CX (1 << 2)
200 #define ASIC3_INTR_BASE 0x0B00
202 #define ASIC3_INTR_INT_MASK 0x00 /* Interrupt mask control */
203 #define ASIC3_INTR_P_INT_STAT 0x04 /* Peripheral interrupt status */
204 #define ASIC3_INTR_INT_CPS 0x08 /* Interrupt timer clock pre-scale */
205 #define ASIC3_INTR_INT_TBS 0x0c /* Interrupt timer set */
207 #define ASIC3_INTMASK_GINTMASK (1 << 0) /* Global INTs mask 1:enable */
208 #define ASIC3_INTMASK_GINTEL (1 << 1) /* 1: rising edge, 0: hi level */
209 #define ASIC3_INTMASK_MASK0 (1 << 2)
210 #define ASIC3_INTMASK_MASK1 (1 << 3)
211 #define ASIC3_INTMASK_MASK2 (1 << 4)
212 #define ASIC3_INTMASK_MASK3 (1 << 5)
213 #define ASIC3_INTMASK_MASK4 (1 << 6)
214 #define ASIC3_INTMASK_MASK5 (1 << 7)
216 #define ASIC3_INTR_PERIPHERAL_A (1 << 0)
217 #define ASIC3_INTR_PERIPHERAL_B (1 << 1)
218 #define ASIC3_INTR_PERIPHERAL_C (1 << 2)
219 #define ASIC3_INTR_PERIPHERAL_D (1 << 3)
220 #define ASIC3_INTR_LED0 (1 << 4)
221 #define ASIC3_INTR_LED1 (1 << 5)
222 #define ASIC3_INTR_LED2 (1 << 6)
223 #define ASIC3_INTR_SPI (1 << 7)
224 #define ASIC3_INTR_SMBUS (1 << 8)
225 #define ASIC3_INTR_OWM (1 << 9)
227 #define ASIC3_INTR_CPS(x) ((x)&0x0f) /* 4 bits, max 14 */
228 #define ASIC3_INTR_CPS_SET (1 << 4) /* Time base enable */
231 /* Basic control of the SD ASIC */
232 #define ASIC3_SDHWCTRL_Base 0x0E00
233 #define ASIC3_SDHWCTRL_SDConf 0x00
235 #define ASIC3_SDHWCTRL_SUSPEND (1 << 0) /* 1=suspend all SD operations */
236 #define ASIC3_SDHWCTRL_CLKSEL (1 << 1) /* 1=SDICK, 0=HCLK */
237 #define ASIC3_SDHWCTRL_PCLR (1 << 2) /* All registers of SDIO cleared */
238 #define ASIC3_SDHWCTRL_LEVCD (1 << 3) /* SD card detection: 0:low */
240 /* SD card write protection: 0=high */
241 #define ASIC3_SDHWCTRL_LEVWP (1 << 4)
242 #define ASIC3_SDHWCTRL_SDLED (1 << 5) /* SD card LED signal 0=disable */
244 /* SD card power supply ctrl 1=enable */
245 #define ASIC3_SDHWCTRL_SDPWR (1 << 6)
247 #define ASIC3_EXTCF_Base 0x1100
249 #define ASIC3_EXTCF_Select 0x00
250 #define ASIC3_EXTCF_Reset 0x04
252 #define ASIC3_EXTCF_SMOD0 (1 << 0) /* slot number of mode 0 */
253 #define ASIC3_EXTCF_SMOD1 (1 << 1) /* slot number of mode 1 */
254 #define ASIC3_EXTCF_SMOD2 (1 << 2) /* slot number of mode 2 */
255 #define ASIC3_EXTCF_OWM_EN (1 << 4) /* enable onewire module */
256 #define ASIC3_EXTCF_OWM_SMB (1 << 5) /* OWM bus selection */
257 #define ASIC3_EXTCF_OWM_RESET (1 << 6) /* ?? used by OWM and CF */
258 #define ASIC3_EXTCF_CF0_SLEEP_MODE (1 << 7) /* CF0 sleep state */
259 #define ASIC3_EXTCF_CF1_SLEEP_MODE (1 << 8) /* CF1 sleep state */
260 #define ASIC3_EXTCF_CF0_PWAIT_EN (1 << 10) /* CF0 PWAIT_n control */
261 #define ASIC3_EXTCF_CF1_PWAIT_EN (1 << 11) /* CF1 PWAIT_n control */
262 #define ASIC3_EXTCF_CF0_BUF_EN (1 << 12) /* CF0 buffer control */
263 #define ASIC3_EXTCF_CF1_BUF_EN (1 << 13) /* CF1 buffer control */
264 #define ASIC3_EXTCF_SD_MEM_ENABLE (1 << 14)
265 #define ASIC3_EXTCF_CF_SLEEP (1 << 15) /* CF sleep mode control */
267 /*********************************************
268 * The Onewire interface registers
270 * OWM_CMD
271 * OWM_DAT
272 * OWM_INTR
273 * OWM_INTEN
274 * OWM_CLKDIV
276 *********************************************/
278 #define ASIC3_OWM_Base 0xC00
280 #define ASIC3_OWM_CMD 0x00
281 #define ASIC3_OWM_DAT 0x04
282 #define ASIC3_OWM_INTR 0x08
283 #define ASIC3_OWM_INTEN 0x0C
284 #define ASIC3_OWM_CLKDIV 0x10
286 #define ASIC3_OWM_CMD_ONEWR (1 << 0)
287 #define ASIC3_OWM_CMD_SRA (1 << 1)
288 #define ASIC3_OWM_CMD_DQO (1 << 2)
289 #define ASIC3_OWM_CMD_DQI (1 << 3)
291 #define ASIC3_OWM_INTR_PD (1 << 0)
292 #define ASIC3_OWM_INTR_PDR (1 << 1)
293 #define ASIC3_OWM_INTR_TBE (1 << 2)
294 #define ASIC3_OWM_INTR_TEMP (1 << 3)
295 #define ASIC3_OWM_INTR_RBF (1 << 4)
297 #define ASIC3_OWM_INTEN_EPD (1 << 0)
298 #define ASIC3_OWM_INTEN_IAS (1 << 1)
299 #define ASIC3_OWM_INTEN_ETBE (1 << 2)
300 #define ASIC3_OWM_INTEN_ETMT (1 << 3)
301 #define ASIC3_OWM_INTEN_ERBF (1 << 4)
303 #define ASIC3_OWM_CLKDIV_PRE (3 << 0) /* two bits wide at bit 0 */
304 #define ASIC3_OWM_CLKDIV_DIV (7 << 2) /* 3 bits wide at bit 2 */
307 /*****************************************************************************
308 * The SD configuration registers are at a completely different location
309 * in memory. They are divided into three sets of registers:
311 * SD_CONFIG Core configuration register
312 * SD_CTRL Control registers for SD operations
313 * SDIO_CTRL Control registers for SDIO operations
315 *****************************************************************************/
316 #define ASIC3_SD_CONFIG_Base 0x0400 /* Assumes 32 bit addressing */
318 #define ASIC3_SD_CONFIG_Command 0x08 /* R/W: Command */
320 /* [0:8] SD Control Register Base Address */
321 #define ASIC3_SD_CONFIG_Addr0 0x20
323 /* [9:31] SD Control Register Base Address */
324 #define ASIC3_SD_CONFIG_Addr1 0x24
326 /* R/O: interrupt assigned to pin */
327 #define ASIC3_SD_CONFIG_IntPin 0x78
330 * Set to 0x1f to clock SD controller, 0 otherwise.
331 * At 0x82 - Gated Clock Ctrl
333 #define ASIC3_SD_CONFIG_ClkStop 0x80
335 /* Control clock of SD controller */
336 #define ASIC3_SD_CONFIG_ClockMode 0x84
337 #define ASIC3_SD_CONFIG_SDHC_PinStatus 0x88 /* R/0: SD pins status */
338 #define ASIC3_SD_CONFIG_SDHC_Power1 0x90 /* Power1 - manual pwr ctrl */
340 /* auto power up after card inserted */
341 #define ASIC3_SD_CONFIG_SDHC_Power2 0x92
343 /* auto power down when card removed */
344 #define ASIC3_SD_CONFIG_SDHC_Power3 0x94
345 #define ASIC3_SD_CONFIG_SDHC_CardDetect 0x98
346 #define ASIC3_SD_CONFIG_SDHC_Slot 0xA0 /* R/O: support slot number */
347 #define ASIC3_SD_CONFIG_SDHC_ExtGateClk1 0x1E0 /* Not used */
348 #define ASIC3_SD_CONFIG_SDHC_ExtGateClk2 0x1E2 /* Not used*/
350 /* GPIO Output Reg. , at 0x1EA - GPIO Output Enable Reg. */
351 #define ASIC3_SD_CONFIG_SDHC_GPIO_OutAndEnable 0x1E8
352 #define ASIC3_SD_CONFIG_SDHC_GPIO_Status 0x1EC /* GPIO Status Reg. */
354 /* Bit 1: double buffer/single buffer */
355 #define ASIC3_SD_CONFIG_SDHC_ExtGateClk3 0x1F0
357 /* Memory access enable (set to 1 to access SD Controller) */
358 #define SD_CONFIG_COMMAND_MAE (1<<1)
360 #define SD_CONFIG_CLK_ENABLE_ALL 0x1f
362 #define SD_CONFIG_POWER1_PC_33V 0x0200 /* Set for 3.3 volts */
363 #define SD_CONFIG_POWER1_PC_OFF 0x0000 /* Turn off power */
365 /* two bits - number of cycles for card detection */
366 #define SD_CONFIG_CARDDETECTMODE_CLK ((x) & 0x3)
369 #define ASIC3_SD_CTRL_Base 0x1000
371 #define ASIC3_SD_CTRL_Cmd 0x00
372 #define ASIC3_SD_CTRL_Arg0 0x08
373 #define ASIC3_SD_CTRL_Arg1 0x0C
374 #define ASIC3_SD_CTRL_StopInternal 0x10
375 #define ASIC3_SD_CTRL_TransferSectorCount 0x14
376 #define ASIC3_SD_CTRL_Response0 0x18
377 #define ASIC3_SD_CTRL_Response1 0x1C
378 #define ASIC3_SD_CTRL_Response2 0x20
379 #define ASIC3_SD_CTRL_Response3 0x24
380 #define ASIC3_SD_CTRL_Response4 0x28
381 #define ASIC3_SD_CTRL_Response5 0x2C
382 #define ASIC3_SD_CTRL_Response6 0x30
383 #define ASIC3_SD_CTRL_Response7 0x34
384 #define ASIC3_SD_CTRL_CardStatus 0x38
385 #define ASIC3_SD_CTRL_BufferCtrl 0x3C
386 #define ASIC3_SD_CTRL_IntMaskCard 0x40
387 #define ASIC3_SD_CTRL_IntMaskBuffer 0x44
388 #define ASIC3_SD_CTRL_CardClockCtrl 0x48
389 #define ASIC3_SD_CTRL_MemCardXferDataLen 0x4C
390 #define ASIC3_SD_CTRL_MemCardOptionSetup 0x50
391 #define ASIC3_SD_CTRL_ErrorStatus0 0x58
392 #define ASIC3_SD_CTRL_ErrorStatus1 0x5C
393 #define ASIC3_SD_CTRL_DataPort 0x60
394 #define ASIC3_SD_CTRL_TransactionCtrl 0x68
395 #define ASIC3_SD_CTRL_SoftwareReset 0x1C0
397 #define SD_CTRL_SOFTWARE_RESET_CLEAR (1<<0)
399 #define SD_CTRL_TRANSACTIONCONTROL_SET (1<<8)
401 #define SD_CTRL_CARDCLOCKCONTROL_FOR_SD_CARD (1<<15)
402 #define SD_CTRL_CARDCLOCKCONTROL_ENABLE_CLOCK (1<<8)
403 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_512 (1<<7)
404 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_256 (1<<6)
405 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_128 (1<<5)
406 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_64 (1<<4)
407 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_32 (1<<3)
408 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_16 (1<<2)
409 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_8 (1<<1)
410 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_4 (1<<0)
411 #define SD_CTRL_CARDCLOCKCONTROL_CLK_DIV_2 (0<<0)
413 #define MEM_CARD_OPTION_REQUIRED 0x000e
414 #define MEM_CARD_OPTION_DATA_RESPONSE_TIMEOUT(x) (((x) & 0x0f) << 4)
415 #define MEM_CARD_OPTION_C2_MODULE_NOT_PRESENT (1<<14)
416 #define MEM_CARD_OPTION_DATA_XFR_WIDTH_1 (1<<15)
417 #define MEM_CARD_OPTION_DATA_XFR_WIDTH_4 0
419 #define SD_CTRL_COMMAND_INDEX(x) ((x) & 0x3f)
420 #define SD_CTRL_COMMAND_TYPE_CMD (0 << 6)
421 #define SD_CTRL_COMMAND_TYPE_ACMD (1 << 6)
422 #define SD_CTRL_COMMAND_TYPE_AUTHENTICATION (2 << 6)
423 #define SD_CTRL_COMMAND_RESPONSE_TYPE_NORMAL (0 << 8)
424 #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1 (4 << 8)
425 #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R1B (5 << 8)
426 #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R2 (6 << 8)
427 #define SD_CTRL_COMMAND_RESPONSE_TYPE_EXT_R3 (7 << 8)
428 #define SD_CTRL_COMMAND_DATA_PRESENT (1 << 11)
429 #define SD_CTRL_COMMAND_TRANSFER_READ (1 << 12)
430 #define SD_CTRL_COMMAND_TRANSFER_WRITE (0 << 12)
431 #define SD_CTRL_COMMAND_MULTI_BLOCK (1 << 13)
432 #define SD_CTRL_COMMAND_SECURITY_CMD (1 << 14)
434 #define SD_CTRL_STOP_INTERNAL_ISSSUE_CMD12 (1 << 0)
435 #define SD_CTRL_STOP_INTERNAL_AUTO_ISSUE_CMD12 (1 << 8)
437 #define SD_CTRL_CARDSTATUS_RESPONSE_END (1 << 0)
438 #define SD_CTRL_CARDSTATUS_RW_END (1 << 2)
439 #define SD_CTRL_CARDSTATUS_CARD_REMOVED_0 (1 << 3)
440 #define SD_CTRL_CARDSTATUS_CARD_INSERTED_0 (1 << 4)
441 #define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_0 (1 << 5)
442 #define SD_CTRL_CARDSTATUS_WRITE_PROTECT (1 << 7)
443 #define SD_CTRL_CARDSTATUS_CARD_REMOVED_3 (1 << 8)
444 #define SD_CTRL_CARDSTATUS_CARD_INSERTED_3 (1 << 9)
445 #define SD_CTRL_CARDSTATUS_SIGNAL_STATE_PRESENT_3 (1 << 10)
447 #define SD_CTRL_BUFFERSTATUS_CMD_INDEX_ERROR (1 << 0)
448 #define SD_CTRL_BUFFERSTATUS_CRC_ERROR (1 << 1)
449 #define SD_CTRL_BUFFERSTATUS_STOP_BIT_END_ERROR (1 << 2)
450 #define SD_CTRL_BUFFERSTATUS_DATA_TIMEOUT (1 << 3)
451 #define SD_CTRL_BUFFERSTATUS_BUFFER_OVERFLOW (1 << 4)
452 #define SD_CTRL_BUFFERSTATUS_BUFFER_UNDERFLOW (1 << 5)
453 #define SD_CTRL_BUFFERSTATUS_CMD_TIMEOUT (1 << 6)
454 #define SD_CTRL_BUFFERSTATUS_UNK7 (1 << 7)
455 #define SD_CTRL_BUFFERSTATUS_BUFFER_READ_ENABLE (1 << 8)
456 #define SD_CTRL_BUFFERSTATUS_BUFFER_WRITE_ENABLE (1 << 9)
457 #define SD_CTRL_BUFFERSTATUS_ILLEGAL_FUNCTION (1 << 13)
458 #define SD_CTRL_BUFFERSTATUS_CMD_BUSY (1 << 14)
459 #define SD_CTRL_BUFFERSTATUS_ILLEGAL_ACCESS (1 << 15)
461 #define SD_CTRL_INTMASKCARD_RESPONSE_END (1 << 0)
462 #define SD_CTRL_INTMASKCARD_RW_END (1 << 2)
463 #define SD_CTRL_INTMASKCARD_CARD_REMOVED_0 (1 << 3)
464 #define SD_CTRL_INTMASKCARD_CARD_INSERTED_0 (1 << 4)
465 #define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_0 (1 << 5)
466 #define SD_CTRL_INTMASKCARD_UNK6 (1 << 6)
467 #define SD_CTRL_INTMASKCARD_WRITE_PROTECT (1 << 7)
468 #define SD_CTRL_INTMASKCARD_CARD_REMOVED_3 (1 << 8)
469 #define SD_CTRL_INTMASKCARD_CARD_INSERTED_3 (1 << 9)
470 #define SD_CTRL_INTMASKCARD_SIGNAL_STATE_PRESENT_3 (1 << 10)
472 #define SD_CTRL_INTMASKBUFFER_CMD_INDEX_ERROR (1 << 0)
473 #define SD_CTRL_INTMASKBUFFER_CRC_ERROR (1 << 1)
474 #define SD_CTRL_INTMASKBUFFER_STOP_BIT_END_ERROR (1 << 2)
475 #define SD_CTRL_INTMASKBUFFER_DATA_TIMEOUT (1 << 3)
476 #define SD_CTRL_INTMASKBUFFER_BUFFER_OVERFLOW (1 << 4)
477 #define SD_CTRL_INTMASKBUFFER_BUFFER_UNDERFLOW (1 << 5)
478 #define SD_CTRL_INTMASKBUFFER_CMD_TIMEOUT (1 << 6)
479 #define SD_CTRL_INTMASKBUFFER_UNK7 (1 << 7)
480 #define SD_CTRL_INTMASKBUFFER_BUFFER_READ_ENABLE (1 << 8)
481 #define SD_CTRL_INTMASKBUFFER_BUFFER_WRITE_ENABLE (1 << 9)
482 #define SD_CTRL_INTMASKBUFFER_ILLEGAL_FUNCTION (1 << 13)
483 #define SD_CTRL_INTMASKBUFFER_CMD_BUSY (1 << 14)
484 #define SD_CTRL_INTMASKBUFFER_ILLEGAL_ACCESS (1 << 15)
486 #define SD_CTRL_DETAIL0_RESPONSE_CMD_ERROR (1 << 0)
487 #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 2)
488 #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_RESPONSE_CMD12 (1 << 3)
489 #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_READ_DATA (1 << 4)
490 #define SD_CTRL_DETAIL0_END_BIT_ERROR_FOR_WRITE_CRC_STATUS (1 << 5)
491 #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_NON_CMD12 (1 << 8)
492 #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_RESPONSE_CMD12 (1 << 9)
493 #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_READ_DATA (1 << 10)
494 #define SD_CTRL_DETAIL0_CRC_ERROR_FOR_WRITE_CMD (1 << 11)
496 #define SD_CTRL_DETAIL1_NO_CMD_RESPONSE (1 << 0)
497 #define SD_CTRL_DETAIL1_TIMEOUT_READ_DATA (1 << 4)
498 #define SD_CTRL_DETAIL1_TIMEOUT_CRS_STATUS (1 << 5)
499 #define SD_CTRL_DETAIL1_TIMEOUT_CRC_BUSY (1 << 6)
501 #define ASIC3_SDIO_CTRL_Base 0x1200
503 #define ASIC3_SDIO_CTRL_Cmd 0x00
504 #define ASIC3_SDIO_CTRL_CardPortSel 0x04
505 #define ASIC3_SDIO_CTRL_Arg0 0x08
506 #define ASIC3_SDIO_CTRL_Arg1 0x0C
507 #define ASIC3_SDIO_CTRL_TransferBlockCount 0x14
508 #define ASIC3_SDIO_CTRL_Response0 0x18
509 #define ASIC3_SDIO_CTRL_Response1 0x1C
510 #define ASIC3_SDIO_CTRL_Response2 0x20
511 #define ASIC3_SDIO_CTRL_Response3 0x24
512 #define ASIC3_SDIO_CTRL_Response4 0x28
513 #define ASIC3_SDIO_CTRL_Response5 0x2C
514 #define ASIC3_SDIO_CTRL_Response6 0x30
515 #define ASIC3_SDIO_CTRL_Response7 0x34
516 #define ASIC3_SDIO_CTRL_CardStatus 0x38
517 #define ASIC3_SDIO_CTRL_BufferCtrl 0x3C
518 #define ASIC3_SDIO_CTRL_IntMaskCard 0x40
519 #define ASIC3_SDIO_CTRL_IntMaskBuffer 0x44
520 #define ASIC3_SDIO_CTRL_CardXferDataLen 0x4C
521 #define ASIC3_SDIO_CTRL_CardOptionSetup 0x50
522 #define ASIC3_SDIO_CTRL_ErrorStatus0 0x54
523 #define ASIC3_SDIO_CTRL_ErrorStatus1 0x58
524 #define ASIC3_SDIO_CTRL_DataPort 0x60
525 #define ASIC3_SDIO_CTRL_TransactionCtrl 0x68
526 #define ASIC3_SDIO_CTRL_CardIntCtrl 0x6C
527 #define ASIC3_SDIO_CTRL_ClocknWaitCtrl 0x70
528 #define ASIC3_SDIO_CTRL_HostInformation 0x74
529 #define ASIC3_SDIO_CTRL_ErrorCtrl 0x78
530 #define ASIC3_SDIO_CTRL_LEDCtrl 0x7C
531 #define ASIC3_SDIO_CTRL_SoftwareReset 0x1C0
533 #define ASIC3_MAP_SIZE 0x2000
535 #endif /* __ASIC3_H__ */