* [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
@ 2021-05-12 10:01 peter.wang
2021-05-12 10:01 ` [PATCH] " peter.wang
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: peter.wang @ 2021-05-12 10:01 UTC (permalink / raw)
To: stanley.chu, linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, peter.wang, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao
From: Peter Wang <peter.wang@mediatek.com>
As per specs, e.g, JESD220E chapter 7.2, while powering off
the ufs device, RST_N signal should be between VSS(Ground)
and VCCQ/VCCQ2. The power down sequence after fixing as below:
Power down:
1. Assert RST_N low
2. Turn-off VCC
3. Turn-off VCCQ/VCCQ2
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index c55202b..47b4066 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
int err;
+ struct arm_smccc_res res;
if (ufshcd_is_link_hibern8(hba)) {
err = ufs_mtk_link_set_lpm(hba);
@@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
goto fail;
}
+ if (ufshcd_is_link_off(hba))
+ ufs_mtk_device_reset_ctrl(0, res);
+
return 0;
fail:
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-12 10:01 [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation peter.wang
@ 2021-05-12 10:01 ` peter.wang
2021-05-12 10:11 ` [PATCH v4] " Stanley Chu
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: peter.wang @ 2021-05-12 10:01 UTC (permalink / raw)
To: stanley.chu, linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb
Cc: wsd_upstream, peter.wang, chun-hung.wu, alice.chao, cc.chou,
chaotian.jing, jiajie.hao
From: Peter Wang <peter.wang@mediatek.com>
As per specs, e.g, JESD220E chapter 7.2, while powering off
the ufs device, RST_N signal should be between VSS(Ground)
and VCCQ/VCCQ2. The power down sequence after fixing as below:
Power down:
1. Assert RST_N low
2. Turn-off VCC
3. Turn-off VCCQ/VCCQ2
Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
drivers/scsi/ufs/ufs-mediatek.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index c55202b..47b4066 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
{
int err;
+ struct arm_smccc_res res;
if (ufshcd_is_link_hibern8(hba)) {
err = ufs_mtk_link_set_lpm(hba);
@@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
goto fail;
}
+ if (ufshcd_is_link_off(hba))
+ ufs_mtk_device_reset_ctrl(0, res);
+
return 0;
fail:
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-12 10:01 [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation peter.wang
2021-05-12 10:01 ` [PATCH] " peter.wang
@ 2021-05-12 10:11 ` Stanley Chu
2021-05-13 6:45 ` Avri Altman
2021-05-15 3:13 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Stanley Chu @ 2021-05-12 10:11 UTC (permalink / raw)
To: peter.wang
Cc: linux-scsi, martin.petersen, avri.altman, alim.akhtar, jejb,
wsd_upstream, chun-hung.wu, alice.chao, cc.chou, chaotian.jing,
jiajie.hao
Hi Peter,
On Wed, 2021-05-12 at 18:01 +0800, peter.wang@mediatek.com wrote:
> From: Peter Wang <peter.wang@mediatek.com>
>
> As per specs, e.g, JESD220E chapter 7.2, while powering off
> the ufs device, RST_N signal should be between VSS(Ground)
> and VCCQ/VCCQ2. The power down sequence after fixing as below:
>
> Power down:
> 1. Assert RST_N low
> 2. Turn-off VCC
> 3. Turn-off VCCQ/VCCQ2
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> ---
> drivers/scsi/ufs/ufs-mediatek.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> index c55202b..47b4066 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba *hba, bool lpm)
> static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> {
> int err;
> + struct arm_smccc_res res;
>
> if (ufshcd_is_link_hibern8(hba)) {
> err = ufs_mtk_link_set_lpm(hba);
> @@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> goto fail;
> }
>
> + if (ufshcd_is_link_off(hba))
> + ufs_mtk_device_reset_ctrl(0, res);
> +
For the case "linkoff @ suspend", HW reset pin can be de-asserted via
ufshcd_resume() -> ufshcd_reset_and_restore() ->
ufshcd_vops_device_reset(), so this looks good to me.
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-12 10:01 [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation peter.wang
2021-05-12 10:01 ` [PATCH] " peter.wang
2021-05-12 10:11 ` [PATCH v4] " Stanley Chu
@ 2021-05-13 6:45 ` Avri Altman
2021-05-13 7:58 ` Peter Wang
2021-05-15 3:13 ` Martin K. Petersen
3 siblings, 1 reply; 7+ messages in thread
From: Avri Altman @ 2021-05-13 6:45 UTC (permalink / raw)
To: peter.wang, stanley.chu, linux-scsi, martin.petersen, alim.akhtar, jejb
Cc: wsd_upstream, chun-hung.wu, alice.chao, cc.chou, chaotian.jing,
jiajie.hao
> From: Peter Wang <peter.wang@mediatek.com>
>
> As per specs, e.g, JESD220E chapter 7.2, while powering off
> the ufs device, RST_N signal should be between VSS(Ground)
> and VCCQ/VCCQ2. The power down sequence after fixing as below:
>
> Power down:
> 1. Assert RST_N low
> 2. Turn-off VCC
> 3. Turn-off VCCQ/VCCQ2
>
> Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> ---
> drivers/scsi/ufs/ufs-mediatek.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> index c55202b..47b4066 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba
> *hba, bool lpm)
> static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> {
> int err;
> + struct arm_smccc_res res;
>
> if (ufshcd_is_link_hibern8(hba)) {
> err = ufs_mtk_link_set_lpm(hba);
> @@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba,
> enum ufs_pm_op pm_op)
> goto fail;
> }
>
> + if (ufshcd_is_link_off(hba))
> + ufs_mtk_device_reset_ctrl(0, res);
According to your commit log, you should call reset just before
ufs_mtk_vreg_set_lpm, or turn phy off, whichever turn off vcc -
Few lines above.
Thanks,
Avri
> +
> return 0;
> fail:
> /*
> --
> 1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-13 6:45 ` Avri Altman
@ 2021-05-13 7:58 ` Peter Wang
2021-05-13 8:15 ` Avri Altman
0 siblings, 1 reply; 7+ messages in thread
From: Peter Wang @ 2021-05-13 7:58 UTC (permalink / raw)
To: Avri Altman
Cc: stanley.chu, linux-scsi, martin.petersen, alim.akhtar, jejb,
wsd_upstream, chun-hung.wu, alice.chao, cc.chou, chaotian.jing,
jiajie.hao
On Thu, 2021-05-13 at 06:45 +0000, Avri Altman wrote:
> > From: Peter Wang <peter.wang@mediatek.com>
> >
> > As per specs, e.g, JESD220E chapter 7.2, while powering off
> > the ufs device, RST_N signal should be between VSS(Ground)
> > and VCCQ/VCCQ2. The power down sequence after fixing as below:
> >
> > Power down:
> > 1. Assert RST_N low
> > 2. Turn-off VCC
> > 3. Turn-off VCCQ/VCCQ2
> >
> > Signed-off-by: Peter Wang <peter.wang@mediatek.com>
> > ---
> > drivers/scsi/ufs/ufs-mediatek.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> > index c55202b..47b4066 100644
> > --- a/drivers/scsi/ufs/ufs-mediatek.c
> > +++ b/drivers/scsi/ufs/ufs-mediatek.c
> > @@ -922,6 +922,7 @@ static void ufs_mtk_vreg_set_lpm(struct ufs_hba
> > *hba, bool lpm)
> > static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
> > {
> > int err;
> > + struct arm_smccc_res res;
> >
> > if (ufshcd_is_link_hibern8(hba)) {
> > err = ufs_mtk_link_set_lpm(hba);
> > @@ -941,6 +942,9 @@ static int ufs_mtk_suspend(struct ufs_hba *hba,
> > enum ufs_pm_op pm_op)
> > goto fail;
> > }
> >
> > + if (ufshcd_is_link_off(hba))
> > + ufs_mtk_device_reset_ctrl(0, res);
> According to your commit log, you should call reset just before
> ufs_mtk_vreg_set_lpm, or turn phy off, whichever turn off vcc -
> Few lines above.
>
> Thanks,
> Avri
ufs_mtk_vreg_set_lpm only set vccq2 power mode to lpm, dose't trun off
vccq2.And turn phy off is also turn off vcc, dose't turn off vccq2.
RST_N keep high is no problem when we trun off vcc and vccq2 keep on.
But RST_N will got problem if we trun off vccq2.
(RST_N signal should be between VSS(Ground) and VCCQ/VCCQ2)
Here set RST_N to low is after shut down pm set link off, and before
shutdown pm turn off vccq2.
Thanks
Peter
>
> > +
> > return 0;
> > fail:
> > /*
> > --
> > 1.7.9.5
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-13 7:58 ` Peter Wang
@ 2021-05-13 8:15 ` Avri Altman
0 siblings, 0 replies; 7+ messages in thread
From: Avri Altman @ 2021-05-13 8:15 UTC (permalink / raw)
To: Peter Wang
Cc: stanley.chu, linux-scsi, martin.petersen, alim.akhtar, jejb,
wsd_upstream, chun-hung.wu, alice.chao, cc.chou, chaotian.jing,
jiajie.hao
> > > + if (ufshcd_is_link_off(hba))
> > > + ufs_mtk_device_reset_ctrl(0, res);
> > According to your commit log, you should call reset just before
> > ufs_mtk_vreg_set_lpm, or turn phy off, whichever turn off vcc -
> > Few lines above.
> >
> > Thanks,
> > Avri
>
> ufs_mtk_vreg_set_lpm only set vccq2 power mode to lpm, dose't trun off
> vccq2.And turn phy off is also turn off vcc, dose't turn off vccq2.
> RST_N keep high is no problem when we trun off vcc and vccq2 keep on.
> But RST_N will got problem if we trun off vccq2.
> (RST_N signal should be between VSS(Ground) and VCCQ/VCCQ2)
> Here set RST_N to low is after shut down pm set link off, and before
> shutdown pm turn off vccq2.
OK. Thanks for clarifying this.
Thanks,
Avri
>
> Thanks
> Peter
>
> >
> > > +
> > > return 0;
> > > fail:
> > > /*
> > > --
> > > 1.7.9.5
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation
2021-05-12 10:01 [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation peter.wang
` (2 preceding siblings ...)
2021-05-13 6:45 ` Avri Altman
@ 2021-05-15 3:13 ` Martin K. Petersen
3 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2021-05-15 3:13 UTC (permalink / raw)
To: alim.akhtar, stanley.chu, jejb, linux-scsi, peter.wang, avri.altman
Cc: Martin K . Petersen, jiajie.hao, chun-hung.wu, cc.chou,
wsd_upstream, alice.chao, chaotian.jing
On Wed, 12 May 2021 18:01:45 +0800, peter.wang@mediatek.com wrote:
> As per specs, e.g, JESD220E chapter 7.2, while powering off
> the ufs device, RST_N signal should be between VSS(Ground)
> and VCCQ/VCCQ2. The power down sequence after fixing as below:
>
> Power down:
> 1. Assert RST_N low
> 2. Turn-off VCC
> 3. Turn-off VCCQ/VCCQ2
Applied to 5.13/scsi-fixes, thanks!
[1/1] scsi: ufs-mediatek: fix ufs power down specs violation
https://git.kernel.org/mkp/scsi/c/c625b80b9d00
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-15 3:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 10:01 [PATCH v4] scsi: ufs-mediatek: fix ufs power down specs violation peter.wang
2021-05-12 10:01 ` [PATCH] " peter.wang
2021-05-12 10:11 ` [PATCH v4] " Stanley Chu
2021-05-13 6:45 ` Avri Altman
2021-05-13 7:58 ` Peter Wang
2021-05-13 8:15 ` Avri Altman
2021-05-15 3:13 ` Martin K. Petersen
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.