Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp293380pxb; Wed, 20 Jan 2021 07:12:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcOdatJ6dtEUvrCr//fu/VuJSm3+hhiNTMHZD3WfgoUeZmnB40yFbhKubmIzGk/IrSLc1D X-Received: by 2002:a50:9dc9:: with SMTP id l9mr7714936edk.377.1611155569992; Wed, 20 Jan 2021 07:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611155569; cv=none; d=google.com; s=arc-20160816; b=X8eBvF/mFKYpfX4S4fOEVR9UAY1hj8seyPfynKCXlzeL35R6GzXMqzs8G6FsMdlyDo 2BTrrItWcFUd/X1pKmum+kf82KyfykTgfCBI+nNmm2dguZm6LTq4ljXE3pXioqYnOx5Y DZTshrX9d52N7FMmFNl388aqdosraZxj9p9uK656bISlsfJlfBpfoTY+L/a0MPWYXGn3 XeIZnmi/+JKU6NvhXfIt18GSW+RVGkB/fzS0snBRtMfOsdg4Nu2u1sLzCFXTg352oMQU c4QY3zkT+ucnI33wefOSlUdjE0UElaUp/ZwUiDzBYzpdHtIMPWVnjrvFy0kEcEJ9dLTI oaFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=sUHuaCPz16VMa7CYH8WbEw6Xdv8BgjZHYjL6590ZBPc=; b=lnVfJ5t3uzv4e7WiEJHKDiB4m4F6fVNZTo5GE2m9z616Yubrz0geiqIds6ekD3muc/ In73piMgKRJ/Foq1Sx7pdjm6YRPbY7lJ/3nWvWsIKtq+arM3Y/vZ8rmLtVZwStdFP5dQ 4k01qI09pyGQpOmdRECO+nowTDM0MG5egOA5nO04BaeYUnUh2n4wtBp9KJRcS9S66+V3 TMvxAZQOmblRQYqTSdmNQsNP2LkZGRaWC96JwoSCDX3p3bZ75OfMI28sGzfz/oOWjYXn DNIKQ+tK2fEwJI/HUpkWI3Cr+kGEgQ1MJQxN6f+BeR01Ln0Tppok19brn9X4hjU5iVpa jdmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=uheoepFQ; 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 t20si900026edv.290.2021.01.20.07.12.01; Wed, 20 Jan 2021 07:12:49 -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=uheoepFQ; 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 S2390279AbhATPKK (ORCPT + 99 others); Wed, 20 Jan 2021 10:10:10 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:54537 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390855AbhATPC5 (ORCPT ); Wed, 20 Jan 2021 10:02:57 -0500 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 714C622727; Wed, 20 Jan 2021 16:02:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1611154925; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sUHuaCPz16VMa7CYH8WbEw6Xdv8BgjZHYjL6590ZBPc=; b=uheoepFQtsTTigNWCwM48rCQ2vQd7kXwLLUWWEAbcWX0dujmbKPuCDvw0EPLqiG2FG5eNe Xi9jnS/JNKVvt9Knkf+e2CxjLqYd/q6j5+P1ISsc/Cy5Q4P2nX3xTK1v5C8iLW9XARHeKQ upEs8IEhrxDY2E3FDw2bHDIvyrL2y3Q= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Wed, 20 Jan 2021 16:02:05 +0100 From: Michael Walle To: Tudor.Ambarus@microchip.com Cc: vigneshr@ti.com, p.yadav@ti.com, miquel.raynal@bootlin.com, richard@nod.at, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Kavyasree.Kotagiri@microchip.com Subject: Re: [PATCH v2 2/2] mtd: spi-nor: sst: Add support for Global Unlock on sst26vf In-Reply-To: References: <20210120131914.277363-1-tudor.ambarus@microchip.com> <20210120131914.277363-2-tudor.ambarus@microchip.com> User-Agent: Roundcube Webmail/1.4.10 Message-ID: <447aca9c61a45b05f7869b9747e2c301@walle.cc> X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2021-01-20 15:52, schrieb Tudor.Ambarus@microchip.com: > On 1/20/21 4:05 PM, Michael Walle wrote: >>> diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c >>> index 00e48da0744a..d6e1396abb96 100644 >>> --- a/drivers/mtd/spi-nor/sst.c >>> +++ b/drivers/mtd/spi-nor/sst.c >>> @@ -8,6 +8,39 @@ >>> >>>  #include "core.h" >>> >>> +static int sst26vf_lock(struct spi_nor *nor, loff_t ofs, uint64_t >>> len) >>> +{ >>> +     return -EOPNOTSUPP; >>> +} >>> + >>> +static int sst26vf_unlock(struct spi_nor *nor, loff_t ofs, uint64_t >>> len) >>> +{ >>> +     if (ofs == 0 && len == nor->params->size) >>> +             return spi_nor_global_block_unlock(nor); >> >> >> Some blocks might not be unlocked because they are permanently >> locked. Does it make sense to read BPNV of the control register >> and add a debug message here? > > It would, yes. If any block is permanently locked in the unlock_all > case, > I'll just print a dbg message and return -EINVAL. Sounds good? spi_nor_sr_unlock(), atmel_at25fs_unlock() and atmel_global_unprotect() will return -EIO in case the SR wasn't writable. -michael