diff mbox series

[v4,1/2] dt-bindings: serial: sc16is7xx: add reset-gpios

Message ID 20240613082528.22591-1-hui.wang@canonical.com
State Superseded
Headers show
Series [v4,1/2] dt-bindings: serial: sc16is7xx: add reset-gpios | expand

Commit Message

Hui Wang June 13, 2024, 8:25 a.m. UTC
In some designs, the chip reset pin is connected to a GPIO, and this
GPIO needs to be set correctly before probing the driver, so add a
reset-gpios in the device tree.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
No change between v3 and v4.

 Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Andy Shevchenko June 13, 2024, 8:47 p.m. UTC | #1
On Thu, Jun 13, 2024 at 10:26 AM Hui Wang <hui.wang@canonical.com> wrote:

> Some boards connect a GPIO to the reset pin, and the reset pin needs
> to be setup correctly before accessing the chip.

set up

> Add a function to handle the chip reset. If the reset-gpios is defined
> in the DT, do hardware reset through this GPIO, othwerwise do software

otherwise

> reset as before.

...

> +               /* The minimum reset pulse width is 3 us. */
> +               usleep_range(5, 10);

Simply use fsleep() and it will take care of the sane API to be called.

> +               gpiod_set_value_cansleep(reset_gpio, 0); /* Deassert GPIO */
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml b/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
index 5dec15b7e7c3..88871480018e 100644
--- a/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
+++ b/Documentation/devicetree/bindings/serial/nxp,sc16is7xx.yaml
@@ -28,6 +28,9 @@  properties:
   clocks:
     maxItems: 1
 
+  reset-gpios:
+    maxItems: 1
+
   clock-frequency:
     description:
       When there is no clock provider visible to the platform, this
@@ -91,6 +94,7 @@  unevaluatedProperties: false
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
     i2c {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -120,6 +124,7 @@  examples:
             compatible = "nxp,sc16is752";
             reg = <0x54>;
             clocks = <&clk20m>;
+            reset-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
             interrupt-parent = <&gpio3>;
             interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
             nxp,modem-control-line-ports = <0 1>; /* Ports 0 and 1 as modem control lines */