blob: 6de02f09c3222408a457b871c225b26071cd980d [file] [log] [blame]
Thomas Gleixner84a14ae2019-05-28 09:57:07 -07001/* SPDX-License-Identifier: GPL-2.0-only */
Wolfram Sang80872e22010-10-15 12:21:03 +02002/*
3 * Freescale eSDHC controller driver generics for OF and pltfm.
4 *
5 * Copyright (c) 2007 Freescale Semiconductor, Inc.
6 * Copyright (c) 2009 MontaVista Software, Inc.
7 * Copyright (c) 2010 Pengutronix e.K.
Yangbo Lu011fde42020-10-20 16:11:16 +08008 * Copyright 2020 NXP
Wolfram Sang30e10282020-05-02 16:28:25 +02009 * Author: Wolfram Sang <kernel@pengutronix.de>
Wolfram Sang80872e22010-10-15 12:21:03 +020010 */
11
12#ifndef _DRIVERS_MMC_SDHCI_ESDHC_H
13#define _DRIVERS_MMC_SDHCI_ESDHC_H
14
15/*
16 * Ops and quirks for the Freescale eSDHC controller.
17 */
18
19#define ESDHC_DEFAULT_QUIRKS (SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \
Benoît Thébaudeaucbb45092017-05-30 11:14:08 +020020 SDHCI_QUIRK_32BIT_DMA_ADDR | \
Wolfram Sang80872e22010-10-15 12:21:03 +020021 SDHCI_QUIRK_NO_BUSY_IRQ | \
Wolfram Sang80872e22010-10-15 12:21:03 +020022 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | \
Yangbo Lu67b589a2015-07-10 11:42:37 +080023 SDHCI_QUIRK_PIO_NEEDS_DELAY | \
24 SDHCI_QUIRK_NO_HISPD_BIT)
Wolfram Sang80872e22010-10-15 12:21:03 +020025
Wolfram Sang80872e22010-10-15 12:21:03 +020026/* pltfm-specific */
27#define ESDHC_HOST_CONTROL_LE 0x20
28
Oded Gabbay66b50a02013-06-27 12:00:05 -040029/*
yangbo lua6b44882016-12-26 17:46:29 +080030 * eSDHC register definition
Oded Gabbay66b50a02013-06-27 12:00:05 -040031 */
Oded Gabbay66b50a02013-06-27 12:00:05 -040032
yangbo lue87d2db2016-12-26 17:46:30 +080033/* Present State Register */
34#define ESDHC_PRSSTAT 0x24
Haibo Chenf581e902020-02-19 16:25:50 +080035#define ESDHC_CLOCK_GATE_OFF 0x00000080
yangbo lue87d2db2016-12-26 17:46:30 +080036#define ESDHC_CLOCK_STABLE 0x00000008
37
yangbo lua6b44882016-12-26 17:46:29 +080038/* Protocol Control Register */
39#define ESDHC_PROCTL 0x28
yangbo luea356452017-04-20 16:14:41 +080040#define ESDHC_VOLT_SEL 0x00000400
yangbo lua6b44882016-12-26 17:46:29 +080041#define ESDHC_CTRL_4BITBUS (0x1 << 1)
42#define ESDHC_CTRL_8BITBUS (0x2 << 1)
43#define ESDHC_CTRL_BUSWIDTH_MASK (0x3 << 1)
44#define ESDHC_HOST_CONTROL_RES 0x01
Wolfram Sang80872e22010-10-15 12:21:03 +020045
yangbo lua6b44882016-12-26 17:46:29 +080046/* System Control Register */
47#define ESDHC_SYSTEM_CONTROL 0x2c
48#define ESDHC_CLOCK_MASK 0x0000fff0
49#define ESDHC_PREDIV_SHIFT 8
50#define ESDHC_DIVIDER_SHIFT 4
yangbo lue87d2db2016-12-26 17:46:30 +080051#define ESDHC_CLOCK_SDCLKEN 0x00000008
yangbo lua6b44882016-12-26 17:46:29 +080052#define ESDHC_CLOCK_PEREN 0x00000004
53#define ESDHC_CLOCK_HCKEN 0x00000002
54#define ESDHC_CLOCK_IPGEN 0x00000001
55
Yangbo Lu22dc1322019-10-09 15:41:40 +080056/* System Control 2 Register */
57#define ESDHC_SYSTEM_CONTROL_2 0x3c
58#define ESDHC_SMPCLKSEL 0x00800000
59#define ESDHC_EXTN 0x00400000
60
yangbo lu2f3110c2017-08-15 10:17:03 +080061/* Host Controller Capabilities Register 2 */
62#define ESDHC_CAPABILITIES_1 0x114
63
yangbo luba49cbd2017-04-20 16:14:42 +080064/* Tuning Block Control Register */
65#define ESDHC_TBCTL 0x120
Yangbo Lu54e08d92018-11-23 11:15:34 +080066#define ESDHC_HS400_WNDW_ADJUST 0x00000040
67#define ESDHC_HS400_MODE 0x00000010
yangbo luba49cbd2017-04-20 16:14:42 +080068#define ESDHC_TB_EN 0x00000004
Yangbo Lu22dc1322019-10-09 15:41:40 +080069#define ESDHC_TB_MODE_MASK 0x00000003
70#define ESDHC_TB_MODE_SW 0x00000003
71#define ESDHC_TB_MODE_3 0x00000002
72
73#define ESDHC_TBSTAT 0x124
74
Yinbo Zhub1f378a2018-08-23 16:48:32 +080075#define ESDHC_TBPTR 0x128
Yangbo Lu22dc1322019-10-09 15:41:40 +080076#define ESDHC_WNDW_STRT_PTR_SHIFT 8
77#define ESDHC_WNDW_STRT_PTR_MASK (0x7f << 8)
78#define ESDHC_WNDW_END_PTR_MASK 0x7f
yangbo luba49cbd2017-04-20 16:14:42 +080079
Yangbo Lu54e08d92018-11-23 11:15:34 +080080/* SD Clock Control Register */
81#define ESDHC_SDCLKCTL 0x144
82#define ESDHC_LPBK_CLK_SEL 0x80000000
83#define ESDHC_CMD_CLK_CTL 0x00008000
84
85/* SD Timing Control Register */
86#define ESDHC_SDTIMNGCTL 0x148
87#define ESDHC_FLW_CTL_BG 0x00008000
88
89/* DLL Config 0 Register */
90#define ESDHC_DLLCFG0 0x160
91#define ESDHC_DLL_ENABLE 0x80000000
Yangbo Lu011fde42020-10-20 16:11:16 +080092#define ESDHC_DLL_RESET 0x40000000
Yangbo Lu54e08d92018-11-23 11:15:34 +080093#define ESDHC_DLL_FREQ_SEL 0x08000000
94
Yangbo Lu48e304c2018-11-23 11:15:37 +080095/* DLL Config 1 Register */
96#define ESDHC_DLLCFG1 0x164
97#define ESDHC_DLL_PD_PULSE_STRETCH_SEL 0x80000000
98
Yangbo Lu54e08d92018-11-23 11:15:34 +080099/* DLL Status 0 Register */
100#define ESDHC_DLLSTAT0 0x170
101#define ESDHC_DLL_STS_SLV_LOCK 0x08000000
102
yangbo lua6b44882016-12-26 17:46:29 +0800103/* Control Register for DMA transfer */
104#define ESDHC_DMA_SYSCTL 0x40c
yangbo lu19c3a0e2017-04-20 16:14:40 +0800105#define ESDHC_PERIPHERAL_CLK_SEL 0x00080000
yangbo luba49cbd2017-04-20 16:14:42 +0800106#define ESDHC_FLUSH_ASYNC_FIFO 0x00040000
yangbo lua6b44882016-12-26 17:46:29 +0800107#define ESDHC_DMA_SNOOP 0x00000040
Wolfram Sang80872e22010-10-15 12:21:03 +0200108
Wolfram Sang80872e22010-10-15 12:21:03 +0200109#endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */