diff mbox series

[v2,1/3] scsi: ufs: Do not overwrite Auto-Hibernate timer

Message ID 1557912988-26758-2-git-send-email-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs: Add error handling of Auto-Hibernate | expand

Commit Message

Stanley Chu May 15, 2019, 9:36 a.m. UTC
Some vendor-specific initialization flow may set its own
auto-hibernate timer. In this case, do not overwrite timer value
as "default value" in ufshcd_init().

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alim Akhtar May 20, 2019, 5:05 a.m. UTC | #1
Hello Stanley,

On 5/15/19 3:06 PM, Stanley Chu wrote:
> Some vendor-specific initialization flow may set its own
> auto-hibernate timer. In this case, do not overwrite timer value
> as "default value" in ufshcd_init().
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> ---
>   drivers/scsi/ufs/ufshcd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e040f9dd9ff3..1665820c22fd 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8309,7 +8309,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
>   						UIC_LINK_HIBERN8_STATE);
>   
>   	/* Set the default auto-hiberate idle timer value to 150 ms */
> -	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
> +	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT & !hba->ahit) {
>   		hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 150) |
>   			    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
>   	}
> 
Looks good to me,
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Avri Altman May 20, 2019, 5:47 a.m. UTC | #2
> 
> Hello Stanley,
> 
> On 5/15/19 3:06 PM, Stanley Chu wrote:
> > Some vendor-specific initialization flow may set its own
> > auto-hibernate timer. In this case, do not overwrite timer value
> > as "default value" in ufshcd_init().
> >
> > Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> > ---
> >   drivers/scsi/ufs/ufshcd.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > index e040f9dd9ff3..1665820c22fd 100644
> > --- a/drivers/scsi/ufs/ufshcd.c
> > +++ b/drivers/scsi/ufs/ufshcd.c
> > @@ -8309,7 +8309,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem
> *mmio_base, unsigned int irq)
> >   						UIC_LINK_HIBERN8_STATE);
> >
> >   	/* Set the default auto-hiberate idle timer value to 150 ms */
> > -	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
> > +	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT & !hba->ahit) {
A typo?


> >   		hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK,
> 150) |
> >   			    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
> >   	}
> >
> Looks good to me,
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Stanley Chu May 20, 2019, 5:50 a.m. UTC | #3
Hi Avri,

On Mon, 2019-05-20 at 05:47 +0000, Avri Altman wrote:
> > 
> > Hello Stanley,
> > 
> > On 5/15/19 3:06 PM, Stanley Chu wrote:
> > > Some vendor-specific initialization flow may set its own
> > > auto-hibernate timer. In this case, do not overwrite timer value
> > > as "default value" in ufshcd_init().
> > >
> > > Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
> > > ---
> > >   drivers/scsi/ufs/ufshcd.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> > > index e040f9dd9ff3..1665820c22fd 100644
> > > --- a/drivers/scsi/ufs/ufshcd.c
> > > +++ b/drivers/scsi/ufs/ufshcd.c
> > > @@ -8309,7 +8309,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem
> > *mmio_base, unsigned int irq)
> > >   						UIC_LINK_HIBERN8_STATE);
> > >
> > >   	/* Set the default auto-hiberate idle timer value to 150 ms */
> > > -	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
> > > +	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT & !hba->ahit) {
> A typo?

Yes! Thanks for remind this.
Will fix it in next version.

> 
> 
> > >   		hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK,
> > 150) |
> > >   			    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
> > >   	}
> > >
> > Looks good to me,
> > Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>

Thanks.
Stanley
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index e040f9dd9ff3..1665820c22fd 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8309,7 +8309,7 @@  int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 						UIC_LINK_HIBERN8_STATE);
 
 	/* Set the default auto-hiberate idle timer value to 150 ms */
-	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT) {
+	if (hba->capabilities & MASK_AUTO_HIBERN8_SUPPORT & !hba->ahit) {
 		hba->ahit = FIELD_PREP(UFSHCI_AHIBERN8_TIMER_MASK, 150) |
 			    FIELD_PREP(UFSHCI_AHIBERN8_SCALE_MASK, 3);
 	}