xref: /freebsd/sys/dev/sdhci/sdhci_xenon.h (revision 6f207f5b471efaa29a65a7ccd40dfd5d348f0a03)
1*6f207f5bSLuiz Otavio O Souza /*-
2*6f207f5bSLuiz Otavio O Souza  * Copyright (c) 2018 Rubicon Communications, LLC (Netgate)
3*6f207f5bSLuiz Otavio O Souza  * All rights reserved.
4*6f207f5bSLuiz Otavio O Souza  *
5*6f207f5bSLuiz Otavio O Souza  * Redistribution and use in source and binary forms, with or without
6*6f207f5bSLuiz Otavio O Souza  * modification, are permitted provided that the following conditions
7*6f207f5bSLuiz Otavio O Souza  * are met:
8*6f207f5bSLuiz Otavio O Souza  * 1. Redistributions of source code must retain the above copyright
9*6f207f5bSLuiz Otavio O Souza  *    notice, this list of conditions and the following disclaimer.
10*6f207f5bSLuiz Otavio O Souza  * 2. Redistributions in binary form must reproduce the above copyright
11*6f207f5bSLuiz Otavio O Souza  *    notice, this list of conditions and the following disclaimer in the
12*6f207f5bSLuiz Otavio O Souza  *    documentation and/or other materials provided with the distribution.
13*6f207f5bSLuiz Otavio O Souza  *
14*6f207f5bSLuiz Otavio O Souza  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15*6f207f5bSLuiz Otavio O Souza  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16*6f207f5bSLuiz Otavio O Souza  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*6f207f5bSLuiz Otavio O Souza  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18*6f207f5bSLuiz Otavio O Souza  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*6f207f5bSLuiz Otavio O Souza  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20*6f207f5bSLuiz Otavio O Souza  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21*6f207f5bSLuiz Otavio O Souza  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22*6f207f5bSLuiz Otavio O Souza  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*6f207f5bSLuiz Otavio O Souza  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*6f207f5bSLuiz Otavio O Souza  *
25*6f207f5bSLuiz Otavio O Souza  * $FreeBSD$
26*6f207f5bSLuiz Otavio O Souza  */
27*6f207f5bSLuiz Otavio O Souza 
28*6f207f5bSLuiz Otavio O Souza /*
29*6f207f5bSLuiz Otavio O Souza  * Marvel Xenon SDHCI driver defines.
30*6f207f5bSLuiz Otavio O Souza  */
31*6f207f5bSLuiz Otavio O Souza 
32*6f207f5bSLuiz Otavio O Souza #ifndef	_SDHCI_XENON_H_
33*6f207f5bSLuiz Otavio O Souza #define	_SDHCI_XENON_H_
34*6f207f5bSLuiz Otavio O Souza 
35*6f207f5bSLuiz Otavio O Souza #define	XENON_LOWEST_SDCLK_FREQ			100000
36*6f207f5bSLuiz Otavio O Souza #define	XENON_MMC_MAX_CLK			400000000
37*6f207f5bSLuiz Otavio O Souza 
38*6f207f5bSLuiz Otavio O Souza #define	XENON_SYS_OP_CTRL			0x0108
39*6f207f5bSLuiz Otavio O Souza #define	 XENON_AUTO_CLKGATE_DISABLE		(1 << 20)
40*6f207f5bSLuiz Otavio O Souza #define	 XENON_SDCLK_IDLEOFF_ENABLE_SHIFT	8
41*6f207f5bSLuiz Otavio O Souza 
42*6f207f5bSLuiz Otavio O Souza #define	XENON_SYS_EXT_OP_CTRL			0x010C
43*6f207f5bSLuiz Otavio O Souza #define	 XENON_MASK_CMD_CONFLICT_ERR		(1 << 8)
44*6f207f5bSLuiz Otavio O Souza 
45*6f207f5bSLuiz Otavio O Souza #define	XENON_SLOT_EMMC_CTRL			0x0130
46*6f207f5bSLuiz Otavio O Souza #define	 XENON_ENABLE_DATA_STROBE		(1 << 24)
47*6f207f5bSLuiz Otavio O Souza #define	 XENON_ENABLE_RESP_STROBE		(1 << 25)
48*6f207f5bSLuiz Otavio O Souza 
49*6f207f5bSLuiz Otavio O Souza /* eMMC PHY */
50*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_REG_BASE			0x170
51*6f207f5bSLuiz Otavio O Souza 
52*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_TIMING_ADJUST		XENON_EMMC_PHY_REG_BASE
53*6f207f5bSLuiz Otavio O Souza #define	 XENON_SAMPL_INV_QSP_PHASE_SELECT	(1 << 18)
54*6f207f5bSLuiz Otavio O Souza #define	 XENON_TIMING_ADJUST_SDIO_MODE		(1 << 28)
55*6f207f5bSLuiz Otavio O Souza #define	 XENON_TIMING_ADJUST_SLOW_MODE		(1 << 29)
56*6f207f5bSLuiz Otavio O Souza #define	 XENON_PHY_INITIALIZATION		(1U << 31)
57*6f207f5bSLuiz Otavio O Souza #define	 XENON_WAIT_CYCLE_BEFORE_USING_MASK	0xF
58*6f207f5bSLuiz Otavio O Souza #define	 XENON_WAIT_CYCLE_BEFORE_USING_SHIFT	12
59*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_EN_DURATION_MASK		0xF
60*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_EN_DURATION_SHIFT	8
61*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_RST_EN_DURATION_MASK	0xF
62*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_RST_EN_DURATION_SHIFT	4
63*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_RST_DURATION_MASK	0xF
64*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_SYNC_RST_DURATION_SHIFT	0
65*6f207f5bSLuiz Otavio O Souza 
66*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_FUNC_CONTROL		(XENON_EMMC_PHY_REG_BASE + 0x4)
67*6f207f5bSLuiz Otavio O Souza #define	 XENON_DQ_ASYNC_MODE			(1 << 4)
68*6f207f5bSLuiz Otavio O Souza #define	 XENON_CMD_DDR_MODE			(1 << 16)
69*6f207f5bSLuiz Otavio O Souza #define	 XENON_DQ_DDR_MODE_SHIFT		8
70*6f207f5bSLuiz Otavio O Souza #define	 XENON_DQ_DDR_MODE_MASK			0xFF
71*6f207f5bSLuiz Otavio O Souza #define	 XENON_ASYNC_DDRMODE_MASK		(1 << 23)
72*6f207f5bSLuiz Otavio O Souza #define	 XENON_ASYNC_DDRMODE_SHIFT		23
73*6f207f5bSLuiz Otavio O Souza 
74*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_PAD_CONTROL		(XENON_EMMC_PHY_REG_BASE + 0x8)
75*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_DQ_RECEN			(1 << 24)
76*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_CMD_RECEN			(1 << 25)
77*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_QSP_RECEN			(1 << 26)
78*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_QSN_RECEN			(1 << 27)
79*6f207f5bSLuiz Otavio O Souza #define	 XENON_OEN_QSN				(1 << 28)
80*6f207f5bSLuiz Otavio O Souza #define	 XENON_FC_ALL_CMOS_RECEIVER		0xF000
81*6f207f5bSLuiz Otavio O Souza 
82*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_PAD_CONTROL1		(XENON_EMMC_PHY_REG_BASE + 0xC)
83*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_CMD_PD			(1 << 8)
84*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_QSP_PD			(1 << 9)
85*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_CMD_PU			(1 << 24)
86*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_QSP_PU			(1 << 25)
87*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_DQ_PD			0xFF
88*6f207f5bSLuiz Otavio O Souza #define	 XENON_EMMC_FC_DQ_PU			(0xFF << 16)
89*6f207f5bSLuiz Otavio O Souza 
90*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_PAD_CONTROL2		(XENON_EMMC_PHY_REG_BASE + 0x10)
91*6f207f5bSLuiz Otavio O Souza #define	 XENON_ZNR_MASK				0x1F
92*6f207f5bSLuiz Otavio O Souza #define	 XENON_ZNR_SHIFT			8
93*6f207f5bSLuiz Otavio O Souza #define	 XENON_ZPR_MASK				0x1F
94*6f207f5bSLuiz Otavio O Souza #define	 XENON_ZNR_DEF_VALUE			0xF
95*6f207f5bSLuiz Otavio O Souza #define	 XENON_ZPR_DEF_VALUE			0xF
96*6f207f5bSLuiz Otavio O Souza 
97*6f207f5bSLuiz Otavio O Souza #define	XENON_EMMC_PHY_LOGIC_TIMING_ADJUST	(XENON_EMMC_PHY_REG_BASE + 0x18)
98*6f207f5bSLuiz Otavio O Souza #define	 XENON_LOGIC_TIMING_VALUE		0x00AA8977
99*6f207f5bSLuiz Otavio O Souza 
100*6f207f5bSLuiz Otavio O Souza #endif	/* _SDHCI_XENON_H_ */
101