From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/3] mci: imx-esdhc: Replace printf with dev_*
Date: Wed, 13 May 2015 08:20:37 +0200 [thread overview]
Message-ID: <1431498037-31789-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1431498037-31789-1-git-send-email-s.hauer@pengutronix.de>
This replaces printf with dev_* since a struct device_d * is
available.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/imx-esdhc.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index f310213..6caf165 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -115,7 +115,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
while (!(esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_BREN)
&& --timeout);
if (timeout <= 0) {
- printf("\nData Read Failed in PIO Mode.");
+ dev_err(host->dev, "Data Read Failed\n");
return -ETIMEDOUT;
}
while (size && (!(irqstat & IRQSTAT_TC))) {
@@ -138,7 +138,7 @@ esdhc_pio_read_write(struct mci_host *mci, struct mci_data *data)
while (!(esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_BWEN)
&& --timeout);
if (timeout <= 0) {
- printf("\nData Write Failed in PIO Mode.");
+ dev_err(host->dev, "Data Write Failed\n");
return -ETIMEDOUT;
}
while (size && (!(irqstat & IRQSTAT_TC))) {
@@ -164,11 +164,8 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data)
if (IS_ENABLED(CONFIG_MCI_IMX_ESDHC_PIO)) {
if (!(data->flags & MMC_DATA_READ)) {
- if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0) {
- printf("\nThe SD card is locked. "
- "Can not write to a locked card.\n\n");
- return -ETIMEDOUT;
- }
+ if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0)
+ goto err_locked;
esdhc_write32(regs + SDHCI_DMA_ADDRESS, (u32)data->src);
} else {
esdhc_write32(regs + SDHCI_DMA_ADDRESS, (u32)data->dest);
@@ -185,10 +182,8 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data)
} else {
if (wml_value > 0x80)
wml_value = 0x80;
- if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0) {
- printf("\nThe SD card is locked. Can not write to a locked card.\n\n");
- return -ETIMEDOUT;
- }
+ if ((esdhc_read32(regs + SDHCI_PRESENT_STATE) & PRSSTAT_WPSPL) == 0)
+ goto err_locked;
esdhc_clrsetbits32(regs + IMX_SDHCI_WML, WML_WR_WML_MASK,
wml_value << 16);
@@ -199,6 +194,11 @@ static int esdhc_setup_data(struct mci_host *mci, struct mci_data *data)
esdhc_write32(regs + SDHCI_BLOCK_SIZE__BLOCK_COUNT, data->blocks << 16 | data->blocksize);
return 0;
+
+err_locked:
+ dev_err(host->dev, "Can not write to locked card.\n\n");
+
+ return -ETIMEDOUT;
}
static int esdhc_do_data(struct mci_host *mci, struct mci_data *data)
@@ -512,8 +512,9 @@ static int esdhc_init(struct mci_host *mci, struct device_d *dev)
return ret;
}
-static int esdhc_reset(void __iomem *regs)
+static int esdhc_reset(struct fsl_esdhc_host *host)
{
+ void __iomem *regs = host->regs;
uint64_t start;
/* reset the controller */
@@ -527,7 +528,7 @@ static int esdhc_reset(void __iomem *regs)
& SYSCTL_RSTA))
break;
if (is_timeout(start, 100 * MSECOND)) {
- printf("MMC/SD: Reset never completed.\n");
+ dev_err(host->dev, "Reset never completed.\n");
return -EIO;
}
}
@@ -564,7 +565,7 @@ static int fsl_esdhc_probe(struct device_d *dev)
return PTR_ERR(host->regs);
/* First reset the eSDHC controller */
- ret = esdhc_reset(host->regs);
+ ret = esdhc_reset(host);
if (ret) {
free(host);
return ret;
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2015-05-13 6:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 6:20 [PATCH 1/3] mci: imx-esdhc: Use IS_ENABLED() instead of #ifdef Sascha Hauer
2015-05-13 6:20 ` [PATCH 2/3] mci: imx-esdhc: Check for errors in esdhc_pio_read_write Sascha Hauer
2015-05-13 6:20 ` 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=1431498037-31789-3-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