Skip to content

Commit 2fee958

Browse files
goldelicobroonie
authored andcommitted
spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors
Behavior of CS signal in combination of spi-cs-high and gpio descriptors is not clearly defined and documented. So clarify the documentation Cc: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/3bed61807fff6268789e7d411412fbc5cd6ffe2a.1607507863.git.hns@goldelico.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 49ab19a commit 2fee958

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Documentation/devicetree/bindings/spi/spi-controller.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,33 @@ properties:
4242
cs2 : &gpio1 1 0
4343
cs3 : &gpio1 2 0
4444
45+
The second flag of a gpio descriptor can be GPIO_ACTIVE_HIGH (0)
46+
or GPIO_ACTIVE_LOW(1). Legacy device trees often use 0.
47+
48+
There is a special rule set for combining the second flag of an
49+
cs-gpio with the optional spi-cs-high flag for SPI slaves.
50+
51+
Each table entry defines how the CS pin is to be physically
52+
driven (not considering potential gpio inversions by pinmux):
53+
54+
device node | cs-gpio | CS pin state active | Note
55+
================+===============+=====================+=====
56+
spi-cs-high | - | H |
57+
- | - | L |
58+
spi-cs-high | ACTIVE_HIGH | H |
59+
- | ACTIVE_HIGH | L | 1
60+
spi-cs-high | ACTIVE_LOW | H | 2
61+
- | ACTIVE_LOW | L |
62+
63+
Notes:
64+
1) Should print a warning about polarity inversion.
65+
Here it would be wise to avoid and define the gpio as
66+
ACTIVE_LOW.
67+
2) Should print a warning about polarity inversion
68+
because ACTIVE_LOW is overridden by spi-cs-high.
69+
Should be generally avoided and be replaced by
70+
spi-cs-high + ACTIVE_HIGH.
71+
4572
num-cs:
4673
$ref: /schemas/types.yaml#/definitions/uint32
4774
description:

0 commit comments

Comments
 (0)