From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754843AbaJUKZc (ORCPT ); Tue, 21 Oct 2014 06:25:32 -0400 Received: from webmail.celad.com ([84.14.244.162]:41040 "EHLO webmail.celad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752412AbaJUKZb (ORCPT ); Tue, 21 Oct 2014 06:25:31 -0400 X-Greylist: delayed 326 seconds by postgrey-1.27 at vger.kernel.org; Tue, 21 Oct 2014 06:25:30 EDT Message-ID: <54463356.400@celad.com> Date: Tue, 21 Oct 2014 12:20:06 +0200 From: Herve Codina User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Josh Wu , Vinod Koul , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" CC: David Woodhouse , Brian Norris , Jingoo Han , EzequielGarcia , Mark Brown , Nicolas Ferre , BartlomiejZolnierkiewicz , Bo Shen , Fabio Estevam , Andrew Morton , Michael Grzeschik , Josh Triplett , Wei Yongjun , HuangShijie , Michael Opdenacker Subject: Re: [PATCH 1/2] mtd: atmel_nand: use __iowrite32_copy for 32 bitcopy References: <1413821173-18347-1-git-send-email-vinod.koul@intel.com> <54462F6C.1030307@atmel.com> In-Reply-To: <54462F6C.1030307@atmel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I didn't go deeper in atmel_nand.c code to see other accesses but old copy use writel_relaxed which is a macro to __raw_writel((__force u32) cpu_to_le32(v),c) __iowrite32_copy use directly __raw_writel(*src++, dst++) So we skip cpu_to_le32. Is it ok for all system using atmel_nand ? Best regards, Herve Codina Le 21/10/2014 12:03, Josh Wu a écrit : > Hi, Vinod > > On 10/21/2014 12:06 AM, Vinod Koul wrote: >> The driver was also using own method to do 32bit copy, turns out >> we have a kernel API so use that instead >> >> Signed-off-by: Vinod Koul > > Thanks for the patch. > Acked-by: Josh Wu > > BTW, is there any similar kernel API that is for the read from io? > > Best Regards, > Josh Wu > >> --- >> drivers/mtd/nand/atmel_nand.c | 10 +++------- >> 1 files changed, 3 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c >> index e321c56..b03e80d 100644 >> --- a/drivers/mtd/nand/atmel_nand.c >> +++ b/drivers/mtd/nand/atmel_nand.c >> @@ -265,14 +265,10 @@ static void memcpy32_fromio(void *trg, const void __iomem *src, size_t size) >> *t++ = readl_relaxed(s++); >> } >> >> -static void memcpy32_toio(void __iomem *trg, const void *src, int size) >> +static inline void memcpy32_toio(void __iomem *trg, const void *src, int size) >> { >> - int i; >> - u32 __iomem *t = trg; >> - const u32 *s = src; >> - >> - for (i = 0; i < (size >> 2); i++) >> - writel_relaxed(*s++, t++); >> + /* __iowrite32_copy use 32bit size values so divide by 4 */ >> + __iowrite32_copy(trg, src, size/4); >> } >> >> /* >