From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 5.mo2.mail-out.ovh.net ([87.98.181.248]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNDK4-0007Mi-HT for linux-mtd@lists.infradead.org; Tue, 20 Jun 2017 07:11:38 +0000 Received: from player692.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo2.mail-out.ovh.net (Postfix) with ESMTP id EE58794128 for ; Tue, 20 Jun 2017 09:11:11 +0200 (CEST) Subject: Re: [PATCH 4/4] mtd: spi-nor: aspeed: use command mode for reads To: Marek Vasut , linux-mtd@lists.infradead.org References: <1492689397-4704-1-git-send-email-clg@kaod.org> <1492689397-4704-5-git-send-email-clg@kaod.org> <66e385ec-6688-9ce7-1250-ec840201147e@kaod.org> <9c60f3f9-3f74-930d-07f9-9cb7cb8ba8f4@gmail.com> Cc: Boris Brezillon , Richard Weinberger , Cyrille Pitchen , Brian Norris , David Woodhouse From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <6198d774-d301-3369-8a23-d979425d1806@kaod.org> Date: Tue, 20 Jun 2017 09:10:54 +0200 MIME-Version: 1.0 In-Reply-To: <9c60f3f9-3f74-930d-07f9-9cb7cb8ba8f4@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 04/20/2017 03:58 PM, Marek Vasut wrote: > On 04/20/2017 03:53 PM, Cédric Le Goater wrote: >> On 04/20/2017 03:31 PM, Marek Vasut wrote: >>> On 04/20/2017 01:56 PM, Cédric Le Goater wrote: >>>> When reading flash contents, try to use the "command mode" if the AHB >>>> window configured for the flash module is big enough. Else, just fall >>>> back to the "user mode" to perform the read. >>>> >>>> Signed-off-by: Cédric Le Goater >>>> --- >>>> >>>> Changes since initial version : >>>> >>>> - rebased on current patchset which removed DMA support >>>> >>>> drivers/mtd/spi-nor/aspeed-smc.c | 27 ++++++++++++++++++++++++++- >>>> 1 file changed, 26 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c >>>> index 60c020482946..43015aec4557 100644 >>>> --- a/drivers/mtd/spi-nor/aspeed-smc.c >>>> +++ b/drivers/mtd/spi-nor/aspeed-smc.c >>>> @@ -394,6 +394,31 @@ static ssize_t aspeed_smc_read_user(struct spi_nor *nor, loff_t from, >>>> >>>> aspeed_smc_read_from_ahb(read_buf, chip->ahb_base, len); >>>> aspeed_smc_stop_user(nor); >>>> + return 0; >>>> +} >>>> + >>>> +static ssize_t aspeed_smc_read(struct spi_nor *nor, loff_t from, size_t len, >>>> + u_char *read_buf) >>>> +{ >>>> + struct aspeed_smc_chip *chip = nor->priv; >>>> + >>>> + /* >>>> + * The AHB window configured for the chip is too small for the >>>> + * read offset. Use the "User mode" of the controller to >>>> + * perform the read. >>>> + */ >>>> + if (from >= chip->ahb_window_size) { >>>> + aspeed_smc_read_user(nor, from, len, read_buf); >>>> + goto out; >>> >>> What about turning this into dumb if () {} else {} and dropping the goto ? >> >> yes, well, this is because I have other patches adding DMAs : >> >> https://github.com/legoater/linux/commit/6880924dc2cf7a47c446a708df528b72d9bf9134#diff-e466368d609006970aab53a7b840221fR575 >> >> but as of today, the benefits in speed are to be proven and the current >> implementation does not support vmalloc'ed buffers. So I can drop the >> goto without too much regrets (if you insist :) > > Nah, if you have further plans with this code, I don't mind either way. > OK let's keep that way. Do you think we can merge these four patches in the next window ? Thanks, C.