|
85 | 85 |
|
86 | 86 | #define ICU_TINT_EXTRACT_HWIRQ(x) FIELD_GET(GENMASK(15, 0), (x))
|
87 | 87 | #define ICU_TINT_EXTRACT_GPIOINT(x) FIELD_GET(GENMASK(31, 16), (x))
|
| 88 | +#define ICU_RZG3E_TINT_OFFSET 0x800 |
| 89 | +#define ICU_RZG3E_TSSEL_MAX_VAL 0x8c |
88 | 90 | #define ICU_RZV2H_TSSEL_MAX_VAL 0x55
|
89 | 91 |
|
90 | 92 | /**
|
91 | 93 | * struct rzv2h_hw_info - Interrupt Control Unit controller hardware info structure.
|
| 94 | + * @tssel_lut: TINT lookup table |
92 | 95 | * @t_offs: TINT offset
|
93 | 96 | * @max_tssel: TSSEL max value
|
94 | 97 | * @field_width: TSSR field width
|
95 | 98 | */
|
96 | 99 | struct rzv2h_hw_info {
|
| 100 | + const u8 *tssel_lut; |
97 | 101 | u16 t_offs;
|
98 | 102 | u8 max_tssel;
|
99 | 103 | u8 field_width;
|
@@ -317,6 +321,9 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
|
317 | 321 | if (tint > priv->info->max_tssel)
|
318 | 322 | return -EINVAL;
|
319 | 323 |
|
| 324 | + if (priv->info->tssel_lut) |
| 325 | + tint = priv->info->tssel_lut[tint]; |
| 326 | + |
320 | 327 | hwirq = irqd_to_hwirq(d);
|
321 | 328 | tint_nr = hwirq - ICU_TINT_START;
|
322 | 329 |
|
@@ -529,18 +536,57 @@ static int rzv2h_icu_init_common(struct device_node *node, struct device_node *p
|
529 | 536 | return ret;
|
530 | 537 | }
|
531 | 538 |
|
| 539 | +/* Mapping based on port index on Table 4.2-6 and TSSEL bits on Table 4.6-4 */ |
| 540 | +static const u8 rzg3e_tssel_lut[] = { |
| 541 | + 81, 82, 83, 84, 85, 86, 87, 88, /* P00-P07 */ |
| 542 | + 89, 90, 91, 92, 93, 94, 95, 96, /* P10-P17 */ |
| 543 | + 111, 112, /* P20-P21 */ |
| 544 | + 97, 98, 99, 100, 101, 102, 103, 104, /* P30-P37 */ |
| 545 | + 105, 106, 107, 108, 109, 110, /* P40-P45 */ |
| 546 | + 113, 114, 115, 116, 117, 118, 119, /* P50-P56 */ |
| 547 | + 120, 121, 122, 123, 124, 125, 126, /* P60-P66 */ |
| 548 | + 127, 128, 129, 130, 131, 132, 133, 134, /* P70-P77 */ |
| 549 | + 135, 136, 137, 138, 139, 140, /* P80-P85 */ |
| 550 | + 43, 44, 45, 46, 47, 48, 49, 50, /* PA0-PA7 */ |
| 551 | + 51, 52, 53, 54, 55, 56, 57, 58, /* PB0-PB7 */ |
| 552 | + 59, 60, 61, /* PC0-PC2 */ |
| 553 | + 62, 63, 64, 65, 66, 67, 68, 69, /* PD0-PD7 */ |
| 554 | + 70, 71, 72, 73, 74, 75, 76, 77, /* PE0-PE7 */ |
| 555 | + 78, 79, 80, /* PF0-PF2 */ |
| 556 | + 25, 26, 27, 28, 29, 30, 31, 32, /* PG0-PG7 */ |
| 557 | + 33, 34, 35, 36, 37, 38, /* PH0-PH5 */ |
| 558 | + 4, 5, 6, 7, 8, /* PJ0-PJ4 */ |
| 559 | + 39, 40, 41, 42, /* PK0-PK3 */ |
| 560 | + 9, 10, 11, 12, 21, 22, 23, 24, /* PL0-PL7 */ |
| 561 | + 13, 14, 15, 16, 17, 18, 19, 20, /* PM0-PM7 */ |
| 562 | + 0, 1, 2, 3 /* PS0-PS3 */ |
| 563 | +}; |
| 564 | + |
| 565 | +static const struct rzv2h_hw_info rzg3e_hw_params = { |
| 566 | + .tssel_lut = rzg3e_tssel_lut, |
| 567 | + .t_offs = ICU_RZG3E_TINT_OFFSET, |
| 568 | + .max_tssel = ICU_RZG3E_TSSEL_MAX_VAL, |
| 569 | + .field_width = 16, |
| 570 | +}; |
| 571 | + |
532 | 572 | static const struct rzv2h_hw_info rzv2h_hw_params = {
|
533 | 573 | .t_offs = 0,
|
534 | 574 | .max_tssel = ICU_RZV2H_TSSEL_MAX_VAL,
|
535 | 575 | .field_width = 8,
|
536 | 576 | };
|
537 | 577 |
|
| 578 | +static int rzg3e_icu_init(struct device_node *node, struct device_node *parent) |
| 579 | +{ |
| 580 | + return rzv2h_icu_init_common(node, parent, &rzg3e_hw_params); |
| 581 | +} |
| 582 | + |
538 | 583 | static int rzv2h_icu_init(struct device_node *node, struct device_node *parent)
|
539 | 584 | {
|
540 | 585 | return rzv2h_icu_init_common(node, parent, &rzv2h_hw_params);
|
541 | 586 | }
|
542 | 587 |
|
543 | 588 | IRQCHIP_PLATFORM_DRIVER_BEGIN(rzv2h_icu)
|
| 589 | +IRQCHIP_MATCH("renesas,r9a09g047-icu", rzg3e_icu_init) |
544 | 590 | IRQCHIP_MATCH("renesas,r9a09g057-icu", rzv2h_icu_init)
|
545 | 591 | IRQCHIP_PLATFORM_DRIVER_END(rzv2h_icu)
|
546 | 592 | MODULE_AUTHOR( "Fabrizio Castro <[email protected]>");
|
|
0 commit comments