From: Sujit Reddy Thumma <sthumma@codeaurora.org>
To: Santosh Y <santoshsy@gmail.com>
Cc: Vinayak Holikatti <vinholikatti@gmail.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU
Date: Thu, 02 May 2013 17:01:18 +0530 [thread overview]
Message-ID: <51824E86.6010805@codeaurora.org> (raw)
In-Reply-To: <CALMYJDut2=gwVsNxfeEM5mR2K9uJ0nMiV2y=xu3WZEUpfN-z7w@mail.gmail.com>
On 5/2/2013 12:57 PM, Santosh Y wrote:
>> +
>> +/**
>> + * ufshcd_validate_dev_connection() - Check device connection status
>> + * @hba: per-adapter instance
>> + *
>> + * Send NOP OUT UPIU and wait for NOP IN response to check whether the
>> + * device Transport Protocol (UTP) layer is ready after a reset.
>> + * If the UTP layer at the device side is not initialized, it may
>> + * not respond with NOP IN UPIU within timeout of %NOP_OUT_TIMEOUT
>> + * and we retry sending NOP OUT for %NOP_OUT_RETRIES iterations.
>> + */
>> +static int ufshcd_validate_dev_connection(struct ufs_hba *hba)
>> +{
>> + int err;
>> + struct ufshcd_lrb *lrbp;
>> + unsigned long timeout;
>> + unsigned long flags;
>> + struct completion wait;
>> + int retries = NOP_OUT_RETRIES;
>> +
>> +retry:
>> + spin_lock_irqsave(hba->host->host_lock, flags);
>> + lrbp = &hba->lrb[INTERNAL_CMD_TAG];
>> + init_completion(&wait);
>> +
>> + err = ufshcd_compose_nop_out_upiu(hba, lrbp);
>> + if (err)
>> + goto may_retry;
>> +
>> + lrbp->completion = &wait;
>> + ufshcd_send_command(hba, INTERNAL_CMD_TAG);
>> + spin_unlock_irqrestore(hba->host->host_lock, flags);
>> +
>> + timeout = wait_for_completion_timeout(
>> + &wait, msecs_to_jiffies(NOP_OUT_TIMEOUT));
>> +
>> + spin_lock_irqsave(hba->host->host_lock, flags);
>> + if (timeout > 0) {
>> + int ocs;
>> +
>> + ocs = ufshcd_get_tr_ocs(lrbp);
>> + switch (ocs) {
>> + case OCS_SUCCESS:
>> + goto out;
>> + default:
>> + dev_dbg(hba->dev, "%s: OCS error %d\n", __func__, ocs);
>> + err = -EIO;
>> + goto may_retry;
>> + }
>> + } else {
>> + u32 reg;
>> +
>> + err = -ETIMEDOUT;
>> +
>> + /* clear outstanding transaction before retry */
>> + ufshcd_utrl_clear(hba, INTERNAL_CMD_TAG);
>> + __clear_bit(INTERNAL_CMD_TAG, &hba->outstanding_reqs);
>> +
>> + /* poll for max. 1 sec to clear door bell register by h/w */
>> + spin_unlock_irqrestore(hba->host->host_lock, flags);
>> + if (readl_poll_timeout(
>> + hba->mmio_base + REG_UTP_TRANSFER_REQ_DOOR_BELL,
>> + reg, !(reg & INTERNAL_CMD_TAG), 1000, 1000))
>
> Condition is always true here, change it to !(reg & (1 << INTERNAL_CMD_TAG)).
Good catch. I will update.
>
>> + retries = 0;
>> + spin_lock_irqsave(hba->host->host_lock, flags);
>> + goto may_retry;
>> + }
>> +
>
>
>
--
Regards,
Sujit
prev parent reply other threads:[~2013-05-02 11:31 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-24 14:14 [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU Sujit Reddy Thumma
2013-04-24 16:06 ` [PATCH 1/5] scsi: ufs: move the ufshcd_hba_stop to ufshcd.c Seungwon Jeon
2013-04-30 11:17 ` Subhash Jadavani
2013-05-01 7:46 ` merez
2013-05-02 8:11 ` Santosh Y
2013-05-02 13:37 ` Seungwon Jeon
2013-05-02 18:49 ` merez
2013-05-04 8:45 ` [PATCH v2 1/7] " Seungwon Jeon
2013-05-05 11:22 ` merez
2013-05-06 3:05 ` Seungwon Jeon
2013-05-06 5:37 ` [PATCH v3 1/6] scsi: ufs: wrap the i/o access operations Seungwon Jeon
2013-05-06 10:37 ` merez
2013-05-06 19:30 ` Santosh Y
2013-05-07 3:52 ` Seungwon Jeon
2013-05-06 5:37 ` [PATCH v3 2/6] scsi: ufs: amend interrupt configuration Seungwon Jeon
2013-05-06 10:39 ` merez
2013-05-06 5:37 ` [PATCH v3 3/6] scsi: ufs: fix interrupt status clears Seungwon Jeon
2013-05-06 10:49 ` merez
2013-05-06 5:37 ` [PATCH v3 4/6] scsi: ufs: rework link start-up process Seungwon Jeon
2013-05-06 9:47 ` Sujit Reddy Thumma
2013-05-06 10:36 ` merez
2013-05-06 11:21 ` Seungwon Jeon
2013-05-06 18:15 ` merez
2013-05-06 5:37 ` [PATCH v3 5/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-05-06 19:43 ` Santosh Y
2013-05-06 5:39 ` [PATCH v3 6/6] scsi: ufs: add dme control primitives Seungwon Jeon
2013-05-06 19:51 ` Santosh Y
2013-05-07 3:45 ` Seungwon Jeon
2013-05-08 8:41 ` [PATCH v4 1/6] scsi: ufs: wrap the i/o access operations Seungwon Jeon
2013-05-08 11:58 ` merez
2013-05-08 15:18 ` Santosh Y
2013-05-09 1:59 ` Seungwon Jeon
2013-05-09 3:27 ` Santosh Y
2013-05-09 6:39 ` Seungwon Jeon
2013-05-09 6:52 ` Santosh Y
2013-05-09 14:21 ` James Bottomley
2013-05-10 1:52 ` Seungwon Jeon
2013-05-08 8:41 ` [PATCH v4 2/6] scsi: ufs: amend interrupt configuration Seungwon Jeon
2013-05-08 15:19 ` Santosh Y
2013-05-08 8:41 ` [PATCH v4 3/6] scsi: ufs: fix interrupt status clears Seungwon Jeon
2013-05-08 15:19 ` Santosh Y
2013-05-08 8:42 ` [PATCH v4 4/6] scsi: ufs: rework link start-up process Seungwon Jeon
2013-05-08 15:20 ` Santosh Y
2013-05-08 8:42 ` [PATCH v4 5/6] scsi: ufs: add dme configuration primitives Seungwon Jeon
2013-05-09 6:53 ` Santosh Y
2013-05-08 8:43 ` [PATCH v4 6/6] scsi: ufs: add dme control primitives Seungwon Jeon
2013-05-09 6:53 ` Santosh Y
2013-05-10 10:42 ` [PATCH] scsi: ufs: use devres functions for ufshcd Seungwon Jeon
2013-05-10 11:00 ` Seungwon Jeon
2013-05-10 11:05 ` [PATCH resend] " Seungwon Jeon
2013-05-02 7:27 ` [PATCH 1/1] scsi: ufs: Add support for sending NOP OUT UPIU Santosh Y
2013-05-02 11:31 ` Sujit Reddy Thumma [this message]
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=51824E86.6010805@codeaurora.org \
--to=sthumma@codeaurora.org \
--cc=JBottomley@parallels.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=santoshsy@gmail.com \
--cc=vinholikatti@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.