From patchwork Fri Mar 15 14:14:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philippe REYNES X-Patchwork-Id: 1057073 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=softathome.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44LSS94ldjz9s3l for ; Sat, 16 Mar 2019 01:21:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 4D977C22147; Fri, 15 Mar 2019 14:19:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=KHOP_BIG_TO_CC autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9A983C22170; Fri, 15 Mar 2019 14:15:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9FB34C22186; Fri, 15 Mar 2019 14:15:08 +0000 (UTC) Received: from vrout30.yaziba.net (vrout30.yaziba.net [185.56.204.33]) by lists.denx.de (Postfix) with ESMTPS id 2086DC2209F for ; Fri, 15 Mar 2019 14:15:03 +0000 (UTC) Received: from mtaout20.int.yaziba.net (mtaout20.int.yaziba.net [10.4.20.37]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout30.yaziba.net (mx10.yaziba.net) with ESMTPS id 05B85520CC; Fri, 15 Mar 2019 15:15:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mtaout20.int.yaziba.net (Postfix) with ESMTP id B8E3F1601A6; Fri, 15 Mar 2019 15:15:01 +0100 (CET) Received: from mtaout20.int.yaziba.net ([127.0.0.1]) by localhost (mtaout20.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id z6mhbD5Q3qJx; Fri, 15 Mar 2019 15:15:01 +0100 (CET) Received: from sahnlpt0333.softathome.com (unknown [149.6.166.170]) by mtaout20.int.yaziba.net (Postfix) with ESMTPSA id 3F236160182; Fri, 15 Mar 2019 15:15:01 +0100 (CET) From: Philippe Reynes To: albert.u.boot@aribaud.net, daniel.schwierzeck@gmail.com, noltari@gmail.com, miquel.raynal@bootlin.com, maxime.ripard@bootlin.com, stefan.agner@toradex.com, aford173@gmail.com, lukma@denx.de, t.karthik.reddy@xilinx.com, woods.technical@gmail.com, joerg.krause@embedded.rocks, sr@denx.de, boris.brezillon@bootlin.com, jagan@openedev.com, robert.jarzmik@free.fr, mylene.josserand@bootlin.com, sjg@chromium.org, bmeng.cn@gmail.com, zajec5@gmail.com, computersforpeace@gmail.com, marc_gonzalez@sigmadesigns.com Date: Fri, 15 Mar 2019 15:14:38 +0100 Message-Id: <1552659287-11246-10-git-send-email-philippe.reynes@softathome.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552659287-11246-1-git-send-email-philippe.reynes@softathome.com> References: <1552659287-11246-1-git-send-email-philippe.reynes@softathome.com> X-CLAMAV-SCAN: ok X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrgedutddrheehgdeifecutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhestddtredtredttdenucfhrhhomheprfhhihhlihhpphgvucftvgihnhgvshcuoehphhhilhhiphhpvgdrrhgvhihnvghssehsohhfthgrthhhohhmvgdrtghomheqnecukfhppedugeelrdeirdduieeirddujedtnecurfgrrhgrmhepmhhouggvpehsmhhtphhouhht X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 09/18] drivers: nand: brcmnand: add an option to read the write-protect from device tree X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The option write-protect may only change on the kernel command line, we add a property in the device tree to be more flexible. Signed-off-by: Philippe Reynes --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index e333320..faa6da4 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2671,6 +2671,9 @@ int brcmnand_probe(struct udevice *dev, struct brcmnand_soc *soc) /* Disable XOR addressing */ brcmnand_rmw_reg(ctrl, BRCMNAND_CS_XOR, 0xff, 0, 0); + /* Read the write-protect configuration in the device tree */ + wp_on = dev_read_u32_default(dev, "write-protect", wp_on); + if (ctrl->features & BRCMNAND_HAS_WP) { /* Permanently disable write protection */ if (wp_on == 2)