public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high
@ 2024-12-11 16:50 Iker Pedrosa
  2024-12-11 16:57 ` Mark Brown
  2024-12-11 18:23 ` Rob Herring (Arm)
  0 siblings, 2 replies; 3+ messages in thread
From: Iker Pedrosa @ 2024-12-11 16:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: Iker Pedrosa, broonie, robh, krzk+dt, conor+dt, linux-spi,
	devicetree, javierm

The current documentation does not clearly explain how to invert the SPI
CS signal to make it active-high. This makes it very difficult to
understand.

This patch adds a simple explanation on how to set the CS line in
active-high and adds an example to make it easier for users who need
that setup for their SPI peripherals.

Link: https://forums.raspberrypi.com/viewtopic.php?t=378222
Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
---
 .../bindings/spi/spi-controller.yaml          | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml
index 093150c0cb87..960d60e653d9 100644
--- a/Documentation/devicetree/bindings/spi/spi-controller.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml
@@ -69,6 +69,11 @@ properties:
          Should be generally avoided and be replaced by
          spi-cs-high + ACTIVE_HIGH.
 
+      The simplest way to obtain an active-high CS signal is to configure the
+      controller's cs-gpio property with the ACTIVE_HIGH flag and set the
+      peripheral's spi-cs-high property. See example below for a better
+      understanding.
+
   fifo-depth:
     $ref: /schemas/types.yaml#/definitions/uint32
     description:
@@ -189,3 +194,23 @@ examples:
             stacked-memories = /bits/ 64 <0x10000000 0x10000000>;
         };
     };
+
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    spi@20204000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        compatible = "brcm,bcm2835-spi";
+        reg = <0x7e204000 0x1000>;
+        interrupts = <2 22>;
+        clocks = <&clk_spi>;
+        cs-gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;
+
+        display@0 {
+            compatible = "sitronix,st7920";
+            spi-max-frequency = <600000>;
+            reg = <0>;
+            spi-cs-high;
+        };
+    };
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high
  2024-12-11 16:50 [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high Iker Pedrosa
@ 2024-12-11 16:57 ` Mark Brown
  2024-12-11 18:23 ` Rob Herring (Arm)
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2024-12-11 16:57 UTC (permalink / raw)
  To: Iker Pedrosa
  Cc: linux-kernel, robh, krzk+dt, conor+dt, linux-spi, devicetree,
	javierm

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Wed, Dec 11, 2024 at 05:50:50PM +0100, Iker Pedrosa wrote:
> The current documentation does not clearly explain how to invert the SPI
> CS signal to make it active-high. This makes it very difficult to
> understand.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high
  2024-12-11 16:50 [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high Iker Pedrosa
  2024-12-11 16:57 ` Mark Brown
@ 2024-12-11 18:23 ` Rob Herring (Arm)
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring (Arm) @ 2024-12-11 18:23 UTC (permalink / raw)
  To: Iker Pedrosa
  Cc: linux-spi, krzk+dt, linux-kernel, devicetree, javierm, conor+dt,
	broonie


On Wed, 11 Dec 2024 17:50:50 +0100, Iker Pedrosa wrote:
> The current documentation does not clearly explain how to invert the SPI
> CS signal to make it active-high. This makes it very difficult to
> understand.
> 
> This patch adds a simple explanation on how to set the CS line in
> active-high and adds an example to make it easier for users who need
> that setup for their SPI peripherals.
> 
> Link: https://forums.raspberrypi.com/viewtopic.php?t=378222
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
>  .../bindings/spi/spi-controller.yaml          | 25 +++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/spi/spi-controller.example.dtb: /example-1/spi@20204000/display@0: failed to match any schema with compatible: ['sitronix,st7920']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241211165054.254164-1-ikerpedrosam@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-11 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-11 16:50 [PATCH v2] dt-bindings: devicetree: explain how to get CS active-high Iker Pedrosa
2024-12-11 16:57 ` Mark Brown
2024-12-11 18:23 ` Rob Herring (Arm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox