From: Faiz Abbas <faiz_abbas@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 03/11] scsi: Retry inquiry 3 times to overcome Unit Attention condition
Date: Tue, 15 Oct 2019 18:24:34 +0530 [thread overview]
Message-ID: <20191015125442.1786-4-faiz_abbas@ti.com> (raw)
In-Reply-To: <20191015125442.1786-1-faiz_abbas@ti.com>
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>
---
drivers/scsi/scsi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 0bce22a51a..1256e22a52 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -479,6 +479,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
lbaint_t capacity;
unsigned long blksz;
struct scsi_cmd *pccb = (struct scsi_cmd *)&tempccb;
+ int count, err;
pccb->target = target;
pccb->lun = lun;
@@ -514,9 +515,14 @@ static int scsi_detect_dev(struct udevice *dev, int target, int 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;
--
2.19.2
next prev parent reply other threads:[~2019-10-15 12:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 12:54 [U-Boot] [PATCH v2 00/11] Add Support for UFS subsystem for TI's J721e Faiz Abbas
2019-10-15 12:54 ` [U-Boot] [PATCH v2 01/11] scsi: Simplify scsi_read()/_write() Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 02/11] scsi: Add max_bytes_per_req to scsi_platdata Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` Faiz Abbas [this message]
2019-10-24 18:52 ` [U-Boot] [PATCH v2 03/11] scsi: Retry inquiry 3 times to overcome Unit Attention condition Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 04/11] scsi: Add dma direction member to command structure Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 05/11] ufs: Add Initial Support for UFS subsystem Faiz Abbas
2019-10-23 14:20 ` Bin Meng
2019-10-24 14:45 ` Tom Rini
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 06/11] ufs: Add Support for Cadence platform UFS driver Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 07/11] ufs: Add glue layer driver for TI J721E devices Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 08/11] arm: dts: k3-j721e-main: Add UFS nodes Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 09/11] cmd: Add Support for UFS commands Faiz Abbas
2019-10-24 18:52 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 10/11] env: ti: Add environment variables to boot from UFS Faiz Abbas
2019-10-24 18:53 ` Tom Rini
2019-10-15 12:54 ` [U-Boot] [PATCH v2 11/11] configs: j721e_evm_a72: Enable configs for UFS Faiz Abbas
2019-10-24 18:53 ` Tom Rini
2019-10-23 14:17 ` [U-Boot] [PATCH v2 00/11] Add Support for UFS subsystem for TI's J721e Faiz Abbas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191015125442.1786-4-faiz_abbas@ti.com \
--to=faiz_abbas@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox