public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Seungwon Jeon <tgih.jun@samsung.com>
To: 'Dmitry Shmidt' <dimitrysh@android.com>, linux-mmc@vger.kernel.org
Cc: 'Jaehoon Chung' <jh80.chung@samsung.com>,
	'Will Newton' <will.newton@imgtec.com>
Subject: RE: dw_mmc: New sdio CMD53 starts with non-empty FIFO
Date: Tue, 08 May 2012 20:27:06 +0900	[thread overview]
Message-ID: <000e01cd2d0d$806463e0$812d2ba0$%jun@samsung.com> (raw)
In-Reply-To: <CALzehA0GkpxLqfPLUr0+Y=JfWAzq4B-0oJ4Ap9gVo3-vSTp1NA@mail.gmail.com>

Hi,

Dmitry Shmidt <dimitrysh@android.com> wrote:
> Hi,
> 
> I am working with dw_mmc controller. Kernel 3.4-rc3. Sdio wlan device
> in UHS_SDR50 mode.
> What I see that sometimes next sdio CMD53 starts before FIFO is empty
> and then controller goes insane and
> sdio request will be blocked forever.
> 
> And it looks like DW_MCI_QUIRK_IDMAC_DTO quirk is helping this problem
> to disappear.
> 
> My question is that this quirk actually adds SDMMC_INT_DATA_OVER to
> pending status and in this case
> reading from device it taking care of. Is it the only case? Writing
> can not be interrupted in same way?
> 
> For the test I adding the next code to dw_mmc.c
> (DW_MCI_QUIRK_IDMAC_DTO was not set):

I found that idmac interrupt(Transmit Interrupt) is sometimes later than DTO interrupt
in case of write. Current handling of idmac interrupt sets EVENT_DATA_COMPLETE as well as
EVENT_XFER_COMPLETE regardless DTO rising. This makes the current request be finished in tasklet 
and permits the next request even though data transfer is still in progress.
Setting EVENT_DATA_COMPLETE is not proper after IDMAC interrupt.
It should be taken after DTO interrupt is generated.

@@ -1625,7 +1625,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
        if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
                mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI);
                mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
-               set_bit(EVENT_DATA_COMPLETE, &host->pending_events);
                host->dma_ops->complete(host);
        }
 #endif

> 
> @@ -687,11 +721,19 @@ static void __dw_mci_start_request(struct dw_mci *host,
>         struct mmc_request *mrq;
>         struct mmc_data *data;
>         u32 cmdflags;
> +#define FIFO_SIZE(x)   (((x) & 0x3FFE0000) >> 17)
> +       u32 temp;
> 
>         mrq = slot->mrq;
>         if (host->pdata->select_slot)
>                 host->pdata->select_slot(slot->id);
> 
> +       do {
> +               temp = mci_readl(host, STATUS);
> +               if (!(temp & BIT(2))) {
> +                       printk("%s: FIFO is not empty: 0x%x\n",
> __func__, FIFO_SIZE(temp));
> +               }
> +       } while (!(temp & BIT(2)));
> +
> 
> -----------------------------------------------------------------------------------------------
> [  215.785000] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot
> req 98040Hz, actual 98039HZ div = 255)
> [  215.800000] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot
> req 50000000Hz, actual 50000000HZ div = 0)
> ...
> [  215.865000] __dw_mci_start_request: FIFO is not empty: 0xf
> <<<<<<<< !!!!!!!!!!!!!!!!
> ------------------------------------------------------------------------------------------------
> 
> My other question is why do we need to use pio transfer in this case
> if DMA controller will finish the job if we will give it a chance?
> 
> Thanks,
> 
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2012-05-08 11:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28  0:35 dw_mmc: New sdio CMD53 starts with non-empty FIFO Dmitry Shmidt
2012-05-08 11:27 ` Seungwon Jeon [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='000e01cd2d0d$806463e0$812d2ba0$%jun@samsung.com' \
    --to=tgih.jun@samsung.com \
    --cc=dimitrysh@android.com \
    --cc=jh80.chung@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=will.newton@imgtec.com \
    /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