aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.h
diff options
context:
space:
mode:
authorArindam Nath <arindam.nath@amd.com>2011-05-05 02:48:57 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 21:04:38 -0400
commitf2119df6b764609af4baceb68caf1e848c1c8aa7 (patch)
tree3c234b150d7add419cd07e15929b94b8c3baec63 /drivers/mmc/host/sdhci.h
parentcb87ea28ed9e75a41eb456bfcb547b4e6f10e750 (diff)
mmc: sd: add support for signal voltage switch procedure
Host Controller v3.00 adds another Capabilities register. Apart from other things, this new register indicates whether the Host Controller supports SDR50, SDR104, and DDR50 UHS-I modes. The spec doesn't mention about explicit support for SDR12 and SDR25 UHS-I modes, so the Host Controller v3.00 should support them by default. Also if the controller supports SDR104 mode, it will also support SDR50 mode as well. So depending on the host support, we set the corresponding MMC_CAP_* flags. One more new register. Host Control2 is added in v3.00, which is used during Signal Voltage Switch procedure described below. Since as per v3.00 spec, UHS-I supported hosts should set S18R to 1, we set S18R (bit 24) of OCR before sending ACMD41. We also need to set XPC (bit 28) of OCR in case the host can supply >150mA. This support is indicated by the Maximum Current Capabilities register of the Host Controller. If the response of ACMD41 has both CCS and S18A set, we start the signal voltage switch procedure, which if successfull, will switch the card from 3.3V signalling to 1.8V signalling. Signal voltage switch procedure adds support for a new command CMD11 in the Physical Layer Spec v3.01. As part of this procedure, we need to set 1.8V Signalling Enable (bit 3) of Host Control2 register, which if remains set after 5ms, means the switch to 1.8V signalling is successfull. Otherwise, we clear bit 24 of OCR and retry the initialization sequence. When we remove the card, and insert the same or another card, we need to make sure that we start with 3.3V signalling voltage. So we call mmc_set_signal_voltage() with MMC_SIGNAL_VOLTAGE_330 set so that we are back to 3.3V signalling voltage before we actually start initializing the card. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/host/sdhci.h')
-rw-r--r--drivers/mmc/host/sdhci.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index c6e25a76d269..5cba2fea46e0 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -68,6 +68,8 @@
68#define SDHCI_DATA_AVAILABLE 0x00000800 68#define SDHCI_DATA_AVAILABLE 0x00000800
69#define SDHCI_CARD_PRESENT 0x00010000 69#define SDHCI_CARD_PRESENT 0x00010000
70#define SDHCI_WRITE_PROTECT 0x00080000 70#define SDHCI_WRITE_PROTECT 0x00080000
71#define SDHCI_DATA_LVL_MASK 0x00F00000
72#define SDHCI_DATA_LVL_SHIFT 20
71 73
72#define SDHCI_HOST_CONTROL 0x28 74#define SDHCI_HOST_CONTROL 0x28
73#define SDHCI_CTRL_LED 0x01 75#define SDHCI_CTRL_LED 0x01
@@ -146,7 +148,8 @@
146 148
147#define SDHCI_ACMD12_ERR 0x3C 149#define SDHCI_ACMD12_ERR 0x3C
148 150
149/* 3E-3F reserved */ 151#define SDHCI_HOST_CONTROL2 0x3E
152#define SDHCI_CTRL_VDD_180 0x0008
150 153
151#define SDHCI_CAPABILITIES 0x40 154#define SDHCI_CAPABILITIES 0x40
152#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F 155#define SDHCI_TIMEOUT_CLK_MASK 0x0000003F
@@ -167,9 +170,20 @@
167#define SDHCI_CAN_VDD_180 0x04000000 170#define SDHCI_CAN_VDD_180 0x04000000
168#define SDHCI_CAN_64BIT 0x10000000 171#define SDHCI_CAN_64BIT 0x10000000
169 172
173#define SDHCI_SUPPORT_SDR50 0x00000001
174#define SDHCI_SUPPORT_SDR104 0x00000002
175#define SDHCI_SUPPORT_DDR50 0x00000004
176
170#define SDHCI_CAPABILITIES_1 0x44 177#define SDHCI_CAPABILITIES_1 0x44
171 178
172#define SDHCI_MAX_CURRENT 0x48 179#define SDHCI_MAX_CURRENT 0x48
180#define SDHCI_MAX_CURRENT_330_MASK 0x0000FF
181#define SDHCI_MAX_CURRENT_330_SHIFT 0
182#define SDHCI_MAX_CURRENT_300_MASK 0x00FF00
183#define SDHCI_MAX_CURRENT_300_SHIFT 8
184#define SDHCI_MAX_CURRENT_180_MASK 0xFF0000
185#define SDHCI_MAX_CURRENT_180_SHIFT 16
186#define SDHCI_MAX_CURRENT_MULTIPLIER 4
173 187
174/* 4C-4F reserved for more max current */ 188/* 4C-4F reserved for more max current */
175 189