162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Exynos Specific Extensions for Synopsys DW Multimedia Card Interface driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012-2014 Samsung Electronics Co., Ltd.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _DW_MMC_EXYNOS_H_
962306a36Sopenharmony_ci#define _DW_MMC_EXYNOS_H_
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define SDMMC_CLKSEL			0x09C
1262306a36Sopenharmony_ci#define SDMMC_CLKSEL64			0x0A8
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/* Extended Register's Offset */
1562306a36Sopenharmony_ci#define SDMMC_HS400_DQS_EN		0x180
1662306a36Sopenharmony_ci#define SDMMC_HS400_ASYNC_FIFO_CTRL	0x184
1762306a36Sopenharmony_ci#define SDMMC_HS400_DLINE_CTRL		0x188
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/* CLKSEL register defines */
2062306a36Sopenharmony_ci#define SDMMC_CLKSEL_CCLK_SAMPLE(x)	(((x) & 7) << 0)
2162306a36Sopenharmony_ci#define SDMMC_CLKSEL_CCLK_DRIVE(x)	(((x) & 7) << 16)
2262306a36Sopenharmony_ci#define SDMMC_CLKSEL_CCLK_DIVIDER(x)	(((x) & 7) << 24)
2362306a36Sopenharmony_ci#define SDMMC_CLKSEL_GET_DRV_WD3(x)	(((x) >> 16) & 0x7)
2462306a36Sopenharmony_ci#define SDMMC_CLKSEL_GET_DIV(x)		(((x) >> 24) & 0x7)
2562306a36Sopenharmony_ci#define SDMMC_CLKSEL_UP_SAMPLE(x, y)	(((x) & ~SDMMC_CLKSEL_CCLK_SAMPLE(7)) |\
2662306a36Sopenharmony_ci					 SDMMC_CLKSEL_CCLK_SAMPLE(y))
2762306a36Sopenharmony_ci#define SDMMC_CLKSEL_TIMING(x, y, z)	(SDMMC_CLKSEL_CCLK_SAMPLE(x) |	\
2862306a36Sopenharmony_ci					 SDMMC_CLKSEL_CCLK_DRIVE(y) |	\
2962306a36Sopenharmony_ci					 SDMMC_CLKSEL_CCLK_DIVIDER(z))
3062306a36Sopenharmony_ci#define SDMMC_CLKSEL_TIMING_MASK	SDMMC_CLKSEL_TIMING(0x7, 0x7, 0x7)
3162306a36Sopenharmony_ci#define SDMMC_CLKSEL_WAKEUP_INT		BIT(11)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* RCLK_EN register defines */
3462306a36Sopenharmony_ci#define DATA_STROBE_EN			BIT(0)
3562306a36Sopenharmony_ci#define AXI_NON_BLOCKING_WR	BIT(7)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* DLINE_CTRL register defines */
3862306a36Sopenharmony_ci#define DQS_CTRL_RD_DELAY(x, y)		(((x) & ~0x3FF) | ((y) & 0x3FF))
3962306a36Sopenharmony_ci#define DQS_CTRL_GET_RD_DELAY(x)	((x) & 0x3FF)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci/* Protector Register */
4262306a36Sopenharmony_ci#define SDMMC_EMMCP_BASE	0x1000
4362306a36Sopenharmony_ci#define SDMMC_MPSECURITY	(SDMMC_EMMCP_BASE + 0x0010)
4462306a36Sopenharmony_ci#define SDMMC_MPSBEGIN0		(SDMMC_EMMCP_BASE + 0x0200)
4562306a36Sopenharmony_ci#define SDMMC_MPSEND0		(SDMMC_EMMCP_BASE + 0x0204)
4662306a36Sopenharmony_ci#define SDMMC_MPSCTRL0		(SDMMC_EMMCP_BASE + 0x020C)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* SMU control defines */
4962306a36Sopenharmony_ci#define SDMMC_MPSCTRL_SECURE_READ_BIT		BIT(7)
5062306a36Sopenharmony_ci#define SDMMC_MPSCTRL_SECURE_WRITE_BIT		BIT(6)
5162306a36Sopenharmony_ci#define SDMMC_MPSCTRL_NON_SECURE_READ_BIT	BIT(5)
5262306a36Sopenharmony_ci#define SDMMC_MPSCTRL_NON_SECURE_WRITE_BIT	BIT(4)
5362306a36Sopenharmony_ci#define SDMMC_MPSCTRL_USE_FUSE_KEY		BIT(3)
5462306a36Sopenharmony_ci#define SDMMC_MPSCTRL_ECB_MODE			BIT(2)
5562306a36Sopenharmony_ci#define SDMMC_MPSCTRL_ENCRYPTION		BIT(1)
5662306a36Sopenharmony_ci#define SDMMC_MPSCTRL_VALID			BIT(0)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* Maximum number of Ending sector */
5962306a36Sopenharmony_ci#define SDMMC_ENDING_SEC_NR_MAX	0xFFFFFFFF
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/* Fixed clock divider */
6262306a36Sopenharmony_ci#define EXYNOS4210_FIXED_CIU_CLK_DIV	2
6362306a36Sopenharmony_ci#define EXYNOS4412_FIXED_CIU_CLK_DIV	4
6462306a36Sopenharmony_ci#define HS400_FIXED_CIU_CLK_DIV		1
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/* Minimal required clock frequency for cclkin, unit: HZ */
6762306a36Sopenharmony_ci#define EXYNOS_CCLKIN_MIN	50000000
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#endif /* _DW_MMC_EXYNOS_H_ */
70