Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Lad Prabhakar and committed by
Andi Shyti
529a3ff2 832b2f3e

+28
+28
drivers/i2c/busses/i2c-riic.c
··· 79 79 #define ICIER_SPIE BIT(3) 80 80 81 81 #define ICSR2_NACKF BIT(4) 82 + #define ICSR2_STOP BIT(3) 82 83 83 84 #define ICBR_RESERVED GENMASK(7, 5) /* Should be 1 on writes */ 84 85 ··· 327 326 return IRQ_HANDLED; 328 327 } 329 328 329 + static irqreturn_t riic_eei_isr(int irq, void *data) 330 + { 331 + u8 icsr2 = riic_readb(data, RIIC_ICSR2); 332 + 333 + if (icsr2 & ICSR2_NACKF) 334 + return riic_tend_isr(irq, data); 335 + 336 + if (icsr2 & ICSR2_STOP) 337 + return riic_stop_isr(irq, data); 338 + 339 + return IRQ_NONE; 340 + } 341 + 330 342 static u32 riic_func(struct i2c_adapter *adap) 331 343 { 332 344 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; ··· 511 497 { .res_num = 5, .isr = riic_tend_isr, .name = "riic-nack" }, 512 498 }; 513 499 500 + static const struct riic_irq_desc riic_rzt2h_irqs[] = { 501 + { .res_num = 0, .isr = riic_eei_isr, .name = "riic-eei" }, 502 + { .res_num = 1, .isr = riic_rdrf_isr, .name = "riic-rxi" }, 503 + { .res_num = 2, .isr = riic_tdre_isr, .name = "riic-txi" }, 504 + { .res_num = 3, .isr = riic_tend_isr, .name = "riic-tei" }, 505 + }; 506 + 514 507 static int riic_i2c_probe(struct platform_device *pdev) 515 508 { 516 509 struct device *dev = &pdev->dev; ··· 664 643 .fast_mode_plus = true, 665 644 }; 666 645 646 + static const struct riic_of_data riic_rz_t2h_info = { 647 + .regs = riic_rz_v2h_regs, 648 + .irqs = riic_rzt2h_irqs, 649 + .num_irqs = ARRAY_SIZE(riic_rzt2h_irqs), 650 + }; 651 + 667 652 static int riic_i2c_suspend(struct device *dev) 668 653 { 669 654 struct riic_dev *riic = dev_get_drvdata(dev); ··· 722 695 static const struct of_device_id riic_i2c_dt_ids[] = { 723 696 { .compatible = "renesas,riic-r7s72100", .data = &riic_rz_a1h_info, }, 724 697 { .compatible = "renesas,riic-r9a09g057", .data = &riic_rz_v2h_info }, 698 + { .compatible = "renesas,riic-r9a09g077", .data = &riic_rz_t2h_info }, 725 699 { .compatible = "renesas,riic-rz", .data = &riic_rz_a_info }, 726 700 { /* Sentinel */ } 727 701 };