Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp550432rdh; Wed, 7 Feb 2024 12:26:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwrcSkJobHYERWv9mGZneL4oJIAYCQmoxULqyUUAjZh+4tRxBHpy4b88GQWUn6qYN/ghnx X-Received: by 2002:ac2:550c:0:b0:511:577a:3647 with SMTP id j12-20020ac2550c000000b00511577a3647mr5158783lfk.11.1707337580377; Wed, 07 Feb 2024 12:26:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707337580; cv=pass; d=google.com; s=arc-20160816; b=efOs3/t3K9wrkf1Eov3msI52uAiJnq4PTYC+NsD4qL60lX/dmukVGhdINa7FxDkrIC v7dSu0nrm3/0sDDwFLGjUARju0qME5mBfKfpHMF9iawN5eaUxHK4jVlQqZw6/RlNqIH9 sFDo6ow6oNpE4BVUB4JCNk+WWuwtGaDfy192SZA2NM6dLOcy1xPVsWQ+A88y4BKnhAoR D1MHPtBdF4up0vDHhVeS0BXzT2yGOUPpqx5L+IiEBHO0MkL2gBwUvIsippt9SbMSRR4n F0UEBpErpuaYoeln2E3Lw7nkBcUl/NsqMvTWDohQ96D1s/ZqIW+avBgsTSx3gLBHtjEl sHhQ== 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=vd6+brN7Ywpsiho9xpogMzfMVDVpsBXiBQrE2mkzs+Q=; b=Wq5tuFneM1bG7giFQm3/8LQf+Xj9/vrlkw8JDOGqvd2sLzDGbghRy1MsuNm0Ww+sX0 S5kaGr49ODTpn+N8YWB9MKSPFsNK0RjoOPs/x0FA8QBXHxfyWOyDbRA/X5E3yiAMfA2e 2NhxFG0Gf4/I/H4RPf5tw+QK28ffnoaFQ2D4Vw/quD0TglWfIoOABWDZgJXf0iaOXTbD oiaLmF6x9kGzmIa7KcPAlS3llZM0pFq+mwLRiv889VK65VvAvyeQftam8dNg5Dh4J2kf 2V/9r40eqiTowVaCd26ljDJ6CeGcD19CLlmDGcR1SxaiN1EABwPYgHhQ+rF1v8h4YRvS e08Q==; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57021-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com X-Forwarded-Encrypted: i=2; AJvYcCWcfBJ8DDTQj23Q5r7qZmTujjNvOdzfV4JYym4trGiJi/kSNVg66J8X9RMyxSlfZSGKK8JS4ja9kdG+gtgz4KeRBAkiOoItwjgCvKSekg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a18-20020a170906191200b00a3850efc79fsi1291597eje.1044.2024.02.07.12.26.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 12:26:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57021-linux.lists.archive=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-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57021-linux.lists.archive=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 F2E321F214B8 for ; Wed, 7 Feb 2024 20:26:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6D2F12C7F8; Wed, 7 Feb 2024 20:24:14 +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 Content-Transfer-Encoding: 8bit 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) -- 2.37.3