Thomas Gleixner | 84a14ae | 2019-05-28 09:57:07 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 2 | /* |
| 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 Lu | 011fde4 | 2020-10-20 16:11:16 +0800 | [diff] [blame] | 8 | * Copyright 2020 NXP |
Wolfram Sang | 30e1028 | 2020-05-02 16:28:25 +0200 | [diff] [blame] | 9 | * Author: Wolfram Sang <kernel@pengutronix.de> |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 10 | */ |
| 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ébaudeau | cbb4509 | 2017-05-30 11:14:08 +0200 | [diff] [blame] | 20 | SDHCI_QUIRK_32BIT_DMA_ADDR | \ |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 21 | SDHCI_QUIRK_NO_BUSY_IRQ | \ |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 22 | SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | \ |
Yangbo Lu | 67b589a | 2015-07-10 11:42:37 +0800 | [diff] [blame] | 23 | SDHCI_QUIRK_PIO_NEEDS_DELAY | \ |
| 24 | SDHCI_QUIRK_NO_HISPD_BIT) |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 25 | |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 26 | /* pltfm-specific */ |
| 27 | #define ESDHC_HOST_CONTROL_LE 0x20 |
| 28 | |
Oded Gabbay | 66b50a0 | 2013-06-27 12:00:05 -0400 | [diff] [blame] | 29 | /* |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 30 | * eSDHC register definition |
Oded Gabbay | 66b50a0 | 2013-06-27 12:00:05 -0400 | [diff] [blame] | 31 | */ |
Oded Gabbay | 66b50a0 | 2013-06-27 12:00:05 -0400 | [diff] [blame] | 32 | |
yangbo lu | e87d2db | 2016-12-26 17:46:30 +0800 | [diff] [blame] | 33 | /* Present State Register */ |
| 34 | #define ESDHC_PRSSTAT 0x24 |
Haibo Chen | f581e90 | 2020-02-19 16:25:50 +0800 | [diff] [blame] | 35 | #define ESDHC_CLOCK_GATE_OFF 0x00000080 |
yangbo lu | e87d2db | 2016-12-26 17:46:30 +0800 | [diff] [blame] | 36 | #define ESDHC_CLOCK_STABLE 0x00000008 |
| 37 | |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 38 | /* Protocol Control Register */ |
| 39 | #define ESDHC_PROCTL 0x28 |
yangbo lu | ea35645 | 2017-04-20 16:14:41 +0800 | [diff] [blame] | 40 | #define ESDHC_VOLT_SEL 0x00000400 |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 41 | #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 Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 45 | |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 46 | /* 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 lu | e87d2db | 2016-12-26 17:46:30 +0800 | [diff] [blame] | 51 | #define ESDHC_CLOCK_SDCLKEN 0x00000008 |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 52 | #define ESDHC_CLOCK_PEREN 0x00000004 |
| 53 | #define ESDHC_CLOCK_HCKEN 0x00000002 |
| 54 | #define ESDHC_CLOCK_IPGEN 0x00000001 |
| 55 | |
Yangbo Lu | 22dc132 | 2019-10-09 15:41:40 +0800 | [diff] [blame] | 56 | /* System Control 2 Register */ |
| 57 | #define ESDHC_SYSTEM_CONTROL_2 0x3c |
| 58 | #define ESDHC_SMPCLKSEL 0x00800000 |
| 59 | #define ESDHC_EXTN 0x00400000 |
| 60 | |
yangbo lu | 2f3110c | 2017-08-15 10:17:03 +0800 | [diff] [blame] | 61 | /* Host Controller Capabilities Register 2 */ |
| 62 | #define ESDHC_CAPABILITIES_1 0x114 |
| 63 | |
yangbo lu | ba49cbd | 2017-04-20 16:14:42 +0800 | [diff] [blame] | 64 | /* Tuning Block Control Register */ |
| 65 | #define ESDHC_TBCTL 0x120 |
Yangbo Lu | 54e08d9 | 2018-11-23 11:15:34 +0800 | [diff] [blame] | 66 | #define ESDHC_HS400_WNDW_ADJUST 0x00000040 |
| 67 | #define ESDHC_HS400_MODE 0x00000010 |
yangbo lu | ba49cbd | 2017-04-20 16:14:42 +0800 | [diff] [blame] | 68 | #define ESDHC_TB_EN 0x00000004 |
Yangbo Lu | 22dc132 | 2019-10-09 15:41:40 +0800 | [diff] [blame] | 69 | #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 Zhu | b1f378a | 2018-08-23 16:48:32 +0800 | [diff] [blame] | 75 | #define ESDHC_TBPTR 0x128 |
Yangbo Lu | 22dc132 | 2019-10-09 15:41:40 +0800 | [diff] [blame] | 76 | #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 lu | ba49cbd | 2017-04-20 16:14:42 +0800 | [diff] [blame] | 79 | |
Yangbo Lu | 54e08d9 | 2018-11-23 11:15:34 +0800 | [diff] [blame] | 80 | /* 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 Lu | 011fde4 | 2020-10-20 16:11:16 +0800 | [diff] [blame] | 92 | #define ESDHC_DLL_RESET 0x40000000 |
Yangbo Lu | 54e08d9 | 2018-11-23 11:15:34 +0800 | [diff] [blame] | 93 | #define ESDHC_DLL_FREQ_SEL 0x08000000 |
| 94 | |
Yangbo Lu | 48e304c | 2018-11-23 11:15:37 +0800 | [diff] [blame] | 95 | /* DLL Config 1 Register */ |
| 96 | #define ESDHC_DLLCFG1 0x164 |
| 97 | #define ESDHC_DLL_PD_PULSE_STRETCH_SEL 0x80000000 |
| 98 | |
Yangbo Lu | 54e08d9 | 2018-11-23 11:15:34 +0800 | [diff] [blame] | 99 | /* DLL Status 0 Register */ |
| 100 | #define ESDHC_DLLSTAT0 0x170 |
| 101 | #define ESDHC_DLL_STS_SLV_LOCK 0x08000000 |
| 102 | |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 103 | /* Control Register for DMA transfer */ |
| 104 | #define ESDHC_DMA_SYSCTL 0x40c |
yangbo lu | 19c3a0e | 2017-04-20 16:14:40 +0800 | [diff] [blame] | 105 | #define ESDHC_PERIPHERAL_CLK_SEL 0x00080000 |
yangbo lu | ba49cbd | 2017-04-20 16:14:42 +0800 | [diff] [blame] | 106 | #define ESDHC_FLUSH_ASYNC_FIFO 0x00040000 |
yangbo lu | a6b4488 | 2016-12-26 17:46:29 +0800 | [diff] [blame] | 107 | #define ESDHC_DMA_SNOOP 0x00000040 |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 108 | |
Wolfram Sang | 80872e2 | 2010-10-15 12:21:03 +0200 | [diff] [blame] | 109 | #endif /* _DRIVERS_MMC_SDHCI_ESDHC_H */ |