1
2
3
4
5
6
7
8
9#ifndef __BFIN_SDH_H__
10#define __BFIN_SDH_H__
11
12
13struct bfin_sd_host {
14 int dma_chan;
15 int irq_int0;
16 int irq_int1;
17 u16 pin_req[7];
18};
19
20
21#define CMD_IDX 0x3f
22#define CMD_RSP (1 << 6)
23#define CMD_L_RSP (1 << 7)
24#define CMD_INT_E (1 << 8)
25#define CMD_PEND_E (1 << 9)
26#define CMD_E (1 << 10)
27#ifdef RSI_BLKSZ
28#define CMD_CRC_CHECK_D (1 << 11)
29#define CMD_DATA0_BUSY (1 << 12)
30#endif
31
32
33#ifndef RSI_BLKSZ
34#define PWR_ON 0x3
35#define SD_CMD_OD (1 << 6)
36#define ROD_CTL (1 << 7)
37#endif
38
39
40#define CLKDIV 0xff
41#define CLK_E (1 << 8)
42#define PWR_SV_E (1 << 9)
43#define CLKDIV_BYPASS (1 << 10)
44#define BUS_MODE_MASK 0x1800
45#define STD_BUS_1 0x000
46#define WIDE_BUS_4 0x800
47#define BYTE_BUS_8 0x1000
48
49
50#define RESP_CMD 0x3f
51
52
53#define DTX_E (1 << 0)
54#define DTX_DIR (1 << 1)
55#define DTX_MODE (1 << 2)
56#define DTX_DMA_E (1 << 3)
57#ifndef RSI_BLKSZ
58#define DTX_BLK_LGTH (0xf << 4)
59#else
60
61
62#define DTX_BLK_LGTH 0x1fff
63#endif
64
65
66#define CMD_CRC_FAIL (1 << 0)
67#define DAT_CRC_FAIL (1 << 1)
68#define CMD_TIME_OUT (1 << 2)
69#define DAT_TIME_OUT (1 << 3)
70#define TX_UNDERRUN (1 << 4)
71#define RX_OVERRUN (1 << 5)
72#define CMD_RESP_END (1 << 6)
73#define CMD_SENT (1 << 7)
74#define DAT_END (1 << 8)
75#define START_BIT_ERR (1 << 9)
76#define DAT_BLK_END (1 << 10)
77#define CMD_ACT (1 << 11)
78#define TX_ACT (1 << 12)
79#define RX_ACT (1 << 13)
80#define TX_FIFO_STAT (1 << 14)
81#define RX_FIFO_STAT (1 << 15)
82#define TX_FIFO_FULL (1 << 16)
83#define RX_FIFO_FULL (1 << 17)
84#define TX_FIFO_ZERO (1 << 18)
85#define RX_DAT_ZERO (1 << 19)
86#define TX_DAT_RDY (1 << 20)
87#define RX_FIFO_RDY (1 << 21)
88
89
90#define CMD_CRC_FAIL_STAT (1 << 0)
91#define DAT_CRC_FAIL_STAT (1 << 1)
92#define CMD_TIMEOUT_STAT (1 << 2)
93#define DAT_TIMEOUT_STAT (1 << 3)
94#define TX_UNDERRUN_STAT (1 << 4)
95#define RX_OVERRUN_STAT (1 << 5)
96#define CMD_RESP_END_STAT (1 << 6)
97#define CMD_SENT_STAT (1 << 7)
98#define DAT_END_STAT (1 << 8)
99#define START_BIT_ERR_STAT (1 << 9)
100#define DAT_BLK_END_STAT (1 << 10)
101
102
103#define CMD_CRC_FAIL_MASK (1 << 0)
104#define DAT_CRC_FAIL_MASK (1 << 1)
105#define CMD_TIMEOUT_MASK (1 << 2)
106#define DAT_TIMEOUT_MASK (1 << 3)
107#define TX_UNDERRUN_MASK (1 << 4)
108#define RX_OVERRUN_MASK (1 << 5)
109#define CMD_RESP_END_MASK (1 << 6)
110#define CMD_SENT_MASK (1 << 7)
111#define DAT_END_MASK (1 << 8)
112#define START_BIT_ERR_MASK (1 << 9)
113#define DAT_BLK_END_MASK (1 << 10)
114#define CMD_ACT_MASK (1 << 11)
115#define TX_ACT_MASK (1 << 12)
116#define RX_ACT_MASK (1 << 13)
117#define TX_FIFO_STAT_MASK (1 << 14)
118#define RX_FIFO_STAT_MASK (1 << 15)
119#define TX_FIFO_FULL_MASK (1 << 16)
120#define RX_FIFO_FULL_MASK (1 << 17)
121#define TX_FIFO_ZERO_MASK (1 << 18)
122#define RX_DAT_ZERO_MASK (1 << 19)
123#define TX_DAT_RDY_MASK (1 << 20)
124#define RX_FIFO_RDY_MASK (1 << 21)
125
126
127#define FIFO_COUNT 0x7fff
128
129
130#define SDIO_INT_DET (1 << 1)
131#define SD_CARD_DET (1 << 4)
132#define SD_CARD_BUSYMODE (1 << 31)
133#define SD_CARD_SLPMODE (1 << 30)
134#define SD_CARD_READY (1 << 17)
135
136
137#define SDIO_MSK (1 << 1)
138#define SCD_MSK (1 << 4)
139#define CARD_READY_MSK (1 << 16)
140
141
142#define CLKS_EN (1 << 0)
143#define SD4E (1 << 2)
144#define MWE (1 << 3)
145#define SD_RST (1 << 4)
146#define PUP_SDDAT (1 << 5)
147#define PUP_SDDAT3 (1 << 6)
148#ifndef RSI_BLKSZ
149#define PD_SDDAT3 (1 << 7)
150#else
151#define PWR_ON 0x600
152#define SD_CMD_OD (1 << 11)
153#define BOOT_EN (1 << 12)
154#define BOOT_MODE (1 << 13)
155#define BOOT_ACK_EN (1 << 14)
156#endif
157
158
159#define RWR (1 << 0)
160
161#endif
162