Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dw_mmc.h
Go to the documentation of this file.
1 /*
2  * Synopsys DesignWare Multimedia Card Interface driver
3  * (Based on NXP driver for lpc 31xx)
4  *
5  * Copyright (C) 2009 NXP Semiconductors
6  * Copyright (C) 2009, 2010 Imagination Technologies Ltd.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  */
13 
14 #ifndef LINUX_MMC_DW_MMC_H
15 #define LINUX_MMC_DW_MMC_H
16 
17 #include <linux/scatterlist.h>
18 
19 #define MAX_MCI_SLOTS 2
20 
28 };
29 
30 enum {
36 };
37 
38 struct mmc_data;
39 
121 struct dw_mci {
123  void __iomem *regs;
124 
125  struct scatterlist *sg;
127 
129  struct mmc_request *mrq;
130  struct mmc_command *cmd;
131  struct mmc_data *data;
133 
134  /* DMA interface members*/
135  int use_dma;
137 
139  void *sg_cpu;
140  const struct dw_mci_dma_ops *dma_ops;
141 #ifdef CONFIG_MMC_DW_IDMAC
142  unsigned int ring_size;
143 #else
144  struct dw_mci_dma_data *dma_data;
145 #endif
152  unsigned long pending_events;
153  unsigned long completed_events;
155  struct list_head queue;
156 
163  struct device *dev;
165  const struct dw_mci_drv_data *drv_data;
166  void *priv;
167  struct clk *biu_clk;
168  struct clk *ciu_clk;
170 
171  /* FIFO push and pull */
176  union {
180  };
181  void (*push_data)(struct dw_mci *host, void *buf, int cnt);
182  void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
183 
184  /* Workaround flags */
186 
187  struct regulator *vmmc; /* Power regulator */
188  unsigned long irq_flags; /* IRQ flags */
189  int irq;
190 };
191 
192 /* DMA ops for Internal/External DMAC interface */
194  /* DMA Ops */
195  int (*init)(struct dw_mci *host);
196  void (*start)(struct dw_mci *host, unsigned int sg_len);
197  void (*complete)(struct dw_mci *host);
198  void (*stop)(struct dw_mci *host);
199  void (*cleanup)(struct dw_mci *host);
200  void (*exit)(struct dw_mci *host);
201 };
202 
203 /* IP Quirks/flags. */
204 /* DTO fix for command transmission with IDMAC configured */
205 #define DW_MCI_QUIRK_IDMAC_DTO BIT(0)
206 /* delay needed between retries on some 2.11a implementations */
207 #define DW_MCI_QUIRK_RETRY_DELAY BIT(1)
208 /* High Speed Capable - Supports HS cards (up to 50MHz) */
209 #define DW_MCI_QUIRK_HIGHSPEED BIT(2)
210 /* Unreliable card detection */
211 #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
212 /* Write Protect detection not available */
213 #define DW_MCI_QUIRK_NO_WRITE_PROTECT BIT(4)
214 
215 struct dma_pdata;
216 
218  unsigned short max_segs; /* see blk_queue_max_segments */
219  unsigned int max_blk_size; /* maximum size of one mmc block */
220  unsigned int max_blk_count; /* maximum number of blocks in one req*/
221  unsigned int max_req_size; /* maximum number of bytes in one req*/
222  unsigned int max_seg_size; /* see blk_queue_max_segment_size */
223 };
224 
225 /* Board platform data */
226 struct dw_mci_board {
228 
229  u32 quirks; /* Workaround / Quirk flags */
230  unsigned int bus_hz; /* Clock speed at the cclk_in pad */
231 
232  unsigned int caps; /* Capabilities */
233  unsigned int caps2; /* More capabilities */
234  /*
235  * Override fifo depth. If 0, autodetect it from the FIFOTH register,
236  * but note that this may not be reliable after a bootloader has used
237  * it.
238  */
239  unsigned int fifo_depth;
240 
241  /* delay in mS before detecting cards after interrupt */
243 
244  int (*init)(u32 slot_id, irq_handler_t , void *);
245  int (*get_ro)(u32 slot_id);
246  int (*get_cd)(u32 slot_id);
247  int (*get_ocr)(u32 slot_id);
248  int (*get_bus_wd)(u32 slot_id);
249  /*
250  * Enable power to selected slot and set voltage to desired level.
251  * Voltage levels are specified using MMC_VDD_xxx defines defined
252  * in linux/mmc/host.h file.
253  */
254  void (*setpower)(u32 slot_id, u32 volt);
255  void (*exit)(u32 slot_id);
256  void (*select_slot)(u32 slot_id);
257 
259  struct dma_pdata *data;
261 };
262 
263 #endif /* LINUX_MMC_DW_MMC_H */