xref: /openbmc/linux/drivers/mmc/host/dw_mmc-exynos.h (revision 2874c5fd)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
20b5fce48SSeungwon Jeon /*
30b5fce48SSeungwon Jeon  * Exynos Specific Extensions for Synopsys DW Multimedia Card Interface driver
40b5fce48SSeungwon Jeon  *
50b5fce48SSeungwon Jeon  * Copyright (C) 2012-2014 Samsung Electronics Co., Ltd.
60b5fce48SSeungwon Jeon  */
70b5fce48SSeungwon Jeon 
80b5fce48SSeungwon Jeon #ifndef _DW_MMC_EXYNOS_H_
90b5fce48SSeungwon Jeon #define _DW_MMC_EXYNOS_H_
100b5fce48SSeungwon Jeon 
110b5fce48SSeungwon Jeon #define SDMMC_CLKSEL			0x09C
120b5fce48SSeungwon Jeon #define SDMMC_CLKSEL64			0x0A8
130b5fce48SSeungwon Jeon 
1480113132SSeungwon Jeon /* Extended Register's Offset */
1580113132SSeungwon Jeon #define SDMMC_HS400_DQS_EN		0x180
1680113132SSeungwon Jeon #define SDMMC_HS400_ASYNC_FIFO_CTRL	0x184
1780113132SSeungwon Jeon #define SDMMC_HS400_DLINE_CTRL		0x188
1880113132SSeungwon Jeon 
190b5fce48SSeungwon Jeon /* CLKSEL register defines */
200b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_CCLK_SAMPLE(x)	(((x) & 7) << 0)
210b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_CCLK_DRIVE(x)	(((x) & 7) << 16)
220b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_CCLK_DIVIDER(x)	(((x) & 7) << 24)
230b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_GET_DRV_WD3(x)	(((x) >> 16) & 0x7)
2480113132SSeungwon Jeon #define SDMMC_CLKSEL_GET_DIV(x)		(((x) >> 24) & 0x7)
2580113132SSeungwon Jeon #define SDMMC_CLKSEL_UP_SAMPLE(x, y)	(((x) & ~SDMMC_CLKSEL_CCLK_SAMPLE(7)) |\
2680113132SSeungwon Jeon 					 SDMMC_CLKSEL_CCLK_SAMPLE(y))
270b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_TIMING(x, y, z)	(SDMMC_CLKSEL_CCLK_SAMPLE(x) |	\
280b5fce48SSeungwon Jeon 					 SDMMC_CLKSEL_CCLK_DRIVE(y) |	\
290b5fce48SSeungwon Jeon 					 SDMMC_CLKSEL_CCLK_DIVIDER(z))
3080113132SSeungwon Jeon #define SDMMC_CLKSEL_TIMING_MASK	SDMMC_CLKSEL_TIMING(0x7, 0x7, 0x7)
310b5fce48SSeungwon Jeon #define SDMMC_CLKSEL_WAKEUP_INT		BIT(11)
320b5fce48SSeungwon Jeon 
3380113132SSeungwon Jeon /* RCLK_EN register defines */
3480113132SSeungwon Jeon #define DATA_STROBE_EN			BIT(0)
3580113132SSeungwon Jeon #define AXI_NON_BLOCKING_WR	BIT(7)
3680113132SSeungwon Jeon 
3780113132SSeungwon Jeon /* DLINE_CTRL register defines */
3880113132SSeungwon Jeon #define DQS_CTRL_RD_DELAY(x, y)		(((x) & ~0x3FF) | ((y) & 0x3FF))
3980113132SSeungwon Jeon #define DQS_CTRL_GET_RD_DELAY(x)	((x) & 0x3FF)
4080113132SSeungwon Jeon 
410b5fce48SSeungwon Jeon /* Protector Register */
420b5fce48SSeungwon Jeon #define SDMMC_EMMCP_BASE	0x1000
430b5fce48SSeungwon Jeon #define SDMMC_MPSECURITY	(SDMMC_EMMCP_BASE + 0x0010)
440b5fce48SSeungwon Jeon #define SDMMC_MPSBEGIN0		(SDMMC_EMMCP_BASE + 0x0200)
450b5fce48SSeungwon Jeon #define SDMMC_MPSEND0		(SDMMC_EMMCP_BASE + 0x0204)
460b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL0		(SDMMC_EMMCP_BASE + 0x020C)
470b5fce48SSeungwon Jeon 
480b5fce48SSeungwon Jeon /* SMU control defines */
490b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_SECURE_READ_BIT		BIT(7)
500b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_SECURE_WRITE_BIT		BIT(6)
510b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_NON_SECURE_READ_BIT	BIT(5)
520b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_NON_SECURE_WRITE_BIT	BIT(4)
530b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_USE_FUSE_KEY		BIT(3)
540b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_ECB_MODE			BIT(2)
550b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_ENCRYPTION		BIT(1)
560b5fce48SSeungwon Jeon #define SDMMC_MPSCTRL_VALID			BIT(0)
570b5fce48SSeungwon Jeon 
580b5fce48SSeungwon Jeon /* Maximum number of Ending sector */
590b5fce48SSeungwon Jeon #define SDMMC_ENDING_SEC_NR_MAX	0xFFFFFFFF
600b5fce48SSeungwon Jeon 
610b5fce48SSeungwon Jeon /* Fixed clock divider */
620b5fce48SSeungwon Jeon #define EXYNOS4210_FIXED_CIU_CLK_DIV	2
630b5fce48SSeungwon Jeon #define EXYNOS4412_FIXED_CIU_CLK_DIV	4
6480113132SSeungwon Jeon #define HS400_FIXED_CIU_CLK_DIV		1
650b5fce48SSeungwon Jeon 
660b5fce48SSeungwon Jeon /* Minimal required clock frequency for cclkin, unit: HZ */
670b5fce48SSeungwon Jeon #define EXYNOS_CCLKIN_MIN	50000000
680b5fce48SSeungwon Jeon 
690b5fce48SSeungwon Jeon #endif /* _DW_MMC_EXYNOS_H_ */
70