Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1218348rdb; Fri, 2 Feb 2024 19:23:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzz/mIztAwWcuvEPkY9hj1rd37vU8oXv+WOMfDc9N6zB5Cbh8nvyIEs5Uy8+L0IErUDKi0 X-Received: by 2002:a05:6870:ec8e:b0:203:d7a8:b4ff with SMTP id eo14-20020a056870ec8e00b00203d7a8b4ffmr1780082oab.33.1706930629687; Fri, 02 Feb 2024 19:23:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706930629; cv=pass; d=google.com; s=arc-20160816; b=ChNYdW/ImN3WZ3sKkwLzSybFQkqCpteJv9X+iSKYF1zbWhz764EcyZMJtmQD4el1L5 X6FnQGRlMEbUFym077CMJflfRnYarLtDFErL8tLLhBddrC+Q/ZSJBbJaggl5GTdIR25A LohRHrM+kLrNMoHaoYpVvPoldw8S9FwaQcaUXxR1DEK8de7NnmHXYNL3oquBo4Em3rgu 6ZrwiovzyTI6Lp/nLaeyW2E6qVTyd/Yr/qbeFLBlm3sFwL0n8MCzBkuBoJIDC7vuzawY eKfIZodxHzom7h58CDH44FBdKai6P7XCuY5gCqBamdEiqi5ndLea4Tch506PSmhxN4Vv 8OHQ== 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=JbJskgU16IKX1o+zwN+em6SbRZySqO1hl82127p0go8=; fh=mAJK7iP4GLhhoY/kS3AL37Yxwo0FMi7mahhL2VxyIKk=; b=BDIhyt+oeyqUErGSti9QTg+tif6h9WmEYeFf4OjXAHnh0LGPvwmdDSB+Ys4/rqwFmb FaTBSFf1Q+BUXQSC+ayqpV20PmhYVeiNmFKcvG5ZbImt6nOCvVv+J1RR5NOl47tUHNt4 Ta9QjO0ueZ90xIcebHzX1VTaa32JUqbURqTEoaFIOanSFdf+6t3NVsi9dS5drfeS1GS9 0tFiTDJ+0dKCNfj7BxOgqFs8+x+rZ6a/+P9StnZW6Cst7dAI5ymZ5H1L7OsIMIf6myrA AL/SueF8IK+o5hUachgsDRXSPMgsogfp81bFyst3OIztz82PshxIZc4M0yp2QKTqFnw2 8B/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=AlOW1xN+; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-50784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50784-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com X-Forwarded-Encrypted: i=1; AJvYcCUAIP1/jQnDKrehQE+rNUK7q1YdwGS40zwQTSlGnSVufdI2a2hejg0SzMR5cbHQs9N3Smzjzl7SZBkpKagJf3jFI0uJsAXcAEqN+wQbUg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id cm20-20020a056a020a1400b005ce4d72996fsi2546720pgb.353.2024.02.02.19.23.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 19:23:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=dkimrelay header.b=AlOW1xN+; arc=pass (i=1 dkim=pass dkdomain=broadcom.com dmarc=pass fromdomain=broadcom.com); spf=pass (google.com: domain of linux-kernel+bounces-50784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50784-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 27240B26D29 for ; Sat, 3 Feb 2024 00:31:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8803311C82; Sat, 3 Feb 2024 00:29:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="AlOW1xN+" 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 51DB7111A1 for ; Sat, 3 Feb 2024 00:29:42 +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=1706920183; cv=none; b=g8+TgSXPRjGgIm3cG7wjB5zpzNWsTV04VO58rVm16TJ5I2cgq4Mkw8m8yeHRtPMs87ZPssX5R0LsW43Rs4YNn++jSELrpDQRHdwWo2LYOSLkdZCS2j5dzqxoTTC8+OJlf0EcHjIUjaK/t15PDi0/Qt3y8hg/HqwTJUIpGY4ne60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706920183; c=relaxed/simple; bh=UPiy9NotMMhw6RetrVpXpgqiL4XDR2ya1PJkJ281Hf8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dli//m7Gj3r6LAd2YliPiLzDBD8QJnfnaSH24U6bhwT8Urw5kzO1/2zaj0nNp5yxgGn5zJIgagmTbIaOmXeORJmRsNH+dlQVU8yEuhKJr9pm0fsSGy0mSrkKpxARcGiNlmptDtlYlBK8w2kHHUQz1+QpKi3Z8eFLOHLJ1+N14BU= 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=AlOW1xN+; 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 63CA3C0000EC; Fri, 2 Feb 2024 16:29:41 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 63CA3C0000EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1706920181; bh=UPiy9NotMMhw6RetrVpXpgqiL4XDR2ya1PJkJ281Hf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlOW1xN+lDL5uGwFqHKc4uMARbK5v94zuXoKF0hP1LhOT+WAHAL7MkoSU+zbEHFxx VtPNJTcVDwzuxLCnN0z/yyw6F1YD8Ewj79abbz4NboHDpX5i6UaYD4IblJ7qnGCTXA COFjVniYLx4GhQvguR6/bT08YNL4ksYPLVdDrm/k= 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 BE1E518041CAC4; Fri, 2 Feb 2024 16:29:39 -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 v4 10/12] mtd: rawnand: brcmnand: Support write protection setting from dts Date: Fri, 2 Feb 2024 16:28:31 -0800 Message-Id: <20240203002834.171462-11-william.zhang@broadcom.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20240203002834.171462-1-william.zhang@broadcom.com> References: <20240203002834.171462-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 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