Skip to content

Commit 92a85b7

Browse files
darkxstwsakernel
authored andcommitted
i2c: rk3x: Adjust mask/value offset for i2c2 on rv1126
Rockchip RV1126 is using old style i2c controller, the i2c2 bus uses a non-sequential offset in the grf register for the mask/value bits for this bus. This patch fixes i2c2 bus on rv1126 SoCs. Signed-off-by: Tim Lunn <tim@feathertop.org> Acked-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 187432b commit 92a85b7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/i2c/busses/i2c-rk3x.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,8 +1288,12 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
12881288
return -EINVAL;
12891289
}
12901290

1291-
/* 27+i: write mask, 11+i: value */
1292-
value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
1291+
/* rv1126 i2c2 uses non-sequential write mask 20, value 4 */
1292+
if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2)
1293+
value = BIT(20) | BIT(4);
1294+
else
1295+
/* 27+i: write mask, 11+i: value */
1296+
value = BIT(27 + bus_nr) | BIT(11 + bus_nr);
12931297

12941298
ret = regmap_write(grf, i2c->soc_data->grf_offset, value);
12951299
if (ret != 0) {

0 commit comments

Comments
 (0)