Message ID | 20231113120705.1647498-4-tim@feathertop.org |
---|---|
State | Accepted |
Commit | 92a85b7c6262f19c65a1c115cf15f411ba65a57c |
Headers | show |
Series | Add support for Sonoff iHost RV1126 Smart Home Gateway | expand |
Hi, Am Montag, 13. November 2023, 13:07:00 CET schrieb Tim Lunn: > Rockchip RV1126 has a special case grf offset/mask for i2c2 This sounds misleading. When looking at the soc-data, the grf offset seems to be the same for all busses of the rv1126, only the offset seems to be different for i2c2. Sadly I don't have (and didn't find any) rv1126 TRM, so couldn't verify. Change itself looks nice. As it's only this one bus of one soc so far, we likely won't need a more involved solution just now. > Signed-off-by: Tim Lunn <tim@feathertop.org> > --- > > drivers/i2c/busses/i2c-rk3x.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c > index a044ca0c35a1..83b7bf7b48a7 100644 > --- a/drivers/i2c/busses/i2c-rk3x.c > +++ b/drivers/i2c/busses/i2c-rk3x.c > @@ -1288,8 +1288,12 @@ 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) > + /* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */ same here, comment could drop the offset reference I guess. > + 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) { > Heiko
Hi Heiko, On 11/17/23 06:54, Heiko Stuebner wrote: > Hi, > > Am Montag, 13. November 2023, 13:07:00 CET schrieb Tim Lunn: >> Rockchip RV1126 has a special case grf offset/mask for i2c2 > This sounds misleading. When looking at the soc-data, the grf offset > seems to be the same for all busses of the rv1126, only the offset > seems to be different for i2c2. > > Sadly I don't have (and didn't find any) rv1126 TRM, so couldn't verify. > > Change itself looks nice. As it's only this one bus of one soc so far, > we likely won't need a more involved solution just now. > Thanks for your comments. I agree it sounds a bit misleading, I will clarify the commit message and comments in v2 of this series. Unfortunately I dont have access to the TRM either, however I have validated that this fixes i2c2 on actual hardware. > >> Signed-off-by: Tim Lunn <tim@feathertop.org> >> --- >> >> drivers/i2c/busses/i2c-rk3x.c | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c >> index a044ca0c35a1..83b7bf7b48a7 100644 >> --- a/drivers/i2c/busses/i2c-rk3x.c >> +++ b/drivers/i2c/busses/i2c-rk3x.c >> @@ -1288,8 +1288,12 @@ 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) >> + /* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */ > same here, comment could drop the offset reference I guess. > >> + 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) { >> > > Heiko > >
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index a044ca0c35a1..83b7bf7b48a7 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -1288,8 +1288,12 @@ 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) + /* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */ + 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) {
Rockchip RV1126 has a special case grf offset/mask for i2c2 Signed-off-by: Tim Lunn <tim@feathertop.org> --- drivers/i2c/busses/i2c-rk3x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)