Skip to content

Commit 49b472e

Browse files
wangxiaoningnxpalexandrebelloni
authored andcommitted
i3c: master: svc: add NACK check after start byte sent
Add NACK check after start byte is sent. It is possible to detect early that a device is not on the bus and avoid invalid transmissions thereafter. Signed-off-by: Clark Wang <xiaoning.wang@nxp.com> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20230517033030.3068085-3-xiaoning.wang@nxp.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 33beadb commit 49b472e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/i3c/master/svc-i3c-master.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
#define SVC_I3C_MINTCLR 0x094
9393
#define SVC_I3C_MINTMASKED 0x098
9494
#define SVC_I3C_MERRWARN 0x09C
95+
#define SVC_I3C_MERRWARN_NACK BIT(2)
9596
#define SVC_I3C_MDMACTRL 0x0A0
9697
#define SVC_I3C_MDATACTRL 0x0AC
9798
#define SVC_I3C_MDATACTRL_FLUSHTB BIT(0)
@@ -1014,6 +1015,11 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
10141015
if (ret)
10151016
goto emit_stop;
10161017

1018+
if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) {
1019+
ret = -ENXIO;
1020+
goto emit_stop;
1021+
}
1022+
10171023
if (rnw)
10181024
ret = svc_i3c_master_read(master, in, xfer_len);
10191025
else

0 commit comments

Comments
 (0)