From patchwork Tue Jun 23 18:30:25 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 11621437
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 1640D6C1
for ;
Tue, 23 Jun 2020 18:32:15 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by mail.kernel.org (Postfix) with ESMTP id F140F20829
for ;
Tue, 23 Jun 2020 18:32:14 +0000 (UTC)
Authentication-Results: mail.kernel.org;
dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="h/owzAfL"
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S2387482AbgFWSbs (ORCPT
);
Tue, 23 Jun 2020 14:31:48 -0400
Received: from fllv0016.ext.ti.com ([198.47.19.142]:48120 "EHLO
fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S2387473AbgFWSbq (ORCPT
); Tue, 23 Jun 2020 14:31:46 -0400
Received: from fllv0034.itg.ti.com ([10.64.40.246])
by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05NIVbjc046991;
Tue, 23 Jun 2020 13:31:37 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1592937097;
bh=yBGNCcbopFGvxKZCAWkAxJMuz+3sEiqQI5mQ644ETyQ=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=h/owzAfLPfjpol0Wm5WLeaomv+iV8OyC0e9FoDZ4wSKzwmv6naudlD+MCUUyv1RVk
DntgyfUqaRZdSJC7vg9CiTIws82xuMQJoD91OjfUUQ9H2qWIfCq7guHIvHyfDL0hjG
dgLoax4n6vWTewdUlaxxBEMS1RumOYJc8/TEGovI=
Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33])
by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05NIVba5040050
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Tue, 23 Jun 2020 13:31:37 -0500
Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE112.ent.ti.com
(10.64.6.33) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 23
Jun 2020 13:31:37 -0500
Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE111.ent.ti.com
(10.64.6.32) 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; Tue, 23 Jun 2020 13:31:37 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05NIUVJQ000942;
Tue, 23 Jun 2020 13:31:32 -0500
From: Pratyush Yadav
To: Tudor Ambarus ,
Miquel Raynal ,
Richard Weinberger ,
Vignesh Raghavendra ,
Mark Brown ,
Nicolas Ferre ,
Alexandre Belloni ,
Ludovic Desroches ,
Matthias Brugger ,
Michal Simek ,
, ,
,
,
CC: Pratyush Yadav , Sekhar Nori ,
Boris Brezillon
Subject: [PATCH v10 12/17] mtd: spi-nor: sfdp: detect Soft Reset sequence
support from BFPT
Date: Wed, 24 Jun 2020 00:00:25 +0530
Message-ID: <20200623183030.26591-13-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
In-Reply-To: <20200623183030.26591-1-p.yadav@ti.com>
References: <20200623183030.26591-1-p.yadav@ti.com>
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
Sender: linux-spi-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: linux-spi@vger.kernel.org
A Soft Reset sequence will return the flash to Power-on-Reset (POR)
state. It consists of two commands: Soft Reset Enable and Soft Reset.
Find out if the sequence is supported from BFPT DWORD 16.
Signed-off-by: Pratyush Yadav
---
drivers/mtd/spi-nor/core.h | 1 +
drivers/mtd/spi-nor/sfdp.c | 4 ++++
drivers/mtd/spi-nor/sfdp.h | 2 ++
3 files changed, 7 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 6338d32a0d77..79ce952c0539 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -26,6 +26,7 @@ enum spi_nor_option_flags {
SNOR_F_HAS_SR_TB_BIT6 = BIT(11),
SNOR_F_HAS_4BIT_BP = BIT(12),
SNOR_F_HAS_SR_BP3_BIT6 = BIT(13),
+ SNOR_F_SOFT_RESET = BIT(14),
};
struct spi_nor_read_command {
diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index 7983ff431346..8e0741d8bfd3 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -616,6 +616,10 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
break;
}
+ /* Soft Reset support. */
+ if (bfpt.dwords[BFPT_DWORD(16)] & BFPT_DWORD16_SOFT_RST)
+ nor->flags |= SNOR_F_SOFT_RESET;
+
/* Stop here if not JESD216 rev C or later. */
if (bfpt_header->length == BFPT_DWORD_MAX_JESD216B)
return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt,
diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h
index 6d7243067252..8ae55e98084e 100644
--- a/drivers/mtd/spi-nor/sfdp.h
+++ b/drivers/mtd/spi-nor/sfdp.h
@@ -90,6 +90,8 @@ struct sfdp_bfpt {
#define BFPT_DWORD15_QER_SR2_BIT1_NO_RD (0x4UL << 20)
#define BFPT_DWORD15_QER_SR2_BIT1 (0x5UL << 20) /* Spansion */
+#define BFPT_DWORD16_SOFT_RST BIT(12)
+
#define BFPT_DWORD18_CMD_EXT_MASK GENMASK(30, 29)
#define BFPT_DWORD18_CMD_EXT_REP (0x0UL << 29) /* Repeat */
#define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */