Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp3555479ybk; Tue, 19 May 2020 07:31:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBwJzMmZhvqeITjE7utl+aRw7b7Om/kJDg0IO/qbrlwQEBL8E4vMxpLOKSW40YGXfRRFcR X-Received: by 2002:a17:906:16c2:: with SMTP id t2mr20087973ejd.17.1589898668495; Tue, 19 May 2020 07:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589898668; cv=none; d=google.com; s=arc-20160816; b=FK6cZxsfDEmZTRdMh6pUGutN0/wsFzYnpXtHdOstU0VDEJbABwFHCmuqXcB0j6PSwc ZHCP7BypZ2eqhAd+oVDF2V6XUz8+LL3sWgPhxySqWPm5aHbwQeR35TYy83A7aHgr+Wj2 lGmom2oSuYu/7I04MnggJwK8lCBDsZJ7ilH5xLCAgTI92S1dHlBTgohQF/QErWp6Jxni iQ1lAgCzm6K/xtsjKrMP+jBchX6f/DGdNXOojTZjpcc9hfDYUhINZzHA+Lt7ZqRQgxZA yf/RXwfcwLduLhUunSM6r2q4vODbSdJDObBUVeTJ6y07IbQeMwZ9mMENXRXkLuqefJr0 Fb8A== 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=9xLffVA5r8ASMh0Vn0pVTuU1915Ui+S8Ct4YIoEdtdo=; b=SrzmPYQ4cvE+aj5eNQtBWhMUzUhOWYt53cakC9sKCUpzyQNM91mmwQAsoPAotIcVZk LBobrP3ClnPZLPu/18Uknydr86yv8wlL5hqVnGnN8x3t+rPSMWMGfNtFFZV8QeUu9ih6 4CPk3PObscO86DB7Vw0yScK7SI9C2GJef2KX9Q5EGcnP/8mQQr3mc75xqyyb87LPDmXe DhYikCaNfL6BOnh52x++VQJs/bD0NgmCVjAMEp/maKWu78FwuKwQEnY1KzlSPUqVyLNk LUigP1k+h6XbQi5mJ8E7w99+FWVjLgQ3ejIqlsm4i04bkZzlmg7jgYGwTEehS1DXZIeV mo4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=y6pFTWRi; 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 sb26si8596173ejb.196.2020.05.19.07.30.44; Tue, 19 May 2020 07:31:08 -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=y6pFTWRi; 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 S1729271AbgESO2M (ORCPT + 99 others); Tue, 19 May 2020 10:28:12 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:59200 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729057AbgESO2K (ORCPT ); Tue, 19 May 2020 10:28:10 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04JERw1W075283; Tue, 19 May 2020 09:27:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589898478; bh=9xLffVA5r8ASMh0Vn0pVTuU1915Ui+S8Ct4YIoEdtdo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=y6pFTWRiaKX4rmkTDtmsCenHjPzuGJo18OfAn9VJEJVxxgS9uKX/Je+2hE1uFS0yf A6NoCDFbZvfFBKFjtjCr5UczScUhuzHrefbITB7y0zwRyzehS57O4GCWALvmHd/FwM yv8tN5nxMXqFjMzc1SmDW3zfPoUSpZWL6Fn+wGGA= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04JERwhj047065 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 May 2020 09:27:58 -0500 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 19 May 2020 09:27:58 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE102.ent.ti.com (157.170.170.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, 19 May 2020 09:27:58 -0500 Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04JEQgjW008313; Tue, 19 May 2020 09:27:53 -0500 From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Matthias Brugger , , , , , CC: Pratyush Yadav , Sekhar Nori , Boris Brezillon , Mason Yang Subject: [PATCH v5 14/19] mtd: spi-nor: sfdp: detect Soft Reset sequence support from BFPT Date: Tue, 19 May 2020 19:56:36 +0530 Message-ID: <20200519142642.24131-15-p.yadav@ti.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200519142642.24131-1-p.yadav@ti.com> References: <20200519142642.24131-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 be9c6c3d6590..490ece7b3d33 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -611,6 +611,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 */ -- 2.26.2