From patchwork Fri May 22 10:12:42 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 11565259
Return-Path:
Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
[172.30.200.123])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D6A31392
for ;
Fri, 22 May 2020 10:20:27 +0000 (UTC)
Received: from bombadil.infradead.org (bombadil.infradead.org
[198.137.202.133])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mail.kernel.org (Postfix) with ESMTPS id 59E40206C3
for ;
Fri, 22 May 2020 10:20:27 +0000 (UTC)
Authentication-Results: mail.kernel.org;
dkim=pass (2048-bit key) header.d=lists.infradead.org
header.i=@lists.infradead.org header.b="lav8GEtO";
dkim=fail reason="signature verification failed" (1024-bit key)
header.d=ti.com header.i=@ti.com header.b="GZTN5KAt"
DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59E40206C3
Authentication-Results: mail.kernel.org;
dmarc=fail (p=quarantine dis=none) header.from=ti.com
Authentication-Results: mail.kernel.org;
spf=none
smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
d=lists.infradead.org; s=bombadil.20170209; h=Sender:
Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:
List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:
Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description:
Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:
List-Owner; bh=7FMGpUpP3MRfVit/dSJIRhIax8qoV/kfYn6hdPLy3lk=; b=lav8GEtOwKZ7Nj
zVzmdqBe5Hg+P+eu4YxPAvNDvOjrpJfM5KwCJ04tH0U0sH2jIO7vZSoBK1geXN0CXWaLiNcbKEyz+
7uOZa/9qmTSJqx8yiw40kpSjCoW9WzoWHnEjsLTyYslBtU4MUNCa+8qrQSo402jc5T+ExHl9teavf
KtQ5G3cu2kRO27AGNgJVTIQ7o45nh+/1yI/KT7q6Tm7nHvv6zDOd3vPodZ5zQ+24J5bRuPARsRdLQ
6T+fKN5pRhvkEtY/m1/M8F+bxoG7MB5WlTpnxpzSJIdBGThEtm+6V7NfY6kZgzJOzjjXbm2WsfY47
DhYgBqvZxMrZxTSRaKsw==;
Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org)
by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux))
id 1jc4mv-0003lY-Qe; Fri, 22 May 2020 10:20:25 +0000
Received: from lelv0142.ext.ti.com ([198.47.23.249])
by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
id 1jc4gh-0002XY-Q4; Fri, 22 May 2020 10:14:04 +0000
Received: from lelv0266.itg.ti.com ([10.180.67.225])
by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04MADt9V013831;
Fri, 22 May 2020 05:13:55 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1590142435;
bh=QVVBkRYpNpHNnM3DtoOcxGwPAsP60fEAqbUuQ94mGJM=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=GZTN5KAt7ZiMuuJAXRucs42IfCqaHtGh0R54EY33VKqw5Kxx7hWghhksu4zb5BkWQ
+Nd3X4vkjuQ8X6KkItdMir33Oo+ugsGSCoxMW9Ga9DUjWpQE2+BrYy5MgatjOTi4go
WLJVe0T/mR3COo0bzTRhtv1KF1zQf+Rk9o+0IbYA=
Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33])
by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04MADtoa084121
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Fri, 22 May 2020 05:13:55 -0500
Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE103.ent.ti.com
(157.170.170.33) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 22
May 2020 05:13:12 -0500
Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE108.ent.ti.com
(157.170.170.38) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via
Frontend Transport; Fri, 22 May 2020 05:13:12 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04MAD1a2041179;
Fri, 22 May 2020 05:13:07 -0500
From: Pratyush Yadav
To: Tudor Ambarus , Miquel Raynal
, Richard Weinberger , Vignesh
Raghavendra , Mark Brown ,
Nicolas Ferre , Alexandre Belloni
, Ludovic Desroches
,
Matthias Brugger ,
, ,
, ,
Subject: [PATCH v7 01/20] spi: spi-mem: allow specifying whether an op is DTR
or not
Date: Fri, 22 May 2020 15:42:42 +0530
Message-ID: <20200522101301.26909-2-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
In-Reply-To: <20200522101301.26909-1-p.yadav@ti.com>
References: <20200522101301.26909-1-p.yadav@ti.com>
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
X-CRM114-CacheID: sfid-20200522_031400_909374_38D0ACAB
X-CRM114-Status: GOOD ( 12.93 )
X-Spam-Score: -2.5 (--)
X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary:
Content analysis details: (-2.5 points)
pts rule name description
---- ----------------------
--------------------------------------------------
-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/,
medium trust [198.47.23.249 listed in list.dnswl.org]
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
-0.0 SPF_PASS SPF: sender matches SPF record
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's domain
0.1 DKIM_SIGNED Message has a DKIM or DK signature,
not necessarily
valid
-0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
envelope-from domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
-0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender
X-BeenThere: linux-mediatek@lists.infradead.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id:
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Mason Yang ,
Boris Brezillon ,
Sekhar Nori ,
Pratyush Yadav
Sender: "Linux-mediatek"
Errors-To:
linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org
Each phase is given a separate 'dtr' field so mixed protocols like
4S-4D-4D can be supported.
Signed-off-by: Pratyush Yadav
---
drivers/spi/spi-mem.c | 3 +++
include/linux/spi/spi-mem.h | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index 9a86cc27fcc0..93e255287ab9 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -156,6 +156,9 @@ bool spi_mem_default_supports_op(struct spi_mem *mem,
op->data.dir == SPI_MEM_DATA_OUT))
return false;
+ if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr)
+ return false;
+
return true;
}
EXPORT_SYMBOL_GPL(spi_mem_default_supports_op);
diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h
index af9ff2f0f1b2..e3dcb956bf61 100644
--- a/include/linux/spi/spi-mem.h
+++ b/include/linux/spi/spi-mem.h
@@ -71,9 +71,11 @@ enum spi_mem_data_dir {
* struct spi_mem_op - describes a SPI memory operation
* @cmd.buswidth: number of IO lines used to transmit the command
* @cmd.opcode: operation opcode
+ * @cmd.dtr: whether the command opcode should be sent in DTR mode or not
* @addr.nbytes: number of address bytes to send. Can be zero if the operation
* does not need to send an address
* @addr.buswidth: number of IO lines used to transmit the address cycles
+ * @addr.dtr: whether the address should be sent in DTR mode or not
* @addr.val: address value. This value is always sent MSB first on the bus.
* Note that only @addr.nbytes are taken into account in this
* address value, so users should make sure the value fits in the
@@ -81,7 +83,9 @@ enum spi_mem_data_dir {
* @dummy.nbytes: number of dummy bytes to send after an opcode or address. Can
* be zero if the operation does not require dummy bytes
* @dummy.buswidth: number of IO lanes used to transmit the dummy bytes
+ * @dummy.dtr: whether the dummy bytes should be sent in DTR mode or not
* @data.buswidth: number of IO lanes used to send/receive the data
+ * @data.dtr: whether the data should be sent in DTR mode or not
* @data.dir: direction of the transfer
* @data.nbytes: number of data bytes to send/receive. Can be zero if the
* operation does not involve transferring data
@@ -91,22 +95,26 @@ enum spi_mem_data_dir {
struct spi_mem_op {
struct {
u8 buswidth;
+ u8 dtr : 1;
u8 opcode;
} cmd;
struct {
u8 nbytes;
u8 buswidth;
+ u8 dtr : 1;
u64 val;
} addr;
struct {
u8 nbytes;
u8 buswidth;
+ u8 dtr : 1;
} dummy;
struct {
u8 buswidth;
+ u8 dtr : 1;
enum spi_mem_data_dir dir;
unsigned int nbytes;
union {