Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp405370pxk; Thu, 1 Oct 2020 05:30:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqhgKZ/g0vTOzUTYNa72j8888PEN7xUnFJRDsVpojCpr/ClBXh5edItrKlZAW+WboV+Bz7 X-Received: by 2002:a17:906:a1d4:: with SMTP id bx20mr7635915ejb.262.1601555445377; Thu, 01 Oct 2020 05:30:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601555445; cv=none; d=google.com; s=arc-20160816; b=lXwbYPVo1ISdlGwbDeaDHLI99OUHsNCyCGuUzzKYGl3pq0RaKxWiZAO9/KrKiLhnhj 9G3j0NlstwRyCOyEIrybu0xzR+J4EkaNAJBrbMDfIoe2rWcLQBKC2heU6CtBTYpTOCEX VtbMaynYjbw0RVav6OAhruuFjc6p70uny9IXvAfQFI9m6iwiaTTG7RKF+J2TAIddtBmA TqAqGcBOq7YhkmzKmULsUSKWUBQHnUzoLkupd3O62iz4Xm2VftM1DmnBbdwhfmPwzUH9 RjSHn0XYxHo7ox0trQOBp7ODcl5eBsna8F2r4K4QyOtnlgVrO+fEd6IKkZtOr8yPy/rD tWhA== 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=YPmdGtgririZWeFGZIixYdXaBLbq2MRNAKDVlX/4kUw=; b=q+AAQoyZNSRn/McjS5iMtQzpQbvv1H2a83u6XTUoOyckGkLnH1es6p0gG8NH1j2M6D F/yfeCPW2HlQdthIGIS1P/RsQ6YxNgZIh12tyuo54IGidjKn2+N87cFJVIuOT9ebVeTp qEAV/RrRVL42eF82vYFQPB16x2CQieS/wBrHA9RryXrkK+wezdrpC/vaUIel6TqtEIZF UNGkp2VYrpAvp+ibTFhmKV5awU2br999wYATleWsH3LiBFftlT0XE0EIOJfOD3irC4gw akeuGxnLIuygWW54EdmFkG/xFG24nteOJUZN/aT5tG/G2duo8vXDwsqvtWHUI66xlxx/ iB1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=Vmvl50Ng; 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 y2si3331573edp.120.2020.10.01.05.30.22; Thu, 01 Oct 2020 05:30:45 -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=@walle.cc header.s=mail2016061301 header.b=Vmvl50Ng; 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 S1732261AbgJAM2n (ORCPT + 99 others); Thu, 1 Oct 2020 08:28:43 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:38949 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732243AbgJAM2k (ORCPT ); Thu, 1 Oct 2020 08:28:40 -0400 Received: from mwalle01.sab.local. (unknown [213.135.10.150]) (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 B694523E3E; Thu, 1 Oct 2020 14:28:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1601555317; 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=YPmdGtgririZWeFGZIixYdXaBLbq2MRNAKDVlX/4kUw=; b=Vmvl50NgCEDLAz7p7XnOx8mdTY8ozKD66f57f4M0PBQog4T6N7jGjiB2a8yyRdIAKKcg32 2Ox8lO47xe4Fqo799W+uers876u2fFo6Tgajr88MJ97GFDh0FEjTA9wMxwrTP9F/iBJevr EIYqBetka2N21AU3h9VIIwG19DuldzI= From: Michael Walle To: Tudor Ambarus , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Michael Walle Subject: [RFC PATCH 2/2] mtd: spi-nor: sst: remove global SNOR_F_HAS_LOCK Date: Thu, 1 Oct 2020 14:28:28 +0200 Message-Id: <20201001122828.23186-2-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201001122828.23186-1-michael@walle.cc> References: <20201001122828.23186-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 don'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 --- 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