Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3246105ima; Tue, 23 Oct 2018 02:49:39 -0700 (PDT) X-Google-Smtp-Source: AJdET5dbjo3zKU0XrKqzGzUNiP4TAMksJSBvFN0PiFMNg5vmRbLTp6uyMsfzGOCG4EtASSTBA3lh X-Received: by 2002:a63:8b4b:: with SMTP id j72mr6162865pge.126.1540288178915; Tue, 23 Oct 2018 02:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540288178; cv=none; d=google.com; s=arc-20160816; b=CsaV9Rezp+NJLeQmx5VH6hwOUnHa5KX+Idje+38udeNMLTKWKty1jXRMT6ddS1ZdpO +2EanpeQHXsTFJ0/SO63kAQ+E7dxNe8x3ucu1vhsRKwufcV3b8zk7VDS1MIr8uY8JqTm V0iBlFhgrgZP2r420eUvFqDrgvzcFIHRXJ/STP6iXwfXCwkbu4UmJ1Ta7LeVKAyJ5sTu pvR/fnCJp+evi4as4dJo1H/koLcc8179VjUHJj2hAWGKVFwGUJ3jxwwp8nNeK7ZH8JyR sbXpAraC2KKboBvPwYd6z5+2hQXARfu1vQsJjLBYnGCt+ssgb6vOesZxwS8rhdgTTDJM MuDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=WkSE4Io/3jxl4qeXKOpUw3NVpdEKzOcgjCRzj5FxMdk=; b=SBhTtwVe6t3SFncNX6GZ0+wfnta/AtcgclgTp36s8cFokwpRySdyJEERkcFxtEJC7T nFaflzrxnZSfRLSPiUIxowvRQPxJjG25dhdTxOnZ0Mja2yIxJ+kgJkk+kt2U3JcY8f6p hl5X13dwmVdM/Jqjd6gWWQasy5mSUWDyszRCL6AHCG9l56NhUwnTlHYBJAi69WJCVDIG J+VIijvpAgSed0dVGDCtr5uwCONa5gA+COE5KjbQ4HSiKXEsmopH+p/XIfC7TdYBATYs +/0de+TqehnXUkgMJ9FOVsRsQA0VdZYJB7MPR6Y7ivaEhNGs1g4Ge1v7cL/dBHy0Swto VgDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6-v6si819087pgg.182.2018.10.23.02.49.23; Tue, 23 Oct 2018 02:49:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728702AbeJWSL0 (ORCPT + 99 others); Tue, 23 Oct 2018 14:11:26 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42951 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbeJWSL0 (ORCPT ); Tue, 23 Oct 2018 14:11:26 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id C4DB620789; Tue, 23 Oct 2018 11:48:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (aaubervilliers-681-1-25-52.w90-88.abo.wanadoo.fr [90.88.145.52]) by mail.bootlin.com (Postfix) with ESMTPSA id 5854820701; Tue, 23 Oct 2018 11:48:44 +0200 (CEST) Date: Tue, 23 Oct 2018 11:48:44 +0200 From: Boris Brezillon To: Yogesh Narayan Gaur Cc: "linux-mtd@lists.infradead.org" , "broonie@kernel.org" , "marek.vasut@gmail.com" , "vigneshr@ti.com" , "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" , "robh@kernel.org" , "mark.rutland@arm.com" , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "computersforpeace@gmail.com" , "frieder.schrempf@exceet.de" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3 1/7] spi: add support for octo mode I/O data transfer Message-ID: <20181023114844.7adfa054@bbrezillon> In-Reply-To: <1540287311-1572-2-git-send-email-yogeshnarayan.gaur@nxp.com> References: <1540287311-1572-1-git-send-email-yogeshnarayan.gaur@nxp.com> <1540287311-1572-2-git-send-email-yogeshnarayan.gaur@nxp.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Oct 2018 09:37:06 +0000 Yogesh Narayan Gaur wrote: > Add flags for Octo mode I/O data transfer > Required for the SPI controller which can do the data transfer (TX/RX) > on 8 data lines e.g. NXP FlexSPI controller. > SPI_TX_OCTO: transmit with 8 wires > SPI_RX_OCTO: receive with 8 wires > > Signed-off-by: Yogesh Gaur Reviewed-by: Boris Brezillon > --- > Changes for v3: > - Modified string 'octal' with 'octo'. > - Add octo mode support in spi_setup(). > Changes for v2: > - Incorporated review comments of Boris. > > drivers/spi/spi.c | 12 ++++++++++-- > include/linux/spi/spi.h | 2 ++ > 2 files changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c > index ec395a6..6d57fa7 100644 > --- a/drivers/spi/spi.c > +++ b/drivers/spi/spi.c > @@ -1573,6 +1573,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, > case 4: > spi->mode |= SPI_TX_QUAD; > break; > + case 8: > + spi->mode |= SPI_TX_OCTO; > + break; > default: > dev_warn(&ctlr->dev, > "spi-tx-bus-width %d not supported\n", > @@ -1591,6 +1594,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi, > case 4: > spi->mode |= SPI_RX_QUAD; > break; > + case 8: > + spi->mode |= SPI_RX_OCTO; > + break; > default: > dev_warn(&ctlr->dev, > "spi-rx-bus-width %d not supported\n", > @@ -2770,14 +2776,16 @@ int spi_setup(struct spi_device *spi) > /* if it is SPI_3WIRE mode, DUAL and QUAD should be forbidden > */ > if ((spi->mode & SPI_3WIRE) && (spi->mode & > - (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD))) > + (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTO | > + SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTO))) > return -EINVAL; > /* help drivers fail *cleanly* when they need options > * that aren't supported with their current controller > */ > bad_bits = spi->mode & ~spi->controller->mode_bits; > ugly_bits = bad_bits & > - (SPI_TX_DUAL | SPI_TX_QUAD | SPI_RX_DUAL | SPI_RX_QUAD); > + (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTO | > + SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTO); > if (ugly_bits) { > dev_warn(&spi->dev, > "setup: ignoring unsupported mode bits %x\n", > diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h > index a64235e..cea4e49 100644 > --- a/include/linux/spi/spi.h > +++ b/include/linux/spi/spi.h > @@ -163,6 +163,8 @@ struct spi_device { > #define SPI_TX_QUAD 0x200 /* transmit with 4 wires */ > #define SPI_RX_DUAL 0x400 /* receive with 2 wires */ > #define SPI_RX_QUAD 0x800 /* receive with 4 wires */ > +#define SPI_TX_OCTO 0x1000 /* transmit with 8 wires */ > +#define SPI_RX_OCTO 0x2000 /* receive with 8 wires */ > int irq; > void *controller_state; > void *controller_data;