summaryrefslogtreecommitdiff
path: root/drivers/i3c/master/dw-i3c-master.h
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2023-03-30 15:50:34 +0800
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2023-04-28 08:20:07 +0200
commite389b1d72a6241b326071dd75e1b33f9e8818cd1 (patch)
treeb45acb77078b5337028c7131fbf04d4eecdc4358 /drivers/i3c/master/dw-i3c-master.h
parente2d43101f61d6e79510d1cd9e7052b4745b8d809 (diff)
i3c: dw: Add support for in-band interrupts
This change adds support for receiving and dequeueing i3c IBIs. By setting struct dw_i3c_master->ibi_capable before probe, a platform implementation can select the IBI-enabled version of the i3c_master_ops, enabling the global IBI infrastrcture for that controller. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/79daeefd7ccb7c935d0c159149df21a6c9a73ffa.1680161823.git.jk@codeconstruct.com.au Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/i3c/master/dw-i3c-master.h')
-rw-r--r--drivers/i3c/master/dw-i3c-master.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/i3c/master/dw-i3c-master.h b/drivers/i3c/master/dw-i3c-master.h
index 5fb620727639..a5425fa6b7d4 100644
--- a/drivers/i3c/master/dw-i3c-master.h
+++ b/drivers/i3c/master/dw-i3c-master.h
@@ -19,6 +19,7 @@ struct dw_i3c_master_caps {
struct dw_i3c_dat_entry {
u8 addr;
+ struct i3c_dev_desc *ibi_dev;
};
struct dw_i3c_master {
@@ -37,12 +38,22 @@ struct dw_i3c_master {
struct clk *core_clk;
char version[5];
char type[5];
+ bool ibi_capable;
/*
* Per-device hardware data, used to manage the device address table
* (DAT)
+ *
+ * Locking: the devs array may be referenced in IRQ context while
+ * processing an IBI. However, IBIs (for a specific device, which
+ * implies a specific DAT entry) can only happen while interrupts are
+ * requested for that device, which is serialised against other
+ * insertions/removals from the array by the global i3c infrastructure.
+ * So, devs_lock protects against concurrent updates to devs->ibi_dev
+ * between request_ibi/free_ibi and the IBI irq event.
*/
struct dw_i3c_dat_entry devs[DW_I3C_MAX_DEVS];
+ spinlock_t devs_lock;
/* platform-specific data */
const struct dw_i3c_platform_ops *platform_ops;