Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5544487ybl; Tue, 10 Dec 2019 07:43:32 -0800 (PST) X-Google-Smtp-Source: APXvYqz87oZHintAHjTBVrGnBR/9DvV4bOy/h34pUO7HmZJIM6wHp4QxOsfdzZILBsTGhtdq7SyI X-Received: by 2002:a9d:66ca:: with SMTP id t10mr25781958otm.352.1575992612460; Tue, 10 Dec 2019 07:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575992612; cv=none; d=google.com; s=arc-20160816; b=qfCMv1IfWHReYxeB0vyGOhsNKedfIF1dMry/qChBxGp94RhW4VWlVuZB1u39t5im1s YPdXyrz9HcI3zbYs5O8eMMNdsuJ3U8LX5g4+Al/k8FFxYdhyTsWaeFT0o8gCPfqFMZ1f +tyyr1hLn0pIOKLvPCTb+Ecqt91jSMgwIPlkggqA0jt4WOTy7Td6Yn1fvVbl/Wxbn2Bo j5rXXGSi2/IiOPfy8McV4fM/xm6Pn1EbmEf2MHrLabC4buMNwT0N+HDmtlQKZsBDgpsB NRXe+vuHrSVPV6O0bWcWuUyYjU2tSAhlW2c74Ta5NbBug7zeIoiwfjvissCdrifdfGj2 tfRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DYGCPlFYfMEo2ftPv0Z0kGJqzS3pUpAwvlGql73I9Zo=; b=MEZLhQ639ZBrrf2xPOaT4s47sTPI/MbITPjt36ReBgojGr/BqjwtYmaWimiUpq+JJN d6o/qmgYeWFXGRgSn5grIk4nLfkhouhYsMzNR4ScJEhUeHfWgadX3qSDMxo9QnhUX8oj wAk6jqqAb4WckAJhjSUuqqLPKj6KjDbqlPIHcBK9DOdmyPGY2S8aikUEf7ENc6UZoU+t gVbJewZTzLUgFr/iQBL89EVSW3YRvl2Ncn/VCfBf4COGOQflqCbsJQkwFpCxBXeXOLY+ nNQpGlvsl5AIKFzZWABNd/Y83runVd8wSyTrbRUtXo6ZSRK/pVbUyiF00XJFcSfxIZmw oDPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=JnGRUlhX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si2141675ota.19.2019.12.10.07.43.20; Tue, 10 Dec 2019 07:43:32 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=JnGRUlhX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727565AbfLJPmU (ORCPT + 99 others); Tue, 10 Dec 2019 10:42:20 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36315 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbfLJPmR (ORCPT ); Tue, 10 Dec 2019 10:42:17 -0500 Received: by mail-wr1-f67.google.com with SMTP id z3so20660283wru.3 for ; Tue, 10 Dec 2019 07:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DYGCPlFYfMEo2ftPv0Z0kGJqzS3pUpAwvlGql73I9Zo=; b=JnGRUlhX7iRqoMyv7JDwrWvHc2bZ1iB+KpNAHCFq0O9OVhsjih/fG50MoAkvz/PDit IM2Gk/ygL2VBxPBxuxWdSmiSWRF3V8hCXX2vf3KPfZkV1e/esNFP1Rs7yOSf/95Dy+67 QaakjZbFwax/LcTA+kHx2vbCl+rW8/i6+j/07QVVbA8TXDZ6HpAa2PZkpdrINqMY1mLC XzvgbFqz6EsntOXM5CaWKRrDamJhBtXfVzh5PDYVk6kJyGkqLVRbrEFcNGQ5oGxFQuqy fN94q7TYNyysZcvEqjnibJowJMHmT4F+9/ktkez/dojR0ZX3nSAPTIKsO5Xl3T+3vIYH QMuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DYGCPlFYfMEo2ftPv0Z0kGJqzS3pUpAwvlGql73I9Zo=; b=OHiU2zZXRPPR0SlxDiulGHMtoVZNzKlOvzelsPsZemdU7p20MaccrUYhxqTA+Bw1S0 Y/jDODMghzdLpP6o3xo8rFPAeNYa38Nc929d2y9tQt63G16/nFXVs7hLrMV02L1l8ZGc yV1Ijfj8NdFk47BkgQ3xNXIc18Z3QtqwoRitJnAApgQG8j9ABYkOf8+mRxSsS/A5WJXi Cl/V8lebb8z5bKP2rpA7tuJJk+BpzpB6dMnI5lzwKEsKy9j/kQh+8/NUgVpivtG+ml/H ab2NZzXYK4HZX1xrZvgtIORurIWQaQquN6GYoIGAOpJGBP8D6DExZ2T79vpZ5U3QR4Ur zCYA== X-Gm-Message-State: APjAAAUTHy3SevuM9oSYV664+PRuFCFziB1TP8BGzvKuPEQWT2BAEtlz gDhu6k+XfbwjQWpx5RzsSxtGPA== X-Received: by 2002:a5d:5308:: with SMTP id e8mr3999583wrv.77.1575992536121; Tue, 10 Dec 2019 07:42:16 -0800 (PST) Received: from khouloud-ThinkPad-T470p.baylibre.local (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id o7sm3469085wmc.41.2019.12.10.07.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 07:42:15 -0800 (PST) From: Khouloud Touil To: bgolaszewski@baylibre.com, robh+dt@kernel.org, mark.rutland@arm.com, srinivas.kandagatla@linaro.org, baylibre-upstreaming@groups.io Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-i2c@vger.kernel.org, linus.walleij@linaro.org, Khouloud Touil Subject: [PATCH v2 1/4] dt-bindings: nvmem: new optional property write-protect-gpios Date: Tue, 10 Dec 2019 16:41:54 +0100 Message-Id: <20191210154157.21930-2-ktouil@baylibre.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191210154157.21930-1-ktouil@baylibre.com> References: <20191210154157.21930-1-ktouil@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Several memories have a write-protect pin, that when pulled high, it blocks the write operation. On some boards, this pin is connected to a GPIO and pulled high by default, which forces the user to manually change its state before writing. Instead of modifying all the memory drivers to check this pin, make the NVMEM subsystem check if the write-protect GPIO being passed through the nvmem_config or defined in the device tree and pull it low whenever writing to the memory. Add a new optional property to the device tree binding document, which allows to specify the GPIO line to which the write-protect pin is connected. Signed-off-by: Khouloud Touil --- Documentation/devicetree/bindings/nvmem/nvmem.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml index 1c75a059206c..ea012b2f2e77 100644 --- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml +++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml @@ -34,6 +34,14 @@ properties: description: Mark the provider as read only. + wp-gpios: + description: + GPIO to which the write-protect pin of the chip is connected. + The write-protect GPIO is asserted, when it's driven high + (logical '1') to block the write operation. It's deasserted, + when it's driven low (logical '0') to allow writing. + maxItems: 1 + patternProperties: "^.*@[0-9a-f]+$": type: object @@ -66,6 +74,7 @@ examples: qfprom: eeprom@700000 { #address-cells = <1>; #size-cells = <1>; + wp-gpios = <&gpio1 3 0>; /* ... */ -- 2.17.1