From patchwork Tue Feb 11 13:33:46 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 1236293
X-Patchwork-Delegate: tudor.ambarus@gmail.com
Return-Path:
X-Original-To: incoming@patchwork.ozlabs.org
Delivered-To: patchwork-incoming@bilbo.ozlabs.org
Authentication-Results: ozlabs.org; spf=none (no SPF record)
smtp.mailfrom=lists.infradead.org
(client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org;
envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;
receiver=)
Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none)
header.from=ti.com
Authentication-Results: ozlabs.org; dkim=pass (2048-bit key;
unprotected) header.d=lists.infradead.org
header.i=@lists.infradead.org header.a=rsa-sha256
header.s=bombadil.20170209 header.b=LtsuLMC+;
dkim=fail reason="signature verification failed" (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256
header.s=ti-com-17Q1 header.b=L6mIbZho;
dkim-atps=neutral
Received: from bombadil.infradead.org (bombadil.infradead.org
[IPv6:2607:7c80:54:e::133])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits)
server-digest SHA256) (No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 48H3hP2lK3z9s3x
for ;
Wed, 12 Feb 2020 00:36:21 +1100 (AEDT)
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=etV5sOE5qdqaG9GGvUVGR8U6HVE2P4wz+U+V25sP5tQ=;
b=LtsuLMC+AMm+8y
Cu4foYszHVItAcrjJ8/YN1B5Y4p6QL+HW6+BVEx7SPbQRrwK2oDAl0sSZUv8eIiqv7EnkEcLRItwt
vPJrk0g/7vw6VbeyQGGn8etKUARin/HPmRHfo5kmSkEExTEYhic0NvP7cM/9jXnP7kmgOcyxjONxu
390s77EdFA8hqDtf0oYMeIv5O+oqyT4UYlCOVqsuFP+EWKcOzhLPqhE3WNqgOydK962tP8Se/29tK
qRsMlKc8IE6auRZx7ytkFbOQlxF7mznsgJG+dvM1Cl7Fpw5VYCwBF63PK/TrBEkzf16f8rT9ulTO2
BvzAAX6ptjvPkCj92Hxw==;
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 1j1Vhw-0006kH-G5; Tue, 11 Feb 2020 13:36:08 +0000
Received: from lelv0143.ext.ti.com ([198.47.23.248])
by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat
Linux)) id 1j1Vg9-0003wj-2s
for linux-mtd@lists.infradead.org; Tue, 11 Feb 2020 13:34:18 +0000
Received: from fllv0035.itg.ti.com ([10.64.41.0])
by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 01BDYEO7085720;
Tue, 11 Feb 2020 07:34:14 -0600
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1581428054;
bh=tg5lVWtgcaAec3Kw2nWplmrwbgO3I2UETTo4WpiW3uI=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=L6mIbZhoMmNegyub+E0gZuV/hdWvSg9144XEAKwf0GXvG4hIf9UdPzQOcR0xFrbD5
KgAF6YQR3e7jF/XjejYWyqaQB/Alape+PM+jb1WUGEy2KTlrxVUV7EW1Da5UPBBiWM
CW1w1pqjkplmzjlCr6JqDRpWaUJz8kv8rCAQjhc0=
Received: from DFLE108.ent.ti.com (dfle108.ent.ti.com [10.64.6.29])
by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BDYEOR025961;
Tue, 11 Feb 2020 07:34:14 -0600
Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE108.ent.ti.com
(10.64.6.29) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3;
Tue, 11 Feb 2020 07:34:14 -0600
Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com
(10.64.6.28) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via
Frontend Transport; Tue, 11 Feb 2020 07:34:14 -0600
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 01BDXm5O087522;
Tue, 11 Feb 2020 07:34:11 -0600
From: Pratyush Yadav
To: Tudor Ambarus , Miquel Raynal
, Richard Weinberger , Vignesh
Raghavendra , Mark Brown
Subject: [PATCH 7/9] mtd: spi-nor: use dummy cycle and address width info
from SFDP
Date: Tue, 11 Feb 2020 19:03:46 +0530
Message-ID: <20200211133348.15558-8-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
In-Reply-To: <20200211133348.15558-1-p.yadav@ti.com>
References: <20200211133348.15558-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-20200211_053417_227284_DEA68861
X-CRM114-Status: GOOD ( 13.55 )
X-Spam-Score: -2.5 (--)
X-Spam-Report: SpamAssassin version 3.4.3 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.248 listed in list.dnswl.org]
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
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.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
author's domain
-0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender
X-BeenThere: linux-mtd@lists.infradead.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Linux MTD discussion mailing list
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Cc: Sekhar Nori , linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, Pratyush Yadav ,
linux-spi@vger.kernel.org
Sender: "linux-mtd"
Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org
The xSPI Profile 1.0 table specifies how many dummy cycles and address
bytes are needed for the Read Status Register command in octal DTR mode.
Use that information to send the correct Read SR command.
Signed-off-by: Pratyush Yadav
---
drivers/mtd/spi-nor/spi-nor.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index eefde5abff8a..8c5d7bfa4f16 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -525,6 +525,8 @@ static int spi_nor_write_disable(struct spi_nor *nor)
static int spi_nor_read_sr(struct spi_nor *nor, u8 *sr)
{
int ret;
+ u8 addr_bytes = nor->params.rdsr_addr_nbytes;
+ u8 dummy = nor->params.rdsr_dummy;
if (nor->spimem) {
struct spi_mem_op op =
@@ -533,10 +535,21 @@ static int spi_nor_read_sr(struct spi_nor *nor, u8 *sr)
SPI_MEM_OP_NO_DUMMY,
SPI_MEM_OP_DATA_IN(1, sr, 1));
+ if (spi_nor_protocol_is_dtr(nor->reg_proto)) {
+ op.addr.nbytes = addr_bytes;
+ op.addr.val = 0;
+ op.dummy.nbytes = dummy;
+ }
+
+ spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
+
ret = spi_mem_exec_op(nor->spimem, &op);
} else {
- ret = nor->controller_ops->read_reg(nor, SPINOR_OP_RDSR,
- sr, 1);
+ if (spi_nor_protocol_is_dtr(nor->reg_proto))
+ ret = -ENOTSUPP;
+ else
+ ret = nor->controller_ops->read_reg(nor, SPINOR_OP_RDSR,
+ sr, 1);
}
if (ret)