From patchwork Wed Feb 7 20:22:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 198079 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp2486015dyb; Wed, 7 Feb 2024 12:26:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgI3z6pnncl8srD3mlMjP57D3j5I230Sk4OglCHOl+AqQBk/v7cpu8qoQoe8/4xQQDhwmW X-Received: by 2002:a05:6402:1814:b0:560:a95:5385 with SMTP id g20-20020a056402181400b005600a955385mr5546136edy.24.1707337584601; Wed, 07 Feb 2024 12:26:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707337584; cv=pass; d=google.com; s=arc-20160816; b=nmwJd4JJKlz2JTRKNF9xhJg7L/96EmmeL2VlPWp4CVYAN3Bd4pxxvW3dmBzO5p3Po/ hFObnZtlB/5lXrZ7etV4ZJBA0coKqwP1pbYqEQmHDE5Mg7vuLwDdvDrBaMdaOQFEpiSp MveRCzoZFZFc6CthdjJG0Jw4TRm+RInHzVyB8njooWJxJSwnEpCC/uci+HbFDNQAbNM3 dBkw1TSojs9QenXLN/LMEVooqe35hon6a3ViL+mIeDPLWacHjcbE1y8001VDBwVvtPfH VfOup0jG65gA7Q2BiJrSDjMKfDDqeZqOUaGc1u9uTT8n9Mp2Q5CTcbSEVWQ68XG8plue Mk+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter; bh=nZrR7JwKd51aTsZqOrtbFzQBcNmBsdxEapH6SC+pbno=; fh=VDZjNVJMjvNHIM2cICw0ot1qthj47J58IcKS4FgMBKY=; b=OFAz5zXq8v9oPShjOnn/cSCvJbhxiUuH+apWaxQ0nIla9mWAXmIwMb9IqvApPi0vlT Jhi1ZEO/wKjTy93i/buDAVrp8tjw3y/OVXTqay9EhjpjE7m3tCgmvtQMmZTYXADqHVv7 04k4aRqsBdOsnw1BnaNZ2GvKpdgOflQcdMJ5EFUTePoIFuOO7wKx9kz/2xfJ63Ylx5KA +sBKVoyIL15QHV61pi76bSuqR1WeheYtYKxmom9EyD1ZUH2Y9+rwVrwTsdg3+qWT0SeE xccn8dotd0NRVqlW4xxt3qrDhRYKk0c1OLw3BdNA8a81z6zP3m0jagJdM/+f0vhZtAQa Sbvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=Tlirzqhu; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-57021-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57021-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com X-Forwarded-Encrypted: i=2; AJvYcCVolR68n9aTIbRNUeQ4iQBH+GWSZp4LSNHpG9s26nZMURxRb6iZS0PyqLpl5JCz5G26oOHEQ8VAS0R/WlRx0bbGJBua+Q== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id be19-20020a0564021a3300b00560c77f7239si72590edb.85.2024.02.07.12.26.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 12:26:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57021-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=Tlirzqhu; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-57021-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57021-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 27B8B1F22250 for ; Wed, 7 Feb 2024 20:26:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC04D12D777; Wed, 7 Feb 2024 20:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Tlirzqhu" Received: from relay.smtp-ext.broadcom.com (unknown [192.19.166.231]) (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 805191272CF for ; Wed, 7 Feb 2024 20:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.166.231 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707337454; cv=none; b=b/9RXKprg2CnDStkZjwCyinMUNsgMXPZdcPpixHiHhlOX4YsdHqP4rW7FvY7TPERQQNXDhoDyYF4dunLU1bZohZUxVYV8m2mNQcUKChJYDlb3c8JlTdAIUbiML9/5CUTSbxZKQ/6LFP9EcNUElORtPuL5Tqc8TwpBrTdQMJ4kcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707337454; c=relaxed/simple; bh=LUvXfylQz7V0uRO9qJXNQP+bE5k1kmYrwKzlIAWOYL8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SaD17gTE+0H7csSWHcQYSBX6vLO3vvmhiQsAXHS4opJQ49U95a8W0vJvqY8aCi0ClzjlVYKDQ9udK8n6hEz3GpgDiY9JqPLNTay6jKfHvpU/GilA+ynz5CupHuVL5vAYpofc7L/xYFU8mm9m/rVT2FFVn8qxULO+rLJhxrDenlc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Tlirzqhu; arc=none smtp.client-ip=192.19.166.231 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id D7BADC002E04; Wed, 7 Feb 2024 12:24:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com D7BADC002E04 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1707337451; bh=LUvXfylQz7V0uRO9qJXNQP+bE5k1kmYrwKzlIAWOYL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlirzqhuOg4tzEbiBkiwG77jPDzlr/bygIvtETqRJAeJSvGAkBKcdW74oig5H971m +TASW5kxTqfJ/6Xr8yMbDxWyWItcj20C4moqq7sQYUl8fEhl9ACvmN0OBcvMqf3Eov 5ycU0qevpNPAqMh/f7IHSu9ryvTDNWpCqmYmBIUg= Received: from bcacpedev-irv-3.lvn.broadcom.net (bcacpedev-irv-3.lvn.broadcom.net [10.173.232.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 72E8618041CAC4; Wed, 7 Feb 2024 12:24:10 -0800 (PST) From: William Zhang To: Linux MTD List , Linux ARM List , Broadcom Kernel List Cc: f.fainelli@gmail.com, kursad.oney@broadcom.com, joel.peshkin@broadcom.com, anand.gore@broadcom.com, dregan@mail.com, kamal.dasu@broadcom.com, tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com, William Zhang , Florian Fainelli , David Regan , Miquel Raynal , linux-kernel@vger.kernel.org, Vignesh Raghavendra , Brian Norris , Richard Weinberger Subject: [PATCH v5 10/12] mtd: rawnand: brcmnand: Support write protection setting from dts Date: Wed, 7 Feb 2024 12:22:55 -0800 Message-Id: <20240207202257.271784-11-william.zhang@broadcom.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20240207202257.271784-1-william.zhang@broadcom.com> References: <20240207202257.271784-1-william.zhang@broadcom.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790273215011935945 X-GMAIL-MSGID: 1790273215011935945 The write protection feature is controlled by the module parameter wp_on with default set to enabled. But not all the board use this feature especially in BCMBCA broadband board. And module parameter is not sufficient as different board can have different option. Add a device tree property and allow this feature to be configured through the board dts on per board basis. Signed-off-by: William Zhang Reviewed-by: Florian Fainelli Reviewed-by: Kamal Dasu Reviewed-by: David Regan --- Changes in v5: None Changes in v4: - Use the new brcm,wp-not-connected property based on the dts binding change Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/brcmnand/brcmnand.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index efeee9e80213..8c1489ff7bd6 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -3218,6 +3218,10 @@ int brcmnand_probe(struct platform_device *pdev, struct brcmnand_soc *soc) /* Disable XOR addressing */ brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); + /* Check if the board connects the WP pin */ + if (of_property_read_bool(dn, "brcm,wp-not-connected")) + wp_on = 0; + if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */ if (wp_on == 2)