Skip to content

Commit 2eca473

Browse files
claudiubezneaKAGA-KOKO
authored andcommitted
irqchip/renesas-rzg2l: Add macro to retrieve TITSR register offset based on register's index
There are 2 TITSR registers available on the IA55 interrupt controller. Add a macro that retrieves the TITSR register offset based on it's index. This macro is useful in when adding suspend/resume support so both TITSR registers can be accessed in a for loop. Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20231120111820.87398-7-claudiu.beznea.uj@bp.renesas.com
1 parent ef88eef commit 2eca473

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

drivers/irqchip/irq-renesas-rzg2l.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
#define ISCR 0x10
2929
#define IITSR 0x14
3030
#define TSCR 0x20
31-
#define TITSR0 0x24
32-
#define TITSR1 0x28
31+
#define TITSR(n) (0x24 + (n) * 4)
3332
#define TITSR0_MAX_INT 16
3433
#define TITSEL_WIDTH 0x2
3534
#define TSSR(n) (0x30 + ((n) * 4))
@@ -200,8 +199,7 @@ static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
200199
struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
201200
unsigned int hwirq = irqd_to_hwirq(d);
202201
u32 titseln = hwirq - IRQC_TINT_START;
203-
u32 offset;
204-
u8 sense;
202+
u8 index, sense;
205203
u32 reg;
206204

207205
switch (type & IRQ_TYPE_SENSE_MASK) {
@@ -217,17 +215,17 @@ static int rzg2l_tint_set_edge(struct irq_data *d, unsigned int type)
217215
return -EINVAL;
218216
}
219217

220-
offset = TITSR0;
218+
index = 0;
221219
if (titseln >= TITSR0_MAX_INT) {
222220
titseln -= TITSR0_MAX_INT;
223-
offset = TITSR1;
221+
index = 1;
224222
}
225223

226224
raw_spin_lock(&priv->lock);
227-
reg = readl_relaxed(priv->base + offset);
225+
reg = readl_relaxed(priv->base + TITSR(index));
228226
reg &= ~(IRQ_MASK << (titseln * TITSEL_WIDTH));
229227
reg |= sense << (titseln * TITSEL_WIDTH);
230-
writel_relaxed(reg, priv->base + offset);
228+
writel_relaxed(reg, priv->base + TITSR(index));
231229
raw_spin_unlock(&priv->lock);
232230

233231
return 0;

0 commit comments

Comments
 (0)