|
66 | 66 |
|
67 | 67 | #define ICU_TSSR_TSSEL_PREP(tssel, n) ((tssel) << ((n) * 8))
|
68 | 68 | #define ICU_TSSR_TSSEL_MASK(n) ICU_TSSR_TSSEL_PREP(0x7F, n)
|
69 |
| -#define ICU_TSSR_TIEN(n) (BIT(7) << ((n) * 8)) |
| 69 | +#define ICU_TSSR_TIEN(n, field_width) \ |
| 70 | +({\ |
| 71 | + typeof(field_width) (_field_width) = (field_width); \ |
| 72 | + BIT((_field_width) - 1) << ((n) * (_field_width)); \ |
| 73 | +}) |
70 | 74 |
|
71 | 75 | #define ICU_TITSR_K(tint_nr) ((tint_nr) / 16)
|
72 | 76 | #define ICU_TITSR_TITSEL_N(tint_nr) ((tint_nr) % 16)
|
@@ -153,9 +157,9 @@ static void rzv2h_tint_irq_endisable(struct irq_data *d, bool enable)
|
153 | 157 | guard(raw_spinlock)(&priv->lock);
|
154 | 158 | tssr = readl_relaxed(priv->base + priv->info->t_offs + ICU_TSSR(k));
|
155 | 159 | if (enable)
|
156 |
| - tssr |= ICU_TSSR_TIEN(tssel_n); |
| 160 | + tssr |= ICU_TSSR_TIEN(tssel_n, priv->info->field_width); |
157 | 161 | else
|
158 |
| - tssr &= ~ICU_TSSR_TIEN(tssel_n); |
| 162 | + tssr &= ~ICU_TSSR_TIEN(tssel_n, priv->info->field_width); |
159 | 163 | writel_relaxed(tssr, priv->base + priv->info->t_offs + ICU_TSSR(k));
|
160 | 164 | }
|
161 | 165 |
|
@@ -314,7 +318,7 @@ static int rzv2h_tint_set_type(struct irq_data *d, unsigned int type)
|
314 | 318 | nr_tint = 32 / priv->info->field_width;
|
315 | 319 | tssr_k = tint_nr / nr_tint;
|
316 | 320 | tssel_n = tint_nr % nr_tint;
|
317 |
| - tien = ICU_TSSR_TIEN(tssel_n); |
| 321 | + tien = ICU_TSSR_TIEN(tssel_n, priv->info->field_width); |
318 | 322 |
|
319 | 323 | titsr_k = ICU_TITSR_K(tint_nr);
|
320 | 324 | titsel_n = ICU_TITSR_TITSEL_N(tint_nr);
|
|
0 commit comments