dwc_mmc_reg.h revision 1.1 1 1.1 jmcneill /* $NetBSD: dwc_mmc_reg.h,v 1.1 2014/12/27 01:18:48 jmcneill Exp $ */
2 1.1 jmcneill
3 1.1 jmcneill /*-
4 1.1 jmcneill * Copyright (c) 2014 Jared D. McNeill <jmcneill (at) invisible.ca>
5 1.1 jmcneill * All rights reserved.
6 1.1 jmcneill *
7 1.1 jmcneill * Redistribution and use in source and binary forms, with or without
8 1.1 jmcneill * modification, are permitted provided that the following conditions
9 1.1 jmcneill * are met:
10 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright
11 1.1 jmcneill * notice, this list of conditions and the following disclaimer.
12 1.1 jmcneill * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 jmcneill * notice, this list of conditions and the following disclaimer in the
14 1.1 jmcneill * documentation and/or other materials provided with the distribution.
15 1.1 jmcneill *
16 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 jmcneill * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 jmcneill * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 jmcneill * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 jmcneill * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 1.1 jmcneill * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 1.1 jmcneill * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 1.1 jmcneill * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 1.1 jmcneill * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 jmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 jmcneill * SUCH DAMAGE.
27 1.1 jmcneill */
28 1.1 jmcneill
29 1.1 jmcneill #ifndef _DWC_MMC_REG_H
30 1.1 jmcneill #define _DWC_MMC_REG_H
31 1.1 jmcneill
32 1.1 jmcneill #define DWC_MMC_CTRL_REG 0x0000
33 1.1 jmcneill #define DWC_MMC_PWREN_REG 0x0004
34 1.1 jmcneill #define DWC_MMC_CLKDIV_REG 0x0008
35 1.1 jmcneill #define DWC_MMC_CLKENA_REG 0x0010
36 1.1 jmcneill #define DWC_MMC_TMOUT_REG 0x0014
37 1.1 jmcneill #define DWC_MMC_CTYPE_REG 0x0018
38 1.1 jmcneill #define DWC_MMC_BLKSIZ_REG 0x001c
39 1.1 jmcneill #define DWC_MMC_BYTCNT_REG 0x0020
40 1.1 jmcneill #define DWC_MMC_INTMASK_REG 0x0024
41 1.1 jmcneill #define DWC_MMC_CMDARG_REG 0x0028
42 1.1 jmcneill #define DWC_MMC_CMD_REG 0x002c
43 1.1 jmcneill #define DWC_MMC_RESP0_REG 0x0030
44 1.1 jmcneill #define DWC_MMC_RESP1_REG 0x0034
45 1.1 jmcneill #define DWC_MMC_RESP2_REG 0x0038
46 1.1 jmcneill #define DWC_MMC_RESP3_REG 0x003c
47 1.1 jmcneill #define DWC_MMC_MINTSTS_REG 0x0040
48 1.1 jmcneill #define DWC_MMC_RINTSTS_REG 0x0044
49 1.1 jmcneill #define DWC_MMC_STATUS_REG 0x0048
50 1.1 jmcneill #define DWC_MMC_FIFOTH_REG 0x004c
51 1.1 jmcneill #define DWC_MMC_CDETECT_REG 0x0050
52 1.1 jmcneill #define DWC_MMC_WRTPRT_REG 0x0054
53 1.1 jmcneill #define DWC_MMC_TCBCNT_REG 0x005c
54 1.1 jmcneill #define DWC_MMC_TBBCNT_REG 0x0060
55 1.1 jmcneill #define DWC_MMC_DEBNCE_REG 0x0064
56 1.1 jmcneill #define DWC_MMC_USRID_REG 0x0068
57 1.1 jmcneill #define DWC_MMC_VERID_REG 0x006c
58 1.1 jmcneill #define DWC_MMC_UHS_REG 0x0074
59 1.1 jmcneill #define DWC_MMC_RST_REG 0x0078
60 1.1 jmcneill #define DWC_MMC_CARDTHRCTL_REG 0x0100
61 1.1 jmcneill #define DWC_MMC_BACK_END_POWER_REG 0x0104
62 1.1 jmcneill #define DWC_MMC_FIFO_BASE_REG 0x0200
63 1.1 jmcneill
64 1.1 jmcneill #define DWC_MMC_CTRL_ABORT_READ_DATA __BIT(8)
65 1.1 jmcneill #define DWC_MMC_CTRL_SEND_IRQ_RESPONSE __BIT(7)
66 1.1 jmcneill #define DWC_MMC_CTRL_READ_WAIT __BIT(6)
67 1.1 jmcneill #define DWC_MMC_CTRL_DMA_ENABLE __BIT(5)
68 1.1 jmcneill #define DWC_MMC_CTRL_INT_ENABLE __BIT(4)
69 1.1 jmcneill #define DWC_MMC_CTRL_DMA_RESET __BIT(2)
70 1.1 jmcneill #define DWC_MMC_CTRL_FIFO_RESET __BIT(1)
71 1.1 jmcneill #define DWC_MMC_CTRL_CONTROLLER_RESET __BIT(0)
72 1.1 jmcneill
73 1.1 jmcneill #define DWC_MMC_PWREN_POWER_ENABLE __BIT(0)
74 1.1 jmcneill
75 1.1 jmcneill #define DWC_MMC_CLKDIV_CLK_DIVIDER0 __BITS(7,0)
76 1.1 jmcneill
77 1.1 jmcneill #define DWC_MMC_CLKENA_CCLK_LOW_POWER __BIT(16)
78 1.1 jmcneill #define DWC_MMC_CLKENA_CCLK_ENABLE __BIT(0)
79 1.1 jmcneill
80 1.1 jmcneill #define DWC_MMC_TMOUT_DATA_TIMEOUT __BITS(31,8)
81 1.1 jmcneill #define DWC_MMC_TMOUT_RESPONSE_TIMEOUT __BITS(7,0)
82 1.1 jmcneill
83 1.1 jmcneill #define DWC_MMC_CTYPE_CARD_WIDTH_8 __BIT(16)
84 1.1 jmcneill #define DWC_MMC_CTYPE_CARD_WIDTH_4 __BIT(0)
85 1.1 jmcneill #define DWC_MMC_CTYPE_CARD_WIDTH_1 0
86 1.1 jmcneill
87 1.1 jmcneill #define DWC_MMC_INT_SDIO_INT __BIT(24)
88 1.1 jmcneill #define DWC_MMC_INT_NEW_INT __BIT(16)
89 1.1 jmcneill #define DWC_MMC_INT_MASK __BITS(15,0)
90 1.1 jmcneill #define DWC_MMC_INT_EBE __BIT(15)
91 1.1 jmcneill #define DWC_MMC_INT_ACD __BIT(14)
92 1.1 jmcneill #define DWC_MMC_INT_SBE __BIT(13)
93 1.1 jmcneill #define DWC_MMC_INT_HLE __BIT(12)
94 1.1 jmcneill #define DWC_MMC_INT_FRUN __BIT(11)
95 1.1 jmcneill #define DWC_MMC_INT_HTO __BIT(10)
96 1.1 jmcneill #define DWC_MMC_INT_DRTO __BIT(9)
97 1.1 jmcneill #define DWC_MMC_INT_RTO __BIT(8)
98 1.1 jmcneill #define DWC_MMC_INT_DCRC __BIT(7)
99 1.1 jmcneill #define DWC_MMC_INT_RCRC __BIT(6)
100 1.1 jmcneill #define DWC_MMC_INT_RXDR __BIT(5)
101 1.1 jmcneill #define DWC_MMC_INT_TXDR __BIT(4)
102 1.1 jmcneill #define DWC_MMC_INT_DTO __BIT(3)
103 1.1 jmcneill #define DWC_MMC_INT_CD __BIT(2)
104 1.1 jmcneill #define DWC_MMC_INT_RE __BIT(1)
105 1.1 jmcneill #define DWC_MMC_INT_CARDDET __BIT(0)
106 1.1 jmcneill #define DWC_MMC_INT_ERROR \
107 1.1 jmcneill (DWC_MMC_INT_RE | DWC_MMC_INT_RCRC | DWC_MMC_INT_DCRC | \
108 1.1 jmcneill DWC_MMC_INT_RTO | DWC_MMC_INT_DRTO | DWC_MMC_INT_HTO | \
109 1.1 jmcneill DWC_MMC_INT_HLE | DWC_MMC_INT_SBE | DWC_MMC_INT_EBE)
110 1.1 jmcneill
111 1.1 jmcneill #define DWC_MMC_CMD_START_CMD __BIT(31)
112 1.1 jmcneill #define DWC_MMC_CMD_USE_HOLD_REG __BIT(29)
113 1.1 jmcneill #define DWC_MMC_CMD_VOLT_SWITCH __BIT(28)
114 1.1 jmcneill #define DWC_MMC_CMD_BOOT_MODE __BIT(27)
115 1.1 jmcneill #define DWC_MMC_CMD_DISABLE_BOOT __BIT(26)
116 1.1 jmcneill #define DWC_MMC_CMD_EXPECT_BOOT_ACK __BIT(25)
117 1.1 jmcneill #define DWC_MMC_CMD_ENABLE_BOOT __BIT(24)
118 1.1 jmcneill #define DWC_MMC_CMD_UPDATE_CLOCK_REGS_ONLY __BIT(21)
119 1.1 jmcneill #define DWC_MMC_CMD_SEND_INIT __BIT(15)
120 1.1 jmcneill #define DWC_MMC_CMD_STOP_ABORT_CMD __BIT(14)
121 1.1 jmcneill #define DWC_MMC_CMD_WAIT_PRVDATA_COMPLETE __BIT(13)
122 1.1 jmcneill #define DWC_MMC_CMD_SEND_AUTO_STOP __BIT(12)
123 1.1 jmcneill #define DWC_MMC_CMD_TRANSFER_MODE __BIT(11)
124 1.1 jmcneill #define DWC_MMC_CMD_WR __BIT(10)
125 1.1 jmcneill #define DWC_MMC_CMD_DATA_EXPECTED __BIT(9)
126 1.1 jmcneill #define DWC_MMC_CMD_CHECK_RESP_CRC __BIT(8)
127 1.1 jmcneill #define DWC_MMC_CMD_RESP_LEN __BIT(7)
128 1.1 jmcneill #define DWC_MMC_CMD_RESP_EXPECTED __BIT(6)
129 1.1 jmcneill #define DWC_MMC_CMD_INDEX __BITS(5,0)
130 1.1 jmcneill
131 1.1 jmcneill #define DWC_MMC_STATUS_DMA_REQ __BIT(31)
132 1.1 jmcneill #define DWC_MMC_STATUS_DMA_ACK __BIT(30)
133 1.1 jmcneill #define DWC_MMC_STATUS_FIFO_COUNT __BITS(29,17)
134 1.1 jmcneill #define DWC_MMC_STATUS_RESP_INDEX __BITS(16,11)
135 1.1 jmcneill #define DWC_MMC_STATUS_DATA_STATE_MC_BUSY __BIT(10)
136 1.1 jmcneill #define DWC_MMC_STATUS_DATA_BUSY __BIT(9)
137 1.1 jmcneill #define DWC_MMC_STATUS_DATA_3_STATUS __BIT(8)
138 1.1 jmcneill #define DWC_MMC_STATUS_COMMAND_FSM_STATES __BITS(7,4)
139 1.1 jmcneill #define DWC_MMC_STATUS_FIFO_FULL __BIT(3)
140 1.1 jmcneill #define DWC_MMC_STATUS_FIFO_EMPTY __BIT(2)
141 1.1 jmcneill #define DWC_MMC_STATUS_FIFO_TX_WATERMARK __BIT(1)
142 1.1 jmcneill #define DWC_MMC_STATUS_FIFO_RX_WATERMARK __BIT(0)
143 1.1 jmcneill
144 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE __BITS(30,28)
145 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_1 0
146 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_4 1
147 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_8 2
148 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_16 3
149 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_32 4
150 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_64 5
151 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_128 6
152 1.1 jmcneill #define DWC_MMC_FIFOTH_DMA_MULTIPLE_TXN_SIZE_256 7
153 1.1 jmcneill #define DWC_MMC_FIFOTH_RX_WMARK __BITS(27,16)
154 1.1 jmcneill #define DWC_MMC_FIFOTH_TX_WMARK __BITS(11,0)
155 1.1 jmcneill
156 1.1 jmcneill #define DWC_MMC_CDETECT_CARD_DETECT_N __BIT(0)
157 1.1 jmcneill
158 1.1 jmcneill #define DWC_MMC_WRTPRT_WRITE_PROTECT __BIT(0)
159 1.1 jmcneill
160 1.1 jmcneill #define DWC_MMC_DEBNCE_DEBOUNCE_COUNT __BITS(23,0)
161 1.1 jmcneill
162 1.1 jmcneill #define DWC_MMC_UHS_DDR __BIT(16)
163 1.1 jmcneill #define DWC_MMC_UHS_VOLT __BIT(0)
164 1.1 jmcneill
165 1.1 jmcneill #define DWC_MMC_RST_CARD_RESET __BIT(0)
166 1.1 jmcneill
167 1.1 jmcneill #define DWC_MMC_CARDTHRCTL_CARDRDTHRESHOLD __BITS(27,16)
168 1.1 jmcneill #define DWC_MMC_CARDTHRCTL_CARDRDTHREN __BIT(0)
169 1.1 jmcneill
170 1.1 jmcneill #define DWC_MMC_BACK_END_POWER_ENABLE __BIT(0)
171 1.1 jmcneill
172 1.1 jmcneill #endif /* !_DWC_MMC_REG_H */
173