From patchwork Fri Feb 23 03:47:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Zhang X-Patchwork-Id: 13568548 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 CF6A7C48BC4 for ; Fri, 23 Feb 2024 03:52:35 +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=prMarG/aG5KYcBeF9+eJ2r7QFiEQeWn3+lATPoc/C+g=; b=WoruF6JYm1KLkR 2gc0VMKgdqgGsmo9cdpCSiTxULBck57cBEdWpo176ycyZjTO7/lBL5CAx+2CWZIhOUV4IU5Wo8PMG K37kqSKgpJgUy4mpXki2hRrTH3mdbdNBuhQYcQzsujUNw3JtnBCLya8NQ2gcCi4GMOqIcT9eDmnmc 12eHo+EcOhbjOur6gN3g9DnMWxh+9U2J7Vo9xRFgHw16xlFT5W8BDWILs8KKkB1l/c3yfJ3HsU93C xo5bc90IMXbUGeo0r3Da1SflhsBmWAEMVmU9rIJwCtnkOHg7T9Fs90npPzLk+jLXbnRoWGTIa+uGy mSR6r/V9vOpcsrC9gIZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdMbE-00000007kgT-3r5b; Fri, 23 Feb 2024 03:51:58 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdMYG-00000007jfV-18CO; Fri, 23 Feb 2024 03:48:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=f7OrPXkA9h5wUvIzBLPC8L+hyLvLOPdYeBxH789kQv0=; b=qRLkZCRgw/XBMu8M/A2Ykojhmh BnSfGB8+4l+hafmgAzk7jB0MiM+uEPHN0la4Ahw7yu3olV6S9y/4qxVfCF5IECPnPV+UTY4n09tmg PBIi1/dY76GqbcKbBgoH+U93UDUojqisj9+rGve86oslqEM6PM5H2Wu0eOxKhoN0XRBOxIiY/n3eu higZPSCWn6+tHzu0PSC85ffFq6vYQDfBLStZxkF20eD8QMaxiViLaMhTv5X+tb41KhlBddBZx7Wte jyQR7qDjf00M77rBwuqj+TYH2GupEU4hNbgTXN0U0iu5zCGuG1lF1oh5OPcVvMf3baJ0qsP4M7iTa 6BPwnkCg==; Received: from saphodev.broadcom.com ([192.19.144.205] helo=relay.smtp-ext.broadcom.com) by casper.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rdMYD-00000005dkY-1BJz; Fri, 23 Feb 2024 03:48:43 +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 99370C0000FB; Thu, 22 Feb 2024 19:48:34 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 99370C0000FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1708660114; bh=wKBvVMc60Fe2dxQpvxpi677VlKI114pZ3dAsj88tuns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhT4oVyZgKRKY7Nnq2vDCMrwhgFNocShT5rPsyPDWdtvaFG1LiYUuXSPfe+vTDwsI vY0jPY29IlLy+Kfinlw69gTmNR9eR5R4HaxmxOwiO0+8GvulZgblNc084VWDz0l7k5 KRcpTG0OOzNdkLuNI0jVVuHnFsuZq7G0SeS/eIdc= 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 EDB2618041CAC4; Thu, 22 Feb 2024 19:48:32 -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 v6 13/13] mtd: rawnand: brcmnand: Support write protection setting from dts Date: Thu, 22 Feb 2024 19:47:58 -0800 Message-Id: <20240223034758.13753-14-william.zhang@broadcom.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20240223034758.13753-1-william.zhang@broadcom.com> References: <20240223034758.13753-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-20240223_034841_453888_70616468 X-CRM114-Status: GOOD ( 12.98 ) 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 v6: None 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 e8ffc283b365..4810345d0d8a 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -3223,6 +3223,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)