Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: nvmem: new optional property wp-gpios

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 <ktouil@baylibre.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

authored by

Khouloud Touil and committed by
Bartosz Golaszewski
14f49573 69afc4b6

+11
+11
Documentation/devicetree/bindings/nvmem/nvmem.yaml
··· 34 34 description: 35 35 Mark the provider as read only. 36 36 37 + wp-gpios: 38 + description: 39 + GPIO to which the write-protect pin of the chip is connected. 40 + The write-protect GPIO is asserted, when it's driven high 41 + (logical '1') to block the write operation. It's deasserted, 42 + when it's driven low (logical '0') to allow writing. 43 + maxItems: 1 44 + 37 45 patternProperties: 38 46 "^.*@[0-9a-f]+$": 39 47 type: object ··· 71 63 72 64 examples: 73 65 - | 66 + #include <dt-bindings/gpio/gpio.h> 67 + 74 68 qfprom: eeprom@700000 { 75 69 #address-cells = <1>; 76 70 #size-cells = <1>; 71 + wp-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; 77 72 78 73 /* ... */ 79 74