The UFS SCSI device LUNs are observed to return failure the first time a
unit ready inquiry is sent and pass on the second try. Send this
inquiry 3 times to make sure device is ready.
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
lbaint_t capacity;
unsigned long blksz;
struct scsi_cmd *pccb = (struct scsi_cmd *)&tempccb;
+ int count, err;
pccb->target = target;
pccb->lun = lun;
dev_desc->target = pccb->target;
dev_desc->lun = pccb->lun;
- pccb->datalen = 0;
- scsi_setup_test_unit_ready(pccb);
- if (scsi_exec(dev, pccb)) {
+ for (count = 0; count < 3; count++) {
+ pccb->datalen = 0;
+ scsi_setup_test_unit_ready(pccb);
+ err = scsi_exec(dev, pccb);
+ if (!err)
+ break;
+ }
+ if (err) {
if (dev_desc->removable) {
dev_desc->type = perq;
goto removable;