2024-01-19 05:47:12

by Dylan Hung

[permalink] [raw]
Subject: [PATCH] i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling

Disable IBI IRQ signal and status only when hot-join and SIR enabling of
all target devices attached to the bus are disabled.

Fixes: e389b1d72a62 ("i3c: dw: Add support for in-band interrupts")

Signed-off-by: Dylan Hung <[email protected]>
---
drivers/i3c/master/dw-i3c-master.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
index ef5751e91cc9..276153e10f5a 100644
--- a/drivers/i3c/master/dw-i3c-master.c
+++ b/drivers/i3c/master/dw-i3c-master.c
@@ -1163,8 +1163,10 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master,
global = reg == 0xffffffff;
reg &= ~BIT(idx);
} else {
- global = reg == 0;
+ bool hj_rejected = !!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK);
+
reg |= BIT(idx);
+ global = (reg == 0xffffffff) && hj_rejected;
}
writel(reg, master->regs + IBI_SIR_REQ_REJECT);

--
2.25.1



2024-02-18 23:33:22

by Alexandre Belloni

[permalink] [raw]
Subject: Re: [PATCH] i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling

On Fri, 19 Jan 2024 13:45:47 +0800, Dylan Hung wrote:
> Disable IBI IRQ signal and status only when hot-join and SIR enabling of
> all target devices attached to the bus are disabled.
>
> Fixes: e389b1d72a62 ("i3c: dw: Add support for in-band interrupts")
>
>

Applied, thanks!

[1/1] i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling
https://git.kernel.org/abelloni/c/10201396ef64

Best regards,

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2024-02-19 20:39:00

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] i3c: dw: Disable IBI IRQ depends on hot-join and SIR enabling

Fri, Jan 19, 2024 at 01:45:47PM +0800, Dylan Hung kirjoitti:
> Disable IBI IRQ signal and status only when hot-join and SIR enabling of
> all target devices attached to the bus are disabled.

> Fixes: e389b1d72a62 ("i3c: dw: Add support for in-band interrupts")
>
> Signed-off-by: Dylan Hung <[email protected]>

Tag block is not supposed to have blank lines.

..

> @@ -1163,8 +1163,10 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master,
> global = reg == 0xffffffff;
> reg &= ~BIT(idx);
> } else {
> - global = reg == 0;
> + bool hj_rejected = !!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK);

'!!()' is redundant.

> +
> reg |= BIT(idx);
> + global = (reg == 0xffffffff) && hj_rejected;
> }

Moreover, you can refactor a bit both branches, like

bool hj_rejected = true;
...
if (...) {
...
} else {
hj_rejected = readl(master->regs + DEVICE_CTRL) & DEV_CTRL_HOT_JOIN_NACK;
...
}
global = (reg == 0xffffffff) && hj_rejected;


--
With Best Regards,
Andy Shevchenko