1/* 2 * SdioDrv.h 3 * 4 * Copyright (C) 2009 Texas Instruments, Inc. - http://www.ti.com/ 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation version 2. 9 * 10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 * kind, whether express or implied; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 */ 15 16#ifndef __OMAP3430_SDIODRV_API_H 17#define __OMAP3430_SDIODRV_API_H 18 19#include <asm/types.h> 20#include <linux/mmc/mmc.h> 21 22/* Card Common Control Registers (CCCR) */ 23 24#define CCCR_SDIO_REVISION 0x00 25#define CCCR_SD_SPECIFICATION_REVISION 0x01 26#define CCCR_IO_ENABLE 0x02 27#define CCCR_IO_READY 0x03 28#define CCCR_INT_ENABLE 0x04 29#define CCCR_INT_PENDING 0x05 30#define CCCR_IO_ABORT 0x06 31#define CCCR_BUS_INTERFACE_CONTOROL 0x07 32#define CCCR_CARD_CAPABILITY 0x08 33#define CCCR_COMMON_CIS_POINTER 0x09 /*0x09-0x0B*/ 34#define CCCR_FNO_BLOCK_SIZE 0x10 /*0x10-0x11*/ 35#define FN0_CCCR_REG_32 0x64 36 37/* Pprotocol defined constants */ 38 39#define SD_IO_GO_IDLE_STATE 0 40#define SD_IO_SEND_RELATIVE_ADDR 3 41#define SDIO_CMD5 5 42#define SD_IO_SELECT_CARD 7 43#define SDIO_CMD52 52 44#define SDIO_CMD53 53 45#define SD_IO_SEND_OP_COND SDIO_CMD5 46#define SD_IO_RW_DIRECT SDIO_CMD52 47#define SD_IO_RW_EXTENDED SDIO_CMD53 48#define SDIO_SHIFT(v,n) (v<<n) 49#define SDIO_RWFLAG(v) (SDIO_SHIFT(v,31)) 50#define SDIO_FUNCN(v) (SDIO_SHIFT(v,28)) 51#define SDIO_RAWFLAG(v) (SDIO_SHIFT(v,27)) 52#define SDIO_BLKM(v) (SDIO_SHIFT(v,27)) 53#define SDIO_OPCODE(v) (SDIO_SHIFT(v,26)) 54#define SDIO_ADDRREG(v) (SDIO_SHIFT(v,9)) 55 56 57#define VDD_VOLTAGE_WINDOW 0xffffc0 58#define FN2_OBI_INV 0x0002 59 60#define MMC_RSP_NONE (0 << 0) 61#define MMC_RSP_SHORT (1 << 0) 62#define MMC_RSP_LONG (2 << 0) 63#define MMC_RSP_MASK (3 << 0) 64#define MMC_RSP_CRC (1 << 3) 65#define MMC_RSP_BUSY (1 << 4) 66 67#define MMC_RSP_R1 (MMC_RSP_SHORT|MMC_RSP_CRC) 68#define MMC_RSP_R1B (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY) 69#define MMC_RSP_R2 (MMC_RSP_LONG|MMC_RSP_CRC) 70#define MMC_RSP_R3 (MMC_RSP_SHORT) 71 72/* HSMMC controller bit definitions 73 * */ 74#define OMAP_HSMMC_CMD_NO_RESPONSE (0 << 0) 75#define OMAP_HSMMC_CMD_LONG_RESPONSE (1 << 0) 76#define OMAP_HSMMC_CMD_SHORT_RESPONSE (2 << 0) 77 78#define MMC_ERR_NONE 0 79#define MMC_ERR_TIMEOUT 1 80#define MMC_ERR_BADCRC 2 81#define MMC_ERR_FIFO 3 82#define MMC_ERR_FAILED 4 83#define MMC_ERR_INVALID 5 84 85#undef MMC_RSP_R4 86#define MMC_RSP_R4 OMAP_HSMMC_CMD_SHORT_RESPONSE 87#undef MMC_RSP_R5 88#define MMC_RSP_R5 OMAP_HSMMC_CMD_SHORT_RESPONSE 89#undef MMC_RSP_R6 90#define MMC_RSP_R6 OMAP_HSMMC_CMD_SHORT_RESPONSE 91 92/********************************************************************/ 93/* SDIO driver functions prototypes */ 94/********************************************************************/ 95int sdioDrv_ConnectBus (void * fCbFunc, 96 void * hCbArg, 97 unsigned int uBlkSizeShift, 98 unsigned int uSdioThreadPriority, 99 unsigned char **pTxDmaSrcAddr); 100 101int sdioDrv_DisconnectBus (void); 102 103int sdioDrv_ExecuteCmd (unsigned int uCmd, 104 unsigned int uArg, 105 unsigned int uRespType, 106 void * pResponse, 107 unsigned int uLen); 108 109int sdioDrv_ReadSync (unsigned int uFunc, 110 unsigned int uHwAddr, 111 void * pData, 112 unsigned int uLen, 113 unsigned int bIncAddr, 114 unsigned int bMore); 115 116int sdioDrv_ReadAsync (unsigned int uFunc, 117 unsigned int uHwAddr, 118 void * pData, 119 unsigned int uLen, 120 unsigned int bBlkMode, 121 unsigned int bIncAddr, 122 unsigned int bMore); 123 124int sdioDrv_WriteSync (unsigned int uFunc, 125 unsigned int uHwAddr, 126 void * pData, 127 unsigned int uLen, 128 unsigned int bIncAddr, 129 unsigned int bMore); 130 131int sdioDrv_WriteAsync (unsigned int uFunc, 132 unsigned int uHwAddr, 133 void * pData, 134 unsigned int uLen, 135 unsigned int bBlkMode, 136 unsigned int bIncAddr, 137 unsigned int bMore); 138 139int sdioDrv_ReadSyncBytes (unsigned int uFunc, 140 unsigned int uHwAddr, 141 unsigned char *pData, 142 unsigned int uLen, 143 unsigned int bMore); 144 145int sdioDrv_WriteSyncBytes (unsigned int uFunc, 146 unsigned int uHwAddr, 147 unsigned char *pData, 148 unsigned int uLen, 149 unsigned int bMore); 150 151void sdioDrv_register_pm(int (*wlanDrvIf_Start)(void), 152 int (*wlanDrvIf_Stop)(void)); 153 154 155#endif/* _OMAP3430_SDIODRV_H */ 156