Commit 5fe23c7f51def59f66bc6aeee988ef1a467a2c8c
Committed by
Pierre Ossman
1 parent
04ac2f46d6
Exists in
master
and in
7 other branches
sdhci: Add support for hosts that are only capable of 1-bit transfers
Some hosts (hardware configurations, or particular SD/MMC slots) may not support 4-bit bus. For example, on MPC8569E-MDS boards we can switch between serial (1-bit only) and nibble (4-bit) modes, thought we have to disable more peripherals to work in 4-bit mode. Along with some small core changes, this patch modifies sdhci-of driver, so that now it looks for "sdhci,1-bit-only" property in the device-tree, and if specified we enable a proper quirk. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Pierre Ossman <pierre@ossman.eu>
Showing 4 changed files with 11 additions and 1 deletions Side-by-side Diff
Documentation/powerpc/dts-bindings/fsl/esdhc.txt
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | - interrupts : should contain eSDHC interrupt. |
11 | 11 | - interrupt-parent : interrupt source phandle. |
12 | 12 | - clock-frequency : specifies eSDHC base clock frequency. |
13 | + - sdhci,1-bit-only : (optional) specifies that a controller can | |
14 | + only handle 1-bit data transfers. | |
13 | 15 | |
14 | 16 | Example: |
15 | 17 |
drivers/mmc/host/sdhci-of.c
... | ... | @@ -250,6 +250,9 @@ |
250 | 250 | host->ops = &sdhci_of_data->ops; |
251 | 251 | } |
252 | 252 | |
253 | + if (of_get_property(np, "sdhci,1-bit-only", NULL)) | |
254 | + host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; | |
255 | + | |
253 | 256 | clk = of_get_property(np, "clock-frequency", &size); |
254 | 257 | if (clk && size == sizeof(*clk) && *clk) |
255 | 258 | of_host->clock = *clk; |
drivers/mmc/host/sdhci.c
... | ... | @@ -1761,7 +1761,10 @@ |
1761 | 1761 | mmc->ops = &sdhci_ops; |
1762 | 1762 | mmc->f_min = host->max_clk / 256; |
1763 | 1763 | mmc->f_max = host->max_clk; |
1764 | - mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; | |
1764 | + mmc->caps = MMC_CAP_SDIO_IRQ; | |
1765 | + | |
1766 | + if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA)) | |
1767 | + mmc->caps |= MMC_CAP_4_BIT_DATA; | |
1765 | 1768 | |
1766 | 1769 | if (caps & SDHCI_CAN_DO_HISPD) |
1767 | 1770 | mmc->caps |= MMC_CAP_SD_HIGHSPEED; |
drivers/mmc/host/sdhci.h
... | ... | @@ -228,6 +228,8 @@ |
228 | 228 | #define SDHCI_QUIRK_FORCE_BLK_SZ_2048 (1<<20) |
229 | 229 | /* Controller cannot do multi-block transfers */ |
230 | 230 | #define SDHCI_QUIRK_NO_MULTIBLOCK (1<<21) |
231 | +/* Controller can only handle 1-bit data transfers */ | |
232 | +#define SDHCI_QUIRK_FORCE_1_BIT_DATA (1<<22) | |
231 | 233 | |
232 | 234 | int irq; /* Device IRQ */ |
233 | 235 | void __iomem * ioaddr; /* Mapped address */ |