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 6EBEAC433F5 for ; Wed, 3 Nov 2021 16:25:23 +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 BA860600EF for ; Wed, 3 Nov 2021 16:25:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BA860600EF 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 1E7D983632; Wed, 3 Nov 2021 17:25:13 +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="hr/XlWSU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19D308347E; Wed, 3 Nov 2021 17:25:09 +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 CEAC7835CC for ; Wed, 3 Nov 2021 17:25: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=1635956704; x=1667492704; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CDLlH4To/ClD/5Yv6IbO2YBJ7gy/rB3ethxjZx87l0I=; b=hr/XlWSU8l3G8AC1zyuncIokeUC2XkXgRIoKrU9gUDDsqE0yY6coDX5h +Td8+Ff5qRR52w5EpcNBUNGFSm3Hcd0Udvgd6lxSAbKmJCBJtNXNapERF yFCcfV/3l1TJI2ZegNgvtC2NAVEn93GVZ1cX1F9ecdU2J06cyCKHeuL7f X+atHjDcBxVh2GjBcRUePMVzo7HLfAyHNNqB8RyDOHkqMhZTzH5BaEsxM 1CzRAhjHZvwVA9X2YJQFbtjkN9boW0RIXtcQ+I+HaFx5CgYxtgo482D15 aOSF2Q8BJKRO70E4/4aqtH3gkndLBfVPBds+/o8I5XlxTltUiR4sf7v0A A==; IronPort-SDR: mmp2Jj/jy3pJYMu0wzAgxYi2bZeDlDpY023Mwp4pHP+xymEaGp0UMkdBwmh0ip80BSpokzoQFd h5y+8ra+DPxX+FsDxa0AD1sBEK2dFTNil+aF/YvueCSQq7ABJsPPv5vzDoSL21xSER+RVxQoc9 TrQbFqqNaY4Eo6NwUxuTkHi9ceWdBDKlkb7fc5XjCwaObHMHugaAw7c/AWNjTYD2cP7uC2nEWo NOLQTDu8Dh5ToKocbsVjjPMgX46sSBpBam+JQvVizoCEy+pKpmIby7CK1OYVMVF5TDXpywkbPy UkkJcS6t8Sk2crlbJyAch1Tp X-IronPort-AV: E=Sophos;i="5.87,206,1631602800"; d="scan'208";a="75251934" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Nov 2021 09:25:01 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) 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 09:25:01 -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 09:24:59 -0700 From: Tudor Ambarus To: , CC: , , Tudor Ambarus Subject: [PATCH 1/3] mtd: spi-nor-core: Introduce SPI_NOR_SOFT_RESET flash_info flag Date: Wed, 3 Nov 2021 18:24:52 +0200 Message-ID: <20211103162454.179191-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103162454.179191-1-tudor.ambarus@microchip.com> References: <20211103162454.179191-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