]> Git Repo - linux.git/commitdiff
i3c: master: svc: add NACK check after start byte sent
authorClark Wang <[email protected]>
Wed, 17 May 2023 03:30:30 +0000 (11:30 +0800)
committerAlexandre Belloni <[email protected]>
Sun, 4 Jun 2023 22:50:51 +0000 (00:50 +0200)
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 <[email protected]>
Reviewed-by: Miquel Raynal <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexandre Belloni <[email protected]>
drivers/i3c/master/svc-i3c-master.c

index 4edf33ed207d031e682e61230fa19b4a9a5bb2d1..0d63b732ef0c82d076164c15ff455bd8e0fdeb54 100644 (file)
@@ -92,6 +92,7 @@
 #define SVC_I3C_MINTCLR      0x094
 #define SVC_I3C_MINTMASKED   0x098
 #define SVC_I3C_MERRWARN     0x09C
+#define   SVC_I3C_MERRWARN_NACK BIT(2)
 #define SVC_I3C_MDMACTRL     0x0A0
 #define SVC_I3C_MDATACTRL    0x0AC
 #define   SVC_I3C_MDATACTRL_FLUSHTB BIT(0)
@@ -1014,6 +1015,11 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
        if (ret)
                goto emit_stop;
 
+       if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) {
+               ret = -ENXIO;
+               goto emit_stop;
+       }
+
        if (rnw)
                ret = svc_i3c_master_read(master, in, xfer_len);
        else
This page took 0.057063 seconds and 4 git commands to generate.