mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: 冯伟linux <steven_feng@realsil.com.cn>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] mfd:rtsx: do retry when dma transfer error
Date: Mon, 10 Apr 2017 16:00:15 +0100	[thread overview]
Message-ID: <20170410150015.o7d2iueesouzfsuh@dell> (raw)
In-Reply-To: <E865DE34E934EF47ACC616C10D554F76A8118CF6@RS-MBS01.realsil.com.cn>

On Mon, 10 Apr 2017, 冯伟linux wrote:

> > --- a/drivers/mfd/rtsx_pcr.c
> > +++ b/drivers/mfd/rtsx_pcr.c
> > @@ -30,6 +30,7 @@
> >  #include <linux/platform_device.h>
> >  #include <linux/mfd/core.h>
> >  #include <linux/mfd/rtsx_pci.h>
> > +#include <linux/mmc/card.h>
> > Why is this required?
> >
> The UHS_SER104_MAX_DTR which is in "card_clock = UHS_SER104_MAX_DTR
>  - (pcr->dma_error_count *20000000)" is defined in linux/mmc/card.h, so
> it is required.

Okay.

> >  	spin_lock_irqsave(&pcr->lock, flags);
> > -	if (pcr->trans_result == TRANS_RESULT_FAIL)
> > -		err = -EINVAL;
> > +	if (pcr->trans_result == TRANS_RESULT_FAIL) {
> > +		err = -EILSEQ;
> > "Illegal byte sequence", really?
> >
> This errno need to be -EILSEQ.

You need to explain why.

> >>> +	if (card_clock == UHS_SDR104_MAX_DTR &&
> >>> +		pcr->dma_error_count &&
> >>> +		PCI_PID(pcr) == RTS5227_DEVICE_ID)
> >>> +		card_clock = (UHS_SDR104_MAX_DTR -
> >>> +			pcr->dma_error_count * 20000000);
> > ... but won't this only reduce the clock frequency just once?
> >
> > There is no point bracketing the whole statement.
> >
> > But you do need to bracket one (the second) section of it.
> >
> The times of DMA transfer error occurrs recorded in dma_error_count,
> When DMA transfer error occurrs, the card_clock is reduced by 20MHz.

I think you'll find this logic will only reduce the clock frequency by
20MHz once and only once.

After the first:

  card_clock = (UHS_SDR104_MAX_DTR - pcr->dma_error_count * 20000000)

... happens, the first comparison:

  card_clock == UHS_SDR104_MAX_DTR

... will fail on subsequent attempts and will not allow it to be
reduced any further.  Did you test it?

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2017-04-10 15:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  9:01 steven_feng
2017-04-07  8:33 ` 冯伟linux
2017-04-07 11:13   ` Lee Jones
2017-04-10  9:28     ` 冯伟linux
2017-04-10 15:00       ` Lee Jones [this message]
2017-04-11  3:39         ` 冯伟linux
2017-04-25  8:13           ` 冯伟linux
2017-04-25 12:26             ` Lee Jones

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=20170410150015.o7d2iueesouzfsuh@dell \
    --to=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steven_feng@realsil.com.cn \
    /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

Powered by JetHome