summaryrefslogtreecommitdiffstats
path: root/drivers/mci/atmel_mci.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:48:58 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-02-04 15:48:58 +0100
commit6eb49a5b1f2b09a723e3115b3911cebaf6d1ae23 (patch)
treed093c661a571ef24590a23ee21b36c768da16e2c /drivers/mci/atmel_mci.c
parent9c5172fac226c0dd1f0ea9c4095407f9643e2462 (diff)
parent20615ac8c9ea6ef14ee31bb01cfd8f9d0e9fbaef (diff)
downloadbarebox-6eb49a5b1f2b09a723e3115b3911cebaf6d1ae23.tar.gz
barebox-6eb49a5b1f2b09a723e3115b3911cebaf6d1ae23.tar.xz
Merge branch 'for-next/mci'
Conflicts: drivers/mci/atmel_mci.c
Diffstat (limited to 'drivers/mci/atmel_mci.c')
-rw-r--r--drivers/mci/atmel_mci.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index 9de079d31d..dbfb53cb42 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -355,18 +355,25 @@ static int atmci_start_cmd(struct atmel_mci *host, struct mci_cmd *cmd,
return 0;
}
-/** init the host interface */
-static int atmci_reset(struct mci_host *mci, struct device_d *mci_dev)
+static int atmci_card_present(struct mci_host *mci)
{
- int ret;
struct atmel_mci *host = to_mci_host(mci);
struct atmel_mci_platform_data *pd = host->hw_dev->platform_data;
+ int ret;
+
+ /* No gpio, assume card is present */
+ if (!gpio_is_valid(pd->detect_pin))
+ return 1;
ret = gpio_get_value(pd->detect_pin);
- dev_dbg(host->hw_dev, "card %sdetected\n", ret != 0 ? "not " : "");
- if (pd->detect_pin && ret == 1)
- return -ENODEV;
+ return ret == 0 ? 1 : 0;
+}
+
+/** init the host interface */
+static int atmci_reset(struct mci_host *mci, struct device_d *mci_dev)
+{
+ struct atmel_mci *host = to_mci_host(mci);
clk_enable(host->clk);
atmci_writel(host, ATMCI_DTOR, 0x7f);
@@ -554,6 +561,7 @@ static int atmci_probe(struct device_d *hw_dev)
host->mci.send_cmd = atmci_request;
host->mci.set_ios = atmci_set_ios;
host->mci.init = atmci_reset;
+ host->mci.card_present = atmci_card_present;
host->mci.hw_dev = hw_dev;
if (pd->bus_width >= 4)