From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbdCAHwX (ORCPT ); Wed, 1 Mar 2017 02:52:23 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:36530 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750993AbdCAHwP (ORCPT ); Wed, 1 Mar 2017 02:52:15 -0500 Subject: Re: [RFC PATCH 2/2] mtd: devices: m25p80: Enable spi-nor bounce buffer support To: Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen References: <20170227120839.16545-1-vigneshr@ti.com> <20170227120839.16545-3-vigneshr@ti.com> CC: , , , Frode Isaksen , From: Vignesh R Message-ID: <8f999a27-c3ce-2650-452c-b21c3e44989d@ti.com> Date: Wed, 1 Mar 2017 10:24:18 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 01 March 2017 03:11 AM, Richard Weinberger wrote: > Vignesh, > > Am 27.02.2017 um 13:08 schrieb Vignesh R: >> Many SPI controller drivers use DMA to read/write from m25p80 compatible >> flashes. Therefore enable bounce buffers support provided by spi-nor >> framework to take care of handling vmalloc'd buffers which may not be >> DMA'able. >> >> Signed-off-by: Vignesh R >> --- >> drivers/mtd/devices/m25p80.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c >> index c4df3b1bded0..d05acf22eadf 100644 >> --- a/drivers/mtd/devices/m25p80.c >> +++ b/drivers/mtd/devices/m25p80.c >> @@ -241,6 +241,7 @@ static int m25p_probe(struct spi_device *spi) >> else >> flash_name = spi->modalias; >> >> + nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; > > Isn't there a better way to detect whether a bounce buffer is needed or not? Yes, I can poke the spi->master struct to see of dma channels are populated and request SNOR_F_USE_BOUNCE_BUFFER accordingly: - nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; + if (spi->master->dma_tx || spi->master->dma_rx) + nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; + -- Regards Vignesh From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vignesh R Subject: Re: [RFC PATCH 2/2] mtd: devices: m25p80: Enable spi-nor bounce buffer support Date: Wed, 1 Mar 2017 10:24:18 +0530 Message-ID: <8f999a27-c3ce-2650-452c-b21c3e44989d@ti.com> References: <20170227120839.16545-1-vigneshr@ti.com> <20170227120839.16545-3-vigneshr@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Frode Isaksen , linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org To: Richard Weinberger , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Cyrille Pitchen Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+gldm-linux-mtd-36=gmane.org@lists.infradead.org List-Id: linux-spi.vger.kernel.org On Wednesday 01 March 2017 03:11 AM, Richard Weinberger wrote: > Vignesh, > > Am 27.02.2017 um 13:08 schrieb Vignesh R: >> Many SPI controller drivers use DMA to read/write from m25p80 compatible >> flashes. Therefore enable bounce buffers support provided by spi-nor >> framework to take care of handling vmalloc'd buffers which may not be >> DMA'able. >> >> Signed-off-by: Vignesh R >> --- >> drivers/mtd/devices/m25p80.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c >> index c4df3b1bded0..d05acf22eadf 100644 >> --- a/drivers/mtd/devices/m25p80.c >> +++ b/drivers/mtd/devices/m25p80.c >> @@ -241,6 +241,7 @@ static int m25p_probe(struct spi_device *spi) >> else >> flash_name = spi->modalias; >> >> + nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; > > Isn't there a better way to detect whether a bounce buffer is needed or not? Yes, I can poke the spi->master struct to see of dma channels are populated and request SNOR_F_USE_BOUNCE_BUFFER accordingly: - nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; + if (spi->master->dma_tx || spi->master->dma_rx) + nor->flags |= SNOR_F_USE_BOUNCE_BUFFER; + -- Regards Vignesh ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/