]> Git Repo - linux.git/commitdiff
spi: dt-bindings: clarify CS behavior for spi-cs-high and gpio descriptors
authorH. Nikolaus Schaller <[email protected]>
Wed, 9 Dec 2020 09:57:44 +0000 (10:57 +0100)
committerMark Brown <[email protected]>
Fri, 11 Dec 2020 13:23:09 +0000 (13:23 +0000)
Behavior of CS signal in combination of spi-cs-high and gpio descriptors
is not clearly defined and documented. So clarify the documentation

Cc: [email protected]
Cc: [email protected]
Signed-off-by: H. Nikolaus Schaller <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Link: https://lore.kernel.org/r/3bed61807fff6268789e7d411412fbc5cd6ffe2a.1607507863.git.hns@goldelico.com
Signed-off-by: Mark Brown <[email protected]>
Documentation/devicetree/bindings/spi/spi-controller.yaml

index 1b56d5e40f1fcdef84c87d4e726965187762405b..5f505810104ddc1da4812f821ec1bd107e297b66 100644 (file)
@@ -42,6 +42,33 @@ properties:
         cs2 : &gpio1 1 0
         cs3 : &gpio1 2 0
 
+      The second flag of a gpio descriptor can be GPIO_ACTIVE_HIGH (0)
+      or GPIO_ACTIVE_LOW(1). Legacy device trees often use 0.
+
+      There is a special rule set for combining the second flag of an
+      cs-gpio with the optional spi-cs-high flag for SPI slaves.
+
+      Each table entry defines how the CS pin is to be physically
+      driven (not considering potential gpio inversions by pinmux):
+
+      device node     | cs-gpio       | CS pin state active | Note
+      ================+===============+=====================+=====
+      spi-cs-high     | -             | H                   |
+      -               | -             | L                   |
+      spi-cs-high     | ACTIVE_HIGH   | H                   |
+      -               | ACTIVE_HIGH   | L                   | 1
+      spi-cs-high     | ACTIVE_LOW    | H                   | 2
+      -               | ACTIVE_LOW    | L                   |
+
+      Notes:
+      1) Should print a warning about polarity inversion.
+         Here it would be wise to avoid and define the gpio as
+         ACTIVE_LOW.
+      2) Should print a warning about polarity inversion
+         because ACTIVE_LOW is overridden by spi-cs-high.
+         Should be generally avoided and be replaced by
+         spi-cs-high + ACTIVE_HIGH.
+
   num-cs:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
This page took 0.06259 seconds and 4 git commands to generate.