]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/devs/flash/arm/mxc/v2_0/include/mxcmci_core.h
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / devs / flash / arm / mxc / v2_0 / include / mxcmci_core.h
1 #ifndef _MXCMCI_CORE_H_
2 #define _MXCMCI_CORE_H_
3
4 /*=================================================================================
5
6     Module Name:  mxcmci_core.h
7
8     General Description: Limited Bootloader eSDHC Driver.
9
10 ===================================================================================
11                                Copyright: 2004,2005,2006,2007,2008 FREESCALE, INC.
12                    All Rights Reserved. This file contains copyrighted material.
13                    Use of this file is restricted by the provisions of a
14                    Freescale Software License Agreement, which has either
15                    accompanied the delivery of this software in shrink wrap
16                    form or been expressly executed between the parties.
17
18
19 Revision History:
20                             Modification     Tracking
21 Author (core ID)                Date          Number     Description of Changes
22 -------------------------   ------------    ----------   --------------------------
23 Lewis Liu                  18-June-2008
24
25
26 Portability: Portable to other compilers or platforms.
27
28 ====================================================================================================*/
29
30 #include "mxcmci_mmc.h"
31 #include "mxcmci_host.h"
32
33 #define SUCCESS 0
34 #define FAIL 1
35 #define NO_ARG 0
36 #define RCA_SHIFT 16
37 #define ONE 1
38 #define FOUR 4
39 #define EIGHT 8
40 #define TWO_K_SIZE 2048
41 #define MMCSD_READY_TIMEOUT    3000  /* ~(3s / (2 * 48 * 10us)) */
42 #define ESDHC_ACMD41_TIMEOUT 48000 /* 1.5 sec =1500 msec delay for ACMD41 cmd */
43 #define MMCSD_SUPPORT
44
45 #define CURR_CARD_STATE(r) ((cyg_uint32) ((r) & 0x1E00) >> 9)
46
47 /*Defines of CSD data*/
48 #define CSD_STRUCT_MSK                       0x00C00000
49 #define CSD_STRUCT_SHIFT                    22
50 #define MMC_CSD_SPEC_VERS_MASK      0x003C0000
51 #define MMC_CSD_SPEC_VERS_SHIFT     18
52
53 extern cyg_uint32 Card_rca;
54 extern cyg_uint32 address_mode;
55 extern cyg_uint32 MMC_Spec_vers;
56 extern card_specific_data csd;  /* Global variable for Card Specific Data */
57 extern cyg_uint32 Card_capacity_size; /* Capacity size (C_SIZE) for card*/
58 extern cyg_uint32 CCC; /* Card Command Class */
59
60
61 /* Defines the id for each command */
62 enum commands
63 {
64         CMD0= 0,
65         CMD1= 1,
66         CMD2= 2,
67         CMD3= 3,
68         CMD5= 5,
69         CMD6=6,
70         ACMD6= 6,
71         CMD7= 7,
72         CMD8=8,
73         CMD9=9,
74         CMD12   = 12,
75         CMD13   = 13,
76         CMD16   = 16,
77         CMD17   = 17,
78         CMD18   = 18,
79         CMD24   = 24,
80         CMD25   = 25,
81         CMD26   = 26,
82         CMD32   = 32,
83         CMD33   = 33,
84         CMD35   = 35,
85         CMD36   = 36,
86         CMD37   = 37,
87         CMD38   = 38,
88         CMD39   = 39,
89         ACMD41  = 41,
90         CMD43   = 43,
91         ACMD51  = 51,
92         CMD55   = 55,
93         CMD60   = 60,
94         CMD61   = 61,
95         CMD62   = 62,
96 };
97
98 /* Defines for the states of the card*/
99 enum states
100 {
101         IDLE,
102         READY,
103         IDENT,
104         STBY,
105         TRAN,
106         DATA,
107         RCV,
108         PRG,
109         DIS
110 };
111
112 /* Defines for card types */
113 typedef enum
114 {
115         TYPE_NONE,
116         SD_CSD_1_0,
117         SD_CSD_2_0,
118         MMC_CSD_1_0,
119         MMC_CSD_1_1,
120         MMC_CSD_1_2,
121         MMC_UNKNOWN
122 }card_type;
123
124 typedef struct
125 {
126         cyg_uint32 cid0;
127         cyg_uint32 cid1;
128         cyg_uint32 cid2;
129         cyg_uint32 cid3;
130 }card_ident;
131
132
133 /* CARD Flash Configuration Parameters Structure */
134 typedef struct {
135     cyg_uint32  length;         /* Length of Card data to read */
136 } CARD_FLASH_CFG_PARMS_T;
137
138 /*==================================================================================================
139                                              ENUMS
140 ==================================================================================================*/
141
142 /*==================================================================================================
143                                           Global Function
144 ==================================================================================================*/
145 extern cyg_uint32 mxcmci_init (cyg_uint32 bus_width, cyg_uint32 base_address);
146 extern cyg_uint32 mxcmci_data_read (cyg_uint32* dest_ptr,cyg_uint32 len,cyg_uint32 offset);
147 extern cyg_uint32 mxcmci_software_reset (void);
148 extern cyg_uint32 mxcmci_get_cid (void);
149 extern cyg_uint32 mxcmci_trans_prepare(void);
150 extern void   mxcmci_cmd_config (command_t *cmd_config,cyg_uint32 index,cyg_uint32 argument,xfer_type_t transfer,response_format_t format,
151                                   data_present_select data,crc_check_enable crc,cmdindex_check_enable cmdindex);
152
153
154 #endif //_MXCMCI_CORE_H_