Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756465AbcDGPCv (ORCPT ); Thu, 7 Apr 2016 11:02:51 -0400 Received: from eusmtp01.atmel.com ([212.144.249.243]:27146 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756193AbcDGPCu (ORCPT ); Thu, 7 Apr 2016 11:02:50 -0400 Subject: Re: [LINUX PATCH v2 1/3] spi: Added dummy_cycle entry in the spi_transfer structure. To: P L Sai Krishna , Michal Simek , Soren Brinkmann , David Woodhouse , Brian Norris , Mark Brown , "Javier Martinez Canillas" , Boris Brezillon , Stephen Warren , Geert Uytterhoeven , "Andrew F. Davis" , Marek Vasut , Jagan Teki , =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= References: <1460039969-9835-1-git-send-email-lakshmis@xilinx.com> CC: , , , , "Harini Katakam" , Punnaiah Choudary Kalluri , Anirudha Sarangi , P L Sai Krishna , "R, Vignesh" From: Cyrille Pitchen Message-ID: <57067694.8030806@atmel.com> Date: Thu, 7 Apr 2016 17:02:44 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460039969-9835-1-git-send-email-lakshmis@xilinx.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.161.30.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2365 Lines: 60 Hi all, Le 07/04/2016 16:39, P L Sai Krishna a ?crit : > This patch adds dummy_cycles entry in the spi_transfer structure. > len field in the transfer structure contains dummy bytes along with > actual data bytes, controllers which requires dummy bytes use len > field and simply Ignore the dummy_cycles field. Controllers which > expects dummy cycles won't work directly by using len field because > host driver doesn't know that len field of a particular transfer > includes dummy bytes or not (and also number of dummy bytes included > in len field). In such cases host driver use this dummy_cycles field > to identify the number of dummy cycles and based on that it will send > the required number of dummy cycles. Dummy cycles are only used with SPI NOR flashes, aren't they? I guess so since there is also a patch dedicated to the m25p80 driver. So why not using the spi_flash_read() API already introduced by Vignesh in the SPI layer? struct spi_flash_read_message already includes a 'dummy_bytes' member. > > Signed-off-by: P L Sai Krishna > --- > v2: > - Changed the structure member name from dummy to dummy_cycles. > - Updated the documentation of dummy_cycles. > - m25p80 changes split into another patch. > > include/linux/spi/spi.h | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h > index 857a9a1..63135b3 100644 > --- a/include/linux/spi/spi.h > +++ b/include/linux/spi/spi.h > @@ -664,6 +664,9 @@ extern void spi_res_release(struct spi_master *master, > * @len: size of rx and tx buffers (in bytes) > * @speed_hz: Select a speed other than the device default for this > * transfer. If 0 the default (from @spi_device) is used. > + * @dummy_cycles: number of dummy cycles. If host controller requires > + * dummy cycles rather than dummy bytes which send along with Cmd > + * and address then this dummy_cycles is used. > * @bits_per_word: select a bits_per_word other than the device default > * for this transfer. If 0 the default (from @spi_device) is used. > * @cs_change: affects chipselect after this transfer completes > @@ -752,6 +755,7 @@ struct spi_transfer { > u8 bits_per_word; > u16 delay_usecs; > u32 speed_hz; > + u32 dummy_cycles; > > struct list_head transfer_list; > }; > Best regards, Cyrille