diff mbox series

[v2,3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126

Message ID 20231122122232.952696-4-tim@feathertop.org
State New
Headers show
Series Add support for Sonoff iHost RV1126 Smart Home Gateway | expand

Commit Message

Tim Lunn Nov. 22, 2023, 12:22 p.m. UTC
Rockchip RV1126 has special case mask bits for i2c2.

i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone
is not sufficient to enable i2c2. This patch fixes the i2c2 bus.

Signed-off-by: Tim Lunn <tim@feathertop.org>
---

Changes in v2:
- i2c: clarify commit message

 drivers/i2c/busses/i2c-rk3x.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Andi Shyti Nov. 26, 2023, 7:43 p.m. UTC | #1
Hi Tim,

On Wed, Nov 22, 2023 at 11:22:26PM +1100, Tim Lunn wrote:
> Rockchip RV1126 has special case mask bits for i2c2.
> 
> i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone
> is not sufficient to enable i2c2. This patch fixes the i2c2 bus.

If I don't have sufficient information about the hardware this
description is completely meaningless to me.

> Signed-off-by: Tim Lunn <tim@feathertop.org>
> ---
> 
> Changes in v2:
> - i2c: clarify commit message
> 
>  drivers/i2c/busses/i2c-rk3x.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index a044ca0c35a1..151927466d1d 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
>  			return -EINVAL;
>  		}
>  
> -		/* 27+i: write mask, 11+i: value */
> -		value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
> +		if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2)
> +			value = BIT(20) | BIT(4);

Any chance to put a comment here as it is in the other
assignment?

Are the two assignment mutually exclusive?

Heiko, any chance to take a look here?

Thanks,
Andi

> +		else
> +			/* 27+i: write mask, 11+i: value */
> +			value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
>  
>  		ret = regmap_write(grf, i2c->soc_data->grf_offset, value);
>  		if (ret != 0) {
> -- 
> 2.40.1
>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index a044ca0c35a1..151927466d1d 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -1288,8 +1288,11 @@  static int rk3x_i2c_probe(struct platform_device *pdev)
 			return -EINVAL;
 		}
 
-		/* 27+i: write mask, 11+i: value */
-		value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
+		if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2)
+			value = BIT(20) | BIT(4);
+		else
+			/* 27+i: write mask, 11+i: value */
+			value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
 
 		ret = regmap_write(grf, i2c->soc_data->grf_offset, value);
 		if (ret != 0) {