Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9112021pxu; Mon, 28 Dec 2020 06:58:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzVQrF77hBZJkCi9+2qa9ORdEohtahagD3Xxq6eXYcWaGFIgvoD42UdGDW0zSNZ6Xx2qhJ X-Received: by 2002:a50:fc8b:: with SMTP id f11mr42731453edq.11.1609167486597; Mon, 28 Dec 2020 06:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167486; cv=none; d=google.com; s=arc-20160816; b=r0B7lBzatGMzaLdv0o3QyWqp4Lb2sVieanQpcQTqNG53HAhF7D776hWoL2JUCqmqxS I/gP/9EwOdr/VtSXLH1AUlvtRjNnS1SB3LhR50Am1Xrkt3MG8kqmovSuUjufsvxap2th SI2EJvcE9UHyQREnlphlccJhEBl42dZtUJ89E5XQ5wjQJtJx8+psgoiL5US96C7BeC2o 5fj3H/WGrNBY/CTbU1OahJpwRqtTC90Cz3111Qv9dWZqE9g9luE+bT8AiHqIGlMGBxdr nyzdsNl4ur2PxVLMcMGsM6CNI5i9XrFwL20bg+nw0noFETNA3xD/Rys1v/aiR+Xfvm0o V7gQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vdFUCQUgPnnahSLrhInqD2QnM/PgcUS4jBzsTCG45ZU=; b=MOGYy7SWcxbkNnnKd2owdvoZd+TmhTjvgZUcVMvc1uRlOPlfGCLp3FoCyc1BgTC/BA EJdQEjvsWqp9ZBeRGspcYue8s+vOOqgcv7ssi8k7nQjdTO0P6zeaec9sfppAomRvaJ4W pm+EWLma0Qfo3M1fPvmoTDgzV5Itt9OYLO3ropLsyUxMBaeMRp+zY+Y80Kvh0Jp12kLc DK9mxSLJz+fQoeljQxDUyxF2/NBH/GHHvPIuNXxKpunAp9Rna3JeFUZtSzLhqPeaBg8H UoM38dybGeRZZwyfLSi2rzFfYJrKis9u6YxRbr2gmrq5NiayhGmj3Lqjvgj9pfI1k09Y b+pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ZKU+1NO/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si17743981ejq.369.2020.12.28.06.57.42; Mon, 28 Dec 2020 06:58:06 -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=@linuxfoundation.org header.s=korg header.b="ZKU+1NO/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405272AbgL1OzZ (ORCPT + 99 others); Mon, 28 Dec 2020 09:55:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:51268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441347AbgL1ORG (ORCPT ); Mon, 28 Dec 2020 09:17:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6640522583; Mon, 28 Dec 2020 14:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165011; bh=yILNp6kH/yw5GNmBb/hw2thVBIH/jQnLg3VdnXrTiR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZKU+1NO/shupuddV9rpAe8uAEF/8TcIAyCc/yZgmvkMwWA+4ZYUuWlEk8cb/HXyEq XgGj2qvPtOkVqrM2ni2SiOZd4UN1IkED7EUUX3lib/nAHyh2qd9PdiHJP26GLt8Sev 3CAUZRqO5menYAUPc4FSXPjkyK3xwS9TPYoRZuJ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Vignesh Raghavendra , Tudor Ambarus , Sasha Levin Subject: [PATCH 5.10 348/717] mtd: spi-nor: atmel: remove global protection flag Date: Mon, 28 Dec 2020 13:45:46 +0100 Message-Id: <20201228125037.701027739@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Walle [ Upstream commit e6204d4620276398ed7317d64c369813a1f96615 ] This is considered bad for the following reasons: (1) We only support the block protection with BPn bits for write protection. Not all Atmel 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: - AT26F004 - AT25SL321 - AT45DB081D Please note, that some flashes which are marked as SPI_NOR_HAS_LOCK just support Global Protection, i.e. not our supported block protection locking scheme. This is to keep backwards compatibility with the current "unlock all at boot" mechanism. In particular the following flashes doesn't have BP bits: - AT25DF041A - AT25DF321 - AT25DF321A - AT25DF641 - AT26DF081A - AT26DF161A - AT26DF321 Signed-off-by: Michael Walle Signed-off-by: Vignesh Raghavendra Reviewed-by: Tudor Ambarus Link: https://lore.kernel.org/r/20201203162959.29589-4-michael@walle.cc Signed-off-by: Sasha Levin --- drivers/mtd/spi-nor/atmel.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c index 3f5f21a473a69..49d392c6c8bc5 100644 --- a/drivers/mtd/spi-nor/atmel.c +++ b/drivers/mtd/spi-nor/atmel.c @@ -10,37 +10,27 @@ static const struct flash_info atmel_parts[] = { /* Atmel -- some are (confusingly) marketed as "DataFlash" */ - { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, - { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, + { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) }, - { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K) }, - { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) }, - { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K) }, - { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K) }, + { "at25df041a", INFO(0x1f4401, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at25df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at25df321a", INFO(0x1f4701, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at25df641", INFO(0x1f4800, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_HAS_LOCK) }, { "at25sl321", INFO(0x1f4216, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, { "at26f004", INFO(0x1f0400, 0, 64 * 1024, 8, SECT_4K) }, - { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K) }, - { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K) }, - { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K) }, + { "at26df081a", INFO(0x1f4501, 0, 64 * 1024, 16, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at26df161a", INFO(0x1f4601, 0, 64 * 1024, 32, SECT_4K | SPI_NOR_HAS_LOCK) }, + { "at26df321", INFO(0x1f4700, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_HAS_LOCK) }, { "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16, SECT_4K) }, }; -static void atmel_default_init(struct spi_nor *nor) -{ - nor->flags |= SNOR_F_HAS_LOCK; -} - -static const struct spi_nor_fixups atmel_fixups = { - .default_init = atmel_default_init, -}; - const struct spi_nor_manufacturer spi_nor_atmel = { .name = "atmel", .parts = atmel_parts, .nparts = ARRAY_SIZE(atmel_parts), - .fixups = &atmel_fixups, }; -- 2.27.0