Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1323802ybh; Thu, 23 Jul 2020 06:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUixCBntlQdfOmH4d44Omey0S7FyASFBi01DcM2WwpipXfAmv3oBz6qk2SnfKwyvgQwvPA X-Received: by 2002:a17:906:7802:: with SMTP id u2mr4253523ejm.206.1595510070187; Thu, 23 Jul 2020 06:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595510070; cv=none; d=google.com; s=arc-20160816; b=DMPwt6xDNUBIz0UXz7VzwRQ76TTnW9GUansEVNMeIY8Az79n/3t+OQ3ckfeKNdc/3i NIJqJVnyYryW49rckB9cTrOWe5o7WW+ajm/DtC+3RpKXHjF7lkanU1NyWh2WzUHqKBmI efolQtqQ6/JoNXj7Rk6qBG/n5yGIBcXtJKezVtf9t74XQHuLmEjmvPEjXCUs94683BLL xDQ4re1FFTrOEYQ32D5GHpJUhjG/gfza+uHqp5EjwT3MF6lSNJY+6dtQnYrQcVOWejKs WliuonTb9CiNfZVDgo+mOVhpyBJrEc0ES9RVDy9zoZvtRLP1KtIuSS4kDHhHXkanPZRu l0Fg== 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; bh=4LSGhySCD1VAjDg5SM8ZLc65H5oS3BvU3Iea0lxdSf8=; b=FvjWBXpsVMci73mDuPb+G76I1RvPswyMoz3g6nLEM5nf4t91BZ2HUGksrZhxH77Zxn yv2JeUTNphqjMCMtYdaZdlJg1psaFq/L9tayh6b4zt1v7LhUIKoJHpc4qpAScWIcSUvt SOgLtmZSmzUplQMD/S4vb/MpCQE8dKMkKl2s6ejtpe4MsXHSfTRohlqcBf2uMY7EHUOq SXR2I8caXf0YOTGSKTDDbAaIgstoXOlTD9u5x0JeA0JVLtXREG9OkZYYfUid/ieYWnG/ QIZzG9gKu68/bDBI5XQlUr4bljqOMI7DTPWAvBcvkb56BRZWi8A8ujpyjdmkzF0P/6Q7 pnhA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si821931edd.112.2020.07.23.06.14.08; Thu, 23 Jul 2020 06:14:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729203AbgGWNNF (ORCPT + 99 others); Thu, 23 Jul 2020 09:13:05 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56717 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgGWNNE (ORCPT ); Thu, 23 Jul 2020 09:13:04 -0400 X-Originating-IP: 42.109.196.68 Received: from localhost.localdomain (unknown [42.109.196.68]) (Authenticated sender: me@yadavpratyush.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id DF2661C0009; Thu, 23 Jul 2020 13:12:58 +0000 (UTC) From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sekhar Nori , Boris Brezillon , Pratyush Yadav , Pratyush Yadav Subject: [PATCH v11 09/14] mtd: spi-nor: sfdp: detect Soft Reset sequence support from BFPT Date: Thu, 23 Jul 2020 18:41:58 +0530 Message-Id: <20200723131203.40916-10-me@yadavpratyush.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200723131203.40916-1-me@yadavpratyush.com> References: <20200723131203.40916-1-me@yadavpratyush.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pratyush Yadav 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 17dbbb3e4796..ec54ce6c5403 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 05191f7b3b33..3bd173546cca 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -604,6 +604,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