Skip to content

Commit 64bf145

Browse files
Aniketalexandrebelloni
authored andcommitted
i3c: dw: Fix IBI intr programming
IBI_SIR_REQ_REJECT register is not present if the IP has IC_HAS_IBI_DATA = 1 set. So don't rely on doing read- modify-write op on this register. Instead maintain a variable to store the sir reject mask and use it to set IBI_SIR_REQ_REJECT. Signed-off-by: Aniket <[email protected]> Reviewed-by: Jeremy Kerr <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
1 parent 8f2cb03 commit 64bf145

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

drivers/i3c/master/dw-i3c-master.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,9 @@ static int dw_i3c_master_bus_init(struct i3c_master_controller *m)
658658
if (ret)
659659
return ret;
660660

661-
writel(IBI_REQ_REJECT_ALL, master->regs + IBI_SIR_REQ_REJECT);
661+
master->sir_rej_mask = IBI_REQ_REJECT_ALL;
662+
writel(master->sir_rej_mask, master->regs + IBI_SIR_REQ_REJECT);
663+
662664
writel(IBI_REQ_REJECT_ALL, master->regs + IBI_MR_REQ_REJECT);
663665

664666
/* For now don't support Hot-Join */
@@ -1175,17 +1177,16 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master,
11751177
master->platform_ops->set_dat_ibi(master, dev, enable, &reg);
11761178
writel(reg, master->regs + dat_entry);
11771179

1178-
reg = readl(master->regs + IBI_SIR_REQ_REJECT);
11791180
if (enable) {
1180-
global = reg == 0xffffffff;
1181-
reg &= ~BIT(idx);
1181+
global = (master->sir_rej_mask == IBI_REQ_REJECT_ALL);
1182+
master->sir_rej_mask &= ~BIT(idx);
11821183
} else {
11831184
bool hj_rejected = !!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK);
11841185

1185-
reg |= BIT(idx);
1186-
global = (reg == 0xffffffff) && hj_rejected;
1186+
master->sir_rej_mask |= BIT(idx);
1187+
global = (master->sir_rej_mask == IBI_REQ_REJECT_ALL) && hj_rejected;
11871188
}
1188-
writel(reg, master->regs + IBI_SIR_REQ_REJECT);
1189+
writel(master->sir_rej_mask, master->regs + IBI_SIR_REQ_REJECT);
11891190

11901191
if (global)
11911192
dw_i3c_master_enable_sir_signal(master, enable);

drivers/i3c/master/dw-i3c-master.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct dw_i3c_master {
3939
char version[5];
4040
char type[5];
4141
bool ibi_capable;
42-
42+
u32 sir_rej_mask;
4343
/*
4444
* Per-device hardware data, used to manage the device address table
4545
* (DAT)

0 commit comments

Comments
 (0)