Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp738764rdb; Thu, 22 Feb 2024 19:51:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXwciAk+2rG0It+N14WIg84FfakR9HkvQsJZeU6hLQCPBU5mw8c5JZx9YQ3h5f0SVna60byHQhq9LmOCudtf2PYmZjXn/V8XrGl8ENlMw== X-Google-Smtp-Source: AGHT+IFTESJUIfFzhQiBlICMk1rLR6LBdKzmy9KdLjAlNRrPgB4MFREY9UtonZsY8v9aYb5/C74v X-Received: by 2002:a17:90a:564e:b0:29a:5714:f9df with SMTP id d14-20020a17090a564e00b0029a5714f9dfmr674887pji.35.1708660266791; Thu, 22 Feb 2024 19:51:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708660266; cv=pass; d=google.com; s=arc-20160816; b=B9FB5TKFj3+Jk5Dnf75ZeO4CceyvZlOKCsU6UY2LG5dNF1F55pmKeypy1olboYFIlx QEhHsjjaz3Jrlv80doMzcFjdv53FLjwWUIAR+wQQDIalATS4Jxr6uGxIrfcw4h6Wlxrc /USvxwv6dYZs4/lziItG68N7tpm2IRJN2y9UX2vaQlNjVEkwGljL8dMXnBelPJ7cBydr 11EvH3K1jvi/+KsPpFSxMAigARMXBKoAfOCwFHlXV0Tf8xUFpaqA8cDDKzNpA3r1xAXG z/h4TalcVRrlzyO65wkAUYmRgrd/jz94olp1NA4xSCCXUsLEFPAKMWZiz0osp4XyuZd+ 6YFw== 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=f7OrPXkA9h5wUvIzBLPC8L+hyLvLOPdYeBxH789kQv0=; fh=dM09IDhjszaOhVxwrBWY+f266BOhCnoRoNnLsaJcdZ8=; b=m2ryv6vv6fQphAlxFL1YPJw5m+rOKWhwwCUf8vzrXZozOCYFjh3MusowhLBZo4p7HB c0oSvn/hp1zpdBvTAWftLxEqbziQ9Gzx45S9cON/wlk1qWGnoP8tbB5LVYpt3eSBC565 p5/Sbmu53uIOLKpE+LLpxTWdV6hmK/mvaA8LX70VZDLyM2w/x/0dO/Qs3+EKPX9FaYP8 qAtim0GtLWxrh0hpq93FvTS6F4FRq8Qj33pUbom7p8yKPWc3pXl1YSDrmyCTGxbvXtTG WtN1JBT7zPlIe770Qb3/3nz+Tbal8c9teCqWH9Gqan+d9sSm7rhtCIjhOSdLgjqp5vVB ZlKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=AhT4oVyZ; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-77738-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77738-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a9-20020a17090a8c0900b0029625c6f426si438307pjo.20.2024.02.22.19.51.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 19:51:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77738-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=AhT4oVyZ; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-77738-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77738-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 73EE0287B65 for ; Fri, 23 Feb 2024 03:50:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09F881803E; Fri, 23 Feb 2024 03:48:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="AhT4oVyZ" Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.205]) (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 98B9B14F8C for ; Fri, 23 Feb 2024 03:48:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.205 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708660117; cv=none; b=cz2WIbqFflwBGNJ1weNG2QOqKctW0LWAXd72qad+SwcV0EwOa3FWFF7ClQMN0taKCYSnLIoskqMwfAvoSIWymbLFqCt/CM8CH4IxpvYelBqcMsIK8Tr1ZA/JLI+XQeUtQ90r3NxvFzMZKIykW+LxvTPBn1Tef1lgeC+Wv7JxyWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708660117; c=relaxed/simple; bh=wKBvVMc60Fe2dxQpvxpi677VlKI114pZ3dAsj88tuns=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bbhCDxZL5xyEqu1B7WfCtiZB7YhNimCYooR7JSqDjyfgqvp6avGJWIX5biQk0Eaf6TQDK6qy+NMAZYrgIiQPI8sp0N8CnefFITwIu4kWL4UMHPl27Y7ao6Vb6i9oqMbA9PVp2R77NTjmq5Enyc4YkMcMJhREkJ55gMiSM5Av03c= 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=AhT4oVyZ; arc=none smtp.client-ip=192.19.144.205 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 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> 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 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) -- 2.37.3