Commit 33c4c6b6 authored by David Brownell's avatar David Brownell Committed by Tony Lindgren

[PATCH] ARM: OMAP: Add bits of SD support that depend on new APIs

Add bits of SD support that depend on new APIs:

 - detect the readonly slider on the cards;
 - report when the hardware supports 4-bit wide reads;
 - enable 4-bit reads when the upper layer put the card into that mode
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent f9820dd3
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Copyright (C) 2004 Nokia Corporation * Copyright (C) 2004 Nokia Corporation
* Written by Tuukka Tikkanen and Juha Yrjl <juha.yrjola@nokia.com> * Written by Tuukka Tikkanen and Juha Yrjl <juha.yrjola@nokia.com>
* Misc hacks here and there by Tony Lindgren <tony@atomide.com> * Misc hacks here and there by Tony Lindgren <tony@atomide.com>
* Other hacks (DMA, SD, etc) by David Brownell
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
...@@ -767,9 +768,6 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data) ...@@ -767,9 +768,6 @@ static void mmc_omap_dma_cb(int lch, u16 ch_status, void *data)
host->sg_idx++; host->sg_idx++;
if (host->sg_idx < host->sg_len) { if (host->sg_idx < host->sg_len) {
/* REVISIT we only checked the first segment
* for being a dma candidate ...
*/
mmc_omap_prepare_dma(host, host->data); mmc_omap_prepare_dma(host, host->data);
omap_start_dma(host->dma_ch); omap_start_dma(host->dma_ch);
} else } else
...@@ -1089,9 +1087,10 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1089,9 +1087,10 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (dsor > 250) if (dsor > 250)
dsor = 250; dsor = 250;
dsor++; dsor++;
}
/* REVISIT: if (ios->bus_width == MMC_BUS_WIDTH_4) dsor |= 1 << 15; */ if (ios->bus_width == MMC_BUS_WIDTH_4)
dsor |= 1 << 15;
}
switch (ios->power_mode) { switch (ios->power_mode) {
case MMC_POWER_OFF: case MMC_POWER_OFF:
...@@ -1132,9 +1131,17 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1132,9 +1131,17 @@ static void mmc_omap_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
clk_unuse(host->fclk); clk_unuse(host->fclk);
} }
static int mmc_omap_get_ro(struct mmc_host *mmc)
{
struct mmc_omap_host *host = mmc_priv(mmc);
return host->wp_pin && omap_get_gpio_datain(host->wp_pin);
}
static struct mmc_host_ops mmc_omap_ops = { static struct mmc_host_ops mmc_omap_ops = {
.request = mmc_omap_request, .request = mmc_omap_request,
.set_ios = mmc_omap_set_ios, .set_ios = mmc_omap_set_ios,
.get_ro = mmc_omap_get_ro,
}; };
static int __init mmc_omap_probe(struct device *dev) static int __init mmc_omap_probe(struct device *dev)
...@@ -1192,9 +1199,7 @@ static int __init mmc_omap_probe(struct device *dev) ...@@ -1192,9 +1199,7 @@ static int __init mmc_omap_probe(struct device *dev)
goto out; goto out;
} }
/* REVISIT: SD-only support, when core merged /* REVISIT:
* - if (minfo->wire4) mmc->caps |= MMC_CAP_4_BIT_DATA;
* - mmc_omap_ops.get_ro uses wp_pin to sense slider
* Also, use minfo->cover to decide how to manage * Also, use minfo->cover to decide how to manage
* the card detect sensing. * the card detect sensing.
*/ */
...@@ -1212,6 +1217,9 @@ static int __init mmc_omap_probe(struct device *dev) ...@@ -1212,6 +1217,9 @@ static int __init mmc_omap_probe(struct device *dev)
host->irq = pdev->resource[1].start; host->irq = pdev->resource[1].start;
host->base = (void __iomem *)pdev->resource[0].start; host->base = (void __iomem *)pdev->resource[0].start;
if (minfo->wire4)
mmc->caps |= MMC_CAP_4_BIT_DATA;
mmc->ops = &mmc_omap_ops; mmc->ops = &mmc_omap_ops;
mmc->f_min = 400000; mmc->f_min = 400000;
mmc->f_max = 24000000; mmc->f_max = 24000000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment