Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i3c: dw: use bus mode rather than device reg for conditional tCAS setting

In the clock setup path, we set the hardware DEV_CTRL_I2C_SLAVE_PRESENT
bit on a shared mode bus, then read-back this bit for the conditional
tCAS set.

Instead, just use the bus->mode setting for the conditional test.

While we're at it, add a little comment about why the conditional is
there.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/92a933566f7846708a00ad7f5a16ee8e6ed32d0e.1680156630.git.jk@codeconstruct.com.au
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Jeremy Kerr and committed by
Alexandre Belloni
66b32e3d 67df5ce9

+5 -1
+5 -1
drivers/i3c/master/dw-i3c-master.c
··· 538 538 scl_timing = SCL_I3C_TIMING_HCNT(hcnt) | SCL_I3C_TIMING_LCNT(lcnt); 539 539 writel(scl_timing, master->regs + SCL_I3C_PP_TIMING); 540 540 541 - if (!(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_I2C_SLAVE_PRESENT)) 541 + /* 542 + * In pure i3c mode, MST_FREE represents tCAS. In shared mode, this 543 + * will be set up by dw_i2c_clk_cfg as tLOW. 544 + */ 545 + if (master->base.bus.mode == I3C_BUS_MODE_PURE) 542 546 writel(BUS_I3C_MST_FREE(lcnt), master->regs + BUS_FREE_TIMING); 543 547 544 548 lcnt = max_t(u8,