[PATCH v3 1/2] dt-bindings: gnss: u-blox: add "safeboot-gpios" binding

Alejandro Enrique via B4 Relay posted 2 patches 5 months ago
[PATCH v3 1/2] dt-bindings: gnss: u-blox: add "safeboot-gpios" binding
Posted by Alejandro Enrique via B4 Relay 5 months ago
From: Alejandro Enrique <alejandroe1@geotab.com>

U-Blox 8/M8/M9 chip have a pin to start it in safeboot mode, to be
used to recover from situations where the flash content has become
corrupted and needs to be restored. Introduce a binding to support
this safeboot pin.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
---
 .../devicetree/bindings/gnss/u-blox,neo-6m.yaml      | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
index c0c2bfaa606fb01f7efee1ce7e5d30b1640783f3..44c9421cbe0b377661ef99a9e8c0dcebf3f9c894 100644
--- a/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
+++ b/Documentation/devicetree/bindings/gnss/u-blox,neo-6m.yaml
@@ -6,10 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: U-blox GNSS Receiver
 
-allOf:
-  - $ref: gnss-common.yaml#
-  - $ref: /schemas/serial/serial-peripheral-props.yaml#
-
 maintainers:
   - Johan Hovold <johan@kernel.org>
 
@@ -36,6 +32,9 @@ properties:
   reset-gpios:
     maxItems: 1
 
+  safeboot-gpios:
+    maxItems: 1
+
   vcc-supply:
     description: >
       Main voltage regulator
@@ -53,6 +52,18 @@ required:
   - compatible
   - vcc-supply
 
+allOf:
+  - $ref: gnss-common.yaml#
+  - $ref: /schemas/serial/serial-peripheral-props.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: u-blox,neo-6m
+    then:
+      properties:
+        safeboot-gpios: false
+
 unevaluatedProperties: false
 
 examples:
@@ -65,5 +76,6 @@ examples:
             v-bckp-supply = <&gnss_v_bckp_reg>;
             vcc-supply = <&gnss_vcc_reg>;
             reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+            safeboot-gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
         };
     };

-- 
2.34.1
Re: [PATCH v3 1/2] dt-bindings: gnss: u-blox: add "safeboot-gpios" binding
Posted by Johan Hovold 2 months, 3 weeks ago
On Thu, Sep 11, 2025 at 02:58:28PM +0200, Alejandro Enrique via B4 Relay wrote:
> From: Alejandro Enrique <alejandroe1@geotab.com>
> 
> U-Blox 8/M8/M9 chip have a pin to start it in safeboot mode, to be
> used to recover from situations where the flash content has become
> corrupted and needs to be restored. Introduce a binding to support
> this safeboot pin.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Alejandro Enrique <alejandroe1@geotab.com>
 
> +allOf:
> +  - $ref: gnss-common.yaml#
> +  - $ref: /schemas/serial/serial-peripheral-props.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: u-blox,neo-6m
> +    then:
> +      properties:
> +        safeboot-gpios: false
> +

I don't think it's worth adding conditionals like this for an optional
gpio as it just makes the binding harder to read for no good reason (cf.
a dt checker can't verify that you're not using the wrong host pin in
your identifier either).

So I used your v1 without this (and dropped Krzysztof's tag).

>  unevaluatedProperties: false
>  
>  examples:
> @@ -65,5 +76,6 @@ examples:
>              v-bckp-supply = <&gnss_v_bckp_reg>;
>              vcc-supply = <&gnss_vcc_reg>;
>              reset-gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
> +            safeboot-gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
>          };
>      };

Johan