|
@@ -1413,6 +1413,27 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
|
|
|
spin_unlock_irqrestore(&host->lock, flags);
|
|
|
}
|
|
|
|
|
|
+void sdhci_set_bus_width(struct sdhci_host *host, int width)
|
|
|
+{
|
|
|
+ u8 ctrl;
|
|
|
+
|
|
|
+ ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
|
|
|
+ if (width == MMC_BUS_WIDTH_8) {
|
|
|
+ ctrl &= ~SDHCI_CTRL_4BITBUS;
|
|
|
+ if (host->version >= SDHCI_SPEC_300)
|
|
|
+ ctrl |= SDHCI_CTRL_8BITBUS;
|
|
|
+ } else {
|
|
|
+ if (host->version >= SDHCI_SPEC_300)
|
|
|
+ ctrl &= ~SDHCI_CTRL_8BITBUS;
|
|
|
+ if (width == MMC_BUS_WIDTH_4)
|
|
|
+ ctrl |= SDHCI_CTRL_4BITBUS;
|
|
|
+ else
|
|
|
+ ctrl &= ~SDHCI_CTRL_4BITBUS;
|
|
|
+ }
|
|
|
+ sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(sdhci_set_bus_width);
|
|
|
+
|
|
|
static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
|
|
|
{
|
|
|
unsigned long flags;
|
|
@@ -1458,29 +1479,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
|
|
|
if (host->ops->platform_send_init_74_clocks)
|
|
|
host->ops->platform_send_init_74_clocks(host, ios->power_mode);
|
|
|
|
|
|
- /*
|
|
|
- * If your platform has 8-bit width support but is not a v3 controller,
|
|
|
- * or if it requires special setup code, you should implement that in
|
|
|
- * platform_bus_width().
|
|
|
- */
|
|
|
- if (host->ops->platform_bus_width) {
|
|
|
- host->ops->platform_bus_width(host, ios->bus_width);
|
|
|
- } else {
|
|
|
- ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
|
|
|
- if (ios->bus_width == MMC_BUS_WIDTH_8) {
|
|
|
- ctrl &= ~SDHCI_CTRL_4BITBUS;
|
|
|
- if (host->version >= SDHCI_SPEC_300)
|
|
|
- ctrl |= SDHCI_CTRL_8BITBUS;
|
|
|
- } else {
|
|
|
- if (host->version >= SDHCI_SPEC_300)
|
|
|
- ctrl &= ~SDHCI_CTRL_8BITBUS;
|
|
|
- if (ios->bus_width == MMC_BUS_WIDTH_4)
|
|
|
- ctrl |= SDHCI_CTRL_4BITBUS;
|
|
|
- else
|
|
|
- ctrl &= ~SDHCI_CTRL_4BITBUS;
|
|
|
- }
|
|
|
- sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
|
|
|
- }
|
|
|
+ host->ops->set_bus_width(host, ios->bus_width);
|
|
|
|
|
|
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
|
|
|
|