From: Ludovic Desroches <ludovic.desroches@atmel.com>
To: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
cjb@laptop.org
Cc: terry@beam.ltd.uk, nicolas.ferre@atmel.com
Subject: Re: [PATCH] mmc: atmel-mci: pio hang on block errors
Date: Mon, 8 Apr 2013 18:02:24 +0200 [thread overview]
Message-ID: <15090.1651396$1365448029@news.gmane.org> (raw)
In-Reply-To: <1363771946-8931-1-git-send-email-ludovic.desroches@atmel.com>
Hi Chris,
Could you take this fix? If there are no objections of course.
Regards
Ludovic
On Wed, Mar 20, 2013 at 10:32:26AM +0100, ludovic.desroches@atmel.com wrote:
> From: Terry Barnaby <terry@beam.ltd.uk>
>
> The driver is doing, by default, multi-block reads. When a block error occurs
> card/block.c instigates a single block read: "mmcblk0: retrying using single
> block read".
> It leaves the sg chain intact and just changes the length attribute for the
> first sg entry and the overall sg_len parameter. When atmci_read_data_pio is
> called to read the single block of data it ignores the sg_len and expects to
> read more than 512 bytes as it sees there are multiple items in the sg list. No
> more data comes as the controller has only been commanded to get one block.
>
> Signed-off-by: Terry Barnaby <terry@beam.ltd.uk>
> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> Cc: stable <stable@vger.kernel.org> # 3.2+
> ---
> drivers/mmc/host/atmel-mci.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 0932024..d98e68e 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -163,6 +163,7 @@ struct atmel_mci {
> void __iomem *regs;
>
> struct scatterlist *sg;
> + unsigned int sg_len;
> unsigned int pio_offset;
>
> struct atmel_mci_slot *cur_slot;
> @@ -751,6 +752,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
> data->error = -EINPROGRESS;
>
> host->sg = data->sg;
> + host->sg_len = data->sg_len;
> host->data = data;
> host->data_chan = NULL;
>
> @@ -1573,7 +1575,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
> if (offset == sg->length) {
> flush_dcache_page(sg_page(sg));
> host->sg = sg = sg_next(sg);
> - if (!sg)
> + host->sg_len--;
> + if (!sg || !host->sg_len)
> goto done;
>
> offset = 0;
> @@ -1586,7 +1589,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
>
> flush_dcache_page(sg_page(sg));
> host->sg = sg = sg_next(sg);
> - if (!sg)
> + host->sg_len--;
> + if (!sg || !host->sg_len)
> goto done;
>
> offset = 4 - remaining;
> @@ -1640,7 +1644,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
> nbytes += 4;
> if (offset == sg->length) {
> host->sg = sg = sg_next(sg);
> - if (!sg)
> + host->sg_len--;
> + if (!sg || !host->sg_len)
> goto done;
>
> offset = 0;
> @@ -1654,7 +1659,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
> nbytes += remaining;
>
> host->sg = sg = sg_next(sg);
> - if (!sg) {
> + host->sg_len--;
> + if (!sg || !host->sg_len) {
> atmci_writel(host, ATMCI_TDR, value);
> goto done;
> }
> --
> 1.7.11.3
>
next prev parent reply other threads:[~2013-04-08 16:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-20 9:32 [PATCH] mmc: atmel-mci: pio hang on block errors ludovic.desroches
2013-04-08 16:02 ` Ludovic Desroches [this message]
[not found] ` <20130408160224.GC6398@ludovic.desroches@atmel.com>
2013-04-08 16:07 ` Chris Ball
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='15090.1651396$1365448029@news.gmane.org' \
--to=ludovic.desroches@atmel.com \
--cc=cjb@laptop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=terry@beam.ltd.uk \
/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