From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755034AbdDGLNa (ORCPT ); Fri, 7 Apr 2017 07:13:30 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:33256 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752971AbdDGLNU (ORCPT ); Fri, 7 Apr 2017 07:13:20 -0400 Date: Fri, 7 Apr 2017 12:13:16 +0100 From: Lee Jones To: =?utf-8?B?5Yav5LyfbGludXg=?= Cc: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3] mfd:rtsx: do retry when dma transfer error Message-ID: <20170407111316.fcjhydgbnf2yulaw@dell> References: <1483606902-12762-1-git-send-email-steven_feng@realsil.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 07 Apr 2017, 冯伟linux wrote: > HI lee.jones > > I submitted my patch a few months ago, but the patch was not merged. > I want to know what causes this, so that I can update the patch and make > the patch merged. The patch was missed. I do not know why. > steven feng > Realsil Microelectronics CO. LTD. > Mobile:181-6899-0403 Ext:57594 > > On 2017年01月05日 17:01, 冯伟linux wrote: > > From: steven_feng Should be "Steven Feng" > > the request should be reissued when dma transfer error. > > for rts5227, the clock freq need to step reduce when error occurred. Please use correct grammar, including full-stops and capital letters. > > Signed-off-by: steven_feng "Steven Feng" > > --- > > drivers/mfd/rtsx_pcr.c | 17 +++++++++++++++-- > > include/linux/mfd/rtsx_pci.h | 5 +++++ > > 2 files changed, 20 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c > > index 98029ee..3161c46 100644 > > --- a/drivers/mfd/rtsx_pcr.c > > +++ b/drivers/mfd/rtsx_pcr.c > > @@ -30,6 +30,7 @@ > > #include > > #include > > #include > > +#include Why is this required? > > #include > > > > #include "rtsx_pcr.h" > > @@ -452,8 +453,12 @@ int rtsx_pci_dma_transfer(struct rtsx_pcr *pcr, struct scatterlist *sglist, > > } > > > > 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? > > + if (pcr->dma_error_count < RTS_MAX_TIMES_FREQ_REDUCTION) > > + pcr->dma_error_count++; > > + } > > + > > else if (pcr->trans_result == TRANS_NO_DEVICE) > > err = -ENODEV; > > spin_unlock_irqrestore(&pcr->lock, flags); > > @@ -659,6 +664,13 @@ int rtsx_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock, > > if (err < 0) > > return err; > > > > + /* Each time dma transfer error occurs, card clock decreased by 20MHz */ s/dma/DMA/ I would reword as follows: "Reduce MMC card clock by 20MHz each time a DMA transfer error occurs" > > + 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. > > card_clock /= 1000000; > > pcr_dbg(pcr, "Switch card clock to %dMHz\n", card_clock); > > > > @@ -894,6 +906,7 @@ static irqreturn_t rtsx_pci_isr(int irq, void *dev_id) > > pcr->card_removed |= SD_EXIST; > > pcr->card_inserted &= ~SD_EXIST; > > } > > + pcr->dma_error_count = 0; > > } > > > > if (int_reg & MS_INT) { > > diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/mfd/rtsx_pci.h > > index 7eb7cba..116816f 100644 > > --- a/include/linux/mfd/rtsx_pci.h > > +++ b/include/linux/mfd/rtsx_pci.h > > @@ -850,6 +850,9 @@ > > > > #define rtsx_pci_init_cmd(pcr) ((pcr)->ci = 0) > > > > +#define RTS5227_DEVICE_ID 0x5227 > > +#define RTS_MAX_TIMES_FREQ_REDUCTION 8 > > + > > struct rtsx_pcr; > > > > struct pcr_handle { > > @@ -957,6 +960,8 @@ struct rtsx_pcr { > > > > int num_slots; > > struct rtsx_slot *slots; > > + > > + u8 dma_error_count; > > }; > > > > #define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) > > begin:vcard > fn;quoted-printable:=E5=86=AF=E4=BC=9F > n;quoted-printable:;=E5=86=AF=E4=BC=9F > email;internet:steven_feng@realsil.com.cn > tel;cell:18168990403 > version:2.1 > end:vcard > -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog