* [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset
@ 2016-09-08 23:22 Kiwoong Kim
2016-09-21 20:34 ` Martin K. Petersen
2016-09-27 22:38 ` subhashj
0 siblings, 2 replies; 3+ messages in thread
From: Kiwoong Kim @ 2016-09-08 23:22 UTC (permalink / raw)
To: vinholikatti, linux-scsi
Cc: Martin K. Petersen, James E.J. Bottomley,
추헌광
From: Kiwoong Kim <kwmad.kim@samsung.com>
When any UFS host controller receives a TM(Task Management)
response from a UFS device,
UFS driver has been recognize like receiving a message of
"Task Management Function Complete"(00h) in all cases, so far.
That means there is no pending task for a tag of the TM request
sent before in the UFS device.
That's because the byte offset 6 in TM response which has been used
to get a TM service response so far
represents just whether or not a TM transmission passes.
Regarding UFS spec, the correct byte offset to
get TM service response is 15, not 6.
I tested that UFS driver responds properly for the TM response
>From a UFS device with an reference board with exynos8890, as follow:
No pending task -> Task Management Function Complete (00h)
Pending task -> Task Management Function Succeeded (08h)
Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
Signed-off-by: HeonGwang Chu <hg.chu@samsung.com>
Tested-by: : Kiwoong Kim <kwmad.kim@samsung.com>
---
drivers/scsi/ufs/ufs.h | 1 +
drivers/scsi/ufs/ufshcd.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
index 42c459a..89c121e 100644
--- a/drivers/scsi/ufs/ufs.h
+++ b/drivers/scsi/ufs/ufs.h
@@ -295,6 +295,7 @@ enum {
MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
MASK_RSP_EXCEPTION_EVENT = 0x10000,
+ MASK_TM_SERVICE_RESP = 0xFF,
};
/* Task management service response */
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e8a706b..c641cd3 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -3013,8 +3013,8 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index, u8 *resp)
if (ocs_value == OCS_SUCCESS) {
task_rsp_upiup = (struct utp_upiu_task_rsp *)
task_req_descp[index].task_rsp_upiu;
- task_result = be32_to_cpu(task_rsp_upiup->header.dword_1);
- task_result = ((task_result & MASK_TASK_RESPONSE) >> 8);
+ task_result = be32_to_cpu(task_rsp_upiup->output_param1);
+ task_result = task_result & MASK_TM_SERVICE_RESP;
if (resp)
*resp = (u8)task_result;
} else {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset
2016-09-08 23:22 [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset Kiwoong Kim
@ 2016-09-21 20:34 ` Martin K. Petersen
2016-09-27 22:38 ` subhashj
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2016-09-21 20:34 UTC (permalink / raw)
To: Kiwoong Kim
Cc: vinholikatti, linux-scsi, Martin K. Petersen,
James E.J. Bottomley, 추헌광
>>>>> "Kiwoong" == Kiwoong Kim <kwmad.kim@samsung.com> writes:
Kiwoong,
Kiwoong> When any UFS host controller receives a TM(Task Management)
Kiwoong> response from a UFS device, UFS driver has been recognize like
Kiwoong> receiving a message of "Task Management Function Complete"(00h)
Kiwoong> in all cases, so far. That means there is no pending task for
Kiwoong> a tag of the TM request sent before in the UFS device. That's
Kiwoong> because the byte offset 6 in TM response which has been used to
Kiwoong> get a TM service response so far represents just whether or not
Kiwoong> a TM transmission passes.
Kiwoong> Regarding UFS spec, the correct byte offset to get TM service
Kiwoong> response is 15, not 6.
Kiwoong> I tested that UFS driver responds properly for the TM response
Kiwoong> From a UFS device with an reference board with exynos8890, as
Kiwoong> follow: No pending task -> Task Management Function Complete
Kiwoong> (00h) Pending task -> Task Management Function Succeeded (08h)
Went through the hoops to verify this in the spec since nobody stepped
up to review. In the future please make sure to submit patches against
my scsi for-next git repo. I had to apply the patch by hand.
Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset
2016-09-08 23:22 [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset Kiwoong Kim
2016-09-21 20:34 ` Martin K. Petersen
@ 2016-09-27 22:38 ` subhashj
1 sibling, 0 replies; 3+ messages in thread
From: subhashj @ 2016-09-27 22:38 UTC (permalink / raw)
To: Kiwoong Kim
Cc: vinholikatti, linux-scsi, Martin K. Petersen,
James E.J. Bottomley, 추헌광, linux-scsi-owner
Hi Kiwoong Kim,
This is a good catch, Looks good to me.
Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org>
Thanks,
Subhash
On 2016-09-08 16:22, Kiwoong Kim wrote:
> From: Kiwoong Kim <kwmad.kim@samsung.com>
>
> When any UFS host controller receives a TM(Task Management)
> response from a UFS device,
> UFS driver has been recognize like receiving a message of
> "Task Management Function Complete"(00h) in all cases, so far.
> That means there is no pending task for a tag of the TM request
> sent before in the UFS device.
> That's because the byte offset 6 in TM response which has been used
> to get a TM service response so far
> represents just whether or not a TM transmission passes.
>
> Regarding UFS spec, the correct byte offset to
> get TM service response is 15, not 6.
>
> I tested that UFS driver responds properly for the TM response
> From a UFS device with an reference board with exynos8890, as follow:
> No pending task -> Task Management Function Complete (00h)
> Pending task -> Task Management Function Succeeded (08h)
>
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> Signed-off-by: HeonGwang Chu <hg.chu@samsung.com>
> Tested-by: : Kiwoong Kim <kwmad.kim@samsung.com>
> ---
> drivers/scsi/ufs/ufs.h | 1 +
> drivers/scsi/ufs/ufshcd.c | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 42c459a..89c121e 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -295,6 +295,7 @@ enum {
> MASK_QUERY_DATA_SEG_LEN = 0xFFFF,
> MASK_RSP_UPIU_DATA_SEG_LEN = 0xFFFF,
> MASK_RSP_EXCEPTION_EVENT = 0x10000,
> + MASK_TM_SERVICE_RESP = 0xFF,
> };
>
> /* Task management service response */
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e8a706b..c641cd3 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3013,8 +3013,8 @@ static int ufshcd_task_req_compl(struct ufs_hba
> *hba, u32 index, u8 *resp)
> if (ocs_value == OCS_SUCCESS) {
> task_rsp_upiup = (struct utp_upiu_task_rsp *)
> task_req_descp[index].task_rsp_upiu;
> - task_result =
> be32_to_cpu(task_rsp_upiup->header.dword_1);
> - task_result = ((task_result & MASK_TASK_RESPONSE) >>
> 8);
> + task_result =
> be32_to_cpu(task_rsp_upiup->output_param1);
> + task_result = task_result & MASK_TM_SERVICE_RESP;
> if (resp)
> *resp = (u8)task_result;
> } else {
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-27 22:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-08 23:22 [PATCH][SCSI] scsi: ufs: get a TM service response from the correct offset Kiwoong Kim
2016-09-21 20:34 ` Martin K. Petersen
2016-09-27 22:38 ` subhashj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).