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