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: 13549088 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 E7814C4828F for ; Wed, 7 Feb 2024 21:31:39 +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=KEz3xGvYW2eLRAuQZFAVHiF4QwDhdR4KKJ7n8Awmh0w=; b=Sn/oOl/2JEmGGl CKyZ5u4SifjhZj39vARgf5XJ3EhG0enuJAbHxn+hrCAf/N3f5Bt9yBDLrIyDN4XLalK1Fapu0jM+C uXqWqV9Q5nNV4NiX5tb9MxhwMkQ3nDaeOCF7GGXVhcnG1XFQN3UJR/pVbBKaIK5YVFNHclGeQaDMr 3PlkXkyRjmgLL2yd6ag3n7VLuH8HAjmtmJ/dc/Aq2AuyYogRfk6Pc7kaZBTHbauJI+vmUqpHlboZ0 N/8f6Ue+IiC7whrbmd3QqUQHrtobRVGUXT89C9zMyX8raeB805H/5N/o3tAtUVVjW6hq7fL8sxXWc nUA4pDCsqLczWxJ0xh/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXpVx-0000000Bv7h-40fY; Wed, 07 Feb 2024 21:31:29 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXoT3-0000000BiZn-495v; Wed, 07 Feb 2024 20:24:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nZrR7JwKd51aTsZqOrtbFzQBcNmBsdxEapH6SC+pbno=; b=ciPXkzlwbVFoLMHn24uCeclgNb HDcy9rn6knE78P4ROePsb+uW3ljP809czMeAGQ2F96PKS2WI/EWeRC237M1zSUvcB2FbGxA55u1bL uBGYIuUeCMCSEL619q2eXD+ixFZeKJP0nC/7Qk5K1UAq8hmybfwJ0bNb6zzVjC2f/SM22emG6pswD FscPVcxiXIo4dRrv5xz+2cmWqnivmZzzA7nqe2Adm2QISxeHS/OzWnGZjS5/ApM2wzPjK4X6Ex1bF 6rNGeeVriLd9efBlDiRlyFHJbwsSSOYmi83ucvCbKI7BoPmDwhGEcnEn31cj7y9V2emXtIeYIpDfO 1NtcmJsQ==; Received: from lpdvsmtp11.broadcom.com ([192.19.166.231] helo=relay.smtp-ext.broadcom.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXoSr-0000000D6HT-1ab6; Wed, 07 Feb 2024 20:24:16 +0000 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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240207_202414_636817_0542095A X-CRM114-Status: GOOD ( 13.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)