From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/5] mci atmel: implement card_present callback
Date: Sun, 20 Jan 2013 10:58:43 +0100 [thread overview]
Message-ID: <1358675923-13628-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1358675923-13628-1-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/atmel_mci.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/mci/atmel_mci.c b/drivers/mci/atmel_mci.c
index 4065355..222cd4a 100644
--- a/drivers/mci/atmel_mci.c
+++ b/drivers/mci/atmel_mci.c
@@ -331,18 +331,26 @@ static int atmel_start_cmd(struct atmel_mci_host *host, struct mci_cmd *cmd,
return 0;
}
-/** init the host interface */
-static int mci_reset(struct mci_host *mci, struct device_d *mci_dev)
+
+static int mci_card_present(struct mci_host *mci)
{
- int ret;
struct atmel_mci_host *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 mci_reset(struct mci_host *mci, struct device_d *mci_dev)
+{
+ struct atmel_mci_host *host = to_mci_host(mci);
clk_enable(host->clk);
atmel_mci_reset(host);
@@ -454,6 +462,7 @@ static int mci_probe(struct device_d *hw_dev)
host->mci.send_cmd = mci_request;
host->mci.set_ios = mci_set_ios;
host->mci.init = mci_reset;
+ host->mci.card_present = mci_card_present;
host->mci.hw_dev = hw_dev;
host->mci.host_caps = pd->host_caps;
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2013-01-20 9:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-20 9:58 [PATCH] MMC/SD improvements Sascha Hauer
2013-01-20 9:58 ` [PATCH 1/5] mci: return 0 for probe parameter even when already initialized Sascha Hauer
2013-01-20 9:58 ` [PATCH 2/5] mci: Always add probe parameter for cards Sascha Hauer
2013-01-20 9:58 ` [PATCH 3/5] mci: Add card_present callback Sascha Hauer
2013-01-20 9:58 ` [PATCH 4/5] mci i.MX esdhc: implement " Sascha Hauer
2013-01-20 9:58 ` Sascha Hauer [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1358675923-13628-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox