Files
linux/Documentation/devicetree/bindings/gpio/nxp,pcf8575.yaml
Quentin Schulz b28037d4f3 dt-bindings: gpio: nxp,pcf8575: add reset GPIO
A few of the I2C GPIO expander chips supported by this binding have a
RESETN pin to be able to reset the chip. The chip is held in reset while
the pin is low, therefore the polarity of reset-gpios is expected to
reflect that, i.e. a GPIO_ACTIVE_HIGH means the GPIO will be driven high
for reset and then driven low, GPIO_ACTIVE_LOW means the GPIO will be
driven low for reset and then driven high. If a GPIO is directly routed
to RESETN pin on the IC without any inverter, GPIO_ACTIVE_LOW is thus
expected.

Out of the supported chips, only PCA9670, PCA9671, PCA9672 and PCA9673
show a RESETN pin in their datasheets. They all share the same reset
timings, that is 4+us reset pulse[0] and 100+us reset time[0].

When performing a reset, "The PCA9670 registers and I2C-bus state
machine will be held in their default state until the RESET input is
once again HIGH."[1] meaning we now know the state of each line
controlled by the GPIO expander. Therefore, setting lines-initial-states
and reset-gpios both does not make sense and their presence is XOR'ed.

[0] https://www.nxp.com/docs/en/data-sheet/PCA9670.pdf Fig 22.
[1] https://www.nxp.com/docs/en/data-sheet/PCA9670.pdf 8.5

Tested-by: Heiko Stuebner <heiko@sntech.de> # exclusion logic
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Link: https://lore.kernel.org/r/20250224-pca976x-reset-driver-v3-1-58370ef405be@cherry.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2025-02-26 11:25:30 +01:00

145 lines
3.7 KiB
YAML

# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/nxp,pcf8575.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: PCF857x-compatible I/O expanders
maintainers:
- Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
description:
The PCF857x-compatible chips have "quasi-bidirectional" I/O lines that can be
driven high by a pull-up current source or driven low to ground. This
combines the direction and output level into a single bit per line, which
can't be read back. We can't actually know at initialization time whether a
line is configured (a) as output and driving the signal low/high, or (b) as
input and reporting a low/high value, without knowing the last value written
since the chip came out of reset (if any). The only reliable solution for
setting up line direction is thus to do it explicitly.
properties:
compatible:
enum:
- maxim,max7328
- maxim,max7329
- nxp,pca8574
- nxp,pca8575
- nxp,pca9670
- nxp,pca9671
- nxp,pca9672
- nxp,pca9673
- nxp,pca9674
- nxp,pca9675
- nxp,pcf8574
- nxp,pcf8574a
- nxp,pcf8575
reg:
maxItems: 1
gpio-line-names:
minItems: 1
maxItems: 16
gpio-controller: true
'#gpio-cells':
const: 2
description:
The first cell is the GPIO number and the second cell specifies GPIO
flags, as defined in <dt-bindings/gpio/gpio.h>. Only the GPIO_ACTIVE_HIGH
and GPIO_ACTIVE_LOW flags are supported.
lines-initial-states:
$ref: /schemas/types.yaml#/definitions/uint32
description:
Bitmask that specifies the initial state of each line.
When a bit is set to zero, the corresponding line will be initialized to
the input (pulled-up) state.
When the bit is set to one, the line will be initialized to the
low-level output state.
If the property is not specified all lines will be initialized to the
input state.
interrupts:
maxItems: 1
interrupt-controller: true
'#interrupt-cells':
const: 2
wakeup-source: true
reset-gpios:
maxItems: 1
description:
GPIO controlling the (reset active LOW) RESET# pin.
The active polarity of the GPIO must translate to the low state of the
RESET# pin on the IC, i.e. if a GPIO is directly routed to the RESET# pin
without any inverter, GPIO_ACTIVE_LOW is expected.
Performing a reset makes all lines initialized to their input (pulled-up)
state.
allOf:
- if:
properties:
compatible:
not:
contains:
enum:
- nxp,pca9670
- nxp,pca9671
- nxp,pca9672
- nxp,pca9673
then:
properties:
reset-gpios: false
# lines-initial-states XOR reset-gpios
# Performing a reset reinitializes all lines to a known state which
# may not match passed lines-initial-states
- if:
required:
- lines-initial-states
then:
properties:
reset-gpios: false
patternProperties:
"^(.+-hog(-[0-9]+)?)$":
type: object
required:
- gpio-hog
required:
- compatible
- reg
- gpio-controller
- '#gpio-cells'
additionalProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
pcf8575: gpio@20 {
compatible = "nxp,pcf8575";
reg = <0x20>;
interrupt-parent = <&irqpin2>;
interrupts = <3 0>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
};
};