Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1157558pxu; Fri, 27 Nov 2020 00:44:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJztCNHeM71Rxm22+TawXKky1OiZTeZeqe69s4AP/M419YqSqlVQh/FxE1hPJ8L8Ls8uDLW3 X-Received: by 2002:a17:906:2f87:: with SMTP id w7mr6699351eji.83.1606466693599; Fri, 27 Nov 2020 00:44:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466693; cv=none; d=google.com; s=arc-20160816; b=wWbf8xTcR3LLD5sb4loni27fRdX5Y8yLyNiMIzwbhO1QtIq0GaaXAymxD4e7uGkMJa 3c/76fe43jhSd9U2RJZ5ypuvg19PgvwCzE0GcoWFwRHs+Vn0g9Dd7MUOTvhygZ3zghLF oHbNqj5oez7+yEa2ziCvlBMcJK3zak+Lz/HyUZu10ta0d69DjhnmU99pfVp/0iqr0jEz fGbDio7cIOVxIxzWMQCG4b2zJc+BKvKmkLerEz6t+UBOorCgdoBVjs5FA5BB0GG/HlMa juSrXZ/UBHO+/A2iv8e41qANPp/CyVpfN7pvzJCL8fhrH2aoG21Abs7ZOyyLMOTHF3Ms p4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WAEL31FgHdolV0iOEQ5kTwtCJsNfcDo0Hhu/i1SXV2M=; b=od6q24R9SH5Oe01oEbdcaOyR9inmExm1kAlDmqlngjRXM1NxYy/qCmjXA8uH8xbGVG 8kjmvcTLupyjvzRUMvKbj0r1KwJag5MpRkxs/+m5ISs6SDH/NSTU+9n6cIw1Fi7CXCuX sQGxPyM7wxshbMbOAKXDtsxu6I/3wL9hzux+VLDWnZQfZAu+6Ppzz8uy7eY19V71Z8uh 5jFRrlz+QXr9b9ZMOFu92xN/ALQ7EE4RHTHBNauJ0zQosjkCkkfqIKXMsfzbZk6yyv8l 7KB8cnUYZ9nsinB2vIxcGPCLAivOO6juY8re9t+xp8RK8gClD09qTyZMJ/lbFwx6zYCy nTIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=h4NY1gTe; 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 qt18si4319467ejb.602.2020.11.27.00.44.31; Fri, 27 Nov 2020 00:44:53 -0800 (PST) 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=@walle.cc header.s=mail2016061301 header.b=h4NY1gTe; 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 S2390063AbgKZU0k (ORCPT + 99 others); Thu, 26 Nov 2020 15:26:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbgKZU0k (ORCPT ); Thu, 26 Nov 2020 15:26:40 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEE26C0613D4 for ; Thu, 26 Nov 2020 12:26:39 -0800 (PST) Received: from apollo.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 5944923E5D; Thu, 26 Nov 2020 21:26:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1606422396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WAEL31FgHdolV0iOEQ5kTwtCJsNfcDo0Hhu/i1SXV2M=; b=h4NY1gTe5Xsbh+A68RgCvANK4Mjtb04k/6PR1br0IYi9loNngutNr9VS88tOm5GVplpIY/ O2W13oHBv9nuUHSEF2HGlN3Z2E3TDFdczHcAHvgMDEYbIZaeacaeKAxfSXLhz9AHUP9NVd wfYrVhNPHTQ5KAtJU9GG8X/m7Lx7V6Y= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Tudor Ambarus , Boris Brezillon , Michael Walle Subject: [PATCH v6 2/5] mtd: spi-nor: sst: remove global protection flag Date: Thu, 26 Nov 2020 21:26:11 +0100 Message-Id: <20201126202614.5710-3-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201126202614.5710-1-michael@walle.cc> References: <20201126202614.5710-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is considered bad for the following reasons: (1) We only support the block protection with BPn bits for write protection. Not all SST parts support this. (2) Newly added flash chip will automatically inherit the "has locking" support and thus needs to explicitly tested. Better be opt-in instead of opt-out. (3) There are already supported flashes which doesn't support the locking scheme. So I assume this wasn't properly tested before adding that chip; which enforces my previous argument that locking support should be an opt-in. Remove the global flag and add individual flags to all flashes which supports BP locking. In particular the following flashes don't support the BP scheme: - SST26VF016B - SST26WF016B - SST26VF064B Signed-off-by: Michael Walle Reviewed-by: Tudor Ambarus --- changes since v5: - none changes since v4: - none changes since v3/v2/v1: - there was no such version because this patch was bundled with another patch changes since RFC: - none drivers/mtd/spi-nor/sst.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c index e0af6d25d573..8b169fa4102a 100644 --- a/drivers/mtd/spi-nor/sst.c +++ b/drivers/mtd/spi-nor/sst.c @@ -11,26 +11,26 @@ static const struct flash_info sst_parts[] = { /* SST -- large erase sizes are "overlays", "sectors" are 4K */ { "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64, - SECT_4K | SST_WRITE) }, - { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, SECT_4K) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, + { "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_LOCK) }, { "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4, - SECT_4K | SST_WRITE) }, - { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K) }, - { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, + { "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) }, { "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16, - SECT_4K | SST_WRITE) }, + SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK) }, { "sst26wf016b", INFO(0xbf2651, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, @@ -127,11 +127,6 @@ static int sst_write(struct mtd_info *mtd, loff_t to, size_t len, return ret; } -static void sst_default_init(struct spi_nor *nor) -{ - nor->flags |= SNOR_F_HAS_LOCK; -} - static void sst_post_sfdp_fixups(struct spi_nor *nor) { if (nor->info->flags & SST_WRITE) @@ -139,7 +134,6 @@ static void sst_post_sfdp_fixups(struct spi_nor *nor) } static const struct spi_nor_fixups sst_fixups = { - .default_init = sst_default_init, .post_sfdp = sst_post_sfdp_fixups, }; -- 2.20.1