linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path
       [not found] <1614145010-36079-1-git-send-email-cang@codeaurora.org>
@ 2021-02-24  5:36 ` Can Guo
  2021-02-28 14:23   ` Avri Altman
  0 siblings, 1 reply; 4+ messages in thread
From: Can Guo @ 2021-02-24  5:36 UTC (permalink / raw)
  To: asutoshd, nguyenb, hongwus, linux-scsi, kernel-team, cang
  Cc: Nitin Rawat, Andy Gross, Bjorn Andersson, Alim Akhtar,
	Avri Altman, James E.J. Bottomley, Martin K. Petersen,
	open list:ARM/QUALCOMM SUPPORT, open list

From: Nitin Rawat <nitirawa@codeaurora.org>

Disable interrupt in reset path to flush pending IRQ handler in order to
avoid possible NoC issues.

Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
Signed-off-by: Can Guo <cang@codeaurora.org>
---
 drivers/scsi/ufs/ufs-qcom.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index f97d7b0..a9dc8d7 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
 {
 	int ret = 0;
 	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
+	bool reenable_intr = false;
 
 	if (!host->core_reset) {
 		dev_warn(hba->dev, "%s: reset control not set\n", __func__);
 		goto out;
 	}
 
+	reenable_intr = hba->is_irq_enabled;
+	disable_irq(hba->irq);
+	hba->is_irq_enabled = false;
+
 	ret = reset_control_assert(host->core_reset);
 	if (ret) {
 		dev_err(hba->dev, "%s: core_reset assert failed, err = %d\n",
@@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
 
 	usleep_range(1000, 1100);
 
+	if (reenable_intr) {
+		enable_irq(hba->irq);
+		hba->is_irq_enabled = true;
+	}
+
 out:
 	return ret;
 }
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path
  2021-02-24  5:36 ` [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path Can Guo
@ 2021-02-28 14:23   ` Avri Altman
  2021-03-03  4:07     ` Can Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Avri Altman @ 2021-02-28 14:23 UTC (permalink / raw)
  To: Can Guo, asutoshd, nguyenb, hongwus, linux-scsi, kernel-team
  Cc: Nitin Rawat, Andy Gross, Bjorn Andersson, Alim Akhtar,
	James E.J. Bottomley, Martin K. Petersen,
	open list:ARM/QUALCOMM SUPPORT, open list

> 
> From: Nitin Rawat <nitirawa@codeaurora.org>
> 
> Disable interrupt in reset path to flush pending IRQ handler in order to
> avoid possible NoC issues.
> 
> Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
> Signed-off-by: Can Guo <cang@codeaurora.org>
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index f97d7b0..a9dc8d7 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
>  {
>         int ret = 0;
>         struct ufs_qcom_host *host = ufshcd_get_variant(hba);
> +       bool reenable_intr = false;
> 
>         if (!host->core_reset) {
>                 dev_warn(hba->dev, "%s: reset control not set\n", __func__);
>                 goto out;
>         }
> 
> +       reenable_intr = hba->is_irq_enabled;
> +       disable_irq(hba->irq);
> +       hba->is_irq_enabled = false;
> +
>         ret = reset_control_assert(host->core_reset);
>         if (ret) {
>                 dev_err(hba->dev, "%s: core_reset assert failed, err = %d\n",
> @@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
> 
>         usleep_range(1000, 1100);
> 
> +       if (reenable_intr) {
> +               enable_irq(hba->irq);
> +               hba->is_irq_enabled = true;
> +       }
> +
If in the future, you will enable UFSHCI_QUIRK_BROKEN_HCE on your platform (currently only for Exynos),
Will this code still work?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path
  2021-02-28 14:23   ` Avri Altman
@ 2021-03-03  4:07     ` Can Guo
  2021-03-03  7:18       ` Avri Altman
  0 siblings, 1 reply; 4+ messages in thread
From: Can Guo @ 2021-03-03  4:07 UTC (permalink / raw)
  To: Avri Altman
  Cc: asutoshd, nguyenb, hongwus, linux-scsi, kernel-team, Nitin Rawat,
	Andy Gross, Bjorn Andersson, Alim Akhtar, James E.J. Bottomley,
	Martin K. Petersen, open list:ARM/QUALCOMM SUPPORT, open list

On 2021-02-28 22:23, Avri Altman wrote:
>> 
>> From: Nitin Rawat <nitirawa@codeaurora.org>
>> 
>> Disable interrupt in reset path to flush pending IRQ handler in order 
>> to
>> avoid possible NoC issues.
>> 
>> Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
>> Signed-off-by: Can Guo <cang@codeaurora.org>
>> ---
>>  drivers/scsi/ufs/ufs-qcom.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>> 
>> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
>> index f97d7b0..a9dc8d7 100644
>> --- a/drivers/scsi/ufs/ufs-qcom.c
>> +++ b/drivers/scsi/ufs/ufs-qcom.c
>> @@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba 
>> *hba)
>>  {
>>         int ret = 0;
>>         struct ufs_qcom_host *host = ufshcd_get_variant(hba);
>> +       bool reenable_intr = false;
>> 
>>         if (!host->core_reset) {
>>                 dev_warn(hba->dev, "%s: reset control not set\n", 
>> __func__);
>>                 goto out;
>>         }
>> 
>> +       reenable_intr = hba->is_irq_enabled;
>> +       disable_irq(hba->irq);
>> +       hba->is_irq_enabled = false;
>> +
>>         ret = reset_control_assert(host->core_reset);
>>         if (ret) {
>>                 dev_err(hba->dev, "%s: core_reset assert failed, err = 
>> %d\n",
>> @@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba 
>> *hba)
>> 
>>         usleep_range(1000, 1100);
>> 
>> +       if (reenable_intr) {
>> +               enable_irq(hba->irq);
>> +               hba->is_irq_enabled = true;
>> +       }
>> +
> If in the future, you will enable UFSHCI_QUIRK_BROKEN_HCE on your
> platform (currently only for Exynos),
> Will this code still work?

Yes, it still works.

Thanks,
Can Guo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path
  2021-03-03  4:07     ` Can Guo
@ 2021-03-03  7:18       ` Avri Altman
  0 siblings, 0 replies; 4+ messages in thread
From: Avri Altman @ 2021-03-03  7:18 UTC (permalink / raw)
  To: Can Guo
  Cc: asutoshd, nguyenb, hongwus, linux-scsi, kernel-team, Nitin Rawat,
	Andy Gross, Bjorn Andersson, Alim Akhtar, James E.J. Bottomley,
	Martin K. Petersen, open list:ARM/QUALCOMM SUPPORT, open list

> 
> On 2021-02-28 22:23, Avri Altman wrote:
> >>
> >> From: Nitin Rawat <nitirawa@codeaurora.org>
> >>
> >> Disable interrupt in reset path to flush pending IRQ handler in order
> >> to
> >> avoid possible NoC issues.
> >>
> >> Signed-off-by: Nitin Rawat <nitirawa@codeaurora.org>
> >> Signed-off-by: Can Guo <cang@codeaurora.org>
Reviewed-by: Avri Altman <avri.altman@wdc.com>


> >> ---
> >>  drivers/scsi/ufs/ufs-qcom.c | 10 ++++++++++
> >>  1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> >> index f97d7b0..a9dc8d7 100644
> >> --- a/drivers/scsi/ufs/ufs-qcom.c
> >> +++ b/drivers/scsi/ufs/ufs-qcom.c
> >> @@ -253,12 +253,17 @@ static int ufs_qcom_host_reset(struct ufs_hba
> >> *hba)
> >>  {
> >>         int ret = 0;
> >>         struct ufs_qcom_host *host = ufshcd_get_variant(hba);
> >> +       bool reenable_intr = false;
> >>
> >>         if (!host->core_reset) {
> >>                 dev_warn(hba->dev, "%s: reset control not set\n",
> >> __func__);
> >>                 goto out;
> >>         }
> >>
> >> +       reenable_intr = hba->is_irq_enabled;
> >> +       disable_irq(hba->irq);
> >> +       hba->is_irq_enabled = false;
> >> +
> >>         ret = reset_control_assert(host->core_reset);
> >>         if (ret) {
> >>                 dev_err(hba->dev, "%s: core_reset assert failed, err =
> >> %d\n",
> >> @@ -280,6 +285,11 @@ static int ufs_qcom_host_reset(struct ufs_hba
> >> *hba)
> >>
> >>         usleep_range(1000, 1100);
> >>
> >> +       if (reenable_intr) {
> >> +               enable_irq(hba->irq);
> >> +               hba->is_irq_enabled = true;
> >> +       }
> >> +
> > If in the future, you will enable UFSHCI_QUIRK_BROKEN_HCE on your
> > platform (currently only for Exynos),
> > Will this code still work?
> 
> Yes, it still works.
> 
> Thanks,
> Can Guo.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-03 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1614145010-36079-1-git-send-email-cang@codeaurora.org>
2021-02-24  5:36 ` [PATCH v2 2/3] scsi: ufs-qcom: Disable interrupt in reset path Can Guo
2021-02-28 14:23   ` Avri Altman
2021-03-03  4:07     ` Can Guo
2021-03-03  7:18       ` Avri Altman

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).