Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3823725ybt; Tue, 23 Jun 2020 11:35:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr8uZiBXnMM19ZNwkujUJhD2AieXbWcOkTio0kwGQvS45yJstnbQ2AhMFs8cZBZce+zkft X-Received: by 2002:a17:906:3192:: with SMTP id 18mr4631577ejy.208.1592937309464; Tue, 23 Jun 2020 11:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592937309; cv=none; d=google.com; s=arc-20160816; b=nnaVy3L/K3+KJrktTXxrzodp+K2H6QmfomSbvJEX1BoSi+Qg2AWs1NND17vGMGMLYO tCnawPgHu/wCOjFVM5pEqcHFgxIPxfBfUJyid9MapVUzwQsLRgF6oWyrpDRCaexaQbpW C/idUVXCXsu+wCcf3IVO+pECGsvpZxNixJ2LLRGdcZvAE6eaG2vOtnihRfreGnX/Yr35 UaK2J+yl2P5iaHkeZT2WV2+NvRersMuiXLuftYk02zCySl9gHNK4zk9OEHTwXd15Jr3p AihqM8aN8h0mm9FTn9MyVKu4Nfir1sy2ndeA/Gt+XLDWvphyZ0/r8vrBX/xdDRv8N0M0 XL7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yBGNCcbopFGvxKZCAWkAxJMuz+3sEiqQI5mQ644ETyQ=; b=tgfJwvMjW7PH1rCuTE7jxH6D85cp306Y/3UTXzuhPYPyVrtqZxXeRDOmeW37niaF+z VejckOnFL/qDKbVyAaJwdH4CCKzULpNskJPErBTmRIXoLn8jkdUzkgAifYCGeD2BSIHj ZVjPgnlmRQHS1aNH+/6BbA3K+xvbJ8g+FFfBa6GIlBUYmFD4DNq2qRpmcG26vcjx+HRX 8+kMVCMMpvxWWOyLzz//zyPObdG4+MDbGbo+1uhBAW4ZMviw17rM58rG2kv8qnLldY+E b7+fWor1rp4cUAxe14C9DEmznjPrt88KuiXnBfs/zK6B2LKwwg/6SMGxDh3/B62SAwYM 3BVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="h/owzAfL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c26si12512046edj.238.2020.06.23.11.34.45; Tue, 23 Jun 2020 11:35:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="h/owzAfL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387652AbgFWSbu (ORCPT + 99 others); Tue, 23 Jun 2020 14:31:50 -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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 */ -- 2.27.0