1 1.1 jmcneill /* $NetBSD: meson_sdhcreg.h,v 1.1 2019/01/20 00:44:01 jmcneill Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill /*- 4 1.1 jmcneill * Copyright (c) 2015 Jared 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 _MESON_SDHCREG_H 30 1.1 jmcneill #define _MESON_SDHCREG_H 31 1.1 jmcneill 32 1.1 jmcneill #define SD_ARGU_REG 0x00 33 1.1 jmcneill #define SD_SEND_REG 0x04 34 1.1 jmcneill #define SD_CNTL_REG 0x08 35 1.1 jmcneill #define SD_STAT_REG 0x0c 36 1.1 jmcneill #define SD_CLKC_REG 0x10 37 1.1 jmcneill #define SD_ADDR_REG 0x14 38 1.1 jmcneill #define SD_PDMA_REG 0x18 39 1.1 jmcneill #define SD_MISC_REG 0x1c 40 1.1 jmcneill #define SD_DATA_REG 0x20 41 1.1 jmcneill #define SD_ICTL_REG 0x24 42 1.1 jmcneill #define SD_ISTA_REG 0x28 43 1.1 jmcneill #define SD_SRST_REG 0x2c 44 1.1 jmcneill #define SD_ESTA_REG 0x30 45 1.1 jmcneill #define SD_ENHC_REG 0x34 46 1.1 jmcneill #define SD_CLK2_REG 0x38 47 1.1 jmcneill 48 1.1 jmcneill #define SD_SEND_TOTAL_PACK __BITS(31,16) 49 1.1 jmcneill #define SD_SEND_R1B __BIT(12) 50 1.1 jmcneill #define SD_SEND_DATA_STOP __BIT(11) 51 1.1 jmcneill #define SD_SEND_DATA_DIRECTION __BIT(10) 52 1.1 jmcneill #define SD_SEND_RESPONSE_NO_CRC __BIT(9) 53 1.1 jmcneill #define SD_SEND_RESPONSE_LENGTH __BIT(8) 54 1.1 jmcneill #define SD_SEND_COMMAND_HAS_DATA __BIT(7) 55 1.1 jmcneill #define SD_SEND_COMMAND_HAS_RESP __BIT(6) 56 1.1 jmcneill #define SD_SEND_COMMAND_INDEX __BITS(5,0) 57 1.1 jmcneill 58 1.1 jmcneill #define SD_CNTL_TX_ENDIAN_CTRL __BITS(31,29) 59 1.1 jmcneill #define SD_CNTL_DAT0_INT_SEL __BIT(28) 60 1.1 jmcneill #define SD_CNTL_SDIO_IRQ_MODE __BIT(27) 61 1.1 jmcneill #define SD_CNTL_RX_ENDIAN_CTRL __BITS(26,24) 62 1.1 jmcneill #define SD_CNTL_RX_PERIOD __BITS(23,20) 63 1.1 jmcneill #define SD_CNTL_RX_TIMEOUT __BITS(19,13) 64 1.1 jmcneill #define SD_CNTL_PACK_LEN __BITS(12,4) 65 1.1 jmcneill #define SD_CNTL_TX_CRC_CHECK __BIT(3) 66 1.1 jmcneill #define SD_CNTL_DDR_MODE __BIT(2) 67 1.1 jmcneill #define SD_CNTL_DAT_TYPE __BITS(1,0) 68 1.1 jmcneill 69 1.1 jmcneill #define SD_STAT_DAT_HI __BITS(23,20) 70 1.1 jmcneill #define SD_STAT_TXFIFO_COUNT __BITS(19,13) 71 1.1 jmcneill #define SD_STAT_RXFIFO_COUNT __BITS(12,6) 72 1.1 jmcneill #define SD_STAT_CMD __BIT(5) 73 1.1 jmcneill #define SD_STAT_DAT_LO __BITS(4,1) 74 1.1 jmcneill #define SD_STAT_BUSY __BIT(0) 75 1.1 jmcneill 76 1.1 jmcneill #define SD_CLKC_MEM_PWR __BITS(26,25) 77 1.1 jmcneill #define SD_CLKC_MEM_PWR_ON 0 78 1.1 jmcneill #define SD_CLKC_MEM_PWR_OFF 3 79 1.1 jmcneill #define SD_CLKC_CLK_JIC __BIT(24) 80 1.1 jmcneill #define SD_CLKC_CLK_IN_SEL __BITS(17,16) 81 1.1 jmcneill #define SD_CLKC_CLK_IN_SEL_OSC 0 82 1.1 jmcneill #define SD_CLKC_CLK_IN_SEL_FCLK_DIV4 1 83 1.1 jmcneill #define SD_CLKC_CLK_IN_SEL_FCLK_DIV3 2 84 1.1 jmcneill #define SD_CLKC_CLK_IN_SEL_FCLK_DIV5 3 85 1.1 jmcneill #define SD_CLKC_MOD_CLK_ENABLE __BIT(15) 86 1.1 jmcneill #define SD_CLKC_SD_CLK_ENABLE __BIT(14) 87 1.1 jmcneill #define SD_CLKC_RX_CLK_ENABLE __BIT(13) 88 1.1 jmcneill #define SD_CLKC_TX_CLK_ENABLE __BIT(12) 89 1.1 jmcneill #define SD_CLKC_CLK_DIV __BITS(11,0) 90 1.1 jmcneill 91 1.1 jmcneill #define SD_PDMA_TXFIFO_FILL __BIT(31) 92 1.1 jmcneill #define SD_PDMA_RXFIFO_MANUAL_FLUSH __BITS(30,29) 93 1.1 jmcneill #define SD_PDMA_TXFIFO_THRESHOLD __BITS(28,22) 94 1.1 jmcneill #define SD_PDMA_RXFIFO_THRESHOLD __BITS(21,15) 95 1.1 jmcneill #define SD_PDMA_RX_BURST_LEN __BITS(14,10) 96 1.1 jmcneill #define SD_PDMA_TX_BURST_LEN __BITS(9,5) 97 1.1 jmcneill #define SD_PDMA_DMA_URGENT __BIT(4) 98 1.1 jmcneill #define SD_PDMA_PIO_RDRESP __BITS(3,1) 99 1.1 jmcneill #define SD_PDMA_DMA_MODE __BIT(0) 100 1.1 jmcneill 101 1.1 jmcneill #define SD_MISC_TXSTART_THRESHOLD __BITS(31,29) 102 1.1 jmcneill #define SD_MISC_STOP_MODE __BIT(28) 103 1.1 jmcneill #define SD_MISC_THREAD_ID __BITS(27,22) 104 1.1 jmcneill #define SD_MISC_BURST_NUMBER __BITS(21,16) 105 1.1 jmcneill #define SD_MISC_WCRC_OK_PATTERN __BITS(9,7) 106 1.1 jmcneill #define SD_MISC_WCRC_ERR_PATTERN __BITS(6,4) 107 1.1 jmcneill 108 1.1 jmcneill #define SD_ICTL_SDIO_DAT1 __BITS(17,16) 109 1.1 jmcneill 110 1.1 jmcneill #define SD_INT_ADDL_SDIO_DAT1 __BIT(14) 111 1.1 jmcneill #define SD_INT_TXFIFO __BIT(13) 112 1.1 jmcneill #define SD_INT_RXFIFO __BIT(12) 113 1.1 jmcneill #define SD_INT_DMA_DONE __BIT(11) 114 1.1 jmcneill #define SD_INT_SDIO_DAT1 __BIT(10) 115 1.1 jmcneill #define SD_INT_TXFIFO_THRES __BIT(9) 116 1.1 jmcneill #define SD_INT_RXFIFO_THRES __BIT(8) 117 1.1 jmcneill #define SD_INT_DATA_COMPLETE __BIT(7) 118 1.1 jmcneill #define SD_INT_PACK_CRC_ERROR __BIT(6) 119 1.1 jmcneill #define SD_INT_PACK_TIMEOUT __BIT(5) 120 1.1 jmcneill #define SD_INT_PACK_COMPLETE __BIT(4) 121 1.1 jmcneill #define SD_INT_DATA_BIT0_CHG __BIT(3) 122 1.1 jmcneill #define SD_INT_RESP_CRC_ERROR __BIT(2) 123 1.1 jmcneill #define SD_INT_RESP_TIMEOUT __BIT(1) 124 1.1 jmcneill #define SD_INT_RESP_COMPLETE __BIT(0) 125 1.1 jmcneill 126 1.1 jmcneill #define SD_INT_TIMEOUT (SD_INT_PACK_TIMEOUT | SD_INT_RESP_TIMEOUT) 127 1.1 jmcneill #define SD_INT_CRC_ERROR (SD_INT_PACK_CRC_ERROR | SD_INT_RESP_CRC_ERROR) 128 1.1 jmcneill #define SD_INT_ERROR (SD_INT_TIMEOUT | SD_INT_CRC_ERROR) 129 1.1 jmcneill #define SD_INT_CLEAR 0x7fff 130 1.1 jmcneill 131 1.1 jmcneill #define SD_SRST_DMA_IF __BIT(5) 132 1.1 jmcneill #define SD_SRST_DPHY_TX __BIT(4) 133 1.1 jmcneill #define SD_SRST_DPHY_RX __BIT(3) 134 1.1 jmcneill #define SD_SRST_TX_FIFO __BIT(2) 135 1.1 jmcneill #define SD_SRST_RX_FIFO __BIT(1) 136 1.1 jmcneill #define SD_SRST_MAIN_CTRL __BIT(0) 137 1.1 jmcneill 138 1.1 jmcneill #define SD_ENHC_RX_TIMEOUT __BITS(7,0) 139 1.1 jmcneill #define SD_ENHC_SDIO_IRQ_PERIOD __BITS(15,8) 140 1.1 jmcneill #define SD_ENHC_DMA_RX_RESP __BIT(16) 141 1.1 jmcneill #define SD_ENHC_DMA_TX_RESP __BIT(17) 142 1.1 jmcneill #define SD_ENHC_RXFIFO_THRESHOLD __BITS(24,18) 143 1.1 jmcneill #define SD_ENHC_TXFIFO_THRESHOLD __BITS(31,25) 144 1.1 jmcneill 145 1.1 jmcneill #define SD_ESTA_BUSY __BITS(13,11) /* XXX ??? */ 146 1.1 jmcneill 147 1.1 jmcneill #define SD_CLK2_RX_CLK_PHASE __BITS(11,0) 148 1.1 jmcneill #define SD_CLK2_SD_CLK_PHASE __BITS(23,12) 149 1.1 jmcneill 150 1.1 jmcneill #endif /* _MESON_SDHCREG_H */ 151