Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3480451ybl; Mon, 27 Jan 2020 04:59:14 -0800 (PST) X-Google-Smtp-Source: APXvYqwHhawdbid3tQfCJRjJu3SdGi6I4lsppR6YPrrk6IpACmBjohThyMKbTIllccDxCc0Cm7zn X-Received: by 2002:a9d:64ca:: with SMTP id n10mr1348444otl.325.1580129954122; Mon, 27 Jan 2020 04:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580129954; cv=none; d=google.com; s=arc-20160816; b=i1/fwnJQad/1sDCUxKhkURw+E4GbXiZ7vzAhmR5rSVwAB59ZigvOUH409kh3NdCxdB +bUtv8zCKK7mkY5d1x6Drb1OajEJYDnUDplLB9oDOHNo+YbQQr+tw6f4KNpDbb6QA3kN TDVBR/4QyVB3NY8nN/ZgHBZawOqMrEy7JoM96mNeRVs+oFkEQDx9wmd+aifDNBkFhhtA rDUvofuYAiXNERLuBUt52ZjuCLX1n16YtWkIt5Dk8Ic5GIaYYe+e0bfENUzayHD16i5w WlsyN/ujqmzN4IsFvGcK6u078QJr6YJhthLoV9ejy5Rf8PLlfBTdWLCiKwnjQeQMDElo gCIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature:dkim-filter; bh=dGCJAhJbUqKnSgxJYoXM3jsc9acDTx2CkDjtkeQlhGU=; b=QMIw4eoQrDco3w2OsnWItqZO4TffG21ITQgcN79UpuYvBUaL3mRUeB/rfZC+aYfOkK g3Ky2uTING/Bxa7Mvy3QOusPB1YgzP7INZilwhPDEaYzn1DyxM3LGL/S91K/4dnitj2Y zcSHXOS3hh5OKpSXm3VAUqprcEQgRREBvVtovOFNTtc9san7jLe+c709A7JqgtYNX1ev JRnAOemL1U6JACeq83lEqCtQmCbqz0P/vgia6eGv9/q+NuDKI9j8lmGGZjXjCQYs9Ts8 xF3o4M5jVwRiA1aq3joRTQCknhAqelpN1IC9stGyTqJMA3UWozGIm/4aMZNQuddHkxyP g+Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GLhdlobX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si6204380otf.301.2020.01.27.04.59.02; Mon, 27 Jan 2020 04:59:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GLhdlobX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728988AbgA0M4U (ORCPT + 99 others); Mon, 27 Jan 2020 07:56:20 -0500 Received: from conssluserg-04.nifty.com ([210.131.2.83]:63555 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726725AbgA0M4U (ORCPT ); Mon, 27 Jan 2020 07:56:20 -0500 Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) (authenticated) by conssluserg-04.nifty.com with ESMTP id 00RCu2N0019710 for ; Mon, 27 Jan 2020 21:56:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com 00RCu2N0019710 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1580129763; bh=dGCJAhJbUqKnSgxJYoXM3jsc9acDTx2CkDjtkeQlhGU=; h=From:Date:Subject:To:Cc:From; b=GLhdlobXtHz2mq06vtVXyy12ZSIMD3eIAwNIuHFhH7mp/cJ4wepYqbAJCF8H8onWN yVv0pogud67uu92EzzHEyHit4h0uPDsa3inLCSM27aCnRBQXNa/z9JO9cOnpFkgGmb 5PxdB+d1UFdUMN4b2jJWuOS3GJjN1gWhRRgXnG85SrJzOjW44/nozwNLFvpqjmvMud 3FrbLNJpkUVijQIst1JnbfYWYSX/oG6roeRiHv+y4TGtTImIiU7fVO0MdgQNiw9Sac 96AIRBm5mhpEUGZ8quPTgS9U1ToKHWUhX5bAziM5XxWxHUgSoh0zDx4W1fTNEX/sU8 57FZU4zO3grZw== X-Nifty-SrcIP: [209.85.221.173] Received: by mail-vk1-f173.google.com with SMTP id c129so2508529vkh.7 for ; Mon, 27 Jan 2020 04:56:03 -0800 (PST) X-Gm-Message-State: APjAAAXh3snJuHySQglzihaO1GEIVyLclLMWkieqMaEl/Xb0Ng+JTkC/ J2AB9M9Z3aSDgeIbpj2hcRG59cJsxBUAKNHLsuY= X-Received: by 2002:a1f:1bc3:: with SMTP id b186mr8870779vkb.96.1580129761632; Mon, 27 Jan 2020 04:56:01 -0800 (PST) MIME-Version: 1.0 From: Masahiro Yamada Date: Mon, 27 Jan 2020 21:55:25 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: How to handle write-protect pin of NAND device ? To: linux-mtd Cc: Miquel Raynal , Boris Brezillon , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi. I have a question about the WP_n pin of a NAND chip. As far as I see, the NAND framework does not handle it. Instead, it is handled in a driver level. I see some DT-bindings that handle the WP_n pin. $ git grep wp -- Documentation/devicetree/bindings/mtd/ Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt:- brcm,nand-has-wp : Some versions of this IP include a write-protect Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt:- wp-gpios: GPIO specifier for the write protect pin. Documentation/devicetree/bindings/mtd/ingenic,jz4780-nand.txt: wp-gpios = <&gpf 22 GPIO_ACTIVE_LOW>; Documentation/devicetree/bindings/mtd/nvidia-tegra20-nand.txt:- wp-gpios: GPIO specifier for the write protect pin. Documentation/devicetree/bindings/mtd/nvidia-tegra20-nand.txt: wp-gpios = <&gpio TEGRA_GPIO(S, 0) GPIO_ACTIVE_LOW>; I wrote a patch to avoid read-only issue in some cases: http://patchwork.ozlabs.org/patch/1229749/ Generally speaking, we expect NAND devices are writable in Linux. So, I think my patch is OK. However, I asked this myself: Is there a useful case to assert the write protect pin in order to make the NAND chip really read-only? For example, the system recovery image is stored in a read-only device, and the write-protect pin is kept asserted to assure nobody accidentally corrupts it. But, I am not sure if it should be handled in the framework level with a more generic DT-binding. Comments are appreciated. -- Best Regards Masahiro Yamada