PageRenderTime 45ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 1ms

/drivers/net/wireless/tiwlan1251/pform/linux/inc/mmc_omap_api.h

http://github.com/CyanogenMod/cm-kernel
C Header | 570 lines | 168 code | 57 blank | 345 comment | 0 complexity | 366fb5c8523dd8f1706693717bb352b9 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, LGPL-2.0
  1. /****************************************************************************
  2. **+-----------------------------------------------------------------------+**
  3. **| |**
  4. **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
  5. **| All rights reserved. |**
  6. **| |**
  7. **| Redistribution and use in source and binary forms, with or without |**
  8. **| modification, are permitted provided that the following conditions |**
  9. **| are met: |**
  10. **| |**
  11. **| * Redistributions of source code must retain the above copyright |**
  12. **| notice, this list of conditions and the following disclaimer. |**
  13. **| * Redistributions in binary form must reproduce the above copyright |**
  14. **| notice, this list of conditions and the following disclaimer in |**
  15. **| the documentation and/or other materials provided with the |**
  16. **| distribution. |**
  17. **| * Neither the name Texas Instruments nor the names of its |**
  18. **| contributors may be used to endorse or promote products derived |**
  19. **| from this software without specific prior written permission. |**
  20. **| |**
  21. **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |**
  22. **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |**
  23. **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
  24. **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |**
  25. **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
  26. **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |**
  27. **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
  28. **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
  29. **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |**
  30. **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
  31. **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |**
  32. **| |**
  33. **+-----------------------------------------------------------------------+**
  34. ****************************************************************************/
  35. #ifndef MMC_OMAP_API_H
  36. #define MMC_OMAP_API_H
  37. #ifdef __LINUX__
  38. #include <asm/io.h> /* include for SDIO Compilation */
  39. #endif
  40. /*
  41. SDIO_SUCCESS,
  42. SDIO_FAILURE - API return code (means success or failure of command invocation
  43. in unblocking mode and success or failure of command completion in blocking mode).
  44. SDIO_BUSY - Busy means that bus is not avilable.
  45. SDIO_BAD_ALIGNMENT - Bad alignment means that data passed for DMA transaction
  46. has been not aligned.
  47. SDIO_TIMEOUT - Timeout menas that attempt to acquire bus was failed.
  48. SDIO_BAD_INPUT_PARAMS - Bad input parameters means that parameters failed validation.
  49. SDIO_BAD_ADDRESS - Input peripheral address is not in valid range.
  50. SDIO_PACKET_SIZE_AND_MODE_INCONSISTENCY - Packet size inconsistency means that packet
  51. size does not fit the transaction mode (synchronous or asynchronous).
  52. SDIO_CONTEXT_AND_MODE_INCONSISTENCY - Context inconsistency means that API has been
  53. called from context that has some conflicts with API input parameters.
  54. SDIO_NON_AFFECTED - action was not failed, but it has no influence.
  55. */
  56. typedef enum {
  57. SDIO_SUCCESS=0,
  58. SDIO_FAILURE,
  59. SDIO_BUSY,
  60. SDIO_BAD_ALIGNMENT,
  61. SDIO_TIMEOUT,
  62. SDIO_BAD_INPUT_PARAMS,
  63. SDIO_BAD_PERIPHERAL_ADDRESS,
  64. SDIO_PACKET_SIZE_AND_MODE_INCONSISTENCY,
  65. SDIO_CONTEXT_AND_MODE_INCONSISTENCY,
  66. SDIO_NO_RESOURCES,
  67. SDIO_NON_AFFECTED,
  68. } SDIO_Status;
  69. /* Pointer to the SDIO memory-mapped address space */
  70. typedef unsigned long SDIO_Address;
  71. /* Peripheral address space */
  72. typedef unsigned long Peripheral_Address;
  73. /*
  74. SDIO_BufferLength: The length of the transaction.
  75. In byte-basis operation, this length is the number of
  76. bytes in the transaction. In block-basis operation, this
  77. length is the number of blocks in the transaction.
  78. */
  79. typedef unsigned int SDIO_BufferLength;
  80. /* SDIO device driver activation states */
  81. typedef enum {
  82. SDIO_Activation_InactiveState, /* non initialized state */
  83. SDIO_Activation_InitializedState, /* state after initialization or after stop */
  84. SDIO_Activation_ActiveState, /* state after start */
  85. SDIO_Activation_PowerSaveState, /* to be defined */
  86. SDIO_Activation_EnchancedPowerSaveState,/* to be defined */
  87. SDIO_Activation_None,
  88. } SDIO_ActivationState;
  89. /* Bus statuses */
  90. typedef enum {
  91. SDIO_Bus_Busy, /* in processing */
  92. SDIO_Bus_Wait_Queue, /* in processing - wait for the request from queue */
  93. SDIO_Bus_Wait_Async, /* in processing - wait for the asynchronous response */
  94. SDIO_Bus_Available, /* available for use */
  95. SDIO_Bus_None,
  96. } SDIO_BusStatus;
  97. /* SDIO request statuses */
  98. typedef enum {
  99. SDIO_Request_Completed = 0, /* last request has been successfully completed */
  100. SDIO_Request_InProgress, /* last request is still in progress */
  101. SDIO_Request_FailedTimeOut, /* last request has been failed - timeout */
  102. SDIO_Request_FailedCRC, /* last request has been failed - CRC */
  103. SDIO_Request_FailedSubmit, /* last request has been failed - submit request */
  104. SDIO_Request_Rejected, /* last request has been rejected */
  105. SDIO_Request_ReadFailed, /* last read request has been failed */
  106. SDIO_Request_WriteFailed, /* last write request has been failed */
  107. SDIO_Request_None, /* no request has been submitted */
  108. } SDIO_RequestStatus;
  109. /*
  110. SDIO_RequestMode - how to proccess request.
  111. SDIO read or write transaction mode.
  112. OP Code 0 is used to read or write multiple bytes of
  113. data to/from a single I/O register address.
  114. This command is useful when I/O data is transferred
  115. using a FIFO inside of the I/O device. In this case,
  116. multiple bytes of data are transferred to/from a single
  117. register address.
  118. OP Code 1 is used to read or write multiple bytes of
  119. data to/from an I/O register address that increment
  120. by 1after each operation. This command is used used when
  121. large amounts of I/O data exist within the I/O card in a
  122. RAM like data buffer.
  123. */
  124. typedef char SDIO_FunctionNumber; /* SDIO protocol function Id */
  125. typedef unsigned int SDIO_RequestMode;
  126. typedef unsigned int SDIO_BlockSize; /* Block size in case of SDIO is working in block mode */
  127. typedef unsigned int SDIO_ReportLevel; /* Debug report level */
  128. typedef unsigned int SDIO_DMAThreshold; /* Threshold with regards to DMA read and write operations */
  129. typedef void* SDIO_Handle; /* SDIO handle as returned from init routine (SDIO_Init) */
  130. typedef void* SDIO_Owner; /* handle of the object called SDIO_Init */
  131. typedef struct SDIO_Request SDIO_Request_t;
  132. /*
  133. User callback function for request completion notification
  134. */
  135. typedef void (*FNotify)(struct SDIO_Request *, int status);
  136. /*
  137. User callback function for request error notification
  138. */
  139. typedef void (*FError)(struct SDIO_Request *, int status);
  140. /* Request external format */
  141. struct SDIO_Request {
  142. u16 block_len; /* Block length. Zero means byte mode */
  143. u8 *buffer; /* Pointer to the data buffer. Data must be
  144. contiguously allocated and write and release
  145. protected by application. */
  146. unsigned long physical_buffer;/* Physical address of the same buffer */
  147. u16 buffer_len; /* Data buffer length in bytes */
  148. SDIO_Address peripheral_addr;/* SDIO peripheral address */
  149. u32 acquire_window; /* Time out value. If not zero, means in case SDIO resources
  150. are not available, try to acquire it within acquire_window
  151. time. Return with busy resources indication in case
  152. of expiration. */
  153. u8 enqueue_flag; /* 0 - reject request if bus is not avaialable;
  154. 1 - put request into waiting list.
  155. This field is relevant only for synchronous requests.
  156. In case acquire_window is not zero - the attempt to wait
  157. for free bus is to be performed and this flag is ignored. */
  158. SDIO_RequestMode mode; /* One of the following values:
  159. - MMC_DEV_BYTE_INCREMENTAL_MODE
  160. - MMC_DEV_BLOCK_INCREMENTAL_MODE
  161. - MMC_DEV_BYTE_FIXED_MODE
  162. - MMC_DEV_BLOCK_FIXED_MODE */
  163. SDIO_RequestStatus status; /* Request complition or progress status */
  164. SDIO_Handle handle; /* SDIO object handle */
  165. SDIO_Owner owner; /* SDIO object owner handle */
  166. void *user; /* Lower level handle */
  167. u8 access_flag; /* 0 means write operation !0 - read */
  168. FNotify fnotify; /* callback for request completion notification */
  169. FError ferror; /* callback for request error notification */
  170. };
  171. /*
  172. Peripheral configuration function
  173. */
  174. typedef void Peripheral_ConfigParams;
  175. typedef SDIO_Status (*FPeripheral)(SDIO_Handle, Peripheral_ConfigParams **);
  176. /*
  177. Convert peripheral adddress into 17 bits SDIO address.
  178. Default empty function is provided for the case when a caller
  179. supplies already converted address.
  180. */
  181. typedef SDIO_Address (*FConvert)(Peripheral_Address, SDIO_BufferLength);
  182. /* Constants that are used for device driver configuration and tuning */
  183. #define MMC_DEV_TIWIPP_CONFIG_SDIO1 0x00000001 /* use SDIO port 1 */
  184. #define MMC_DEV_TIWIPP_CONFIG_SDIO2 0x00000002 /* use SDIO port 2 */
  185. #define MMC_DEV_TIWIPP_CONFIG_SDDETECT_EN 0x00000004 /* auto detection is enable */
  186. #define MMC_DEV_INIT_BE_MODE 0x00000010 /* big endian mode */
  187. #define MMC_DEV_INIT_LE_MODE 0x00000020 /* little endian mode */
  188. #define MMC_DEV_IRQ_NOTIFY_MODE 0x00000100 /* request notify in irq */
  189. #define MMC_DEV_TASKLET_NOTIFY_MODE 0x00000200 /* request notify in tasklet */
  190. #define MMC_DEV_SDIO_BUS_WIDTH_1 0x00001000 /* 1-bit bus mode */
  191. #define MMC_DEV_SDIO_BUS_WIDTH_4 0x00002000 /* 4-bit bus mode */
  192. #define MMC_DEV_CALLBACK_BLOCKING_MODE 0x00010000 /* callbacks in blocking mode */
  193. #define MMC_DEV_CALLBACK_ASYNC_MODE 0x00020000 /* callbacks in asynchronous mode */
  194. #define MMC_DEV_DMA_ONE_CHUNK_MODE 0x01000000 /* buffer size <= transaction */
  195. #define MMC_DEV_DMA_MULTI_CHUNK_MODE 0x02000000 /* buffer size = n*transaction */
  196. #define MMC_DEV_CONTIGUOUSE_MEMORY_MODE 0x10000000 /* memory convergence is required */
  197. #define MMC_DEV_NON_CONTIGUOUSE_MEMORY_MODE 0x20000000 /* memory copy is required */
  198. #define MMC_DEV_VIRTUAL_MEMORY_MODE 0x40000000 /* application passes virtual address */
  199. #define MMC_DEV_PHYSICAL_MEMORY_MODE 0x80000000 /* application passes physical address*/
  200. #define MMC_DEV_DEFAULT_CLOCK_RATE 24000000 /* clock rate value (24MHz) */
  201. #define MMC_DEV_DEFAULT_AFL_SIZE 2 /* 16-bit words used by DMA write */
  202. #define MMC_DEV_DEFAULT_AEL_SIZE 2 /* 16-bit words used by DMA read */
  203. #define MMC_DEV_DEFAULT_VDD_VOLTAGE_WINDOW 0xFFFFC0 /* 0xFFFF00 is 2.0-3.6 volts window */
  204. #define MMC_DEV_MAX_FIFO_SIZE 64 /* controller size in bytes */
  205. #define MMC_DEV_MIN_AFL_AEL_SIZE 2 /* 2 16-bit words used by DMA */
  206. /* Static configuration parameters.*/
  207. typedef struct {
  208. SDIO_Owner owner; /* caller id */
  209. unsigned int config_flags; /* combination of the above "mode" values */
  210. unsigned int clock_rate; /* initial clock rate of SDIO bus in microseconds */
  211. unsigned int size_for_afl; /* AFL of MMC_BUF register (number of 16-bit words) */
  212. unsigned int size_for_ael; /* AEL of MMC_BUF register (number of 16-bit words) */
  213. unsigned int vdd_voltage_window; /* VDD voltage window - OCR values */
  214. /* User callback function for request completion notification */
  215. FNotify fnotify_read;/* callback for read request completion notification */
  216. FNotify fnotify_write;/* callback for write request completion notification */
  217. FError ferror; /* callback for request error notification */
  218. FPeripheral fconfig_peripheral; /* to be assigned to configuration peripheral target */
  219. FConvert fconvert; /* convert peripheral address to host address function */
  220. } SDIO_ConfigParams;
  221. /* Clock and DMA threshold values รข&#x20AC;&#x201C; should be tuned */
  222. #define MMC_DEV_MASTER_CLOCK 48000000 /* deviser=MASTER_CLOCK/CLOCK_RATE */
  223. #define MMC_DEV_DATA_ALIGNMENT_DEFAULT 4
  224. #define MMC_DEV_DATA_BLOCK_SIZE_DEFAULT 512
  225. #define MMC_DEV_WRITE_BYTE_DMA_THRESHOLD_DEFUALT MMC_DEV_DEFAULT_AFL_SIZE
  226. /* use DMA for packet size > threshold */
  227. #define MMC_DEV_READ_BYTE_DMA_THRESHOLD_DEFUALT MMC_DEV_DEFAULT_AEL_SIZE
  228. /* use DMA for packet size > threshold */
  229. #define MMC_DEV_FUNCTION_NUMBER_DEFUALT 1 /* default function code Id */
  230. #define MMC_DEV_BLOCK_MODE 0x01000000 /* transaction size in blocks */
  231. #define MMC_DEV_BYTE_MODE 0x02000000 /* transaction size in bytes */
  232. #define MMC_DEV_INCREMENTAL_ADDRESS 0x10000000 /* transaction with OP code 0 */
  233. #define MMC_DEV_FIXED_ADDRESS 0x20000000 /* transaction with OP code 1 */
  234. #define MMC_DEV_BYTE_INCREMENTAL_MODE (MMC_DEV_BYTE_MODE|MMC_DEV_INCREMENTAL_ADDRESS)
  235. #define MMC_DEV_BLOCK_INCREMENTAL_MODE (MMC_DEV_BLOCK_MODE|MMC_DEV_INCREMENTAL_ADDRESS)
  236. #define MMC_DEV_BYTE_FIXED_MODE (MMC_DEV_BYTE_MODE|MMC_DEV_FIXED_ADDRESS)
  237. #define MMC_DEV_BLOCK_FIXED_MODE (MMC_DEV_BLOCK_MODE|MMC_DEV_FIXED_ADDRESS)
  238. /* Dynamic configuration parameters */
  239. typedef struct {
  240. unsigned int write_bytes_threshold;
  241. unsigned int read_bytes_threshold;
  242. char card_function_code; /* Card function code */
  243. #ifdef CONFIG_MMC_DEBUG
  244. unsigned int report_level;
  245. #endif
  246. } SDIO_DynamicParams;
  247. /*
  248. This function initializes the SDIO host controller.
  249. After the function is completed SDIO controller is
  250. ready for SDIO interface activating.
  251. The function creates SDIO object and returns a pointer to SDIO handler.
  252. This function does not communicate with SDIO controller.
  253. */
  254. SDIO_Status SDIO_Init(SDIO_ConfigParams*, SDIO_Handle*);
  255. /*
  256. This function frees all resources and destroys SDIO object.
  257. */
  258. SDIO_Status SDIO_Shutdown(SDIO_Handle);
  259. /*
  260. This function activates configured setup for the SDIO device.
  261. */
  262. SDIO_Status SDIO_Start(SDIO_Handle);
  263. /*
  264. This function disconnects the host CPU from the slave SDIO device.
  265. wait_window if non zero means to wait until last transaction is
  266. completed or until wait_window is expired and only after that
  267. disconnect.
  268. wait_window has to be always zero in case API is called from
  269. hardware interrupt context.
  270. */
  271. SDIO_Status SDIO_Stop(SDIO_Handle, unsigned long wait_window);
  272. /*
  273. This function re-activates configured setup for the SDIO device.
  274. This function can be used for recovery purpose.
  275. It performs the same set of actions like SDIO_Start with regard to
  276. SDIO controller. In addition it reset the bus state to the initial
  277. value, it drops a non-competed transaction if exist, it drops whole
  278. SDIO request (in case the request is multi transaction), in case such
  279. request is in progress.
  280. */
  281. SDIO_Status SDIO_Reset(SDIO_Handle);
  282. /*
  283. This function reads from SDIO interface.
  284. The input address is SDIO_Address, which is a pointer to
  285. the SDIO address space. The output address is local pointer in the virtual
  286. address space.
  287. The driver should convert the virtual address space to physical address
  288. space in case of DMA operation.
  289. Read operation can't be processed in case SDIO interface is occupied by
  290. other transaction. But in case acquire_window in input request is not zero,
  291. routine should try to acquire SDIO interface within acquire window.
  292. request->buf - pointer to the data buffer. Data must be contiguously allocated
  293. and write and release protected by application.
  294. request->physical_buffer- physical address of the same buffer.
  295. request->buf_len - data buffer length in bytes. It contains the number of
  296. bytes that is requested to be read.
  297. The number of bytes that have been read within each transaction
  298. is to be returned (one request can contain several transactions).
  299. request->peripheral_addr- SDIO peripheral address.
  300. request->acquire_window - time out value. If not zero, means in case SDIO resources
  301. are not available, try to acquire it within acquire_window
  302. time. Return with busy resources indication in case of
  303. expiration.
  304. request->enqueue_flag - flag indicating whether to put or not syncronouse request into
  305. device waiting list.
  306. request->mode - flag that is a valid combination of the following constants:
  307. - MMC_DEV_BLOCK_MODE or MMC_DEV_BYTE_MODE;
  308. - MMC_DEV_INCREMENTAL_ADDRESS or MMC_DEV_FIXED_ADDRESS.
  309. Upon request completion, the result is to be returned to the request
  310. originator.
  311. */
  312. SDIO_Status SDIO_SyncRead(SDIO_Handle, SDIO_Request_t*);
  313. /*
  314. The input address is a local pointer in the virtual address space.
  315. The output address is SDIO_Address, which is a pointer to the SDIO
  316. address space.
  317. Write operation can't be processed in case SDIO interface is occupied by
  318. other transaction. But in case acquire_window in input request is not zero,
  319. routine should try to acquire SDIO interface within acquire window.
  320. request->buf - pointer to the data buffer. Data must be contiguously allocated
  321. and write and release protected by application.
  322. request->physical_buffer- physical address of the same buffer.
  323. request->buf_len - data buffer length in bytes. It contains the number of
  324. bytes that is requested to be read.
  325. The number of bytes that have been written within each transaction
  326. is to be returned (one request can contain several transactions).
  327. request->peripheral_addr- SDIO peripheral address.
  328. request->acquire_window - time out value. If not zero, means in case SDIO resources
  329. are not available, try to acquire it within acquire_window
  330. time. Return with busy resources indication in case of
  331. expiration.
  332. request->enqueue_flag - flag indicating whether to put or not syncronouse request into
  333. device waiting list.
  334. request->mode - flag that is a valid combination of the following constants:
  335. - MMC_DEV_BLOCK_MODE or MMC_DEV_BYTE_MODE;
  336. - MMC_DEV_INCREMENTAL_ADDRESS or MMC_DEV_FIXED_ADDRESS.
  337. Upon request completion, the result is to be returned to the request
  338. originator.
  339. */
  340. SDIO_Status SDIO_SyncWrite(SDIO_Handle, SDIO_Request_t*);
  341. #ifdef CONFIG_ASYNC_API
  342. /*
  343. This function reads from SDIO interface.
  344. Read operation request is to be proceeded in a chunks of
  345. pre-configured size (this size is set at the initialization time).
  346. Upon part of the request completion (up to one chunk), the result
  347. is to be indicated through the related DMA callback.
  348. The request control data, like number of bytes or blocks that
  349. should be read within transaction, bus status etc, are to be stored
  350. within request template.
  351. */
  352. SDIO_Status SDIO_AsyncRead(SDIO_Handle, SDIO_Request_t*);
  353. /*
  354. This function writes to SDIO interface.
  355. Write operation request is to be proceeded in a chunks of
  356. pre-configured size (this size is set at the initialization time).
  357. Upon part of the request completion (up to one chunk), the result is to
  358. be indicated through the related DMA callback.
  359. The request control data, like number of bytes or blocks that should be
  360. read within transaction, bus status etc, are to be stored within request
  361. template.
  362. */
  363. SDIO_Status SDIO_AsyncWrite(SDIO_Handle, SDIO_Request_t*);
  364. /* The same as SDIO_SyncKillRequest, but for asynchronous mode.
  365. This function drops a non-competed transaction in case such transaction
  366. is exist, it drops whole SDIO request, in case such request is in progress.
  367. A host communicating with SDIO device can abort data transfer just by
  368. writing to the ASx bits in the CCCR. Normally, the abort is used to
  369. stop an infinite block transfer (block count=0). If an exact number of
  370. blocks to be transferred, it is recommended that the host issue a block
  371. command with the correct block count, rather than using an infinite count
  372. and aborting the data at the correct time.
  373. Additionally function runs user iterator function over each item from
  374. driver asynchronous request queue.
  375. */
  376. SDIO_Status SDIO_AsyncKillRequest(SDIO_Handle sdioHandle, void(*fiterator)(void*, int));
  377. /* Go through asynchronous request queue and call fiterator function
  378. for each non empty entry.
  379. Iterator function could be anything according to application needs: delete
  380. entry, modify entry, print entry etc from asynchronous request queue.
  381. */
  382. SDIO_Status SDIO_AsyncIterateQueue(SDIO_Handle sdioHandle, void(*fiterator)(void*, int));
  383. #endif /*CONFIG_ASYNC_API*/
  384. /*
  385. Set activation mode - write it into sdio object control structure
  386. */
  387. SDIO_Status SDIO_SetActivationState(SDIO_Handle, SDIO_ActivationState);
  388. /*
  389. Get activation mode - read from sdio object control structure
  390. */
  391. SDIO_ActivationState SDIO_GetActivationState(SDIO_Handle);
  392. /*
  393. Set function number - write it into sdio object control structure
  394. */
  395. SDIO_Status SDIO_SetFunctionNumber(SDIO_Handle, SDIO_FunctionNumber);
  396. /*
  397. Get function number - read it from sdio object control structure
  398. */
  399. SDIO_FunctionNumber SDIO_GetFunctionNumber(SDIO_Handle sdioHandle);
  400. /*
  401. Set DMA threshold parameter for read transactions - write it into
  402. SDIO object control structure
  403. */
  404. SDIO_Status SDIO_SetDMAReadThreshold(SDIO_Handle, SDIO_DMAThreshold);
  405. /*
  406. Set DMA threshold parameter for write transactions - write it into
  407. SDIO object control structure
  408. */
  409. SDIO_Status SDIO_SetDMAWriteThreshold(SDIO_Handle, SDIO_DMAThreshold);
  410. /*
  411. Set sdio object debug report level - write it into sdio object control structure
  412. */
  413. SDIO_Status SDIO_SetReportLevel(SDIO_Handle, SDIO_ReportLevel);
  414. /*
  415. Set sdio object static parameters - write it into sdio object control
  416. structure. Initialization time only.
  417. */
  418. SDIO_Status SDIO_SetStaticParams(SDIO_Handle sdioHandle, SDIO_ConfigParams *staticParams);
  419. /*
  420. Get sdio object static parameters.
  421. This function can be invoked at the initialization time only, it sets SDIO
  422. static parameters:
  423. - sdio port (controller id);
  424. - Card auto detection mode;
  425. - Endian mode;
  426. - Device driving mode (interrupt, polling or blind);
  427. - Sdio bus width (1 or 4);
  428. - Callback mode (blocking or non-blocking);
  429. - Transfer mode (single or multi chunks);
  430. - DMA channel allocation method (dynamic or static);
  431. - Clock size.
  432. SDIO object static parameters setting will be updated after validation,
  433. as following: object->static_params |= static_params.
  434. */
  435. SDIO_ConfigParams *SDIO_GetStaticParams(SDIO_Handle sdioHandle);
  436. /*
  437. Get sdio object dynamic parameters.
  438. This function can be invoked at the run-time, it sets SDIO parameters,
  439. for example:
  440. - Activation mode;
  441. - Function number;
  442. - Read DMA threshold;
  443. - Write DMA threshold;
  444. - Report level;
  445. - Transaction size (chunk);
  446. SDIO object dynamic parameters setting will be updated after validation,
  447. as following: object->dynamic_params |= dynamic_params;
  448. */
  449. SDIO_Status SDIO_SetDynamicParams(SDIO_Handle sdioHandle, SDIO_DynamicParams *dynamicParams);
  450. /*
  451. Get sdio object dynamic parameters - write it into sdio
  452. object control structure.
  453. */
  454. SDIO_DynamicParams *SDIO_GetDynamicParams(SDIO_Handle sdioHandle);
  455. /*
  456. This function read bus status from SDIO object and returns it to
  457. the caller.
  458. Note that bus status returned to the caller could be different
  459. from the real status, because this function does not run in a lock mode.
  460. */
  461. SDIO_BusStatus SDIO_GetBusStatus(SDIO_Handle);
  462. /*
  463. Set size of the block for the blocking mode.
  464. The SDIO device may transfer data in an optional block format.
  465. The SDIO specification allows any block size from 1 byte to 2048 bytes
  466. (power of 2) in order to accommodate the various natural block sizes
  467. for IO functions. Note that an SDIO card function may define a maximum
  468. block size or byte count in the CIS that is smaller than the maximum
  469. values described above.
  470. */
  471. SDIO_Status SDIO_SetBlockSize(SDIO_Handle, SDIO_BlockSize);
  472. /*
  473. This function can be used for recovery purpose.
  474. This function drops a non-competed transaction in case such transaction
  475. is exist, it drops whole SDIO request, in case such request is in progress.
  476. A host communicating with SDIO device can abort data transfer just by
  477. writing to the ASx bits in the CCCR. Normally, the abort is used to
  478. stop an infinite block transfer (block count=0). If an exact number of
  479. blocks to be transferred, it is recommended that the host issue a block
  480. command with the correct block count, rather than using an infinite count
  481. and aborting the data at the correct time.
  482. */
  483. SDIO_Status SDIO_SyncKillRequest(SDIO_Handle);
  484. /*
  485. Get status of the request executed last time.
  486. */
  487. SDIO_RequestStatus SDIO_GetLastRequestStatus(SDIO_Handle);
  488. #ifdef CONFIG_FORCE_API
  489. /*
  490. Like SDIO_SyncRead and SDIO_SyncWrite, but with enforcement to perform
  491. transactions through DMA (only one chunck per transaction).
  492. Both APIs must be called only in case the length of the buffer fits
  493. the next condtition:
  494. MMC_DEV_MAX_FIFO_SIZE <= length <= MMC_DEV_DATA_BLOCK_SIZE_DEFAULT
  495. For example:
  496. sync_read_request.buffer = dest_addr;
  497. sync_read_request.peripheral_addr = perph_addr;
  498. sync_read_request.buffer_len = length;
  499. if(lenght<MMC_DEV_MAX_FIFO_SIZE || length>MMC_DEV_DATA_BLOCK_SIZE_DEFAULT)
  500. status=SDIO_SyncRead(pHwAccess->hSdio,&sync_read_request);
  501. else
  502. status=SDIO_ForceRead(pHwAccess->hSdio,&sync_read_request);
  503. These APIs is faster then SDIO_SyncRead/SDIO_SyncWrite, but can be used
  504. only for synchronous mode.
  505. */
  506. SDIO_Status SDIO_ForceRead(SDIO_Handle sdioHandle, SDIO_Request_t *req);
  507. SDIO_Status SDIO_ForceWrite(SDIO_Handle sdioHandle, SDIO_Request_t *req);
  508. #endif
  509. #endif /* MMC_OMAP_API_H */