Re: [PATCH 3/5] i2c: riic: Add RZ/G2L support
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2021-06-14 12:38:40
Also in:
linux-renesas-soc
Hi Biju, On Fri, Jun 11, 2021 at 6:56 PM Biju Das [off-list ref] wrote:
RZ/G2L i2c controller is compatible with RZ/A i2c controller. By default IP is in reset state, so need to perform release reset before accessing any register. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Thanks for your patch!
quoted hunk ↗ jump to hunk
--- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig@@ -941,6 +941,7 @@ config I2C_QUP config I2C_RIIC tristate "Renesas RIIC adapter" depends on ARCH_RENESAS || COMPILE_TEST + select RESET_CONTROLLER
if ARCH_R9A07G044?
quoted hunk ↗ jump to hunk
--- a/drivers/i2c/busses/i2c-riic.c +++ b/drivers/i2c/busses/i2c-riic.c
_kzalloc(&pdev->dev, sizeof(*riic), GFP_KERNEL);
quoted hunk ↗ jump to hunk
if (!riic)@@ -412,6 +421,17 @@ static int riic_i2c_probe(struct platform_device *pdev) return PTR_ERR(riic->clk); } + type = (enum riic_type)of_device_get_match_data(&pdev->dev); + if (type == RIIC_RZ_G2L) { + rstc = devm_reset_control_get(&pdev->dev, NULL); + if (IS_ERR(rstc)) { + dev_err(&pdev->dev, "Error: missing reset ctrl\n"); + return PTR_ERR(rstc); + } + + reset_control_deassert(rstc);
Just wondering: does it harm if the driver is unloaded or unbounded, and rebound while the I2C controller is not in reset state?
quoted hunk ↗ jump to hunk
+ } + for (i = 0; i < ARRAY_SIZE(riic_irqs); i++) { res = platform_get_resource(pdev, IORESOURCE_IRQ, riic_irqs[i].res_num); if (!res)@@ -472,6 +492,7 @@ static int riic_i2c_remove(struct platform_device *pdev) } static const struct of_device_id riic_i2c_dt_ids[] = { + { .compatible = "renesas,riic-r9a07g044", .data = (void *)RIIC_RZ_G2L }, { .compatible = "renesas,riic-rz" },
Please fill in .data, to avoid relying implicitly on RIIC_RZ_A being zero.
{ /* Sentinel */ },
};
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds