i3c: Add fallback method for GETMXDS CCC
[linux-2.6-microblaze.git] / drivers / i3c / master.c
index 95caa16..718b643 100644 (file)
@@ -1130,8 +1130,16 @@ static int i3c_master_getmxds_locked(struct i3c_master_controller *master,
 
        i3c_ccc_cmd_init(&cmd, true, I3C_CCC_GETMXDS, &dest, 1);
        ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
-       if (ret)
-               goto out;
+       if (ret) {
+               /*
+                * Retry when the device does not support max read turnaround
+                * while expecting shorter length from this CCC command.
+                */
+               dest->payload.len -= 3;
+               ret = i3c_master_send_ccc_cmd_locked(master, &cmd);
+               if (ret)
+                       goto out;
+       }
 
        if (dest.payload.len != 2 && dest.payload.len != 5) {
                ret = -EIO;