summaryrefslogtreecommitdiffstats
path: root/drivers/mci/pxamci.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-08 15:49:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-09 12:40:11 +0100
commit0f9892cce8792b2d44b07ba8431c2876290e1ac1 (patch)
treed4efdfdf3a4a10849e0abcbdedbe78b5c421f4af /drivers/mci/pxamci.c
parent74b83f91198c8dd81ba3afac2b83f10723bd39b5 (diff)
downloadbarebox-0f9892cce8792b2d44b07ba8431c2876290e1ac1.tar.gz
barebox-0f9892cce8792b2d44b07ba8431c2876290e1ac1.tar.xz
mci core: replace discrete ios values with struct ios
As we'll need more arguments to set_ios over time put them in a struct mci_ios like the kernel does. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/pxamci.c')
-rw-r--r--drivers/mci/pxamci.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/mci/pxamci.c b/drivers/mci/pxamci.c
index 75b61f07b8..a22bdbabeb 100644
--- a/drivers/mci/pxamci.c
+++ b/drivers/mci/pxamci.c
@@ -274,15 +274,15 @@ static int pxamci_request(struct mci_host *mci, struct mci_cmd *cmd,
}
static void pxamci_set_ios(struct mci_host *mci, struct device_d *dev,
- unsigned bus_width, unsigned clock)
+ struct mci_ios *ios)
{
struct pxamci_host *host = to_pxamci(mci);
unsigned int clk_in = pxa_get_mmcclk();
int fact;
- mci_dbg("bus_width=%d, clock=%u\n", bus_width, clock);
- if (clock)
- fact = min_t(int, clk_in / clock, 1 << 6);
+ mci_dbg("bus_width=%d, clock=%u\n", ios->bus_width, ios->clock);
+ if (ios->clock)
+ fact = min_t(int, clk_in / ios->clock, 1 << 6);
else
fact = 1 << 6;
fact = max_t(int, fact, 1);
@@ -294,10 +294,17 @@ static void pxamci_set_ios(struct mci_host *mci, struct device_d *dev,
/* to handle (19.5MHz, 26MHz) */
host->clkrt = fls(fact) - 1;
- if (bus_width == 4)
+ switch (ios->bus_width) {
+ case MMC_BUS_WIDTH_4:
host->cmdat |= CMDAT_SD_4DAT;
- else
+ break;
+ case MMC_BUS_WIDTH_1:
host->cmdat &= ~CMDAT_SD_4DAT;
+ break;
+ default:
+ return;
+ }
+
host->cmdat |= CMDAT_INIT;
clk_enable();