xref: /freebsd/sys/dev/rtsx/rtsxreg.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1926ce35aSJung-uk Kim /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3926ce35aSJung-uk Kim  *
4926ce35aSJung-uk Kim  * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
5926ce35aSJung-uk Kim  * Copyright (c) 2012 Stefan Sperling <stsp@openbsd.org>
6926ce35aSJung-uk Kim  * Copyright (c) 2020 Henri Hennebert <hlh@restart.be>
7926ce35aSJung-uk Kim  * All rights reserved.
8926ce35aSJung-uk Kim  *
9926ce35aSJung-uk Kim  * Permission to use, copy, modify, and distribute this software for any
10926ce35aSJung-uk Kim  * purpose with or without fee is hereby granted, provided that the above
11926ce35aSJung-uk Kim  * copyright notice and this permission notice appear in all copies.
12926ce35aSJung-uk Kim  *
13926ce35aSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14926ce35aSJung-uk Kim  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15926ce35aSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16926ce35aSJung-uk Kim  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17926ce35aSJung-uk Kim  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18926ce35aSJung-uk Kim  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19926ce35aSJung-uk Kim  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20926ce35aSJung-uk Kim  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21926ce35aSJung-uk Kim  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22926ce35aSJung-uk Kim  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23926ce35aSJung-uk Kim  * SUCH DAMAGE.
24926ce35aSJung-uk Kim  */
25926ce35aSJung-uk Kim 
26926ce35aSJung-uk Kim #ifndef	_RTSXREG_H_
27926ce35aSJung-uk Kim #define	_RTSXREG_H_
28926ce35aSJung-uk Kim 
29926ce35aSJung-uk Kim /* Host command buffer control register. */
30926ce35aSJung-uk Kim #define	RTSX_HCBAR		0x00
31926ce35aSJung-uk Kim #define	RTSX_HCBCTLR		0x04
32926ce35aSJung-uk Kim #define	RTSX_START_CMD		(1U << 31)
33926ce35aSJung-uk Kim #define	RTSX_HW_AUTO_RSP	(1U << 30)
34926ce35aSJung-uk Kim #define	RTSX_STOP_CMD		(1U << 28)
35926ce35aSJung-uk Kim 
36926ce35aSJung-uk Kim /* Host data buffer control register. */
37926ce35aSJung-uk Kim #define	RTSX_HDBAR		0x08
38926ce35aSJung-uk Kim #define	RTSX_HDBCTLR		0x0C
39926ce35aSJung-uk Kim #define	RTSX_TRIG_DMA		(1U << 31)
40926ce35aSJung-uk Kim #define	RTSX_DMA_READ		(1U << 29)
41926ce35aSJung-uk Kim #define	RTSX_STOP_DMA		(1U << 28)
42926ce35aSJung-uk Kim #define	RTSX_ADMA_MODE		(2U << 26)
43926ce35aSJung-uk Kim 
44926ce35aSJung-uk Kim /* Interrupt pending register. */
45926ce35aSJung-uk Kim #define	RTSX_BIPR		0x14
46926ce35aSJung-uk Kim #define	RTSX_CMD_DONE_INT	(1U << 31)
47926ce35aSJung-uk Kim #define	RTSX_DATA_DONE_INT	(1U << 30)
48926ce35aSJung-uk Kim #define	RTSX_TRANS_OK_INT	(1U << 29)
49926ce35aSJung-uk Kim #define	RTSX_TRANS_FAIL_INT	(1U << 28)
50926ce35aSJung-uk Kim #define	RTSX_XD_INT		(1U << 27)
51926ce35aSJung-uk Kim #define	RTSX_MS_INT		(1U << 26)
52926ce35aSJung-uk Kim #define	RTSX_SD_INT		(1U << 25)
53926ce35aSJung-uk Kim #define	RTSX_DELINK_INT		(1U << 24)
54926ce35aSJung-uk Kim #define	RTSX_SD_WRITE_PROTECT	(1U << 19)
55926ce35aSJung-uk Kim #define	RTSX_XD_EXIST		(1U << 18)
56926ce35aSJung-uk Kim #define	RTSX_MS_EXIST		(1U << 17)
57926ce35aSJung-uk Kim #define	RTSX_SD_EXIST		(1U << 16)
58926ce35aSJung-uk Kim #define	RTSX_CARD_EXIST		(RTSX_XD_EXIST|RTSX_MS_EXIST|RTSX_SD_EXIST)
59926ce35aSJung-uk Kim #define	RTSX_CARD_INT		(RTSX_XD_INT|RTSX_MS_INT|RTSX_SD_INT)
60926ce35aSJung-uk Kim 
61926ce35aSJung-uk Kim /* Chip register access. */
62926ce35aSJung-uk Kim #define	RTSX_HAIMR		0x10
63926ce35aSJung-uk Kim #define	RTSX_HAIMR_WRITE	0x40000000
64926ce35aSJung-uk Kim #define	RTSX_HAIMR_BUSY		0x80000000
65926ce35aSJung-uk Kim 
66926ce35aSJung-uk Kim /* Interrupt enable register. */
67926ce35aSJung-uk Kim #define	RTSX_BIER		0x18
68926ce35aSJung-uk Kim #define	RTSX_CMD_DONE_INT_EN	(1U << 31)
69926ce35aSJung-uk Kim #define	RTSX_DATA_DONE_INT_EN	(1U << 30)
70926ce35aSJung-uk Kim #define	RTSX_TRANS_OK_INT_EN	(1U << 29)
71926ce35aSJung-uk Kim #define	RTSX_TRANS_FAIL_INT_EN	(1U << 28)
72926ce35aSJung-uk Kim #define	RTSX_XD_INT_EN		(1U << 27)
73926ce35aSJung-uk Kim #define	RTSX_MS_INT_EN		(1U << 26)
74926ce35aSJung-uk Kim #define	RTSX_SD_INT_EN		(1U << 25)
75926ce35aSJung-uk Kim #define	RTSX_GPIO0_INT_EN	(1U << 24)
76926ce35aSJung-uk Kim #define	RTSX_MS_OC_INT_EN	(1U << 23)
77926ce35aSJung-uk Kim #define	RTSX_SD_OC_INT_EN	(1U << 22)
78926ce35aSJung-uk Kim 
79926ce35aSJung-uk Kim /* Power on/off. */
80926ce35aSJung-uk Kim #define	RTSX_FPDCTL			0xFC00
81926ce35aSJung-uk Kim #define	RTSX_SSC_POWER_DOWN		0x01
82926ce35aSJung-uk Kim #define	RTSX_SD_OC_POWER_DOWN		0x02
83926ce35aSJung-uk Kim #define	RTSX_MS_OC_POWER_DOWN		0x04
84926ce35aSJung-uk Kim #define	RTSX_ALL_POWER_DOWN		0x07
85926ce35aSJung-uk Kim #define	RTSX_OC_POWER_DOWN		0x06
86926ce35aSJung-uk Kim 
87926ce35aSJung-uk Kim /* Card power control register. */
88926ce35aSJung-uk Kim #define	RTSX_CARD_PWR_CTL		0xFD50
89926ce35aSJung-uk Kim #define	RTSX_SD_PWR_ON			0x00
90926ce35aSJung-uk Kim #define	RTSX_SD_PARTIAL_PWR_ON		0x01
91926ce35aSJung-uk Kim #define	RTSX_SD_PWR_OFF			0x03
92926ce35aSJung-uk Kim #define	RTSX_SD_PWR_MASK		0x03
93926ce35aSJung-uk Kim 
94926ce35aSJung-uk Kim #define	RTSX_PMOS_STRG_MASK		0x10
95926ce35aSJung-uk Kim #define	RTSX_PMOS_STRG_400mA		0x00
96926ce35aSJung-uk Kim #define	RTSX_PMOS_STRG_800mA		0x10
97926ce35aSJung-uk Kim 
98926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_MASK		0x0F
99926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_OFF		0x0F
100926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_5_PERCENT_ON	0x0E
101926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_10_PERCENT_ON	0x0C
102926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_15_PERCENT_ON	0x08
103926ce35aSJung-uk Kim #define	RTSX_BPP_POWER_ON		0x00
104926ce35aSJung-uk Kim 
105926ce35aSJung-uk Kim #define	RTSX_MS_PWR_OFF			0x0C
106926ce35aSJung-uk Kim #define	RTSX_MS_PWR_ON			0x00
107926ce35aSJung-uk Kim #define	RTSX_MS_PARTIAL_PWR_ON		0x04
108926ce35aSJung-uk Kim 
109926ce35aSJung-uk Kim #define	RTSX_RTL8411B_PACKAGE		0xFD51
110926ce35aSJung-uk Kim #define	RTSX_RTL8411B_QFN48		0x02
111926ce35aSJung-uk Kim 
112926ce35aSJung-uk Kim #define	RTSX_CARD_SHARE_MODE		0xFD52
113926ce35aSJung-uk Kim #define	RTSX_CARD_SHARE_MASK		0x0F
114926ce35aSJung-uk Kim #define	RTSX_CARD_SHARE_48_XD		0x02
115926ce35aSJung-uk Kim #define	RTSX_CARD_SHARE_48_SD		0x04
116926ce35aSJung-uk Kim #define	RTSX_CARD_SHARE_48_MS		0x08
117926ce35aSJung-uk Kim 
118926ce35aSJung-uk Kim #define	RTSX_CARD_DRIVE_SEL		0xFD53
119926ce35aSJung-uk Kim #define	RTSX_MS_DRIVE_8mA		(0x01 << 6)
120926ce35aSJung-uk Kim #define	RTSX_MMC_DRIVE_8mA		(0x01 << 4)
121926ce35aSJung-uk Kim #define	RTSX_XD_DRIVE_8mA		(0x01 << 2)
122926ce35aSJung-uk Kim #define	RTSX_GPIO_DRIVE_8mA		0x01
123926ce35aSJung-uk Kim #define	RTSX_CARD_DRIVE_DEFAULT		(RTSX_MS_DRIVE_8mA | RTSX_GPIO_DRIVE_8mA)
124926ce35aSJung-uk Kim #define	RTSX_RTS5209_CARD_DRIVE_DEFAULT (RTSX_MS_DRIVE_8mA | RTSX_MMC_DRIVE_8mA | \
125926ce35aSJung-uk Kim 					 RTSX_XD_DRIVE_8mA | RTSX_GPIO_DRIVE_8mA)
126926ce35aSJung-uk Kim #define	RTSX_RTL8411_CARD_DRIVE_DEFAULT (RTSX_MS_DRIVE_8mA | RTSX_MMC_DRIVE_8mA | \
127926ce35aSJung-uk Kim 					 RTSX_XD_DRIVE_8mA)
128926ce35aSJung-uk Kim 
129926ce35aSJung-uk Kim #define	RTSX_CARD_STOP			0xFD54
130926ce35aSJung-uk Kim #define	RTSX_SPI_STOP			0x01
131926ce35aSJung-uk Kim #define	RTSX_XD_STOP			0x02
132926ce35aSJung-uk Kim #define	RTSX_SD_STOP			0x04
133926ce35aSJung-uk Kim #define	RTSX_MS_STOP			0x08
134926ce35aSJung-uk Kim #define	RTSX_SPI_CLR_ERR		0x10
135926ce35aSJung-uk Kim #define	RTSX_XD_CLR_ERR			0x20
136926ce35aSJung-uk Kim #define	RTSX_SD_CLR_ERR			0x40
137926ce35aSJung-uk Kim #define	RTSX_MS_CLR_ERR			0x80
138926ce35aSJung-uk Kim #define	RTSX_ALL_STOP			0x0F
139926ce35aSJung-uk Kim #define	RTSX_ALL_CLR_ERR		0xF0
140926ce35aSJung-uk Kim 
141926ce35aSJung-uk Kim #define	RTSX_CARD_OE			0xFD55
142926ce35aSJung-uk Kim #define	RTSX_XD_OUTPUT_EN		0x02
143926ce35aSJung-uk Kim #define	RTSX_SD_OUTPUT_EN		0x04
144926ce35aSJung-uk Kim #define	RTSX_MS_OUTPUT_EN		0x08
145926ce35aSJung-uk Kim #define	RTSX_SPI_OUTPUT_EN		0x10
146926ce35aSJung-uk Kim #define	RTSX_CARD_OUTPUT_EN		(RTSX_XD_OUTPUT_EN|RTSX_SD_OUTPUT_EN|\
147926ce35aSJung-uk Kim 					 RTSX_MS_OUTPUT_EN)
148926ce35aSJung-uk Kim 
149926ce35aSJung-uk Kim #define	RTSX_CARD_GPIO_DIR		0xFD57
150926ce35aSJung-uk Kim #define	RTSX_CARD_GPIO			0xFD58
151926ce35aSJung-uk Kim #define	RTSX_CARD_GPIO_LED_OFF		0x01
152926ce35aSJung-uk Kim 
153926ce35aSJung-uk Kim #define	RTSX_SD30_CLK_DRIVE_SEL		0xFD5A
154926ce35aSJung-uk Kim #define	RTSX_DRIVER_TYPE_A		0x05
155926ce35aSJung-uk Kim #define	RTSX_DRIVER_TYPE_B		0x03
156926ce35aSJung-uk Kim #define	RTSX_DRIVER_TYPE_C		0x02
157926ce35aSJung-uk Kim #define	RTSX_DRIVER_TYPE_D		0x01
158926ce35aSJung-uk Kim 
159926ce35aSJung-uk Kim #define	RTSX_CARD_DATA_SOURCE		0xFD5B
160926ce35aSJung-uk Kim #define	RTSX_RING_BUFFER		0x00
161926ce35aSJung-uk Kim #define	RTSX_PINGPONG_BUFFER		0x01
162926ce35aSJung-uk Kim 
163926ce35aSJung-uk Kim #define	RTSX_CARD_SELECT		0xFD5C
164926ce35aSJung-uk Kim #define	RTSX_XD_MOD_SEL			0x01
165926ce35aSJung-uk Kim #define	RTSX_SD_MOD_SEL			0x02
166926ce35aSJung-uk Kim #define	RTSX_MS_MOD_SEL			0x03
167926ce35aSJung-uk Kim #define	RTSX_SPI_MOD_SEL		0x04
168926ce35aSJung-uk Kim 
169926ce35aSJung-uk Kim #define	RTSX_SD30_CMD_DRIVE_SEL		0xFD5E /* was 0xFE5E in OpenBSD */
170926ce35aSJung-uk Kim #define	RTSX_CFG_DRIVER_TYPE_A		0x02
171926ce35aSJung-uk Kim #define	RTSX_CFG_DRIVER_TYPE_B		0x03
172926ce35aSJung-uk Kim #define	RTSX_CFG_DRIVER_TYPE_C		0x01
173926ce35aSJung-uk Kim #define	RTSX_CFG_DRIVER_TYPE_D		0x00
174926ce35aSJung-uk Kim #define	RTSX_SD30_DRIVE_SEL_MASK	0x07
175926ce35aSJung-uk Kim 
176926ce35aSJung-uk Kim #define	RTSX_SD30_DAT_DRIVE_SEL		0xFD5F
177926ce35aSJung-uk Kim 
178926ce35aSJung-uk Kim /* Card clock. */
179926ce35aSJung-uk Kim #define	RTSX_CARD_CLK_EN		0xFD69
180926ce35aSJung-uk Kim #define	RTSX_XD_CLK_EN			0x02
181926ce35aSJung-uk Kim #define	RTSX_SD_CLK_EN			0x04
182926ce35aSJung-uk Kim #define	RTSX_MS_CLK_EN			0x08
183926ce35aSJung-uk Kim #define	RTSX_SPI_CLK_EN			0x10
184926ce35aSJung-uk Kim #define	RTSX_CARD_CLK_EN_ALL	(RTSX_XD_CLK_EN|RTSX_SD_CLK_EN|\
185926ce35aSJung-uk Kim 				 RTSX_MS_CLK_EN|RTSX_SPI_CLK_EN)
186926ce35aSJung-uk Kim 
187926ce35aSJung-uk Kim #define	RTSX_SDIO_CTRL			0xFD6B
188926ce35aSJung-uk Kim #define	RTSX_SDIO_BUS_CTRL		0x01
189926ce35aSJung-uk Kim #define	RTSX_SDIO_CD_CTRL		0x02
190926ce35aSJung-uk Kim 
191926ce35aSJung-uk Kim #define	RTSX_CARD_PAD_CTL		0xFD73
192926ce35aSJung-uk Kim #define	RTSX_CD_DISABLE_MASK		0x07
193926ce35aSJung-uk Kim #define	RTSX_CD_AUTO_DISABLE		0x40
194926ce35aSJung-uk Kim #define	RTSX_CD_ENABLE			0x00
195926ce35aSJung-uk Kim 
196926ce35aSJung-uk Kim /* Internal clock. */
197926ce35aSJung-uk Kim #define	RTSX_CLK_CTL			0xFC02
198926ce35aSJung-uk Kim #define	RTSX_CHANGE_CLK			0x01
199926ce35aSJung-uk Kim #define	RTSX_CLK_LOW_FREQ		0x01
200926ce35aSJung-uk Kim 
201926ce35aSJung-uk Kim /* Internal clock divisor values. */
202926ce35aSJung-uk Kim #define	RTSX_CLK_DIV			0xFC03
203926ce35aSJung-uk Kim #define	RTSX_CLK_DIV_1			0x01
204926ce35aSJung-uk Kim #define	RTSX_CLK_DIV_2			0x02
205926ce35aSJung-uk Kim #define	RTSX_CLK_DIV_4			0x03
206926ce35aSJung-uk Kim #define	RTSX_CLK_DIV_8			0x04
207926ce35aSJung-uk Kim 
208926ce35aSJung-uk Kim /* Internal clock selection. */
209926ce35aSJung-uk Kim #define	RTSX_CLK_SEL			0xFC04
210926ce35aSJung-uk Kim #define	RTSX_SSC_80			0
211926ce35aSJung-uk Kim #define	RTSX_SSC_100			1
212926ce35aSJung-uk Kim #define	RTSX_SSC_120			2
213926ce35aSJung-uk Kim #define	RTSX_SSC_150			3
214926ce35aSJung-uk Kim #define	RTSX_SSC_200			4
215926ce35aSJung-uk Kim 
216926ce35aSJung-uk Kim #define	RTSX_SSC_DIV_N_0		0xFC0F
217926ce35aSJung-uk Kim 
218926ce35aSJung-uk Kim #define	RTSX_SSC_CTL1			0xFC11
219926ce35aSJung-uk Kim #define	RTSX_RSTB			0x80
220926ce35aSJung-uk Kim #define	RTSX_SSC_8X_EN			0x40
221926ce35aSJung-uk Kim #define	RTSX_SSC_FIX_FRAC		0x20
222926ce35aSJung-uk Kim #define	RTSX_SSC_SEL_1M			0x00
223926ce35aSJung-uk Kim #define	RTSX_SSC_SEL_2M			0x08
224926ce35aSJung-uk Kim #define	RTSX_SSC_SEL_2M			0x08
225926ce35aSJung-uk Kim #define	RTSX_SSC_SEL_4M			0x10
226926ce35aSJung-uk Kim #define	RTSX_SSC_SEL_8M			0x18
227926ce35aSJung-uk Kim 
228926ce35aSJung-uk Kim #define	RTSX_SSC_CTL2			0xFC12
229926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_MASK		0x07
230926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_4M		0x01
231926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_2M		0x02
232926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_1M		0x03
233926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_500K		0x04
234926ce35aSJung-uk Kim #define	RTSX_SSC_DEPTH_250K		0x05
235926ce35aSJung-uk Kim 
236926ce35aSJung-uk Kim /* RC oscillator, default is 2M */
237926ce35aSJung-uk Kim #define	RTSX_RCCTL			0xFC14
238926ce35aSJung-uk Kim #define	RTSX_RCCTL_F_400K		0x00
239926ce35aSJung-uk Kim #define	RTSX_RCCTL_F_2M			0x01
240926ce35aSJung-uk Kim 
241926ce35aSJung-uk Kim /* RTS5229-only. */
242926ce35aSJung-uk Kim #define	RTSX_OLT_LED_CTL		0xFC1E
243926ce35aSJung-uk Kim #define	RTSX_OLT_LED_PERIOD		0x02
244926ce35aSJung-uk Kim #define	RTSX_OLT_LED_AUTOBLINK		0x08
245926ce35aSJung-uk Kim 
246926ce35aSJung-uk Kim #define	RTSX_LDO_CTL			0xFC1E
247926ce35aSJung-uk Kim #define	RTSX_BPP_ASIC_3V3		0x07
248926ce35aSJung-uk Kim #define	RTSX_BPP_ASIC_MASK		0x07
249926ce35aSJung-uk Kim #define	RTSX_BPP_PAD_3V3		0x04
250926ce35aSJung-uk Kim #define	RTSX_BPP_PAD_1V8		0x00
251926ce35aSJung-uk Kim #define	RTSX_BPP_PAD_MASK		0x04
252926ce35aSJung-uk Kim #define	RTSX_BPP_LDO_POWB		0x03
253926ce35aSJung-uk Kim #define	RTSX_BPP_LDO_ON			0x00
254926ce35aSJung-uk Kim #define	RTSX_BPP_LDO_SUSPEND		0x02
255926ce35aSJung-uk Kim #define	RTSX_BPP_LDO_OFF		0x03
256926ce35aSJung-uk Kim #define	RTSX_BPP_SHIFT_8402		5
257926ce35aSJung-uk Kim #define	RTSX_BPP_SHIFT_8411		4
258926ce35aSJung-uk Kim 
259926ce35aSJung-uk Kim #define	RTSX_GPIO_CTL			0xFC1F
260926ce35aSJung-uk Kim #define	RTSX_GPIO_LED_ON		0x02
261926ce35aSJung-uk Kim 
262926ce35aSJung-uk Kim #define	RTSX_SD_VPCLK0_CTL		0xFC2A
263926ce35aSJung-uk Kim #define	RTSX_SD_VPCLK1_CTL		0xFC2B
264926ce35aSJung-uk Kim #define	RTSX_PHASE_SELECT_MASK		0x1F
265926ce35aSJung-uk Kim #define	RTSX_PHASE_NOT_RESET		0x40
266926ce35aSJung-uk Kim 
267926ce35aSJung-uk Kim /* Host controller commands. */
268926ce35aSJung-uk Kim #define	RTSX_READ_REG_CMD		0
269926ce35aSJung-uk Kim #define	RTSX_WRITE_REG_CMD		1
270926ce35aSJung-uk Kim #define	RTSX_CHECK_REG_CMD		2
271926ce35aSJung-uk Kim 
272926ce35aSJung-uk Kim #define	RTSX_OCPCTL			0xFC15
273926ce35aSJung-uk Kim #define	RTSX_OCPSTAT			0xFC16
274926ce35aSJung-uk Kim #define	RTSX_OCPGLITCH			0xFC17
275926ce35aSJung-uk Kim #define	RTSX_OCPPARA1			0xFC18
276926ce35aSJung-uk Kim #define	RTSX_OCPPARA2			0xFC19
277926ce35aSJung-uk Kim 
278926ce35aSJung-uk Kim /* FPGA */
279926ce35aSJung-uk Kim #define	RTSX_FPGA_PULL_CTL		0xFC1D
280926ce35aSJung-uk Kim #define	RTSX_FPGA_MS_PULL_CTL_BIT	0x10
281926ce35aSJung-uk Kim #define	RTSX_FPGA_SD_PULL_CTL_BIT	0x08
282926ce35aSJung-uk Kim 
283926ce35aSJung-uk Kim /* Clock source configuration register. */
284926ce35aSJung-uk Kim #define	RTSX_CARD_CLK_SOURCE		0xFC2E
285926ce35aSJung-uk Kim #define	RTSX_CRC_FIX_CLK		(0x00 << 0)
286926ce35aSJung-uk Kim #define	RTSX_CRC_VAR_CLK0		(0x01 << 0)
287926ce35aSJung-uk Kim #define	RTSX_CRC_VAR_CLK1		(0x02 << 0)
288926ce35aSJung-uk Kim #define	RTSX_SD30_FIX_CLK		(0x00 << 2)
289926ce35aSJung-uk Kim #define	RTSX_SD30_VAR_CLK0		(0x01 << 2)
290926ce35aSJung-uk Kim #define	RTSX_SD30_VAR_CLK1		(0x02 << 2)
291926ce35aSJung-uk Kim #define	RTSX_SAMPLE_FIX_CLK		(0x00 << 4)
292926ce35aSJung-uk Kim #define	RTSX_SAMPLE_VAR_CLK0		(0x01 << 4)
293926ce35aSJung-uk Kim #define	RTSX_SAMPLE_VAR_CLK1		(0x02 << 4)
294926ce35aSJung-uk Kim 
295926ce35aSJung-uk Kim 
296926ce35aSJung-uk Kim /* ASIC */
297926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL1		0xFD60
298926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL2		0xFD61
299926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL3		0xFD62
300926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL4		0xFD63
301926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL5		0xFD64
302926ce35aSJung-uk Kim #define	RTSX_CARD_PULL_CTL6		0xFD65
303926ce35aSJung-uk Kim 
304926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_DISABLE12		0x55
305926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_DISABLE3		0xD5
306926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_DISABLE3_TYPE_C	0xE5
307926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_ENABLE12		0xAA
308926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_ENABLE3		0xE9
309926ce35aSJung-uk Kim #define	RTSX_PULL_CTL_ENABLE3_TYPE_C	0xD9
310926ce35aSJung-uk Kim 
311926ce35aSJung-uk Kim /* SD configuration register 1 (clock divider, bus mode and width). */
312926ce35aSJung-uk Kim #define	RTSX_SD_CFG1			0xFDA0
313926ce35aSJung-uk Kim #define	RTSX_CLK_DIVIDE_0		0x00
314926ce35aSJung-uk Kim #define	RTSX_CLK_DIVIDE_128		0x80
315926ce35aSJung-uk Kim #define	RTSX_CLK_DIVIDE_256		0xC0
316926ce35aSJung-uk Kim #define	RTSX_CLK_DIVIDE_MASK		0xC0
317926ce35aSJung-uk Kim #define	RTSX_SD20_MODE			0x00
318926ce35aSJung-uk Kim #define	RTSX_SDDDR_MODE			0x04
319926ce35aSJung-uk Kim #define	RTSX_SD30_MODE			0x08
320926ce35aSJung-uk Kim #define	RTSX_SD_MODE_MASK		0x0C
321926ce35aSJung-uk Kim #define	RTSX_BUS_WIDTH_1		0x00
322926ce35aSJung-uk Kim #define	RTSX_BUS_WIDTH_4		0x01
323926ce35aSJung-uk Kim #define	RTSX_BUS_WIDTH_8		0x02
324926ce35aSJung-uk Kim #define	RTSX_SD_ASYNC_FIFO_NOT_RST	0x10
325926ce35aSJung-uk Kim #define	RTSX_BUS_WIDTH_MASK		0x03
326926ce35aSJung-uk Kim 
327926ce35aSJung-uk Kim /* SD configuration register 2 (SD command response flags). */
328926ce35aSJung-uk Kim #define	RTSX_SD_CFG2			0xFDA1
329926ce35aSJung-uk Kim #define	RTSX_SD_CALCULATE_CRC7		0x00
330926ce35aSJung-uk Kim #define	RTSX_SD_NO_CALCULATE_CRC7	0x80
331926ce35aSJung-uk Kim #define	RTSX_SD_CHECK_CRC16		0x00
332926ce35aSJung-uk Kim #define	RTSX_SD_NO_CHECK_CRC16		0x40
333926ce35aSJung-uk Kim #define	RTSX_SD_NO_CHECK_WAIT_CRC_TO	0x20
334926ce35aSJung-uk Kim #define	RTSX_SD_WAIT_BUSY_END		0x08
335926ce35aSJung-uk Kim #define	RTSX_SD_NO_WAIT_BUSY_END	0x00
336926ce35aSJung-uk Kim #define	RTSX_SD_CHECK_CRC7		0x00
337926ce35aSJung-uk Kim #define	RTSX_SD_NO_CHECK_CRC7		0x04
338926ce35aSJung-uk Kim #define	RTSX_SD_RSP_LEN_0		0x00
339926ce35aSJung-uk Kim #define	RTSX_SD_RSP_LEN_6		0x01
340926ce35aSJung-uk Kim #define	RTSX_SD_RSP_LEN_17		0x02
341926ce35aSJung-uk Kim /* SD command response types. */
342926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R0		0x04
343926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R1		0x01
344926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R1B		0x09
345926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R2		0x02
346926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R3		0x05
347926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R4		0x05
348926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R5		0x01
349926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R6		0x01
350926ce35aSJung-uk Kim #define	RTSX_SD_RSP_TYPE_R7		0x01
351926ce35aSJung-uk Kim 
352926ce35aSJung-uk Kim #define	RTSX_SD_CFG3			0xFDA2
353577130e5SHenri Hennebert #define RTSX_SD30_CLK_END_EN		0x10
354926ce35aSJung-uk Kim #define	RTSX_SD_RSP_80CLK_TIMEOUT_EN	0x01
355926ce35aSJung-uk Kim 
356926ce35aSJung-uk Kim #define	RTSX_SD_STAT1			0xFDA3
357926ce35aSJung-uk Kim #define	RTSX_SD_CRC7_ERR		0x80
358926ce35aSJung-uk Kim #define	RTSX_SD_CRC16_ERR		0x40
359926ce35aSJung-uk Kim #define	RTSX_SD_CRC_WRITE_ERR		0x20
360926ce35aSJung-uk Kim #define	RTSX_SD_CRC_WRITE_ERR_MASK	0x1C
361926ce35aSJung-uk Kim #define	RTSX_GET_CRC_TIME_OUT		0x02
362926ce35aSJung-uk Kim #define	RTSX_SD_TUNING_COMPARE_ERR	0x01
363926ce35aSJung-uk Kim 
364926ce35aSJung-uk Kim #define	RTSX_SD_STAT2			0xFDA4
365926ce35aSJung-uk Kim #define	RTSX_SD_RSP_80CLK_TIMEOUT	0x01
366926ce35aSJung-uk Kim 
367926ce35aSJung-uk Kim #define	RTSX_SD_CRC_ERR	(RTSX_SD_CRC7_ERR|RTSX_SD_CRC16_ERR|RTSX_SD_CRC_WRITE_ERR)
368926ce35aSJung-uk Kim 
369926ce35aSJung-uk Kim /* SD bus status register. */
370926ce35aSJung-uk Kim #define	RTSX_SD_BUS_STAT		0xFDA5
371926ce35aSJung-uk Kim #define	RTSX_SD_CLK_TOGGLE_EN		0x80
372926ce35aSJung-uk Kim #define	RTSX_SD_CLK_FORCE_STOP		0x40
373926ce35aSJung-uk Kim #define	RTSX_SD_DAT3_STATUS		0x10
374926ce35aSJung-uk Kim #define	RTSX_SD_DAT2_STATUS		0x08
375926ce35aSJung-uk Kim #define	RTSX_SD_DAT1_STATUS		0x04
376926ce35aSJung-uk Kim #define	RTSX_SD_DAT0_STATUS		0x02
377926ce35aSJung-uk Kim #define	RTSX_SD_CMD_STATUS		0x01
378926ce35aSJung-uk Kim 
379926ce35aSJung-uk Kim #define	RTSX_SD_PAD_CTL			0xFDA6
380926ce35aSJung-uk Kim #define	RTSX_SD_IO_USING_1V8		0x80
381926ce35aSJung-uk Kim 
382926ce35aSJung-uk Kim /* Sample point control register. */
383926ce35aSJung-uk Kim #define	RTSX_SD_SAMPLE_POINT_CTL	0xFDA7
384926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_DAT		0x00
385926ce35aSJung-uk Kim #define	RTSX_DDR_VAR_RX_DAT		0x80
386926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_DAT_EDGE	0x00
387926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_DAT_14_DELAY	0x40
388926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_CMD		0x00
389926ce35aSJung-uk Kim #define	RTSX_DDR_VAR_RX_CMD		0x20
390926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_CMD_POS_EDGE	0x00
391926ce35aSJung-uk Kim #define	RTSX_DDR_FIX_RX_CMD_14_DELAY	0x10
392926ce35aSJung-uk Kim #define	RTSX_SD20_RX_POS_EDGE		0x00
393926ce35aSJung-uk Kim #define	RTSX_SD20_RX_14_DELAY		0x08
394926ce35aSJung-uk Kim #define	RTSX_SD20_RX_SEL_MASK		0x08
395926ce35aSJung-uk Kim 
396926ce35aSJung-uk Kim #define	RTSX_SD_PUSH_POINT_CTL		0xFDA8
397926ce35aSJung-uk Kim #define	RTSX_SD20_TX_NEG_EDGE		0x00
398926ce35aSJung-uk Kim #define	RTSX_SD20_TX_SEL_MASK		0x10
399926ce35aSJung-uk Kim #define	RTSX_SD20_TX_14_AHEAD		0x10
400926ce35aSJung-uk Kim 
401926ce35aSJung-uk Kim #define	RTSX_SD_CMD0			0xFDA9
402926ce35aSJung-uk Kim #define	  RTSX_SD_CMD_START		0x40
403926ce35aSJung-uk Kim #define	RTSX_SD_CMD1			0xFDAA
404926ce35aSJung-uk Kim #define	RTSX_SD_CMD2			0xFDAB
405926ce35aSJung-uk Kim #define	RTSX_SD_CMD3			0xFDAC
406926ce35aSJung-uk Kim #define	RTSX_SD_CMD4			0xFDAD
407926ce35aSJung-uk Kim 
408926ce35aSJung-uk Kim #define	RTSX_SD_CMD5			0xFDAE
409926ce35aSJung-uk Kim #define	RTSX_SD_BYTE_CNT_L		0xFDAF
410926ce35aSJung-uk Kim #define	RTSX_SD_BYTE_CNT_H		0xFDB0
411926ce35aSJung-uk Kim #define	RTSX_SD_BLOCK_CNT_L		0xFDB1
412926ce35aSJung-uk Kim #define	RTSX_SD_BLOCK_CNT_H		0xFDB2
413926ce35aSJung-uk Kim 
414926ce35aSJung-uk Kim /*
415926ce35aSJung-uk Kim  * Transfer modes.
416926ce35aSJung-uk Kim  */
417926ce35aSJung-uk Kim #define	RTSX_SD_TRANSFER		0xFDB3
418926ce35aSJung-uk Kim 
419926ce35aSJung-uk Kim /* Write one or two bytes from SD_CMD2 and SD_CMD3 to the card. */
420926ce35aSJung-uk Kim #define	RTSX_TM_NORMAL_WRITE		0x00
421926ce35aSJung-uk Kim 
422926ce35aSJung-uk Kim /* Write (SD_BYTE_CNT * SD_BLOCK_COUNTS) bytes from ring buffer to card. */
423926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_WRITE3		0x01
424926ce35aSJung-uk Kim 
425926ce35aSJung-uk Kim /* Like AUTO_WRITE3, plus automatically send CMD 12 when done.
426926ce35aSJung-uk Kim  * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */
427926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_WRITE4		0x02
428926ce35aSJung-uk Kim 
429926ce35aSJung-uk Kim /* Read (SD_BYTE_CNT * SD_BLOCK_CNT) bytes from card into ring buffer. */
430926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_READ3		0x05
431926ce35aSJung-uk Kim 
432926ce35aSJung-uk Kim /* Like AUTO_READ3, plus automatically send CMD 12 when done.
433926ce35aSJung-uk Kim  * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */
434926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_READ4		0x06
435926ce35aSJung-uk Kim 
436926ce35aSJung-uk Kim /* Send an SD command described in SD_CMD{0,1,2,3,4} to the card and put
437926ce35aSJung-uk Kim  * the response into SD_CMD{0,1,2,3,4}. Long responses (17 byte) are put
438926ce35aSJung-uk Kim  * into ping-pong buffer 2 instead. */
439926ce35aSJung-uk Kim #define	RTSX_TM_CMD_RSP			0x08
440926ce35aSJung-uk Kim 
441926ce35aSJung-uk Kim /* Send write command, get response from the card, write data from ring
442926ce35aSJung-uk Kim  * buffer to card, and send CMD 12 when done.
443926ce35aSJung-uk Kim  * The response to CMD 12 is written to SD_CMD{0,1,2,3,4}. */
444926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_WRITE1		0x09
445926ce35aSJung-uk Kim 
446926ce35aSJung-uk Kim /* Like AUTO_WRITE1 except no CMD 12 is sent. */
447926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_WRITE2		0x0A
448926ce35aSJung-uk Kim 
449926ce35aSJung-uk Kim /* Send read command, read up to 512 bytes (SD_BYTE_CNT * SD_BLOCK_CNT)
450926ce35aSJung-uk Kim  * from the card into the ring buffer or ping-pong buffer 2. */
451926ce35aSJung-uk Kim #define	RTSX_TM_NORMAL_READ		0x0C
452926ce35aSJung-uk Kim 
453926ce35aSJung-uk Kim /* Same as WRITE1, except data is read from the card to the ring buffer. */
454926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_READ1		0x0D
455926ce35aSJung-uk Kim 
456926ce35aSJung-uk Kim /* Same as WRITE2, except data is read from the card to the ring buffer. */
457926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_READ2		0x0E
458926ce35aSJung-uk Kim 
459926ce35aSJung-uk Kim /* Send CMD 19 and receive response and tuning pattern from card and
460926ce35aSJung-uk Kim  * report the result. */
461926ce35aSJung-uk Kim #define	RTSX_TM_AUTO_TUNING		0x0F
462926ce35aSJung-uk Kim 
463926ce35aSJung-uk Kim /* transfer control */
464926ce35aSJung-uk Kim #define	RTSX_SD_TRANSFER_START		0x80
465926ce35aSJung-uk Kim #define	RTSX_SD_TRANSFER_END		0x40
466926ce35aSJung-uk Kim #define	RTSX_SD_STAT_IDLE		0x20
467926ce35aSJung-uk Kim #define	RTSX_SD_TRANSFER_ERR		0x10
468926ce35aSJung-uk Kim 
469926ce35aSJung-uk Kim #define	RTSX_SD_CMD_STATE		0xFDB5
470926ce35aSJung-uk Kim #define	RTSX_SD_CMD_IDLE		0x80
471926ce35aSJung-uk Kim 
472926ce35aSJung-uk Kim #define	RTSX_SD_DATA_STATE		0xFDB6
473926ce35aSJung-uk Kim #define	RTSX_SD_DATA_IDLE		0x80
474926ce35aSJung-uk Kim 
475577130e5SHenri Hennebert #define RTSX_REG_SD_STOP_SDCLK_CFG	0xFDB8
476577130e5SHenri Hennebert #define RTSX_SD30_CLK_STOP_CFG_EN	0x04
477577130e5SHenri Hennebert #define RTSX_SD30_CLK_STOP_CFG0		0x01
478577130e5SHenri Hennebert #define RTSX_SD30_CLK_STOP_CFG1		0x02
479577130e5SHenri Hennebert 
480577130e5SHenri Hennebert #define RTSX_REG_PRE_RW_MODE		0xFD70
481577130e5SHenri Hennebert #define RTSX_EN_INFINITE_MODE		0x01
482577130e5SHenri Hennebert 
483926ce35aSJung-uk Kim /* ping-pong buffer 2 */
484926ce35aSJung-uk Kim #define	RTSX_PPBUF_BASE2		0xFA00
485926ce35aSJung-uk Kim #define	RTSX_PPBUF_SIZE			256
486926ce35aSJung-uk Kim 
487926ce35aSJung-uk Kim #define	RTSX_SUPPORTED_VOLTAGE		(MMC_OCR_300_310|MMC_OCR_310_320|\
488926ce35aSJung-uk Kim 					 MMC_OCR_320_330|MMC_OCR_330_340)
489926ce35aSJung-uk Kim 
490926ce35aSJung-uk Kim #define	RTSX_CFG_PCI			0x1C
491926ce35aSJung-uk Kim #define	RTSX_CFG_ASIC			0x10
492926ce35aSJung-uk Kim 
493926ce35aSJung-uk Kim #define	RTSX_IRQEN0			0xFE20
494926ce35aSJung-uk Kim #define	RTSX_LINK_DOWN_INT_EN		0x10
495926ce35aSJung-uk Kim #define	RTSX_LINK_READY_INT_EN		0x20
496926ce35aSJung-uk Kim #define	RTSX_SUSPEND_INT_EN		0x40
497926ce35aSJung-uk Kim #define	RTSX_DMA_DONE_INT_EN		0x80
498926ce35aSJung-uk Kim 
499926ce35aSJung-uk Kim #define	RTSX_IRQSTAT0			0xFE21
500926ce35aSJung-uk Kim #define	RTSX_LINK_DOWN_INT		0x10
501926ce35aSJung-uk Kim #define	RTSX_LINK_READY_INT		0x20
502926ce35aSJung-uk Kim #define	RTSX_SUSPEND_INT		0x40
503926ce35aSJung-uk Kim #define	RTSX_DMA_DONE_INT		0x80
504926ce35aSJung-uk Kim 
505926ce35aSJung-uk Kim #define	RTSX_DMATC0			0xFE28
506926ce35aSJung-uk Kim #define	RTSX_DMATC1			0xFE29
507926ce35aSJung-uk Kim #define	RTSX_DMATC2			0xFE2A
508926ce35aSJung-uk Kim #define	RTSX_DMATC3			0xFE2B
509926ce35aSJung-uk Kim 
510926ce35aSJung-uk Kim #define	RTSX_DMACTL			0xFE2C
511926ce35aSJung-uk Kim #define	RTSX_DMA_EN			0x01
512926ce35aSJung-uk Kim #define	RTSX_DMA_DIR			0x02
513926ce35aSJung-uk Kim #define	RTSX_DMA_DIR_TO_CARD		0x00
514926ce35aSJung-uk Kim #define	RTSX_DMA_DIR_FROM_CARD		0x02
515926ce35aSJung-uk Kim #define	RTSX_DMA_BUSY			0x04
516926ce35aSJung-uk Kim #define	RTSX_DMA_RST			0x80
517926ce35aSJung-uk Kim #define	RTSX_DMA_128			(0 << 4)
518926ce35aSJung-uk Kim #define	RTSX_DMA_256			(1 << 4)
519926ce35aSJung-uk Kim #define	RTSX_DMA_512			(2 << 4)
520926ce35aSJung-uk Kim #define	RTSX_DMA_1024			(3 << 4)
521926ce35aSJung-uk Kim #define	RTSX_DMA_PACK_SIZE_MASK		0x30
522926ce35aSJung-uk Kim 
523926ce35aSJung-uk Kim #define	RTSX_RBCTL			0xFE34
524926ce35aSJung-uk Kim #define	RTSX_RB_FLUSH			0x80
525577130e5SHenri Hennebert #define RTSX_U_AUTO_DMA_EN_MASK		0x20
526577130e5SHenri Hennebert #define RTSX_U_AUTO_DMA_DISABLE		0x00
527926ce35aSJung-uk Kim 
528926ce35aSJung-uk Kim #define	RTSX_CFGADDR0			0xFE35
529926ce35aSJung-uk Kim #define	RTSX_CFGADDR1			0xFE36
530926ce35aSJung-uk Kim #define	RTSX_CFGDATA0			0xFE37
531926ce35aSJung-uk Kim #define	RTSX_CFGDATA1			0xFE38
532926ce35aSJung-uk Kim #define	RTSX_CFGDATA2			0xFE39
533926ce35aSJung-uk Kim #define	RTSX_CFGDATA3			0xFE3A
534926ce35aSJung-uk Kim #define	RTSX_CFGRWCTL			0xFE3B
535926ce35aSJung-uk Kim #define	RTSX_CFG_WRITE_DATA0		0x01
536926ce35aSJung-uk Kim #define	RTSX_CFG_WRITE_DATA1		0x02
537926ce35aSJung-uk Kim #define	RTSX_CFG_WRITE_DATA2		0x04
538926ce35aSJung-uk Kim #define	RTSX_CFG_WRITE_DATA3		0x08
539926ce35aSJung-uk Kim #define	RTSX_CFG_BUSY			0x80
540926ce35aSJung-uk Kim 
541926ce35aSJung-uk Kim #define	RTSX_LTR_CTL			0xFE4A
542926ce35aSJung-uk Kim 
543926ce35aSJung-uk Kim #define	RTSX_OBFF_CFG			0xFE4C
544926ce35aSJung-uk Kim #define	RTSX_OBFF_EN_MASK		0x03
545926ce35aSJung-uk Kim #define	RTSX_OBFF_DISABLE		0x00
546926ce35aSJung-uk Kim #define	RTSX_OBFF_ENABLE		0x03
547926ce35aSJung-uk Kim 
548926ce35aSJung-uk Kim #define	RTSX_SDIOCFG_REG		0x724
549926ce35aSJung-uk Kim #define	RTSX_SDIOCFG_NO_BYPASS_SDIO	0x02
550926ce35aSJung-uk Kim #define	RTSX_SDIOCFG_HAVE_SDIO		0x04
551926ce35aSJung-uk Kim #define	RTSX_SDIOCFG_SINGLE_LUN		0x08
552926ce35aSJung-uk Kim #define	RTSX_SDIOCFG_SDIO_ONLY		0x80
553926ce35aSJung-uk Kim 
554926ce35aSJung-uk Kim #define	RTSX_HOST_SLEEP_STATE		0xFE60
555926ce35aSJung-uk Kim #define	RTSX_HOST_ENTER_S1		0x01
556926ce35aSJung-uk Kim #define	RTSX_HOST_ENTER_S3		0x02
557926ce35aSJung-uk Kim 
558926ce35aSJung-uk Kim #define	RTSX_SDIO_CFG			0xFE70
559926ce35aSJung-uk Kim #define	RTSX_SDIO_BUS_AUTO_SWITCH	0x10
560926ce35aSJung-uk Kim 
561926ce35aSJung-uk Kim #define	RTSX_NFTS_TX_CTRL		0xFE72
562926ce35aSJung-uk Kim #define	RTSX_INT_READ_CLR		0x02
563926ce35aSJung-uk Kim 
564926ce35aSJung-uk Kim #define	RTSX_PWR_GATE_CTRL		0xFE75
565926ce35aSJung-uk Kim #define	RTSX_PWR_GATE_EN		0x01
566926ce35aSJung-uk Kim #define	RTSX_LDO3318_PWR_MASK		0x06
567926ce35aSJung-uk Kim #define	RTSX_LDO3318_ON			0x00
568926ce35aSJung-uk Kim #define	RTSX_LDO3318_SUSPEND		0x04
569926ce35aSJung-uk Kim #define	RTSX_LDO3318_OFF		0x06
570926ce35aSJung-uk Kim #define	RTSX_LDO3318_VCC1		0x02
571926ce35aSJung-uk Kim #define	RTSX_LDO3318_VCC2		0x04
572926ce35aSJung-uk Kim #define	RTSX_PWD_SUSPEND_EN		0xFE76
573926ce35aSJung-uk Kim #define	RTSX_LDO_PWR_SEL		0xFE78
574926ce35aSJung-uk Kim #define	RTSX_LDO_PWR_SEL_3V3		0x01
575926ce35aSJung-uk Kim #define	RTSX_LDO_PWR_SEL_DV33		0x03
576926ce35aSJung-uk Kim 
577926ce35aSJung-uk Kim #define	RTSX_PHY_RWCTL			0xFE3C
578926ce35aSJung-uk Kim #define	RTSX_PHY_READ			0x00
579926ce35aSJung-uk Kim #define	RTSX_PHY_WRITE			0x01
580926ce35aSJung-uk Kim #define	RTSX_PHY_BUSY			0x80
581926ce35aSJung-uk Kim #define	RTSX_PHY_DATA0			0xFE3D
582926ce35aSJung-uk Kim #define	RTSX_PHY_DATA1			0xFE3E
583926ce35aSJung-uk Kim #define	RTSX_PHY_ADDR			0xFE3F
584926ce35aSJung-uk Kim 
585926ce35aSJung-uk Kim #define	RTSX_PHY_PCR			0x00
586926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_FORCE_CODE		0xB000
587926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_OOBS_CALI_50	0x0800
588926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_OOBS_VCM_08	0x0200
589926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_OOBS_SEN_90	0x0040
590926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_RSSI_EN		0x0002
591926ce35aSJung-uk Kim #define	RTSX_PHY_PCR_RX10K		0x0001
592926ce35aSJung-uk Kim 
593926ce35aSJung-uk Kim #define	RTSX_PHY_RCR1			0x02
594926ce35aSJung-uk Kim #define	RTSX_PHY_RCR1_ADP_TIME_4	0x0400
595926ce35aSJung-uk Kim #define	RTSX_PHY_RCR1_VCO_COARSE	0x001F
596926ce35aSJung-uk Kim #define	RTSX_PHY_RCR1_INIT_27S		0x0A1F
597926ce35aSJung-uk Kim 
598926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2			0x03
599926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_EMPHASE_EN	0x8000
600926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_NADJR		0x4000
601926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_CDR_SR_2		0x0100
602926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_FREQSEL_12	0x0040
603926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_CDR_SC_12P	0x0010
604926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_CALIB_LATE	0x0002
605926ce35aSJung-uk Kim #define	RTSX_PHY_RCR2_INIT_27S		0xC152
606926ce35aSJung-uk Kim 
607926ce35aSJung-uk Kim #define	RTSX__PHY_ANA03			0x03
608926ce35aSJung-uk Kim #define	RTSX__PHY_ANA03_TIMER_MAX	0x2700
609926ce35aSJung-uk Kim #define	RTSX__PHY_ANA03_OOBS_DEB_EN	0x0040
610926ce35aSJung-uk Kim #define	RTSX__PHY_CMU_DEBUG_EN		0x0008
611926ce35aSJung-uk Kim 
612926ce35aSJung-uk Kim #define	RTSX_PHY_RDR			0x05
613926ce35aSJung-uk Kim #define	RTSX_PHY_RDR_RXDSEL_1_9		0x4000
614926ce35aSJung-uk Kim #define	RTSX_PHY_SSC_AUTO_PWD		0x0600
615926ce35aSJung-uk Kim 
616926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE			0x08
617926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_TUNEREF_1_0	0x4000
618926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_VBGSEL_1252	0x0C00
619926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_SDBUS_33		0x0200
620926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_TUNED18		0x01C0
621926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_TUNED12		0X0020
622926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_TUNEA12		0x0004
623926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_VOLTAGE_MASK	0xFC3F
624926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_VOLTAGE_3V3	0x03C0
625926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_D18_1V8		0x0100
626926ce35aSJung-uk Kim #define	RTSX_PHY_TUNE_D18_1V7		0x0080
627926ce35aSJung-uk Kim 
628926ce35aSJung-uk Kim #define	RTSX_PHY_BPCR			0x0A
629926ce35aSJung-uk Kim #define	RTSX_PHY_BPCR_IBRXSEL		0x0400
630926ce35aSJung-uk Kim #define	RTSX_PHY_BPCR_IBTXSEL		0x0100
631926ce35aSJung-uk Kim #define	RTSX_PHY_BPCR_IB_FILTER		0x0080
632926ce35aSJung-uk Kim #define	RTSX_PHY_BPCR_CMIRROR_EN	0x0040
633926ce35aSJung-uk Kim 
634926ce35aSJung-uk Kim #define	RTSX_PHY_REV			0x19
635926ce35aSJung-uk Kim #define	RTSX_PHY_REV_RESV		0xE000
636926ce35aSJung-uk Kim #define	RTSX_PHY_REV_RXIDLE_LATCHED	0x1000
637926ce35aSJung-uk Kim #define	RTSX_PHY_REV_P1_EN		0x0800
638926ce35aSJung-uk Kim #define	RTSX_PHY_REV_RXIDLE_EN		0x0400
639926ce35aSJung-uk Kim #define	RTSX_PHY_REV_CLKREQ_TX_EN	0x0200
640926ce35aSJung-uk Kim #define	RTSX_PHY_REV_CLKREQ_RX_EN	0x0100
641926ce35aSJung-uk Kim #define	RTSX_PHY_REV_CLKREQ_DT_1_0	0x0040
642926ce35aSJung-uk Kim #define	RTSX_PHY_REV_STOP_CLKRD		0x0020
643926ce35aSJung-uk Kim #define	RTSX_PHY_REV_RX_PWST		0x0008
644926ce35aSJung-uk Kim #define	RTSX_PHY_REV_STOP_CLKWR		0x0004
645926ce35aSJung-uk Kim 
646926ce35aSJung-uk Kim 
647926ce35aSJung-uk Kim #define	RTSX__PHY_REV0				0x19
648926ce35aSJung-uk Kim #define	RTSX__PHY_REV0_FILTER_OUT		0x3800
649926ce35aSJung-uk Kim #define	RTSX__PHY_REV0_CDR_BYPASS_PFD		0x0100
650926ce35aSJung-uk Kim #define	RTSX__PHY_REV0_CDR_RX_IDLE_BYPASS	0x0002
651926ce35aSJung-uk Kim 
652926ce35aSJung-uk Kim #define	RTSX_PHY_FLD0			0x1A
653926ce35aSJung-uk Kim #define	RTSX_PHY_FLD0_INIT_27S		0x2546
654926ce35aSJung-uk Kim 
655926ce35aSJung-uk Kim #define	RTSX_PHY_FLD3			0x1D
656926ce35aSJung-uk Kim #define	RTSX_PHY_FLD3_TIMER_4		0x0800
657926ce35aSJung-uk Kim #define	RTSX_PHY_FLD3_TIMER_6		0x0020
658926ce35aSJung-uk Kim #define	RTSX_PHY_FLD3_RXDELINK		0x0004
659926ce35aSJung-uk Kim #define	RTSX_PHY_FLD3_INIT_27S		0x0004
660926ce35aSJung-uk Kim 
661926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0			0x1D
662926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_CLK_REQ_20C	0x8000
663926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_RX_IDLE_EN	0x1000
664926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_BIT_ERR_RSTN	0x0800
665926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_BER_COUNT	0x01E0
666926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_BER_TIMER	0x001E
667926ce35aSJung-uk Kim #define	RTSX__PHY_FLD0_CHECK_EN		0x0001
668926ce35aSJung-uk Kim 
669926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4			0x1E
670926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_FLDEN_SEL		0x4000
671926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_REQ_REF		0x2000
672926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_RXAMP_OFF		0x1000
673926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_REQ_ADDA		0x0800
674926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_BER_COUNT		0x00E0
675926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_BER_TIMER		0x000A
676926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_BER_CHK_EN	0x0001
677926ce35aSJung-uk Kim #define	RTSX_PHY_FLD4_INIT_27S		0x5C7F
678926ce35aSJung-uk Kim 
679926ce35aSJung-uk Kim #define	RTSX_CARD_AUTO_BLINK		0xFD56
680926ce35aSJung-uk Kim #define	RTSX_LED_BLINK_EN		0x08
681926ce35aSJung-uk Kim #define	RTSX_LED_BLINK_SPEED		0x05
682926ce35aSJung-uk Kim 
683926ce35aSJung-uk Kim #define	RTSX_PCLK_CTL			0xFE55
684926ce35aSJung-uk Kim #define	RTSX_PCLK_MODE_SEL		0x20
685926ce35aSJung-uk Kim 
686926ce35aSJung-uk Kim #define	RTSX_PME_FORCE_CTL		0xFE56
687926ce35aSJung-uk Kim 
688926ce35aSJung-uk Kim #define	RTSX_ASPM_FORCE_CTL		0xFE57
689926ce35aSJung-uk Kim #define	RTSX_ASPM_FORCE_MASK		0x3F
690926ce35aSJung-uk Kim #define	RTSX_FORCE_ASPM_NO_ASPM		0x00
691926ce35aSJung-uk Kim 
692926ce35aSJung-uk Kim #define	RTSX_PM_CLK_FORCE_CTL		0xFE58
693577130e5SHenri Hennebert #define RTSX_CLK_PM_EN			0x01
694577130e5SHenri Hennebert 
695926ce35aSJung-uk Kim #define	RTSX_FUNC_FORCE_CTL		0xFE59
696926ce35aSJung-uk Kim #define	RTSX_FUNC_FORCE_UPME_XMT_DBG	0x02
697926ce35aSJung-uk Kim 
698926ce35aSJung-uk Kim #define	RTSX_CHANGE_LINK_STATE		0xFE5B
699926ce35aSJung-uk Kim #define	RTSX_CD_RST_CORE_EN		0x01
700926ce35aSJung-uk Kim #define	RTSX_FORCE_RST_CORE_EN		0x02
701926ce35aSJung-uk Kim #define	RTSX_NON_STICKY_RST_N_DBG	0x08
702926ce35aSJung-uk Kim #define	RTSX_MAC_PHY_RST_N_DBG		0x10
703926ce35aSJung-uk Kim 
704926ce35aSJung-uk Kim #define	RTSX_PERST_GLITCH_WIDTH		0xFE5C
705926ce35aSJung-uk Kim 
706926ce35aSJung-uk Kim #define	RTSX_EFUSE_CONTENT		0xFE5F
707926ce35aSJung-uk Kim 
708926ce35aSJung-uk Kim #define	RTSX_PM_EVENT_DEBUG		0xFE71
709926ce35aSJung-uk Kim #define	RTSX_PME_DEBUG_0		0x08
710926ce35aSJung-uk Kim 
711577130e5SHenri Hennebert #define RTSX_L1SUB_CONFIG1		0xFE8D
712577130e5SHenri Hennebert #define RTSX_AUX_CLK_ACTIVE_SEL_MASK	0x01
713577130e5SHenri Hennebert #define RTSX_MAC_CKSW_DONE		0x00
714577130e5SHenri Hennebert 
715926ce35aSJung-uk Kim #define	RTSX_L1SUB_CONFIG2		0xFE8E
716926ce35aSJung-uk Kim #define	RTSX_L1SUB_AUTO_CFG		0x02
717926ce35aSJung-uk Kim 
718926ce35aSJung-uk Kim #define	RTSX_L1SUB_CONFIG3		0xFE8F
719926ce35aSJung-uk Kim 
720926ce35aSJung-uk Kim #define	RTSX_DUMMY_REG			0xFE90
721926ce35aSJung-uk Kim 
7228290c144SHenri Hennebert #define RTSX_REG_VREF			0xFE97
7238290c144SHenri Hennebert #define RTSX_PWD_SUSPND_EN		0x10
7248290c144SHenri Hennebert 
725577130e5SHenri Hennebert #define RTSX_RTS5260_DMA_RST_CTL_0	0xFEBF
726577130e5SHenri Hennebert #define RTSX_RTS5260_DMA_RST		0x80
727577130e5SHenri Hennebert #define RTSX_RTS5260_ADMA3_RST		0x40
728577130e5SHenri Hennebert 
729926ce35aSJung-uk Kim #define	RTSX_PETXCFG			0xFF03 /* was 0xFE49 in OpenBSD */
7308290c144SHenri Hennebert #define	RTSX_FORCE_CLKREQ_DELINK_MASK	0x80
7318290c144SHenri Hennebert #define	RTSX_FORCE_CLKREQ_LOW		0x80
732926ce35aSJung-uk Kim 
733926ce35aSJung-uk Kim #define	RTSX_RREF_CFG			0xFF6C
734926ce35aSJung-uk Kim #define	RTSX_RREF_VBGSEL_MASK		0x38
735926ce35aSJung-uk Kim #define	RTSX_RREF_VBGSEL_1V25		0x28
736926ce35aSJung-uk Kim 
737926ce35aSJung-uk Kim #define	RTSX_PM_CTRL3			0xFF46
738926ce35aSJung-uk Kim #define	RTSX_RTS522A_PM_CTRL3		0xFF7E
739926ce35aSJung-uk Kim #define	RTSX_D3_DELINK_MODE_EN		0x10
740926ce35aSJung-uk Kim #define	RTSX_PM_WAKE_EN			0x01
741926ce35aSJung-uk Kim 
742926ce35aSJung-uk Kim #define	RTSX_OOBS_CONFIG		0xFF6E
743926ce35aSJung-uk Kim #define	RTSX_OOBS_AUTOK_DIS		0x80
744926ce35aSJung-uk Kim #define	RTSX_OOBS_VAL_MASK		0x1F
745926ce35aSJung-uk Kim 
746577130e5SHenri Hennebert #define RTSX_LDO_DV18_CFG		0xFF70
747577130e5SHenri Hennebert #define RTSX_DV331812_MASK		0x70
748577130e5SHenri Hennebert #define RTSX_DV331812_33		0x70
749577130e5SHenri Hennebert 
750926ce35aSJung-uk Kim #define	RTSX_LDO_CONFIG2		0xFF71
751926ce35aSJung-uk Kim #define	RTSX_LDO_D3318_MASK		0x07
752926ce35aSJung-uk Kim #define	RTSX_LDO_D3318_33V		0x07
753926ce35aSJung-uk Kim #define	RTSX_LDO_D3318_18V		0x02
754926ce35aSJung-uk Kim #define	RTSX_DV331812_VDD1		0x04
755926ce35aSJung-uk Kim #define	RTSX_DV331812_POWERON		0x08
756926ce35aSJung-uk Kim #define	RTSX_DV331812_POWEROFF		0x00
757926ce35aSJung-uk Kim 
758926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_CFG0		0xFF72
759926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_LMTVTH_MASK	0x30
760926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_LMTVTH_2A		0x10
761577130e5SHenri Hennebert #define RTSX_RTS5260_DVCC_TUNE_MASK	0x70
762577130e5SHenri Hennebert #define RTSX_RTS5260_DVCC_33		0x70
763926ce35aSJung-uk Kim 
764926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_CFG1		0xFF73
765926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_REF_TUNE_MASK	0x30
766926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_REF_1V2		0x20
767926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_TUNE_MASK		0x07
768926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_1V8		0x04
769926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_3V3		0x07
770926ce35aSJung-uk Kim #define	RTSX_LDO_VCC_LMT_EN		0x08
771577130e5SHenri Hennebert /*RTS5260*/
772577130e5SHenri Hennebert #define	RTSX_LDO_POW_SDVDD1_MASK	0x08
773577130e5SHenri Hennebert #define	RTSX_LDO_POW_SDVDD1_ON		0x08
774577130e5SHenri Hennebert #define	RTSX_LDO_POW_SDVDD1_OFF		0x00
775577130e5SHenri Hennebert 
7768290c144SHenri Hennebert #define RTSX_RTS5260_DVCC_CTRL		0xFF73
7778290c144SHenri Hennebert #define RTSX_RTS5260_DVCC_OCP_EN	(0x01 << 7)
7788290c144SHenri Hennebert #define RTSX_RTS5260_DVCC_OCP_THD_MASK	(0x07 << 4)
7798290c144SHenri Hennebert #define RTSX_RTS5260_DVCC_POWERON	(0x01 << 3)
7808290c144SHenri Hennebert #define RTSX_RTS5260_DVCC_OCP_CL_EN	(0x01 << 2)
781926ce35aSJung-uk Kim 
782926ce35aSJung-uk Kim #define	RTSX_LDO_VIO_CFG		0xFF75
783926ce35aSJung-uk Kim #define	RTSX_LDO_VIO_TUNE_MASK		0x07
784926ce35aSJung-uk Kim #define	RTSX_LDO_VIO_1V7		0x03
785926ce35aSJung-uk Kim 
786926ce35aSJung-uk Kim #define	RTSX_LDO_DV12S_CFG		0xFF76
787926ce35aSJung-uk Kim #define	RTSX_LDO_D12_TUNE_MASK		0x07
788926ce35aSJung-uk Kim #define	RTSX_LDO_D12_TUNE_DF		0x04
789926ce35aSJung-uk Kim 
790926ce35aSJung-uk Kim #define	RTSX_LDO_AV12S_CFG		0xFF77
791926ce35aSJung-uk Kim #define	RTSX_LDO_AV12S_TUNE_MASK	0x07
792926ce35aSJung-uk Kim #define	RTSX_LDO_AV12S_TUNE_DF		0x04
793926ce35aSJung-uk Kim 
794926ce35aSJung-uk Kim #define	RTSX_SG_INT			0x04
795926ce35aSJung-uk Kim #define	RTSX_SG_END			0x02
796926ce35aSJung-uk Kim #define	RTSX_SG_VALID			0x01
797926ce35aSJung-uk Kim 
798926ce35aSJung-uk Kim #define	RTSX_SG_NO_OP			0x00
799926ce35aSJung-uk Kim #define	RTSX_SG_TRANS_DATA		(0x02 << 4)
800926ce35aSJung-uk Kim #define	RTSX_SG_LINK_DESC		(0x03 << 4)
801926ce35aSJung-uk Kim 
802926ce35aSJung-uk Kim #define	RTSX_IC_VERSION_A		0x00
803926ce35aSJung-uk Kim #define	RTSX_IC_VERSION_B		0x01
804926ce35aSJung-uk Kim #define	RTSX_IC_VERSION_C		0x02
805926ce35aSJung-uk Kim #define	RTSX_IC_VERSION_D		0x03
806926ce35aSJung-uk Kim 
807577130e5SHenri Hennebert #define	RTSX_RTS5260_AUTOLOAD_CFG4	0xFF7F
808577130e5SHenri Hennebert #define RTSX_RTS5260_MIMO_DISABLE	0x8A
809577130e5SHenri Hennebert 
810926ce35aSJung-uk Kim #define	RTSX_PCR_SETTING_REG1		0x724
811926ce35aSJung-uk Kim #define	RTSX_PCR_SETTING_REG2		0x814
812926ce35aSJung-uk Kim #define	RTSX_PCR_SETTING_REG3		0x747
813926ce35aSJung-uk Kim 
814926ce35aSJung-uk Kim #define	RTSX_RX_PHASE_MAX		32
815926ce35aSJung-uk Kim #define	RTSX_RX_TUNING_CNT		3
816926ce35aSJung-uk Kim #endif
817