From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27CEDC54E58 for ; Mon, 25 Mar 2024 10:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zNrFOo7VQL55Gykj+1RExh8y381nVg+Q8F126WEa7HA=; b=rBTpzW4dAfmx7k oo++U/AozI2mUizwnVEo7/0pL+sNs4ZMTYpQxQrDoIA/WdChbxPA+d2ddAj7dVMg6nMRnNF8J7Zwr JtVMJOxrtVMAZdytemJXPVQTtfyTImxBJe4SCX+jZXkAJ9X6FRwBLHo26TDbOqR1pfOG3SOz60XAA KT4UULXVNYzqnhzgXEnp43f6ntgN9DdZ3fj+ocXfvtzT9dejY68/qFxvm1Oti7/sjl9dggSTnaLz8 xIYQQmRjV6Sb+CPt97nGhstZTX0ZmiKo1Ny+ZYg+Cb4vc/UaBrCed2jPwEzmJutFI1phkg9/xyuZj deh5A695Vv9nn8BJUtpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohPf-0000000GhLD-3PRu; Mon, 25 Mar 2024 10:18:43 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rohPb-0000000GhK0-3WHM for linux-mtd@lists.infradead.org; Mon, 25 Mar 2024 10:18:41 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id D9BF7C000B; Mon, 25 Mar 2024 10:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1711361915; 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=fJ+47P+RHmGvxe+WTJ+sohpvSvUI9IclV23BMTd4mZ0=; b=PU3gBbuG8C4gJV4/r2P6rGSYICdiI1h4uO21LKWuX9FS8pFhqRMDq9VQJTtIMAFLIS686l 5HsSs2x0RJA7Qwuo0e1XKpamWhn1+ZGoZByFQKM5rYpKp6CEbpVKIdlM2GzanGu8XZM8V/ +HGvVcaiMA9T0HyzkZDOePVFXFc8AlihHAfK1/IzHWNl3aqTBazNzO+vd/TqmBtJokbkFi MlPwB404kD9sy32p1qXKcqdpkE6ZjLSg2jdEc/lu6aNK/+Y3fdK1RXDOmNfs9DAt6RryZm EGWRoifHlLlIGgDg1sie1wazgVT/ghjYmMJHeiLCushsHl1IjtNSe2jDshzzyw== From: Miquel Raynal To: Christian Marangi , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Jernej Skrabec , Claudiu Beznea , Greg Kroah-Hartman , Srinivas Kandagatla , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: Re: [PATCH v3] mtd: limit OTP NVMEM Cell parse to non Nand devices Date: Mon, 25 Mar 2024 11:18:34 +0100 Message-Id: <20240325101834.262354-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240322040951.16680-1-ansuelsmth@gmail.com> References: MIME-Version: 1.0 X-linux-mtd-patch-notification: thanks X-linux-mtd-patch-commit: b'b0a53dc56c145b8b2c13b43eba2c9ef0507f9840' X-GND-Sasl: miquel.raynal@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_031840_267334_776C3EFD X-CRM114-Status: GOOD ( 17.85 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Fri, 2024-03-22 at 04:09:49 UTC, Christian Marangi wrote: > MTD OTP logic is very fragile and can be problematic with some specific > kind of devices. > > NVMEM across the years had various iteration on how Cells could be > declared in DT and MTD OTP probably was left behind and > add_legacy_fixed_of_cells was enabled without thinking of the consequences. > > That option enables NVMEM to scan the provided of_node and treat each > child as a NVMEM Cell, this was to support legacy NVMEM implementation > and don't cause regression. > > This is problematic if we have devices like Nand where the OTP is > triggered by setting a special mode in the flash. In this context real > partitions declared in the Nand node are registered as OTP Cells and > this cause probe fail with -EINVAL error. > > This was never notice due to the fact that till now, no Nand supported > the OTP feature. With commit e87161321a40 ("mtd: rawnand: macronix: OTP > access for MX30LFxG18AC") this changed and coincidentally this Nand is > used on an FritzBox 7530 supported on OpenWrt. > > Alternative and more robust way to declare OTP Cells are already > prossible by using the fixed-layout node or by declaring a child node > with the compatible set to "otp-user" or "otp-factory". > > To fix this and limit any regression with other MTD that makes use of > declaring OTP as direct child of the dev node, disable > add_legacy_fixed_of_cells if we detect the MTD type is Nand. > > With the following logic, the OTP NVMEM entry is correctly created with > no Cells and the MTD Nand is correctly probed and partitions are > correctly exposed. > > Fixes: 2cc3b37f5b6d ("nvmem: add explicit config option to read old syntax fixed OF cells") > Cc: > Signed-off-by: Christian Marangi Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks. Miquel ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2DDB12FB32; Mon, 25 Mar 2024 10:18:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711361920; cv=none; b=meS3S7+a50YufSuLIV2F17PgOYf6qEXrWTmZGYPGAJ6bAPchVANZKlannt8IbEZkiaG8GmYT9RXfPqymhWNrp2K9zW3GE6d6UeLRoKZEyg5pj7XdX+qqva6cxscILnRqWTUQqdSZYrDXxhmNNSugWmIam5FXfUi01lxcjCCqRik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711361920; c=relaxed/simple; bh=DCAnjdLm8/tipGbWNbbUh0xHQlyrHHYO4HN/R30DK88=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WkI6Xl5B78tZaWBHrGzDo18nYGa7fGL9drdMbPwmrWRDX1RymmIusssXG+OJ6ES+Wi4fxQoQSfBxnsF6pGVUg7nM+lM6OXMyosrI0paOkYGbWmz4/GJoyGhO5kc4bjwZyPbsBhTvVgNvUv576ThHc1wZNfiFrTM/QaqQFUE8T/I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=PU3gBbuG; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="PU3gBbuG" Received: by mail.gandi.net (Postfix) with ESMTPSA id D9BF7C000B; Mon, 25 Mar 2024 10:18:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1711361915; 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=fJ+47P+RHmGvxe+WTJ+sohpvSvUI9IclV23BMTd4mZ0=; b=PU3gBbuG8C4gJV4/r2P6rGSYICdiI1h4uO21LKWuX9FS8pFhqRMDq9VQJTtIMAFLIS686l 5HsSs2x0RJA7Qwuo0e1XKpamWhn1+ZGoZByFQKM5rYpKp6CEbpVKIdlM2GzanGu8XZM8V/ +HGvVcaiMA9T0HyzkZDOePVFXFc8AlihHAfK1/IzHWNl3aqTBazNzO+vd/TqmBtJokbkFi MlPwB404kD9sy32p1qXKcqdpkE6ZjLSg2jdEc/lu6aNK/+Y3fdK1RXDOmNfs9DAt6RryZm EGWRoifHlLlIGgDg1sie1wazgVT/ghjYmMJHeiLCushsHl1IjtNSe2jDshzzyw== From: Miquel Raynal To: Christian Marangi , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Jernej Skrabec , Claudiu Beznea , Greg Kroah-Hartman , Srinivas Kandagatla , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Subject: Re: [PATCH v3] mtd: limit OTP NVMEM Cell parse to non Nand devices Date: Mon, 25 Mar 2024 11:18:34 +0100 Message-Id: <20240325101834.262354-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240322040951.16680-1-ansuelsmth@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-linux-mtd-patch-notification: thanks X-linux-mtd-patch-commit: b'b0a53dc56c145b8b2c13b43eba2c9ef0507f9840' Content-Transfer-Encoding: 8bit X-GND-Sasl: miquel.raynal@bootlin.com On Fri, 2024-03-22 at 04:09:49 UTC, Christian Marangi wrote: > MTD OTP logic is very fragile and can be problematic with some specific > kind of devices. > > NVMEM across the years had various iteration on how Cells could be > declared in DT and MTD OTP probably was left behind and > add_legacy_fixed_of_cells was enabled without thinking of the consequences. > > That option enables NVMEM to scan the provided of_node and treat each > child as a NVMEM Cell, this was to support legacy NVMEM implementation > and don't cause regression. > > This is problematic if we have devices like Nand where the OTP is > triggered by setting a special mode in the flash. In this context real > partitions declared in the Nand node are registered as OTP Cells and > this cause probe fail with -EINVAL error. > > This was never notice due to the fact that till now, no Nand supported > the OTP feature. With commit e87161321a40 ("mtd: rawnand: macronix: OTP > access for MX30LFxG18AC") this changed and coincidentally this Nand is > used on an FritzBox 7530 supported on OpenWrt. > > Alternative and more robust way to declare OTP Cells are already > prossible by using the fixed-layout node or by declaring a child node > with the compatible set to "otp-user" or "otp-factory". > > To fix this and limit any regression with other MTD that makes use of > declaring OTP as direct child of the dev node, disable > add_legacy_fixed_of_cells if we detect the MTD type is Nand. > > With the following logic, the OTP NVMEM entry is correctly created with > no Cells and the MTD Nand is correctly probed and partitions are > correctly exposed. > > Fixes: 2cc3b37f5b6d ("nvmem: add explicit config option to read old syntax fixed OF cells") > Cc: > Signed-off-by: Christian Marangi Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/fixes, thanks. Miquel