Skip to content

Commit d8a5a92

Browse files
Andi Shytiwsakernel
authored andcommitted
i2c: mpc: Use i2c-scl-clk-low-timeout-us i2c property
"fsl,timeout" is marked as deprecated and replaced by the "i2c-scl-clk-low-timeout-us" i2c property. Use this latter and, in case it is missing, for back compatibility, check whether we still have "fsl,timeout" defined. Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent be40a3a commit d8a5a92

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

drivers/i2c/busses/i2c-mpc.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,18 @@ static int fsl_i2c_probe(struct platform_device *op)
843843
mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock);
844844
}
845845

846+
/*
847+
* "fsl,timeout" has been marked as deprecated and, to maintain
848+
* backward compatibility, we will only look for it if
849+
* "i2c-scl-clk-low-timeout-us" is not present.
850+
*/
846851
result = of_property_read_u32(op->dev.of_node,
847-
"fsl,timeout", &mpc_ops.timeout);
852+
"i2c-scl-clk-low-timeout-us",
853+
&mpc_ops.timeout);
854+
if (result == -EINVAL)
855+
result = of_property_read_u32(op->dev.of_node,
856+
"fsl,timeout", &mpc_ops.timeout);
857+
848858
if (!result) {
849859
mpc_ops.timeout *= HZ / 1000000;
850860
if (mpc_ops.timeout < 5)

0 commit comments

Comments
 (0)