Purushotam Kumar <[email protected]> writes:
> Signed-off-by: Purushotam Kumar <[email protected]>
Please update the description to summarize the changes.
Kevin
> ---
> drivers/mmc/host/davinci_mmc.c | 33 +++++++++++++++++++++++----------
> 1 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index b034af6..c631c91 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -816,11 +816,23 @@ static void mmc_davinci_set_ios(struct mmc_host *mmc,
> struct mmc_ios *ios)
>
> host->bus_mode = ios->bus_mode;
> if (ios->power_mode == MMC_POWER_UP) {
> + unsigned long timeout = jiffies + msecs_to_jiffies(50);
> + bool lose = true;
> +
> /* Send clock cycles, poll completion */
> writel(0, host->base + DAVINCI_MMCARGHL);
> writel(MMCCMD_INITCK, host->base + DAVINCI_MMCCMD);
> - while (!(readl(host->base + DAVINCI_MMCST0) & MMCST0_RSPDNE))
> + while (time_before(jiffies, timeout)) {
> + u32 tmp = readl(host->base + DAVINCI_MMCST0);
> +
> + if (tmp & MMCST0_RSPDNE) {
> + lose = false;
> + break;
> + }
> cpu_relax();
> + }
> + if (lose)
> + dev_warn(mmc_dev(host->mmc), "powerup timeout\n");
> }
>
> /* FIXME on power OFF, reset things ... */
> @@ -908,7 +920,13 @@ static inline int handle_core_command(
> unsigned int qstatus = status;
> struct mmc_data *data = host->data;
>
> - /* handle FIFO first when using PIO for data */
> + /* handle FIFO first when using PIO for data.
> + * bytes_left will decrease to zero as I/O progress and status will
> + * read zero over iteration because this controller status
> + * register(MMCST0) reports any status only once and it is cleared
> + * by read. So, it is not unbouned loop even in the case of
> + * non-dma.
> + */
> while (host->bytes_left && (status & (MMCST0_DXRDY | MMCST0_DRRDY))) {
> davinci_fifo_data_trans(host, rw_threshold);
> status = readl(host->base + DAVINCI_MMCST0);
> @@ -1018,16 +1036,11 @@ static irqreturn_t mmc_davinci_irq(int irq, void
> *dev_id)
> "Spurious interrupt 0x%04x\n", status);
> /* Disable the interrupt from mmcsd */
> writel(0, host->base + DAVINCI_MMCIM);
> - return IRQ_HANDLED;
> + return IRQ_NONE;
> }
>
> - do {
> - status = readl(host->base + DAVINCI_MMCST0);
> - if (status == 0)
> - break;
> - if (handle_core_command(host, status))
> - break;
> - } while (1);
> + status = readl(host->base + DAVINCI_MMCST0);
> + handle_core_command(host, status);
> return IRQ_HANDLED;
> }
>
> --
> 1.5.6
>
> _______________________________________________
> Davinci-linux-open-source mailing list
> [email protected]
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source