From patchwork Mon May 25 09:15:39 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 11568335
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 0FA4F739
for ;
Mon, 25 May 2020 09:17:29 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by mail.kernel.org (Postfix) with ESMTP id EB43B20812
for ;
Mon, 25 May 2020 09:17:28 +0000 (UTC)
Authentication-Results: mail.kernel.org;
dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="k4ak4DSh"
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S2389484AbgEYJRZ (ORCPT
);
Mon, 25 May 2020 05:17:25 -0400
Received: from lelv0143.ext.ti.com ([198.47.23.248]:49774 "EHLO
lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S2389454AbgEYJRY (ORCPT
); Mon, 25 May 2020 05:17:24 -0400
Received: from lelv0265.itg.ti.com ([10.180.67.224])
by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04P9H84v069133;
Mon, 25 May 2020 04:17:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1590398228;
bh=JF+D0P9IlTXPAfVYCw880QogymYkRdaUdIkcXPWXVR0=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=k4ak4DShTAe1fnBn80U/w9NlFhqdOkJS/RCmod4EjnJtnlNFq4M2N5QQlPouYiMCm
sCdiswkOmEOLokRg0ZHntmcbWkaHT6lQ4b3dpXNFiDC8FgsROLxTuRL/D10EN5aLwS
Sw0OHYuzX9G7gDrvk6vk9HjKGBYo9CusJ3O1IwiQ=
Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31])
by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04P9H8dp099068
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Mon, 25 May 2020 04:17:08 -0500
Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE110.ent.ti.com
(10.64.6.31) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 25
May 2020 04:17:08 -0500
Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE106.ent.ti.com
(10.64.6.27) 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; Mon, 25 May 2020 04:17:08 -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 04P9FjAE034800;
Mon, 25 May 2020 04:17:03 -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 ,
Mason Yang
Subject: [PATCH v9 14/19] mtd: spi-nor: sfdp: detect Soft Reset sequence
support from BFPT
Date: Mon, 25 May 2020 14:45:39 +0530
Message-ID: <20200525091544.17270-15-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
In-Reply-To: <20200525091544.17270-1-p.yadav@ti.com>
References: <20200525091544.17270-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 9fd3d8d9a127..11109969dc3a 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -618,6 +618,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 JESD216 rev B. */
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 e15e30796d62..d1d43ee09a0a 100644
--- a/drivers/mtd/spi-nor/sfdp.h
+++ b/drivers/mtd/spi-nor/sfdp.h
@@ -84,6 +84,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 */