Skip to content

Commit f3a3553

Browse files
jk-ozlabsalexandrebelloni
authored andcommitted
i3c: dw: Add a platform facility for IBI PEC workarounds
On the AST2600 i3c controller, we'll need to apply a workaround for a hardware issue with IBI payloads. Introduce a platform hook to allow dw i3c platform implementations to modify the DAT entry in IBI enable/disable to allow this workaround in a future change. Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Reviewed-by: Joel Stanley <joel@jms.id.au> Link: https://lore.kernel.org/r/d5d76a8d2336d2a71886537f42e71d51db184df6.1680161823.git.jk@codeconstruct.com.au Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent e389b1d commit f3a3553

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,7 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master,
11551155
} else {
11561156
reg |= DEV_ADDR_TABLE_SIR_REJECT;
11571157
}
1158+
master->platform_ops->set_dat_ibi(master, dev, enable, &reg);
11581159
writel(reg, master->regs + dat_entry);
11591160

11601161
reg = readl(master->regs + IBI_SIR_REQ_REJECT);
@@ -1247,6 +1248,17 @@ static void dw_i3c_master_handle_ibi_sir(struct dw_i3c_master *master,
12471248
addr = IBI_QUEUE_IBI_ADDR(status);
12481249
len = IBI_QUEUE_STATUS_DATA_LEN(status);
12491250

1251+
/*
1252+
* We be tempted to check the error status in bit 30; however, due
1253+
* to the PEC errata workaround on some platform implementations (see
1254+
* ast2600_i3c_set_dat_ibi()), those will almost always have a PEC
1255+
* error on IBI payload data, as well as losing the last byte of
1256+
* payload.
1257+
*
1258+
* If we implement error status checking on that bit, we may need
1259+
* a new platform op to validate it.
1260+
*/
1261+
12501262
spin_lock_irqsave(&master->devs_lock, flags);
12511263
idx = dw_i3c_master_get_addr_pos(master, addr);
12521264
if (idx < 0) {
@@ -1387,8 +1399,15 @@ static int dw_i3c_platform_init_nop(struct dw_i3c_master *i3c)
13871399
return 0;
13881400
}
13891401

1402+
static void dw_i3c_platform_set_dat_ibi_nop(struct dw_i3c_master *i3c,
1403+
struct i3c_dev_desc *dev,
1404+
bool enable, u32 *dat)
1405+
{
1406+
}
1407+
13901408
static const struct dw_i3c_platform_ops dw_i3c_platform_ops_default = {
13911409
.init = dw_i3c_platform_init_nop,
1410+
.set_dat_ibi = dw_i3c_platform_set_dat_ibi_nop,
13921411
};
13931412

13941413
int dw_i3c_common_probe(struct dw_i3c_master *master,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ struct dw_i3c_platform_ops {
6666
* perform actual device enabling with the i3c core ready.
6767
*/
6868
int (*init)(struct dw_i3c_master *i3c);
69+
70+
/*
71+
* Initialise a DAT entry to enable/disable IBIs. Allows the platform
72+
* to perform any device workarounds on the DAT entry before
73+
* inserting into the hardware table.
74+
*
75+
* Called with the DAT lock held; must not sleep.
76+
*/
77+
void (*set_dat_ibi)(struct dw_i3c_master *i3c,
78+
struct i3c_dev_desc *dev, bool enable, u32 *reg);
6979
};
7080

7181
extern int dw_i3c_common_probe(struct dw_i3c_master *master,

0 commit comments

Comments
 (0)