xref: /rk3399_rockchip-uboot/arch/arm/mach-exynos/include/mach/mmc.h (revision 0f9258228e2b2070368ffccf5c243218128770a8)
1*77b55e8cSThomas Abraham /*
2*77b55e8cSThomas Abraham  * (C) Copyright 2009 SAMSUNG Electronics
3*77b55e8cSThomas Abraham  * Minkyu Kang <mk7.kang@samsung.com>
4*77b55e8cSThomas Abraham  *
5*77b55e8cSThomas Abraham  * SPDX-License-Identifier:	GPL-2.0+
6*77b55e8cSThomas Abraham  */
7*77b55e8cSThomas Abraham 
8*77b55e8cSThomas Abraham #ifndef __ASM_ARCH_MMC_H_
9*77b55e8cSThomas Abraham #define __ASM_ARCH_MMC_H_
10*77b55e8cSThomas Abraham 
11*77b55e8cSThomas Abraham #define S5P_MMC_DEV_OFFSET	0x10000
12*77b55e8cSThomas Abraham 
13*77b55e8cSThomas Abraham #define SDHCI_CONTROL2		0x80
14*77b55e8cSThomas Abraham #define SDHCI_CONTROL3		0x84
15*77b55e8cSThomas Abraham #define SDHCI_CONTROL4		0x8C
16*77b55e8cSThomas Abraham 
17*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENSTAASYNCCLR	(1 << 31)
18*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENCMDCNFMSK		(1 << 30)
19*77b55e8cSThomas Abraham #define SDHCI_CTRL2_CDINVRXD3		(1 << 29)
20*77b55e8cSThomas Abraham #define SDHCI_CTRL2_SLCARDOUT		(1 << 28)
21*77b55e8cSThomas Abraham 
22*77b55e8cSThomas Abraham #define SDHCI_CTRL2_FLTCLKSEL_MASK	(0xf << 24)
23*77b55e8cSThomas Abraham #define SDHCI_CTRL2_FLTCLKSEL_SHIFT	(24)
24*77b55e8cSThomas Abraham #define SDHCI_CTRL2_FLTCLKSEL(_x)	((_x) << 24)
25*77b55e8cSThomas Abraham 
26*77b55e8cSThomas Abraham #define SDHCI_CTRL2_LVLDAT_MASK		(0xff << 16)
27*77b55e8cSThomas Abraham #define SDHCI_CTRL2_LVLDAT_SHIFT	(16)
28*77b55e8cSThomas Abraham #define SDHCI_CTRL2_LVLDAT(_x)		((_x) << 16)
29*77b55e8cSThomas Abraham 
30*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENFBCLKTX		(1 << 15)
31*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENFBCLKRX		(1 << 14)
32*77b55e8cSThomas Abraham #define SDHCI_CTRL2_SDCDSEL		(1 << 13)
33*77b55e8cSThomas Abraham #define SDHCI_CTRL2_SDSIGPC		(1 << 12)
34*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENBUSYCHKTXSTART	(1 << 11)
35*77b55e8cSThomas Abraham 
36*77b55e8cSThomas Abraham #define SDHCI_CTRL2_DFCNT_MASK(_x)	((_x) << 9)
37*77b55e8cSThomas Abraham #define SDHCI_CTRL2_DFCNT_SHIFT		(9)
38*77b55e8cSThomas Abraham 
39*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENCLKOUTHOLD	(1 << 8)
40*77b55e8cSThomas Abraham #define SDHCI_CTRL2_RWAITMODE		(1 << 7)
41*77b55e8cSThomas Abraham #define SDHCI_CTRL2_DISBUFRD		(1 << 6)
42*77b55e8cSThomas Abraham #define SDHCI_CTRL2_SELBASECLK_MASK(_x)	((_x) << 4)
43*77b55e8cSThomas Abraham #define SDHCI_CTRL2_SELBASECLK_SHIFT	(4)
44*77b55e8cSThomas Abraham #define SDHCI_CTRL2_PWRSYNC		(1 << 3)
45*77b55e8cSThomas Abraham #define SDHCI_CTRL2_ENCLKOUTMSKCON	(1 << 1)
46*77b55e8cSThomas Abraham #define SDHCI_CTRL2_HWINITFIN		(1 << 0)
47*77b55e8cSThomas Abraham 
48*77b55e8cSThomas Abraham #define SDHCI_CTRL3_FCSEL3		(1 << 31)
49*77b55e8cSThomas Abraham #define SDHCI_CTRL3_FCSEL2		(1 << 23)
50*77b55e8cSThomas Abraham #define SDHCI_CTRL3_FCSEL1		(1 << 15)
51*77b55e8cSThomas Abraham #define SDHCI_CTRL3_FCSEL0		(1 << 7)
52*77b55e8cSThomas Abraham 
53*77b55e8cSThomas Abraham #define SDHCI_CTRL4_DRIVE_MASK(_x)	((_x) << 16)
54*77b55e8cSThomas Abraham #define SDHCI_CTRL4_DRIVE_SHIFT		(16)
55*77b55e8cSThomas Abraham 
56*77b55e8cSThomas Abraham #define SDHCI_MAX_HOSTS 4
57*77b55e8cSThomas Abraham 
58*77b55e8cSThomas Abraham int s5p_sdhci_init(u32 regbase, int index, int bus_width);
59*77b55e8cSThomas Abraham 
s5p_mmc_init(int index,int bus_width)60*77b55e8cSThomas Abraham static inline int s5p_mmc_init(int index, int bus_width)
61*77b55e8cSThomas Abraham {
62*77b55e8cSThomas Abraham 	unsigned int base = samsung_get_base_mmc() +
63*77b55e8cSThomas Abraham 				(S5P_MMC_DEV_OFFSET * index);
64*77b55e8cSThomas Abraham 
65*77b55e8cSThomas Abraham 	return s5p_sdhci_init(base, index, bus_width);
66*77b55e8cSThomas Abraham }
67*77b55e8cSThomas Abraham 
68*77b55e8cSThomas Abraham int exynos_mmc_init(const void *blob);
69*77b55e8cSThomas Abraham 
70*77b55e8cSThomas Abraham #endif
71