[PATCH 3/3] drivers/mci: add PXA host controller
Sascha Hauer
s.hauer at pengutronix.de
Wed Dec 7 03:49:44 EST 2011
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 at 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 |
More information about the barebox
mailing list