Skip to content

Commit 529a3ff

Browse files
prabhakarladAndi Shyti
authored andcommitted
i2c: riic: Add support for RZ/T2H SoC
Add support for the Renesas RZ/T2H (R9A09G077) SoC, which features a different interrupt layout for the RIIC controller. Unlike other SoCs with individual error interrupts, RZ/T2H uses a combined error interrupt (EEI). Introduce a new IRQ descriptor table for RZ/T2H, along with a custom ISR (`riic_eei_isr`) to handle STOP and NACK detection from the shared interrupt. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # on RZ/A1 Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250625104526.101004-6-prabhakar.mahadev-lad.rj@bp.renesas.com
1 parent 832b2f3 commit 529a3ff

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

drivers/i2c/busses/i2c-riic.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#define ICIER_SPIE BIT(3)
8080

8181
#define ICSR2_NACKF BIT(4)
82+
#define ICSR2_STOP BIT(3)
8283

8384
#define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */
8485

@@ -326,6 +327,19 @@ static irqreturn_t riic_stop_isr(int irq, void *data)
326327
return IRQ_HANDLED;
327328
}
328329

330+
static irqreturn_t riic_eei_isr(int irq, void *data)
331+
{
332+
u8 icsr2 = riic_readb(data, RIIC_ICSR2);
333+
334+
if (icsr2 & ICSR2_NACKF)
335+
return riic_tend_isr(irq, data);
336+
337+
if (icsr2 & ICSR2_STOP)
338+
return riic_stop_isr(irq, data);
339+
340+
return IRQ_NONE;
341+
}
342+
329343
static u32 riic_func(struct i2c_adapter *adap)
330344
{
331345
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
@@ -497,6 +511,13 @@ static const struct riic_irq_desc riic_irqs[] = {
497511
{ .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" },
498512
};
499513

514+
static const struct riic_irq_desc riic_rzt2h_irqs[] = {
515+
{ .res_num = 0, .isr = riic_eei_isr, .name = "riic-eei" },
516+
{ .res_num = 1, .isr = riic_rdrf_isr, .name = "riic-rxi" },
517+
{ .res_num = 2, .isr = riic_tdre_isr, .name = "riic-txi" },
518+
{ .res_num = 3, .isr = riic_tend_isr, .name = "riic-tei" },
519+
};
520+
500521
static int riic_i2c_probe(struct platform_device *pdev)
501522
{
502523
struct device *dev = &pdev->dev;
@@ -643,6 +664,12 @@ static const struct riic_of_data riic_rz_v2h_info = {
643664
.fast_mode_plus = true,
644665
};
645666

667+
static const struct riic_of_data riic_rz_t2h_info = {
668+
.regs = riic_rz_v2h_regs,
669+
.irqs = riic_rzt2h_irqs,
670+
.num_irqs = ARRAY_SIZE(riic_rzt2h_irqs),
671+
};
672+
646673
static int riic_i2c_suspend(struct device *dev)
647674
{
648675
struct riic_dev *riic = dev_get_drvdata(dev);
@@ -695,6 +722,7 @@ static const struct dev_pm_ops riic_i2c_pm_ops = {
695722
static const struct of_device_id riic_i2c_dt_ids[] = {
696723
{ .compatible = "renesas,riic-r7s72100", .data = &riic_rz_a1h_info, },
697724
{ .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info },
725+
{ .compatible = "renesas,riic-r9a09g077", .data = &riic_rz_t2h_info },
698726
{ .compatible = "renesas,riic-rz", .data = &riic_rz_a_info },
699727
{ /* Sentinel */ }
700728
};

0 commit comments

Comments
 (0)