From patchwork Mon Sep 16 09:58:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 829009 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:4187:b0:367:895a:4699 with SMTP id ei7csp699755wrb; Mon, 16 Sep 2024 02:59:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVy1W1O8cWefUWfTNh8/Oao5mKwVin7y52MP6LS6mtANAyY4STkilt8H4WCMLHCTz/UezUt4Q==@linaro.org X-Google-Smtp-Source: AGHT+IGKDP7u5+tzfrdWARnEmrPM2+ogHZ+fFXNFEDh0sMe2rOaSxjkxuO1xYqQ9H3acoi1niX/2 X-Received: by 2002:a5d:50c5:0:b0:374:b35e:ea6c with SMTP id ffacd0b85a97d-378c2d515cemr7882586f8f.40.1726480795989; Mon, 16 Sep 2024 02:59:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726480795; cv=none; d=google.com; s=arc-20240605; b=FSBcXfvmmJoOd5+GbgxAHqEiUkh1Wo+zXkTZ+6gXKbaFrBzBUohVdzHDAiuHr9sGrl XVq4pCXUv8GDpA01JpZpqaQP+RQWxjfRJkPHHF6oV+nXUPg22/wFlKQ9UkPTNfQoO162 P6zssV+5ddqxdBlcKjh1ORml//oKDnnMoOuIkzZAwinSSHaA8+X8/Ik447egVETH6/KL 9oCJVva3S+qkiufotTl0oc+bg0WgdpQIMxfxNwis0IN9D/clM/amPzbD33sSd5BOxnJm kLXroMg5oNGph43pomvkfh24pF82wGYZzY5vC0cpTTr5/75ZWH8uuxon3tILBIOESeUU XZmw== 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=pwjIZKsumLweFU0kBnBpQNPYQFt5jGri6gUp/14tvEY=; fh=LjJWeawkcuYIe1gemXcY1RbqD239cYwgFjJpsG2gko4=; b=d3bDftMWdjfccy3dCLzexSJwHlDbwf5gNy+TS1Aj/vBfPuwdrirXAwWZdpo1Ey96zF 9Wf3gJ7YZdUcYL7vIhYUAcfJY1vPQNPHef0IANYIj7UWdkvaFGDtIRfscRdeA/mnv511 aZRxNT+lDzDn5e8mYkzPLggt7e7gsqzFmMaUAaEYGM9UJ8GncfAlbkUzCa2q0uFAGJYa g49CGOnlthkDMHSOQnl8kWhVaIcHiLkBMgoNWixJRVx8j8d8HN39+cG0a5UwK7YfGkii pWkwKg9odVQKiKBswhhS0zTvLiFkJlljNpxVt0eA91EJEUqXkSdLY3GzZPipulV+/8rU w2BQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dc1EZNuG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id ffacd0b85a97d-378e7818285si2080782f8f.748.2024.09.16.02.59.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:59:55 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dc1EZNuG; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 05CD988EF8; Mon, 16 Sep 2024 11:59:01 +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="dc1EZNuG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6CFBF889BD; Mon, 16 Sep 2024 11:59:00 +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-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (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 34C7F88EF8 for ; Mon, 16 Sep 2024 11:58:56 +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-ej1-x635.google.com with SMTP id a640c23a62f3a-a8d0d0aea3cso592456766b.3 for ; Mon, 16 Sep 2024 02:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726480735; x=1727085535; 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=pwjIZKsumLweFU0kBnBpQNPYQFt5jGri6gUp/14tvEY=; b=dc1EZNuGfveTovVyDPX/8yl2k0sKbdlG7q7J5MxZ626xppmiwiQ9/df3yUNrZH/ZKc 09QiQjh4rdLELY/c3JRp5H+TzXeqgf2BXQX4vRo7hziu8e4X16noLMrq6rrapxE5TQaM SHDZiarme+Qm0Cau5DUWo63kPDlHlQSsPk6/t4mfCUGL3OJDopNve8CpNIpcOJ/uy4z9 /AW2cxU2SwPFHZtAAJPwspX6jDjSnGmz7IwMBXMxheON0kGOLUHlVdtYKfmQz+PvsQJ/ F0X5Iz9wo/PzkibaMrOCQeZqvNM37vBA8EZ0mCudQMl5kw1CRZlGtFV4kzqZg9cdanZH DQlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726480735; x=1727085535; 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=pwjIZKsumLweFU0kBnBpQNPYQFt5jGri6gUp/14tvEY=; b=G430+qq4I+Tt9fJSyzV/mxc+wJnkjKAcyVLTdCR0trY58Q+tZ5djZF/dZ33xkBoOvr mYiIp5QrbsBd+xaxDrWTEjwPsV6cNJ7Kt21fN1hpEi3ct+MFt9NW513NGahA7ZYPoahJ PTvnDFd2UZjhMGVjPwEjJeSM4h1Fd1Qb2xayeSdq0ee+jvkwR3JxPCceKz+NORynVsxR ZyC45koLM2eEiXmkdjENcPkdRkc7l37AEoGiP/YlgGJCZKF8AgPPnJiMjgi4KCGvhI9d e5yFdIMl3J3+v+itG8BkhnkQkQSenfl0+yIDF1Tg6rONTCq9afihPg2vSRj9K6IrxAeH /ShA== X-Gm-Message-State: AOJu0YxFfJ2l8IddeFJ35qwq7/E3nru/XKt/P8gG8mO1+rTiJA71cuxU V3DhtJ0bzXJGZXzH2MMpVyBj95RbERxggAY+16UEi/1bbHNUW03nzjZuld6NsWA= X-Received: by 2002:a17:907:f783:b0:a77:e48d:bae with SMTP id a640c23a62f3a-a902949aec3mr1479023066b.28.1726480735528; Mon, 16 Sep 2024 02:58:55 -0700 (PDT) Received: from lino.lan ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a906109662fsm292862966b.38.2024.09.16.02.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2024 02:58:54 -0700 (PDT) From: Linus Walleij Date: Mon, 16 Sep 2024 11:58:48 +0200 Subject: [PATCH v2 6/7] mtd: rawnand: brcmnand: Support write protection setting from dts MIME-Version: 1.0 Message-Id: <20240916-brcmnand-fixes-v2-6-08632f64c8ec@linaro.org> References: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@linaro.org> In-Reply-To: <20240916-brcmnand-fixes-v2-0-08632f64c8ec@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" Augmented to also support the "write-protect" boolean property. 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 Reviewed-by: William Zhang --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 2f786584a1ae..071b33951648 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2844,8 +2844,17 @@ int brcmnand_probe(struct udevice *dev, 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 */ +#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; + /* Read the write-protect configuration in the device tree */ - wp_on = dev_read_u32_default(dev, "write-protect", wp_on); + if (dev_read_bool(ctrl->dev, "write-protect")) + wp_on = dev_read_u32_default(dev, "write-protect", wp_on); if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */