All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-01  7:26 ` Lucas Tanure
  0 siblings, 0 replies; 9+ messages in thread
From: Lucas Tanure @ 2022-03-01  7:26 UTC (permalink / raw)
  To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel, Lucas Tanure

Having meson_i2c_set_clk_div after i2c_add_adapter
causes issues for client drivers that try to use
the bus before the requested speed is applied.

The bus can be used just after i2c_add_adapter, so
move i2c_add_adapter to the final step as
meson_i2c_set_clk_div needs to be called before
the bus is used.

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/i2c/busses/i2c-meson.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
index ef73a42577cc..07eb819072c4 100644
--- a/drivers/i2c/busses/i2c-meson.c
+++ b/drivers/i2c/busses/i2c-meson.c
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
 	 */
 	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
 
-	ret = i2c_add_adapter(&i2c->adap);
-	if (ret < 0) {
-		clk_disable_unprepare(i2c->clk);
-		return ret;
-	}
-
 	/* Disable filtering */
 	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
 			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
 
 	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
 
+	ret = i2c_add_adapter(&i2c->adap);
+	if (ret < 0) {
+		clk_disable_unprepare(i2c->clk);
+		return ret;
+	}
+
 	return 0;
 }
 
-- 
2.35.1


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

* [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-01  7:26 ` Lucas Tanure
  0 siblings, 0 replies; 9+ messages in thread
From: Lucas Tanure @ 2022-03-01  7:26 UTC (permalink / raw)
  To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel, Lucas Tanure

Having meson_i2c_set_clk_div after i2c_add_adapter
causes issues for client drivers that try to use
the bus before the requested speed is applied.

The bus can be used just after i2c_add_adapter, so
move i2c_add_adapter to the final step as
meson_i2c_set_clk_div needs to be called before
the bus is used.

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/i2c/busses/i2c-meson.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
index ef73a42577cc..07eb819072c4 100644
--- a/drivers/i2c/busses/i2c-meson.c
+++ b/drivers/i2c/busses/i2c-meson.c
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
 	 */
 	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
 
-	ret = i2c_add_adapter(&i2c->adap);
-	if (ret < 0) {
-		clk_disable_unprepare(i2c->clk);
-		return ret;
-	}
-
 	/* Disable filtering */
 	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
 			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
 
 	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
 
+	ret = i2c_add_adapter(&i2c->adap);
+	if (ret < 0) {
+		clk_disable_unprepare(i2c->clk);
+		return ret;
+	}
+
 	return 0;
 }
 
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-01  7:26 ` Lucas Tanure
  0 siblings, 0 replies; 9+ messages in thread
From: Lucas Tanure @ 2022-03-01  7:26 UTC (permalink / raw)
  To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel, Lucas Tanure

Having meson_i2c_set_clk_div after i2c_add_adapter
causes issues for client drivers that try to use
the bus before the requested speed is applied.

The bus can be used just after i2c_add_adapter, so
move i2c_add_adapter to the final step as
meson_i2c_set_clk_div needs to be called before
the bus is used.

Signed-off-by: Lucas Tanure <tanure@linux.com>
---
 drivers/i2c/busses/i2c-meson.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
index ef73a42577cc..07eb819072c4 100644
--- a/drivers/i2c/busses/i2c-meson.c
+++ b/drivers/i2c/busses/i2c-meson.c
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
 	 */
 	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
 
-	ret = i2c_add_adapter(&i2c->adap);
-	if (ret < 0) {
-		clk_disable_unprepare(i2c->clk);
-		return ret;
-	}
-
 	/* Disable filtering */
 	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
 			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
 
 	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
 
+	ret = i2c_add_adapter(&i2c->adap);
+	if (ret < 0) {
+		clk_disable_unprepare(i2c->clk);
+		return ret;
+	}
+
 	return 0;
 }
 
-- 
2.35.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
  2022-03-01  7:26 ` Lucas Tanure
  (?)
@ 2022-03-07  8:46   ` Neil Armstrong
  -1 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2022-03-07  8:46 UTC (permalink / raw)
  To: Lucas Tanure, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel

On 01/03/2022 08:26, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
>   drivers/i2c/busses/i2c-meson.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
> index ef73a42577cc..07eb819072c4 100644
> --- a/drivers/i2c/busses/i2c-meson.c
> +++ b/drivers/i2c/busses/i2c-meson.c
> @@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
>   	 */
>   	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
>   
> -	ret = i2c_add_adapter(&i2c->adap);
> -	if (ret < 0) {
> -		clk_disable_unprepare(i2c->clk);
> -		return ret;
> -	}
> -
>   	/* Disable filtering */
>   	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
>   			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
>   
>   	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
>   
> +	ret = i2c_add_adapter(&i2c->adap);
> +	if (ret < 0) {
> +		clk_disable_unprepare(i2c->clk);
> +		return ret;
> +	}
> +
>   	return 0;
>   }
>   

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-07  8:46   ` Neil Armstrong
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2022-03-07  8:46 UTC (permalink / raw)
  To: Lucas Tanure, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel

On 01/03/2022 08:26, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
>   drivers/i2c/busses/i2c-meson.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
> index ef73a42577cc..07eb819072c4 100644
> --- a/drivers/i2c/busses/i2c-meson.c
> +++ b/drivers/i2c/busses/i2c-meson.c
> @@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
>   	 */
>   	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
>   
> -	ret = i2c_add_adapter(&i2c->adap);
> -	if (ret < 0) {
> -		clk_disable_unprepare(i2c->clk);
> -		return ret;
> -	}
> -
>   	/* Disable filtering */
>   	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
>   			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
>   
>   	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
>   
> +	ret = i2c_add_adapter(&i2c->adap);
> +	if (ret < 0) {
> +		clk_disable_unprepare(i2c->clk);
> +		return ret;
> +	}
> +
>   	return 0;
>   }
>   

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-07  8:46   ` Neil Armstrong
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Armstrong @ 2022-03-07  8:46 UTC (permalink / raw)
  To: Lucas Tanure, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel

On 01/03/2022 08:26, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
>   drivers/i2c/busses/i2c-meson.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
> index ef73a42577cc..07eb819072c4 100644
> --- a/drivers/i2c/busses/i2c-meson.c
> +++ b/drivers/i2c/busses/i2c-meson.c
> @@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
>   	 */
>   	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
>   
> -	ret = i2c_add_adapter(&i2c->adap);
> -	if (ret < 0) {
> -		clk_disable_unprepare(i2c->clk);
> -		return ret;
> -	}
> -
>   	/* Disable filtering */
>   	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
>   			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
>   
>   	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
>   
> +	ret = i2c_add_adapter(&i2c->adap);
> +	if (ret < 0) {
> +		clk_disable_unprepare(i2c->clk);
> +		return ret;
> +	}
> +
>   	return 0;
>   }
>   

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
  2022-03-01  7:26 ` Lucas Tanure
  (?)
@ 2022-03-19 23:21   ` Wolfram Sang
  -1 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2022-03-19 23:21 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel

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

On Tue, Mar 01, 2022 at 07:26:00AM +0000, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>

Applied to for-next with a Fixes tag added, thanks!


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

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-19 23:21   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2022-03-19 23:21 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 504 bytes --]

On Tue, Mar 01, 2022 at 07:26:00AM +0000, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>

Applied to for-next with a Fixes tag added, thanks!


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

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] i2c: meson: Fix wrong speed use from probe
@ 2022-03-19 23:21   ` Wolfram Sang
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2022-03-19 23:21 UTC (permalink / raw)
  To: Lucas Tanure
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-i2c, linux-arm-kernel, linux-amlogic, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 504 bytes --]

On Tue, Mar 01, 2022 at 07:26:00AM +0000, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>

Applied to for-next with a Fixes tag added, thanks!


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

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2022-03-19 23:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-01  7:26 [PATCH] i2c: meson: Fix wrong speed use from probe Lucas Tanure
2022-03-01  7:26 ` Lucas Tanure
2022-03-01  7:26 ` Lucas Tanure
2022-03-07  8:46 ` Neil Armstrong
2022-03-07  8:46   ` Neil Armstrong
2022-03-07  8:46   ` Neil Armstrong
2022-03-19 23:21 ` Wolfram Sang
2022-03-19 23:21   ` Wolfram Sang
2022-03-19 23:21   ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.