[2/2] i2c: mpc: Use the i2c-scl-clk-low-timeout-ms property

Message ID 20230312131933.248715-3-andi.shyti@kernel.org
State New
Headers
Series Add the clock stretching i2c property |

Commit Message

Andi Shyti March 12, 2023, 1:19 p.m. UTC
  Now we have the i2c-scl-clk-low-timeout-ms property defined in
the binding. Use it and remove the previous "fsl,timeout".

Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 12 ++++++------
 drivers/i2c/busses/i2c-mpc.c                       |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)
  

Comments

Krzysztof Kozlowski March 12, 2023, 1:44 p.m. UTC | #1
On 12/03/2023 14:19, Andi Shyti wrote:
> Now we have the i2c-scl-clk-low-timeout-ms property defined in
> the binding. Use it and remove the previous "fsl,timeout".
> 
> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 12 ++++++------
>  drivers/i2c/busses/i2c-mpc.c                       |  3 ++-
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
> index 018e1b944424..c01547585456 100644
> --- a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
> +++ b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
> @@ -41,11 +41,6 @@ properties:
>        if defined, the clock settings from the bootloader are
>        preserved (not touched)
>  
> -  fsl,timeout:
> -    $ref: /schemas/types.yaml#/definitions/uint32
> -    description: |
> -      I2C bus timeout in microseconds

Instead:
  deprecated: true

> -
>    fsl,i2c-erratum-a004447:
>      $ref: /schemas/types.yaml#/definitions/flag
>      description: |
> @@ -53,6 +48,11 @@ properties:
>        says that the standard i2c recovery scheme mechanism does
>        not work and an alternate implementation is needed.
>  
> +  i2c-scl-clk-low-timeout-ms:
> +    description:
> +      Indicates the SCL timeouts which used to force the client
> +      into a waiting state

No need for this - will be coming from dtschema.

> +
>  required:
>    - compatible
>    - reg
> @@ -95,6 +95,6 @@ examples:
>          interrupts = <43 2>;
>          interrupt-parent = <&mpic>;
>          clock-frequency = <400000>;
> -        fsl,timeout = <10000>;
> +        i2c-scl-clk-low-timeout-ms = <10000>;
>      };
>  ...
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 81ac92bb4f6f..93c484efc3f3 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -846,7 +846,8 @@ static int fsl_i2c_probe(struct platform_device *op)
>  			mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
>  	}
>  
> -	prop = of_get_property(op->dev.of_node, "fsl,timeout", &plen);
> +	prop = of_get_property(op->dev.of_node,
> +			       "i2c-scl-clk-low-timeout-ms", &plen);

That's an ABI break. You need to keep old code as fallback.


Best regards,
Krzysztof
  
Krzysztof Kozlowski March 12, 2023, 1:44 p.m. UTC | #2
On 12/03/2023 14:19, Andi Shyti wrote:
> Now we have the i2c-scl-clk-low-timeout-ms property defined in
> the binding. Use it and remove the previous "fsl,timeout".
> 
> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
> Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---
>  Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 12 ++++++------

Ah, and I forgot: bindings are always separate patches from driver
changes. Cannot be mixed.

Best regards,
Krzysztof
  
Andi Shyti March 12, 2023, 1:48 p.m. UTC | #3
Hi Krzysztof,

On Sun, Mar 12, 2023 at 02:44:47PM +0100, Krzysztof Kozlowski wrote:
> On 12/03/2023 14:19, Andi Shyti wrote:
> > Now we have the i2c-scl-clk-low-timeout-ms property defined in
> > the binding. Use it and remove the previous "fsl,timeout".
> > 
> > Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
> > Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
> > ---
> >  Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 12 ++++++------
> 
> Ah, and I forgot: bindings are always separate patches from driver
> changes. Cannot be mixed.

Thanks for all your comments, will send a v2.

Andi
  

Patch

diff --git a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
index 018e1b944424..c01547585456 100644
--- a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
+++ b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
@@ -41,11 +41,6 @@  properties:
       if defined, the clock settings from the bootloader are
       preserved (not touched)
 
-  fsl,timeout:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      I2C bus timeout in microseconds
-
   fsl,i2c-erratum-a004447:
     $ref: /schemas/types.yaml#/definitions/flag
     description: |
@@ -53,6 +48,11 @@  properties:
       says that the standard i2c recovery scheme mechanism does
       not work and an alternate implementation is needed.
 
+  i2c-scl-clk-low-timeout-ms:
+    description:
+      Indicates the SCL timeouts which used to force the client
+      into a waiting state
+
 required:
   - compatible
   - reg
@@ -95,6 +95,6 @@  examples:
         interrupts = <43 2>;
         interrupt-parent = <&mpic>;
         clock-frequency = <400000>;
-        fsl,timeout = <10000>;
+        i2c-scl-clk-low-timeout-ms = <10000>;
     };
 ...
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 81ac92bb4f6f..93c484efc3f3 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -846,7 +846,8 @@  static int fsl_i2c_probe(struct platform_device *op)
 			mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
 	}
 
-	prop = of_get_property(op->dev.of_node, "fsl,timeout", &plen);
+	prop = of_get_property(op->dev.of_node,
+			       "i2c-scl-clk-low-timeout-ms", &plen);
 	if (prop && plen == sizeof(u32)) {
 		mpc_ops.timeout = *prop * HZ / 1000000;
 		if (mpc_ops.timeout < 5)