change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / drivers / mmc / card_sdio.h
1 #include "asm/arch/sci_types.h"
2
3 #ifndef __SD_SDIO_20_H__
4 #define __SD_SDIO_20_H__
5
6 struct CARD_PORT_TAG;
7 typedef struct CARD_PORT_TAG* CARD_SDIO_HANDLE;
8
9 /*****************************************************************************/
10 //  Description:  Get Card operation handle,after we get the handle ,we can get next operation way of card
11 //  Author: Jason.wu
12 //  Param
13 //              host_slot: slot number
14 //  Return:
15 //              Not zero: success
16 //              zero : fail
17 //  Note: 
18 /*****************************************************************************/
19 typedef enum
20 {
21         CARD_SDIO_SLOT_0,
22         CARD_SDIO_SLOT_1,
23         CARD_SDIO_SLOT_2,
24         CARD_SDIO_SLOT_3,
25         CARD_SDIO_SLOT_4,
26         CARD_SDIO_SLOT_5,
27         CARD_SDIO_SLOT_6,
28         CARD_SDIO_SLOT_7,
29         CARD_SDIO_SLOT_MAX
30 }
31 CARD_SDIO_SLOT_NO;
32
33 typedef enum
34 {
35         NORMAL_SPEED_MODE,
36         HIGH_SPEED_MODE,
37         SPEED_MODE_MAX
38 }
39 CARD_SPEED_MODE;
40
41 typedef enum CARD_EMMC_PARTITION_TPYE_TAG
42 {
43         PARTITION_USER,
44         PARTITION_BOOT1,
45         PARTITION_BOOT2,
46         PARTITION_RPMB,
47         PARTITION_GENERAL_P1,
48         PARTITION_GENERAL_P2,
49         PARTITION_GENERAL_P3,
50         PARTITION_GENERAL_P4,
51         PARTITION_MAX
52 }CARD_EMMC_PARTITION_TPYE;
53
54 PUBLIC uint32 Emmc_GetCapacity(CARD_EMMC_PARTITION_TPYE cardPartiton);
55
56
57 PUBLIC CARD_SDIO_HANDLE CARD_SDIO_Open(CARD_SDIO_SLOT_NO slotNo);
58 /*****************************************************************************/
59 //  Description:  close operation handle of card. afer we free it ,other application can operate on this card
60 //  Author: Jason.wu
61 //  Param
62 //              cardHandle: the handle returned by CARD_SDIO_Open
63 //  Return:
64 //              NONE
65 //  Note: 
66 /*****************************************************************************/
67 PUBLIC void CARD_SDIO_Close(CARD_SDIO_HANDLE cardHandle);
68 /*****************************************************************************/
69 //  Description:  Turn on or turn off the card 
70 //  Author: Jason.wu
71 //  Param
72 //              cardHandle: the handle returned by CARD_SDIO_Open
73 //              switchCtl: TRUE, turn on the card ,FALSE, turn off the card
74 //  Return:
75 //              NONE
76 //  Note: 
77 /*****************************************************************************/
78 PUBLIC void CARD_SDIO_PwrCtl(CARD_SDIO_HANDLE cardHandle,BOOLEAN switchCtl);
79 /*****************************************************************************/
80 //  Description:  Initialize card, change card from idle state to standy by state ,and get some information from card
81 //  Author: Jason.wu
82 //  Param
83 //              cardHandle: the handle returned by CARD_SDIO_Open
84 //              speedmode: HighSpeed mode or normal speed mode
85 //  Return:
86 //              TRUE: success
87 //              FALSE: fail
88 //  Note: 
89 /*****************************************************************************/
90 PUBLIC BOOLEAN CARD_SDIO_InitCard(CARD_SDIO_HANDLE cardHandle, CARD_SPEED_MODE speedmode);
91 /*****************************************************************************/
92 //  Description:  Set block length of card.  the data will be transmited in block unit
93 //  Author: Jason.wu
94 //  Param
95 //              cardHandle: the handle returned by CARD_SDIO_Open
96 //              length: block length
97 //  Return:
98 //              TRUE: success
99 //              FALSE: fail
100 //  Note: 
101 /*****************************************************************************/
102 PUBLIC BOOLEAN CARD_SDIO_SetBlockLength(CARD_SDIO_HANDLE cardHandle,uint32 length);
103 /*****************************************************************************/
104 //  Description:  Read single block data from card , unit is block
105 //  Author: Jason.wu
106 //  Param
107 //              cardHandle: the handle returned by CARD_SDIO_Open
108 //              BlockId: block number that you want to read
109 //              buf : that data read from card will be stored in this place
110 //  Return:
111 //              TRUE: success
112 //              FALSE: fail
113 //  Note: 
114 /*****************************************************************************/
115 PUBLIC BOOLEAN CARD_SDIO_ReadSingleBlock(CARD_EMMC_PARTITION_TPYE  cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 BlockId,uint8* buf);
116 /*****************************************************************************/
117 //  Description:  Read multi block data from card , unit is block
118 //  Author: Jason.wu
119 //  Param
120 //              cardHandle: the handle returned by CARD_SDIO_Open
121 //              startBlock:  start block number that you want to read
122 //              num: the number of block you want to read
123 //              buf : that data read from card will be stored in this place
124 //  Return:
125 //              TRUE: success
126 //              FALSE: fail
127 //  Note: 
128 /*****************************************************************************/
129 PUBLIC BOOLEAN CARD_SDIO_ReadMultiBlock(CARD_EMMC_PARTITION_TPYE  cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 num,uint8* buf);
130 /*****************************************************************************/
131 //  Description:  Wrtie single block data to card , unit is block
132 //  Author: Jason.wu
133 //  Param
134 //              cardHandle: the handle returned by CARD_SDIO_Open
135 //              BlockId: block number that you want to write
136 //              buf : that data to be writen to card is stored in this place
137 //  Return:
138 //              TRUE: success
139 //              FALSE: fail
140 //  Note: 
141 /*****************************************************************************/
142 PUBLIC BOOLEAN CARD_SDIO_WriteSingleBlock(CARD_EMMC_PARTITION_TPYE  cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 BlockId,uint8* buf);
143 /*****************************************************************************/
144 //  Description:  Wrtie multi block data to card , unit is block
145 //  Author: Jason.wu
146 //  Param
147 //              cardHandle: the handle returned by CARD_SDIO_Open
148 //              startBlock: start block number that you want to write
149 //              num: the number of block you want to write
150 //              buf : the data to be writen to card is stored in this place
151 //  Return:
152 //              TRUE: success
153 //              FALSE: fail
154 //  Note: 
155 /*****************************************************************************/
156 PUBLIC BOOLEAN CARD_SDIO_WriteMultiBlock(CARD_EMMC_PARTITION_TPYE  cardPartiton, CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 num,uint8* buf);
157 /*****************************************************************************/
158 //  Description:  erase card
159 //  Author: Jason.wu
160 //  Param
161 //              cardHandle: the handle returned by CARD_SDIO_Open
162 //              startBlock: start block number that you want to erase
163 //              endBlock : end block number that you want to erase
164 //  Return:
165 //              TRUE: success
166 //              FALSE: fail
167 //  Note: 
168 /*****************************************************************************/
169 PUBLIC BOOLEAN CARD_SDIO_Erase(CARD_SDIO_HANDLE cardHandle,uint32 startBlock,uint32 endBlock);
170 /*****************************************************************************/
171 //  Description:  Get total block number of card ,block length is fix to 512 byte
172 //  Author: Jason.wu
173 //  Param
174 //              cardHandle: the handle returned by CARD_SDIO_Open
175 //  Return:
176 //              uint32 value : total block num
177 //  Note: 
178 /*****************************************************************************/
179 PUBLIC uint32 CARD_SDIO_GetCapacity(CARD_SDIO_HANDLE cardHandle);
180
181 PUBLIC BOOLEAN CARD_SDIO_EnterMcex(CARD_SDIO_HANDLE cardHandle,BOOLEAN* ifEnterMcex );
182
183 PUBLIC BOOLEAN CARD_SDIO_SendPsi(CARD_SDIO_HANDLE cardHandle,uint32 arg,uint8* buf);
184
185 PUBLIC BOOLEAN CARD_SDIO_ReadSecCmd(CARD_SDIO_HANDLE cardHandle,uint8* buf);
186
187 PUBLIC BOOLEAN CARD_SDIO_WriteSecCmd(CARD_SDIO_HANDLE cardHandle,uint8* buf);
188
189 PUBLIC BOOLEAN CARD_SDIO_CtlTrm(CARD_SDIO_HANDLE cardHandle);
190
191 PUBLIC BOOLEAN CARD_SDIO_ExitMcex(CARD_SDIO_HANDLE cardHandle);
192
193 PUBLIC BOOLEAN CARD_SDIO_IsEnterHighSpeed(CARD_SDIO_HANDLE cardHandle);
194
195 PUBLIC BOOLEAN Emmc_Init(void);
196
197 PUBLIC BOOLEAN Emmc_Write(CARD_EMMC_PARTITION_TPYE  cardPartiton, uint32 startBlock,uint32 num,uint8* buf);
198
199 PUBLIC BOOLEAN Emmc_Erase(CARD_EMMC_PARTITION_TPYE cardPartiton, uint32 startBlock,uint32 num);
200
201 PUBLIC BOOLEAN Emmc_Read(CARD_EMMC_PARTITION_TPYE  cardPartiton, uint32 startBlock,uint32 num,uint8* buf);
202
203 PUBLIC uint32 Emmc_GetCapacity(CARD_EMMC_PARTITION_TPYE cardPartiton);
204
205 PUBLIC void Emmc_DisSdClk();
206
207 #endif
208
209
210
211
212