Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51AA3C433F5 for ; Wed, 3 Nov 2021 23:50:14 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4E331611CC for ; Wed, 3 Nov 2021 23:50:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4E331611CC Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F35DE83224; Thu, 4 Nov 2021 00:50:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="ohulr1je"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F185883224; Thu, 4 Nov 2021 00:50:08 +0100 (CET) Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AB8C583224 for ; Thu, 4 Nov 2021 00:50:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Tudor.Ambarus@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1635983405; x=1667519405; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CDLlH4To/ClD/5Yv6IbO2YBJ7gy/rB3ethxjZx87l0I=; b=ohulr1jeIKSdg9rdka6BJT5lKqr0q70a463PHvfjQDJ3gy0eSXUT41FC 7sRRFATavsJNOE5ouoI32KqTm5ubfbl8W7BNNQrwDzRAK65mpoFQgsH4t /uQN82VEDy5hW5AK7VygKJEVeQQt8S3mvBCMP1rLeubC6r0hCON6d4lzV yKsBj1EdXMJFJQvzj9QQ8rhnGbbhbizUHvOvdVxLP4Lr5zhPZhyg0yWb5 +03vQX1wUuJCbch7LBmwM5juUeoCgHBs+MNGi2JgmSzT5sycJ7Nc6BIyY aroUF4oVWkQGmy31DibyU3QVTQsUmo8zW7HiF+TpyKx1ZarrHENy6osCk g==; IronPort-SDR: Ab6YJSqiQ+BElMyvWg0opqJXy5J8c0AYkvAhKqucfQpVJE0q0mstDypVZEFVbOIM20onqgE6yW 20CNLielW3ZfPQ6GFv9SrBf7NFrNSwntqHfOy9QZbQvOCHdw0nk2inNFrDK74Myf+WaFA+Ui+Q VsYNUUG8YxJRWH/SK2Q3mOoeHJhi7OpK0fSUgQAuqoZyl2i/1t/4xjAOnb9+ct12A0S7aOke09 L3XZb4BxnMZ7OfxLi0nNnaQKGtIt2Y2A5pyuMzYwa0cLqsQkO41m4BNFPMdHWU44Gmbpm0lEFP lfE7ApyopHbr+C58qDZRrWX1 X-IronPort-AV: E=Sophos;i="5.87,207,1631602800"; d="scan'208";a="137957449" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Nov 2021 16:50:02 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 3 Nov 2021 16:50:02 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 3 Nov 2021 16:50:00 -0700 From: Tudor Ambarus To: , , CC: , , Tudor Ambarus Subject: [PATCH v2 1/4] mtd: spi-nor-core: Introduce SPI_NOR_SOFT_RESET flash_info flag Date: Thu, 4 Nov 2021 01:49:47 +0200 Message-ID: <20211103234950.202289-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103234950.202289-1-tudor.ambarus@microchip.com> References: <20211103234950.202289-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Some flashes can determine if Soft Reset is supported by parsing BFPT_DWORD(16). There are however flashes that do not define any of the SFDP tables, so they can't discover this capability at SFDP parsing time. For such cases introduce the SPI_NOR_SOFT_RESET flash_info flag to be able to specify statically this support. This flag must be used together with the SPI_NOR_SKIP_SFDP flag. For flashes that support Soft Reset and define BFPT, but have the BFPT_DWORD(16) missing or with a wrong value, a post_sfdp() fixup hook should be used instead, where SNOR_F_SOFT_RESET should be set. Signed-off-by: Tudor Ambarus --- drivers/mtd/spi/sf_internal.h | 5 +++++ drivers/mtd/spi/spi-nor-core.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index d3ef69ec74..9a16e07bc4 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -69,6 +69,11 @@ struct flash_info { #define SPI_NOR_HAS_SST26LOCK BIT(15) /* Flash supports lock/unlock via BPR */ #define SPI_NOR_OCTAL_READ BIT(16) /* Flash supports Octal Read */ #define SPI_NOR_OCTAL_DTR_READ BIT(17) /* Flash supports Octal DTR Read */ +#define SPI_NOR_SOFT_RESET BIT(18) /* + * Used by flashes that do not define + * any SFDP tables, i.e. in conjunction + * with SPI_NOR_SKIP_SFDP. + */ }; extern const struct flash_info spi_nor_ids[]; diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 4388a08a90..ce1ecae899 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -3813,6 +3813,9 @@ int spi_nor_scan(struct spi_nor *nor) if (info->flags & SPI_NOR_NO_ERASE) mtd->flags |= MTD_NO_ERASE; + if (info->flags & SPI_NOR_SOFT_RESET) + nor->flags |= SNOR_F_SOFT_RESET; + nor->page_size = params.page_size; mtd->writebufsize = nor->page_size; -- 2.25.1