Re: [PATCH v5] MMC: Add JZ4740 mmc driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2010-07-13 at 00:20 +0200, Lars-Peter Clausen wrote:
> This patch adds support for the mmc controller on JZ4740 SoCs.
> +static bool jz4740_mmc_write_data(struct jz4740_mmc_host *host,
> +	struct mmc_data *data)
> +{
> +	struct sg_mapping_iter *miter = &host->miter;
> +	uint32_t *buf;
> +	bool timeout;
> +	size_t i, j;
> +
> +	while (sg_miter_next(miter)) {
> +		buf = miter->addr;
> +		i = miter->length / 4;
> +		j = i / 8;
> +		i = i & 0x7;
> +		while (j) {
> +			timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
> +			if (unlikely(timeout))
> +				goto poll_timeout;
> +
> +			writel(buf[0], host->base + JZ_REG_MMC_TXFIFO);

Perhaps it'd be better to use a temporary for
host->base + JZ_REG_MMC_TXFIFO

> +			writel(buf[1], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[2], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[3], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[4], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[5], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[6], host->base + JZ_REG_MMC_TXFIFO);
> +			writel(buf[7], host->base + JZ_REG_MMC_TXFIFO);
> +			buf += 8;
> +			--j;
> +		}
> +		if (unlikely(i)) {
> +			timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
> +			if (unlikely(timeout))
> +				goto poll_timeout;
> +
> +			while (i) {
> +				writel(*buf, host->base + JZ_REG_MMC_TXFIFO);
> +				++buf;
> +				--i;
> +			}
> +		}
> +		data->bytes_xfered += miter->length;
> +	}


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux