Skip to content

Commit bd6a8c3

Browse files
Philip Rakitycjb
authored andcommitted
mmc: sdhci: Allow caps[1] to be set via SDHCI_QUIRK_MISSING_CAPS
Currently only the capability_0 register can be set if SDHCI_QUIRK_MISSING_CAPS is defined. This is a problem when the capability_1 register also needs changing. Use the quirk SDHCI_QUIRK_MISSING_CAPS to allow both registers to be set. Redefining caps[1] is useful when the board design does not support 1.8v vccq so UHS modes are not available. The code that calls sdhci_add_host can then detect this condition and adjust the caps so the UHS mode will not be attempted on UHS cards. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 4dc5a79 commit bd6a8c3

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎drivers/mmc/host/sdhci.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,7 @@ EXPORT_SYMBOL_GPL(sdhci_alloc_host);
25842584
int sdhci_add_host(struct sdhci_host *host)
25852585
{
25862586
struct mmc_host *mmc;
2587-
u32 caps[2];
2587+
u32 caps[2] = {0, 0};
25882588
u32 max_current_caps;
25892589
unsigned int ocr_avail;
25902590
int ret;
@@ -2614,8 +2614,10 @@ int sdhci_add_host(struct sdhci_host *host)
26142614
caps[0] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ? host->caps :
26152615
sdhci_readl(host, SDHCI_CAPABILITIES);
26162616

2617-
caps[1] = (host->version >= SDHCI_SPEC_300) ?
2618-
sdhci_readl(host, SDHCI_CAPABILITIES_1) : 0;
2617+
if (host->version >= SDHCI_SPEC_300)
2618+
caps[1] = (host->quirks & SDHCI_QUIRK_MISSING_CAPS) ?
2619+
host->caps1 :
2620+
sdhci_readl(host, SDHCI_CAPABILITIES_1);
26192621

26202622
if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
26212623
host->flags |= SDHCI_USE_SDMA;

‎include/linux/mmc/sdhci.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ struct sdhci_host {
155155

156156
struct timer_list timer; /* Timer for timeouts */
157157

158-
unsigned int caps; /* Alternative capabilities */
158+
unsigned int caps; /* Alternative CAPABILITY_0 */
159+
unsigned int caps1; /* Alternative CAPABILITY_1 */
159160

160161
unsigned int ocr_avail_sdio; /* OCR bit masks */
161162
unsigned int ocr_avail_sd;

0 commit comments

Comments
 (0)