diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2008-06-28 12:28:51 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2008-07-15 08:14:44 -0400 |
commit | 2134a922c6e75c779983cad5d8aae832275f5a0d (patch) | |
tree | fb77a7a82cc62c9e788044cc7117b2cd72368c15 /drivers/mmc/host/sdhci.h | |
parent | 93fc48c785f6266e67663b3cbbf24579b53fe5cf (diff) |
sdhci: scatter-gather (ADMA) support
Add support for the scatter-gather DMA mode present on newer controllers.
As the mode requires 32-bit alignment, non-aligned chunks are handled by
using a bounce buffer.
Also add some new quirks to handle controllers that have bugs in the
ADMA engine.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host/sdhci.h')
-rw-r--r-- | drivers/mmc/host/sdhci.h | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 7c302515a6a5..5bb355281765 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
@@ -60,6 +60,11 @@ | |||
60 | #define SDHCI_CTRL_LED 0x01 | 60 | #define SDHCI_CTRL_LED 0x01 |
61 | #define SDHCI_CTRL_4BITBUS 0x02 | 61 | #define SDHCI_CTRL_4BITBUS 0x02 |
62 | #define SDHCI_CTRL_HISPD 0x04 | 62 | #define SDHCI_CTRL_HISPD 0x04 |
63 | #define SDHCI_CTRL_DMA_MASK 0x18 | ||
64 | #define SDHCI_CTRL_SDMA 0x00 | ||
65 | #define SDHCI_CTRL_ADMA1 0x08 | ||
66 | #define SDHCI_CTRL_ADMA32 0x10 | ||
67 | #define SDHCI_CTRL_ADMA64 0x18 | ||
63 | 68 | ||
64 | #define SDHCI_POWER_CONTROL 0x29 | 69 | #define SDHCI_POWER_CONTROL 0x29 |
65 | #define SDHCI_POWER_ON 0x01 | 70 | #define SDHCI_POWER_ON 0x01 |
@@ -105,6 +110,7 @@ | |||
105 | #define SDHCI_INT_DATA_END_BIT 0x00400000 | 110 | #define SDHCI_INT_DATA_END_BIT 0x00400000 |
106 | #define SDHCI_INT_BUS_POWER 0x00800000 | 111 | #define SDHCI_INT_BUS_POWER 0x00800000 |
107 | #define SDHCI_INT_ACMD12ERR 0x01000000 | 112 | #define SDHCI_INT_ACMD12ERR 0x01000000 |
113 | #define SDHCI_INT_ADMA_ERROR 0x02000000 | ||
108 | 114 | ||
109 | #define SDHCI_INT_NORMAL_MASK 0x00007FFF | 115 | #define SDHCI_INT_NORMAL_MASK 0x00007FFF |
110 | #define SDHCI_INT_ERROR_MASK 0xFFFF8000 | 116 | #define SDHCI_INT_ERROR_MASK 0xFFFF8000 |
@@ -128,11 +134,14 @@ | |||
128 | #define SDHCI_CLOCK_BASE_SHIFT 8 | 134 | #define SDHCI_CLOCK_BASE_SHIFT 8 |
129 | #define SDHCI_MAX_BLOCK_MASK 0x00030000 | 135 | #define SDHCI_MAX_BLOCK_MASK 0x00030000 |
130 | #define SDHCI_MAX_BLOCK_SHIFT 16 | 136 | #define SDHCI_MAX_BLOCK_SHIFT 16 |
137 | #define SDHCI_CAN_DO_ADMA2 0x00080000 | ||
138 | #define SDHCI_CAN_DO_ADMA1 0x00100000 | ||
131 | #define SDHCI_CAN_DO_HISPD 0x00200000 | 139 | #define SDHCI_CAN_DO_HISPD 0x00200000 |
132 | #define SDHCI_CAN_DO_DMA 0x00400000 | 140 | #define SDHCI_CAN_DO_DMA 0x00400000 |
133 | #define SDHCI_CAN_VDD_330 0x01000000 | 141 | #define SDHCI_CAN_VDD_330 0x01000000 |
134 | #define SDHCI_CAN_VDD_300 0x02000000 | 142 | #define SDHCI_CAN_VDD_300 0x02000000 |
135 | #define SDHCI_CAN_VDD_180 0x04000000 | 143 | #define SDHCI_CAN_VDD_180 0x04000000 |
144 | #define SDHCI_CAN_64BIT 0x10000000 | ||
136 | 145 | ||
137 | /* 44-47 reserved for more caps */ | 146 | /* 44-47 reserved for more caps */ |
138 | 147 | ||
@@ -140,7 +149,16 @@ | |||
140 | 149 | ||
141 | /* 4C-4F reserved for more max current */ | 150 | /* 4C-4F reserved for more max current */ |
142 | 151 | ||
143 | /* 50-FB reserved */ | 152 | #define SDHCI_SET_ACMD12_ERROR 0x50 |
153 | #define SDHCI_SET_INT_ERROR 0x52 | ||
154 | |||
155 | #define SDHCI_ADMA_ERROR 0x54 | ||
156 | |||
157 | /* 55-57 reserved */ | ||
158 | |||
159 | #define SDHCI_ADMA_ADDRESS 0x58 | ||
160 | |||
161 | /* 60-FB reserved */ | ||
144 | 162 | ||
145 | #define SDHCI_SLOT_INT_STATUS 0xFC | 163 | #define SDHCI_SLOT_INT_STATUS 0xFC |
146 | 164 | ||
@@ -149,6 +167,8 @@ | |||
149 | #define SDHCI_VENDOR_VER_SHIFT 8 | 167 | #define SDHCI_VENDOR_VER_SHIFT 8 |
150 | #define SDHCI_SPEC_VER_MASK 0x00FF | 168 | #define SDHCI_SPEC_VER_MASK 0x00FF |
151 | #define SDHCI_SPEC_VER_SHIFT 0 | 169 | #define SDHCI_SPEC_VER_SHIFT 0 |
170 | #define SDHCI_SPEC_100 0 | ||
171 | #define SDHCI_SPEC_200 1 | ||
152 | 172 | ||
153 | struct sdhci_ops; | 173 | struct sdhci_ops; |
154 | 174 | ||
@@ -170,16 +190,20 @@ struct sdhci_host { | |||
170 | #define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) | 190 | #define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS (1<<4) |
171 | /* Controller has an unusable DMA engine */ | 191 | /* Controller has an unusable DMA engine */ |
172 | #define SDHCI_QUIRK_BROKEN_DMA (1<<5) | 192 | #define SDHCI_QUIRK_BROKEN_DMA (1<<5) |
193 | /* Controller has an unusable ADMA engine */ | ||
194 | #define SDHCI_QUIRK_BROKEN_ADMA (1<<6) | ||
173 | /* Controller can only DMA from 32-bit aligned addresses */ | 195 | /* Controller can only DMA from 32-bit aligned addresses */ |
174 | #define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<6) | 196 | #define SDHCI_QUIRK_32BIT_DMA_ADDR (1<<7) |
175 | /* Controller can only DMA chunk sizes that are a multiple of 32 bits */ | 197 | /* Controller can only DMA chunk sizes that are a multiple of 32 bits */ |
176 | #define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<7) | 198 | #define SDHCI_QUIRK_32BIT_DMA_SIZE (1<<8) |
199 | /* Controller can only ADMA chunks that are a multiple of 32 bits */ | ||
200 | #define SDHCI_QUIRK_32BIT_ADMA_SIZE (1<<9) | ||
177 | /* Controller needs to be reset after each request to stay stable */ | 201 | /* Controller needs to be reset after each request to stay stable */ |
178 | #define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<8) | 202 | #define SDHCI_QUIRK_RESET_AFTER_REQUEST (1<<10) |
179 | /* Controller needs voltage and power writes to happen separately */ | 203 | /* Controller needs voltage and power writes to happen separately */ |
180 | #define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<9) | 204 | #define SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER (1<<11) |
181 | /* Controller provides an incorrect timeout value for transfers */ | 205 | /* Controller provides an incorrect timeout value for transfers */ |
182 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<10) | 206 | #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL (1<<12) |
183 | 207 | ||
184 | int irq; /* Device IRQ */ | 208 | int irq; /* Device IRQ */ |
185 | void __iomem * ioaddr; /* Mapped address */ | 209 | void __iomem * ioaddr; /* Mapped address */ |
@@ -197,8 +221,11 @@ struct sdhci_host { | |||
197 | 221 | ||
198 | int flags; /* Host attributes */ | 222 | int flags; /* Host attributes */ |
199 | #define SDHCI_USE_DMA (1<<0) /* Host is DMA capable */ | 223 | #define SDHCI_USE_DMA (1<<0) /* Host is DMA capable */ |
200 | #define SDHCI_REQ_USE_DMA (1<<1) /* Use DMA for this req. */ | 224 | #define SDHCI_USE_ADMA (1<<1) /* Host is ADMA capable */ |
201 | #define SDHCI_DEVICE_DEAD (1<<2) /* Device unresponsive */ | 225 | #define SDHCI_REQ_USE_DMA (1<<2) /* Use DMA for this req. */ |
226 | #define SDHCI_DEVICE_DEAD (1<<3) /* Device unresponsive */ | ||
227 | |||
228 | unsigned int version; /* SDHCI spec. version */ | ||
202 | 229 | ||
203 | unsigned int max_clk; /* Max possible freq (MHz) */ | 230 | unsigned int max_clk; /* Max possible freq (MHz) */ |
204 | unsigned int timeout_clk; /* Timeout freq (KHz) */ | 231 | unsigned int timeout_clk; /* Timeout freq (KHz) */ |
@@ -216,6 +243,14 @@ struct sdhci_host { | |||
216 | int offset; /* Offset into current sg */ | 243 | int offset; /* Offset into current sg */ |
217 | int remain; /* Bytes left in current */ | 244 | int remain; /* Bytes left in current */ |
218 | 245 | ||
246 | int sg_count; /* Mapped sg entries */ | ||
247 | |||
248 | u8 *adma_desc; /* ADMA descriptor table */ | ||
249 | u8 *align_buffer; /* Bounce buffer */ | ||
250 | |||
251 | dma_addr_t adma_addr; /* Mapped ADMA descr. table */ | ||
252 | dma_addr_t align_addr; /* Mapped bounce buffer */ | ||
253 | |||
219 | struct tasklet_struct card_tasklet; /* Tasklet structures */ | 254 | struct tasklet_struct card_tasklet; /* Tasklet structures */ |
220 | struct tasklet_struct finish_tasklet; | 255 | struct tasklet_struct finish_tasklet; |
221 | 256 | ||