linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
       [not found] <CGME20250804113654epcas5p1dc2a495e16ff0f66eafc54be67550f23@epcas5p1.samsung.com>
@ 2025-08-04 11:36 ` Bharat Uppal
  2025-08-04 15:46   ` Bart Van Assche
  0 siblings, 1 reply; 7+ messages in thread
From: Bharat Uppal @ 2025-08-04 11:36 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, James.Bottomley, martin.petersen,
	alim.akhtar, avri.altman, bvanassche, linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, Bharat Uppal, Nimesh Sati

On FSD platform, gating the reference clock (ref_clk) and putting the
UFS device in reset by asserting the reset signal during UFS suspend,
improves the power savings and ensures the PHY is fully turned off.

These operations are added as FSD specific suspend hook to avoid
unintended side effects on other SoCs supported by this driver.

Signed-off-by: Nimesh Sati  <nimesh.sati@samsung.com>
Signed-off-by: Bharat Uppal <bharat.uppal@samsung.com>
---
 drivers/ufs/host/ufs-exynos.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
index 3e545af536e5..b19a9f0d25f6 100644
--- a/drivers/ufs/host/ufs-exynos.c
+++ b/drivers/ufs/host/ufs-exynos.c
@@ -1896,6 +1896,13 @@ static int fsd_ufs_pre_pwr_change(struct exynos_ufs *ufs,
 	return 0;
 }
 
+static int fsd_ufs_suspend(struct exynos_ufs *ufs)
+{
+	exynos_ufs_gate_clks(ufs);
+	hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
+	return 0;
+}
+
 static inline u32 get_mclk_period_unipro_18(struct exynos_ufs *ufs)
 {
 	return (16 * 1000 * 1000000UL / ufs->mclk_rate);
@@ -2162,6 +2169,7 @@ static const struct exynos_ufs_drv_data fsd_ufs_drvs = {
 	.pre_link               = fsd_ufs_pre_link,
 	.post_link              = fsd_ufs_post_link,
 	.pre_pwr_change         = fsd_ufs_pre_pwr_change,
+	.suspend                = fsd_ufs_suspend,
 };
 
 static const struct exynos_ufs_drv_data gs101_ufs_drvs = {
-- 
2.49.0


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

* Re: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
  2025-08-04 11:36 ` [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend Bharat Uppal
@ 2025-08-04 15:46   ` Bart Van Assche
  2025-08-05  5:28     ` Bharat Uppal
  2025-08-28 10:16     ` Bharat Uppal
  0 siblings, 2 replies; 7+ messages in thread
From: Bart Van Assche @ 2025-08-04 15:46 UTC (permalink / raw)
  To: Bharat Uppal, linux-scsi, linux-kernel, James.Bottomley,
	martin.petersen, alim.akhtar, avri.altman, linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, Nimesh Sati

On 8/4/25 4:36 AM, Bharat Uppal wrote:
> +static int fsd_ufs_suspend(struct exynos_ufs *ufs)
> +{
> +	exynos_ufs_gate_clks(ufs);
> +	hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
> +	return 0;
> +}

Why '0 << 0' instead of just '0'? Isn't the latter easier to read?

Thanks,

Bart.

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

* RE: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
  2025-08-04 15:46   ` Bart Van Assche
@ 2025-08-05  5:28     ` Bharat Uppal
  2025-08-28 10:16     ` Bharat Uppal
  1 sibling, 0 replies; 7+ messages in thread
From: Bharat Uppal @ 2025-08-05  5:28 UTC (permalink / raw)
  To: 'Bart Van Assche', linux-scsi, linux-kernel,
	James.Bottomley, martin.petersen, alim.akhtar, avri.altman,
	linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, 'Nimesh Sati'


> -----Original Message-----
> From: Bart Van Assche <bvanassche@acm.org>
> Sent: 04 August 2025 21:17
> To: Bharat Uppal <bharat.uppal@samsung.com>; linux-scsi@vger.kernel.org;
> linux-kernel@vger.kernel.org; James.Bottomley@HansenPartnership.com;
> martin.petersen@oracle.com; alim.akhtar@samsung.com;
> avri.altman@wdc.com; linux-samsung-soc@vger.kernel.org
> Cc: pankaj.dubey@samsung.com; aswani.reddy@samsung.com; Nimesh Sati
> <nimesh.sati@samsung.com>
> Subject: Re: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in
> reset on suspend
> 
> On 8/4/25 4:36 AM, Bharat Uppal wrote:
> > +static int fsd_ufs_suspend(struct exynos_ufs *ufs) {
> > +	exynos_ufs_gate_clks(ufs);
> > +	hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
> > +	return 0;
> > +}
> 
> Why '0 << 0' instead of just '0'? Isn't the latter easier to read?
Thanks for reviewing.
Indeed setting 0 is right, but in the same file ufs-exynos.c,  I have seen HCI_GPIO_OUT register configured using 0 << 0.
My intent here is to maintain coding style within the file.

With Regards
Bharat Uppal

> 
> Thanks,
> 
> Bart.


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

* [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
       [not found] <CGME20250821053938epcas5p290f78790250d8cb09df2f35e45624359@epcas5p2.samsung.com>
@ 2025-08-21  5:39 ` Bharat Uppal
  2025-08-28 13:35   ` Bart Van Assche
  2025-08-31  1:00   ` Martin K. Petersen
  0 siblings, 2 replies; 7+ messages in thread
From: Bharat Uppal @ 2025-08-21  5:39 UTC (permalink / raw)
  To: linux-scsi, linux-kernel, James.Bottomley, martin.petersen,
	alim.akhtar, avri.altman, bvanassche, linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, Bharat Uppal, Nimesh Sati

On FSD platform, gating the reference clock (ref_clk) and putting the
UFS device in reset by asserting the reset signal during UFS suspend,
improves the power savings and ensures the PHY is fully turned off.

These operations are added as FSD specific suspend hook to avoid
unintended side effects on other SoCs supported by this driver.

Signed-off-by: Nimesh Sati  <nimesh.sati@samsung.com>
Signed-off-by: Bharat Uppal <bharat.uppal@samsung.com>
---
 drivers/ufs/host/ufs-exynos.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/ufs/host/ufs-exynos.c b/drivers/ufs/host/ufs-exynos.c
index 3e545af536e5..4d0f7d6b84fe 100644
--- a/drivers/ufs/host/ufs-exynos.c
+++ b/drivers/ufs/host/ufs-exynos.c
@@ -1896,6 +1896,13 @@ static int fsd_ufs_pre_pwr_change(struct exynos_ufs *ufs,
 	return 0;
 }
 
+static int fsd_ufs_suspend(struct exynos_ufs *ufs)
+{
+	exynos_ufs_gate_clks(ufs);
+	hci_writel(ufs, 0, HCI_GPIO_OUT);
+	return 0;
+}
+
 static inline u32 get_mclk_period_unipro_18(struct exynos_ufs *ufs)
 {
 	return (16 * 1000 * 1000000UL / ufs->mclk_rate);
@@ -2162,6 +2169,7 @@ static const struct exynos_ufs_drv_data fsd_ufs_drvs = {
 	.pre_link               = fsd_ufs_pre_link,
 	.post_link              = fsd_ufs_post_link,
 	.pre_pwr_change         = fsd_ufs_pre_pwr_change,
+	.suspend                = fsd_ufs_suspend,
 };
 
 static const struct exynos_ufs_drv_data gs101_ufs_drvs = {
-- 
2.49.0


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

* RE: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
  2025-08-04 15:46   ` Bart Van Assche
  2025-08-05  5:28     ` Bharat Uppal
@ 2025-08-28 10:16     ` Bharat Uppal
  1 sibling, 0 replies; 7+ messages in thread
From: Bharat Uppal @ 2025-08-28 10:16 UTC (permalink / raw)
  To: 'Bart Van Assche', linux-scsi, linux-kernel,
	James.Bottomley, martin.petersen, alim.akhtar, avri.altman,
	linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, 'Nimesh Sati', bharat.uppal

Hi Bart,
I have made the relevant changes and pushed the updated patch.
Can you please review it and close the same.

With Regards
Bharat Uppal

> -----Original Message-----
> From: Bharat Uppal <bharat.uppal@samsung.com>
> Sent: 05 August 2025 10:58
> To: 'Bart Van Assche' <bvanassche@acm.org>; 'linux-scsi@vger.kernel.org'
> <linux-scsi@vger.kernel.org>; 'linux-kernel@vger.kernel.org' <linux-
> kernel@vger.kernel.org>; 'James.Bottomley@HansenPartnership.com'
> <James.Bottomley@HansenPartnership.com>;
> 'martin.petersen@oracle.com' <martin.petersen@oracle.com>;
> 'alim.akhtar@samsung.com' <alim.akhtar@samsung.com>;
> 'avri.altman@wdc.com' <avri.altman@wdc.com>; 'linux-samsung-
> soc@vger.kernel.org' <linux-samsung-soc@vger.kernel.org>
> Cc: 'pankaj.dubey@samsung.com' <pankaj.dubey@samsung.com>;
> 'aswani.reddy@samsung.com' <aswani.reddy@samsung.com>; 'Nimesh Sati'
> <nimesh.sati@samsung.com>
> Subject: RE: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in
> reset on suspend
> 
> 
> > -----Original Message-----
> > From: Bart Van Assche <bvanassche@acm.org>
> > Sent: 04 August 2025 21:17
> > To: Bharat Uppal <bharat.uppal@samsung.com>;
> > linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org;
> > James.Bottomley@HansenPartnership.com;
> > martin.petersen@oracle.com; alim.akhtar@samsung.com;
> > avri.altman@wdc.com; linux-samsung-soc@vger.kernel.org
> > Cc: pankaj.dubey@samsung.com; aswani.reddy@samsung.com; Nimesh
> Sati
> > <nimesh.sati@samsung.com>
> > Subject: Re: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS
> > device in reset on suspend
> >
> > On 8/4/25 4:36 AM, Bharat Uppal wrote:
> > > +static int fsd_ufs_suspend(struct exynos_ufs *ufs) {
> > > +	exynos_ufs_gate_clks(ufs);
> > > +	hci_writel(ufs, 0 << 0, HCI_GPIO_OUT);
> > > +	return 0;
> > > +}
> >
> > Why '0 << 0' instead of just '0'? Isn't the latter easier to read?
> Thanks for reviewing.
> Indeed setting 0 is right, but in the same file ufs-exynos.c,  I have seen
> HCI_GPIO_OUT register configured using 0 << 0.
> My intent here is to maintain coding style within the file.
> 
> With Regards
> Bharat Uppal
> 
> >
> > Thanks,
> >
> > Bart.


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

* Re: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
  2025-08-21  5:39 ` Bharat Uppal
@ 2025-08-28 13:35   ` Bart Van Assche
  2025-08-31  1:00   ` Martin K. Petersen
  1 sibling, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2025-08-28 13:35 UTC (permalink / raw)
  To: Bharat Uppal, linux-scsi, linux-kernel, James.Bottomley,
	martin.petersen, alim.akhtar, avri.altman, linux-samsung-soc
  Cc: pankaj.dubey, aswani.reddy, Nimesh Sati

On 8/20/25 10:39 PM, Bharat Uppal wrote:
> On FSD platform, gating the reference clock (ref_clk) and putting the
> UFS device in reset by asserting the reset signal during UFS suspend,
> improves the power savings and ensures the PHY is fully turned off.
> 
> These operations are added as FSD specific suspend hook to avoid
> unintended side effects on other SoCs supported by this driver.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>


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

* Re: [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend
  2025-08-21  5:39 ` Bharat Uppal
  2025-08-28 13:35   ` Bart Van Assche
@ 2025-08-31  1:00   ` Martin K. Petersen
  1 sibling, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2025-08-31  1:00 UTC (permalink / raw)
  To: Bharat Uppal
  Cc: linux-scsi, linux-kernel, James.Bottomley, martin.petersen,
	alim.akhtar, avri.altman, bvanassche, linux-samsung-soc,
	pankaj.dubey, aswani.reddy, Nimesh Sati


Bharat,

> On FSD platform, gating the reference clock (ref_clk) and putting the
> UFS device in reset by asserting the reset signal during UFS suspend,
> improves the power savings and ensures the PHY is fully turned off.

Applied to 6.18/scsi-staging, thanks!

-- 
Martin K. Petersen

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

end of thread, other threads:[~2025-08-31  1:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250804113654epcas5p1dc2a495e16ff0f66eafc54be67550f23@epcas5p1.samsung.com>
2025-08-04 11:36 ` [PATCH] scsi: ufs: exynos: fsd: Gate ref_clk and put UFS device in reset on suspend Bharat Uppal
2025-08-04 15:46   ` Bart Van Assche
2025-08-05  5:28     ` Bharat Uppal
2025-08-28 10:16     ` Bharat Uppal
     [not found] <CGME20250821053938epcas5p290f78790250d8cb09df2f35e45624359@epcas5p2.samsung.com>
2025-08-21  5:39 ` Bharat Uppal
2025-08-28 13:35   ` Bart Van Assche
2025-08-31  1:00   ` Martin K. Petersen

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