From patchwork Wed Sep 11 07:11:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 827370 Delivered-To: patch@linaro.org Received: by 2002:adf:ab1c:0:b0:367:895a:4699 with SMTP id q28csp663968wrc; Wed, 11 Sep 2024 00:12:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXlB36Py6wkmwnkl5H20I32G0pj5Zeutedw4DYzV2lsSeQSO86P0joOr2hNQwDQRtVdPshwhw==@linaro.org X-Google-Smtp-Source: AGHT+IFm+pdyFh5QypQcy13ZJSJjtNpxe7ypIUWCemI1s0QiYnyasQ7BgEoDzq3xciiHOjTVfyVm X-Received: by 2002:a05:600c:1d0f:b0:42c:b4f1:f281 with SMTP id 5b1f17b1804b1-42cb4f1f41amr78170885e9.34.1726038756767; Wed, 11 Sep 2024 00:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726038756; cv=none; d=google.com; s=arc-20240605; b=F35o5fFvaSUj0JbDqlFuo3kgbq3+AFLfSEmE7MyLZIYVGT4iUenPIrQ17DFW5S+qxW OP+ZZ205BTWnbSWIqX8aZnPQh6eco/KMdJH+i+gTrYd9aXdOUpYdzqcB0xKEIn0Rkd5C 8vAdim8iB/N54JAxXKuUjI2PCLR5sDnXFWVntDroi16gJDY0hd9toTTk0wwi5n7iG41P 9VgkpZv3uYafaedq/swjfGXGWg1zcJBL/qAGUUz3Bwhvokyf+i7rNQW2kWu2ociEsW3v ZjHUUmuLZLYD5vGs73dW9zFL3AYQ4cuiggmx7UvDNPoTeFXAflI574+8paeQNZBtE5MK ZyVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=0thuF0I1ZnDB7MFUd0vK4BvdCnk5Fzf2pv7fmJ53tVo=; fh=LjJWeawkcuYIe1gemXcY1RbqD239cYwgFjJpsG2gko4=; b=BLuzqlPTp949JFydGVtCvKPrA0jiCz97oY3YfpUoVlvJOVcPOU0sZfc6o0Jq3Hh7LJ tuwuHwqK/d8P5NAkUppRagY5QsGWXbcxI50A/d9MJkI9mV0uqE7XFzdZXjnqfBPrdGcW /TuYiMkvwOjUOQ7MsnpZVp/QFqDEshXZ6LW8xFxkb5z1J4IBEypJx4u3rg00Uw9QQg21 NjftFMEGUUR5LMhCHMRNbBGWUKCOE3Zsl8Xk66qgGmbyHepsqxSiJ+tvqtEhgbIgpM6z QcCIiAkWYj1i0/NpX4hrP3vfmKyS909wo0zjlb3exq93h6cD+UhXTuPG0uqEPWdDIPPB EgRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OntOG8p3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id ffacd0b85a97d-378956d88easi4001861f8f.982.2024.09.11.00.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 00:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OntOG8p3; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E523A891F5; Wed, 11 Sep 2024 09:11:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OntOG8p3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B089891E7; Wed, 11 Sep 2024 09:11:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 107FA891FE for ; Wed, 11 Sep 2024 09:11:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=linus.walleij@linaro.org Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5c26311c6f0so8062737a12.3 for ; Wed, 11 Sep 2024 00:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726038699; x=1726643499; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0thuF0I1ZnDB7MFUd0vK4BvdCnk5Fzf2pv7fmJ53tVo=; b=OntOG8p30yPq9PlnunEi7WGkjVys6IiESyIC7oTrtGFzxON03iCPSkcP+1cNg9Xdp6 5w1zjJprtaYjTofitMimicl748IGeAn0MILGsvJ5CCzUMIox0BF5FkRKT+2x4ZKvAYfU pZEO+UPGqpjf2gX1wpCWugO1n8X0tIQPOamIhfGaG1rlk8svjoSqQS3DiM6dsO/8bvm7 h26QnWNvSGj0+/UUPwcW6tULu+Hn840fArw+WYTZiSIuHgE38AXrHNWweeoopd8L3knE Byog+J1VhO4ohZogVDQaJq3UeMYoxl9yC+4i/guGSUxK8RqfNTmFRg6ubGMncCm7tM0b D+nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726038699; x=1726643499; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0thuF0I1ZnDB7MFUd0vK4BvdCnk5Fzf2pv7fmJ53tVo=; b=wTIGnXmlhV0/tMFqmuFLcmZuXi4bi9lCFpIXoPAdtQbjDXTNpUfW9tSKmTJmjQVig0 wYQVEQFs7vwU2uUQaA+gccOyQoleNAqT2CwvwnTzvA1uQTSNFAUguCUfj8nNKONSUGKX CaH66YQACYw1r2ihp9R1Fk0CIxixrc4TRuI0MFu/zeFw/KIHOgVNzAU2fbufcCSV8Qlb F81Fv5r6MTIvuxvRcN4WV52pTh+UIGaiauawzb8qzHbQogmdt3smIsh+cxRsAHAkeejw IC1GcqjsnkfOET9zk2MXmIaH17QLJeWH/77M887Tk8iUbT1V9VpBObdBBI+VpuhvdWBr i4ZA== X-Gm-Message-State: AOJu0YwL2iM9Rk5tiycm+UE3fHd0fljfwwrwNPTVWAIx3FOMim4t3BOy SsV+G0zihwwjiR6z9TdXOpB1w0o9H55VXMM0r5zKHTDwKxvbDacKTryFxB5SKGM= X-Received: by 2002:a17:907:7f10:b0:a7a:af5d:f312 with SMTP id a640c23a62f3a-a8ffad9d1b3mr321307466b.46.1726038699324; Wed, 11 Sep 2024 00:11:39 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25926ee8sm580523866b.50.2024.09.11.00.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 00:11:38 -0700 (PDT) From: Linus Walleij Date: Wed, 11 Sep 2024 09:11:17 +0200 Subject: [PATCH 6/7] mtd: rawnand: brcmnand: Support write protection setting from dts MIME-Version: 1.0 Message-Id: <20240911-brcmnand-fixes-v1-6-be112a20aaf1@linaro.org> References: <20240911-brcmnand-fixes-v1-0-be112a20aaf1@linaro.org> In-Reply-To: <20240911-brcmnand-fixes-v1-0-be112a20aaf1@linaro.org> To: u-boot@lists.denx.de, Dario Binacchi , Michael Trimarchi , Anand Gore , William Zhang , Kursad Oney , Philippe Reynes Cc: Linus Walleij , Florian Fainelli , Kamal Dasu , David Regan , Miquel Raynal X-Mailer: b4 0.14.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: William Zhang Backport of upstream Linux commit 8e7daa85641c9559c113f6b217bdc923397de77c "mtd: rawnand: brcmnand: Support write protection setting from dts" 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 Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240223034758.13753-14-william.zhang@broadcom.com Signed-off-by: Linus Walleij --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 2f786584a1ae..55d5d27438a8 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2847,6 +2847,14 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc) /* Read the write-protect configuration in the device tree */ wp_on = dev_read_u32_default(dev, "write-protect", wp_on); + /* Check if the board connects the WP pin */ +#ifndef __UBOOT__ + if (of_property_read_bool(dn, "brcm,wp-not-connected")) +#else + if (dev_read_bool(ctrl->dev, "brcm,wp-not-connected")) +#endif /* __UBOOT__ */ + wp_on = 0; + if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */ if (wp_on == 2)