mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] drivers/mci: add PXA host controller
Date: Wed, 7 Dec 2011 09:49:44 +0100	[thread overview]
Message-ID: <20111207084944.GL27267@pengutronix.de> (raw)
In-Reply-To: <1323202318-17697-3-git-send-email-robert.jarzmik@free.fr>

Hi Robert,

On Tue, Dec 06, 2011 at 09:11:58PM +0100, Robert Jarzmik wrote:
> Add a simple PIO based host controller for MMC and SD cards
> on PXA SoCs. Reads and writes are available, and no usage is
> made of DMA or IRQs.
> SPI mode is not supported yet.
> 
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
>  drivers/mci/Kconfig  |    7 +
>  drivers/mci/Makefile |    1 +
>  drivers/mci/pxamci.c |  357 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/mci/pxamci.h |   99 ++++++++++++++
>  4 files changed, 464 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/mci/pxamci.c
>  create mode 100644 drivers/mci/pxamci.h
> 
> +
> +static void pxamci_stop_clock(struct pxamci_host *host)
> +{
> +	unsigned long timeout = 10000;
> +	unsigned int v;
> +
> +	if (mmc_readl(MMC_STAT) & STAT_CLK_EN) {
> +		writel(STOP_CLOCK, host->base + MMC_STRPCL);
> +
> +		do {
> +			v = mmc_readl(MMC_STAT);
> +			if (!(v & STAT_CLK_EN))
> +				break;
> +			udelay(1);
> +		} while (timeout--);

please use this for timeout loops:

	uint64_t start = get_time_ns(void);

	while (!is_timeout(start, 10 * MSECOND)
		poll_something();

Otherwise the driver looks good to me.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-12-07  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 20:11 [PATCH 1/3] arm/mach-pxa: add MMC clock Robert Jarzmik
2011-12-06 20:11 ` [PATCH 2/3] arm/mach-pxa: add mci_pxa2xx file Robert Jarzmik
2011-12-06 20:11 ` [PATCH 3/3] drivers/mci: add PXA host controller Robert Jarzmik
2011-12-07  8:49   ` Sascha Hauer [this message]
2011-12-07 16:01     ` Robert Jarzmik
2011-12-07 16:41       ` Sascha Hauer

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=20111207084944.GL27267@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=robert.jarzmik@free.fr \
    /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