Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4984912img; Tue, 26 Mar 2019 22:59:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjjEJaF+BkNrJ8vNxxsG9XL9vHo9aVf665w5YrBXRf1bDjb79oSDA2jndW+VvGMOM+//0e X-Received: by 2002:a62:293:: with SMTP id 141mr33035238pfc.245.1553666379429; Tue, 26 Mar 2019 22:59:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553666379; cv=none; d=google.com; s=arc-20160816; b=C0Dbntx13SXQz568Mt4lcB1jxF500fCqbS/LVzLNzwl89omhxJ8X6zHHLj4jkyMyET XxUxfMU9Dzr+pAGyGrfHsb7QVF09oVKM/9kB8rEDhh9lcbnLKXlZuPuepKiVx8pilywu C2NYwMlh5h2l27/7qRoaw1xsWiytKfyh0lKVWsWqREDcQgGCfZ0Es5+K1fBXVIZk49eY CUFA2U4DUsnGs3QUWkEBXNGDyTQpzaqWhfAI1fE5ccgVqm/+FHq450M+NiTOxbUXMqr0 J7fH3Crvf53wBy4Fb3xNtWfSWCYXgOxXicEZmPgCuVRtX/Rg+ak8WN1YkHNK5qFWIt1t /G2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=D1NqmMHYGMgeORLpgd4zuUBbBNj0Q0aWQBKVBrqrC/k=; b=hkSrD2a8OYLsmBkeCnKQ5JVJCZ0sqDL+9Nw7/tRnEANPS2ORjY6UFIVz9WJPPw5N4w 1ELqIpehO22oPxbZMsFNe6RatSfcNN9Qbk7AQR6CXwZJXOrp0RraLJ7VFfP2DdOKwhYY sCgPnp0Z5vp8fgT09C37I61ejmBQD9EQIfb1Z4bnp4vtGz+cssUur7NFsSTS50m4dBQh agdmGiAqADjRH1PI4d0bnvDS5WgS1292btbfIeSSuZEmm5Pg64klM71sNIHTI1AuZ2rr 7w+uUnVj18TjuUgzhnufgQ7SbexTEMrsG4qxL+jj2owFbTy68+cdjBV+6Dqz7kdOQQPF gBmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=DssW5oqs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si1604920pgq.4.2019.03.26.22.59.24; Tue, 26 Mar 2019 22:59:39 -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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=DssW5oqs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387434AbfC0F5x (ORCPT + 99 others); Wed, 27 Mar 2019 01:57:53 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:7037 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732900AbfC0F5r (ORCPT ); Wed, 27 Mar 2019 01:57:47 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 26 Mar 2019 22:57:42 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 26 Mar 2019 22:57:47 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 26 Mar 2019 22:57:47 -0700 Received: from HQMAIL103.nvidia.com (172.20.187.11) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 27 Mar 2019 05:57:46 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL103.nvidia.com (172.20.187.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Wed, 27 Mar 2019 05:57:46 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.2.161.83]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 26 Mar 2019 22:57:46 -0700 From: Sowjanya Komatineni To: , , , , , , , CC: , , , , Subject: [PATCH V1 25/26] spi: expand mode and mode_bits support Date: Tue, 26 Mar 2019 22:56:46 -0700 Message-ID: <1553666207-11414-25-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553666207-11414-1-git-send-email-skomatineni@nvidia.com> References: <1553666207-11414-1-git-send-email-skomatineni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1553666262; bh=D1NqmMHYGMgeORLpgd4zuUBbBNj0Q0aWQBKVBrqrC/k=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=DssW5oqsnQ1avGVOxgQ7yRGX5cH7c9rgTzev0omdz4DtImZZ/xhSaVWnlqCXdSCYk 3IwmVsp1Qn9yACfGv1JouW5YBSZhVTpS3d25624V/AlcruQ1REQltOhCngZX2nxuCn z9knJqAPAz2GeibEyzGTlEOaTmmEirVoiiIjZnoNXcI8BMD5Ne2554wACne29UaySG QS22sDPO6x0fqnitMGvjr31fBQV1+an2hxEB150XyeO2P9/04PbzPDDPu/acUqwDcx sM5QzATYxbIwe8F+hXp3KcMo7lf9mQwK9MhG9vVgWioRGAQ20VoC05vt3jSt/SK+ai +lKKaEpW4gRJQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mode and mode_bits is declared as u16 and all bits are used. This patch changes mode and mode_bits to be u32 to allow for more mode configurations. Some SPI Master controllers support configuring Least significant byte first or Most significant byte first order for transfers. Also some SPI slave devices expect bytes to be in Least significant first order and some devices expect Most significant first order. This patch creates SPI_LSBYTE_FIRST mode for this purpose. Signed-off-by: Sowjanya Komatineni --- include/linux/spi/spi.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index a0975cf76cf6..0032aa47dea0 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -143,7 +143,7 @@ struct spi_device { u32 max_speed_hz; u8 chip_select; u8 bits_per_word; - u16 mode; + u32 mode; #define SPI_CPHA 0x01 /* clock phase */ #define SPI_CPOL 0x02 /* clock polarity */ #define SPI_MODE_0 (0|0) /* (original MicroWire) */ @@ -164,6 +164,7 @@ struct spi_device { #define SPI_TX_OCTAL 0x2000 /* transmit with 8 wires */ #define SPI_RX_OCTAL 0x4000 /* receive with 8 wires */ #define SPI_3WIRE_HIZ 0x8000 /* high impedance turnaround */ +#define SPI_LSBYTE_FIRST 0x10000 /* per-word bytes-on-wire */ int irq; void *controller_state; void *controller_data; @@ -439,7 +440,7 @@ struct spi_controller { u16 dma_alignment; /* spi_device.mode flags understood by this controller driver */ - u16 mode_bits; + u32 mode_bits; /* bitmask of supported bits_per_word for transfers */ u32 bits_per_word_mask; -- 2.7.4