summaryrefslogtreecommitdiffstats
path: root/drivers/mci/atmel_mci.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2013-01-25 16:17:45 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-01-25 19:52:43 +0100
commitbe42bafdd0deb88535a8a41f5c77bb568178973b (patch)
treea2802b843a8d0c6b83af747544c231acc85c9da0 /drivers/mci/atmel_mci.c
parentc934d62029be3454e4c16073367b8405843e46a4 (diff)
downloadbarebox-be42bafdd0deb88535a8a41f5c77bb568178973b.tar.gz
barebox-be42bafdd0deb88535a8a41f5c77bb568178973b.tar.xz
atmel_mci: update the SD/SDIO Card Register at request time
as we need to reset the IP Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci/atmel_mci.c')
-rw-r--r--drivers/mci/atmel_mci.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index 3f24217833..8ad0e8a41d 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -51,6 +51,7 @@ struct atmel_mci {
unsigned long bus_hz;
u32 mode_reg;
u32 cfg_reg;
+ u32 sdc_reg;
bool need_reset;
};
@@ -382,21 +383,20 @@ static void atmci_set_ios(struct mci_host *mci, struct mci_ios *ios)
dev_dbg(host->hw_dev, "atmel_mci_set_ios: bus_width=%d clk=%d\n",
ios->bus_width, ios->clock);
+ host->sdc_reg &= ~ATMCI_SDCBUS_MASK;
switch (ios->bus_width) {
case MMC_BUS_WIDTH_4:
- atmci_writel(host, ATMCI_SDCR, ATMCI_SDCBUS_4BIT);
+ host->sdc_reg |= ATMCI_SDCBUS_4BIT;
break;
case MMC_BUS_WIDTH_8:
- atmci_writel(host, ATMCI_SDCR, ATMCI_SDCBUS_8BIT);
+ host->sdc_reg |= ATMCI_SDCBUS_8BIT;
break;
case MMC_BUS_WIDTH_1:
- atmci_writel(host, ATMCI_SDCR, ATMCI_SDCBUS_1BIT);
+ host->sdc_reg |= ATMCI_SDCBUS_1BIT;
break;
default:
return;
}
- atmci_writel(host, ATMCI_SDCR, atmci_readl(host, ATMCI_SDCR)
- | host->slot_b);
if (ios->clock) {
atmci_set_clk_rate(host, ios->clock);
@@ -437,6 +437,7 @@ static int atmci_request(struct mci_host *mci, struct mci_cmd *cmd, struct mci_d
atmci_writel(host, ATMCI_CFG, host->cfg_reg);
host->need_reset = false;
}
+ atmci_writel(host, ATMCI_SDCR, host->sdc_reg);
if (cmd->resp_type != MMC_RSP_NONE)
cmdat |= ATMCI_CMDR_MAXLAT_64CYC;
@@ -571,6 +572,11 @@ static int atmci_probe(struct device_d *hw_dev)
if (host->caps.has_highspeed)
host->mci.host_caps |= MMC_MODE_HS;
+ if (host->slot_b)
+ host->sdc_reg = ATMCI_SDCSEL_SLOT_B;
+ else
+ host->sdc_reg = ATMCI_SDCSEL_SLOT_A;
+
mci_register(&host->mci);
return 0;