public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
@ 2026-04-30  4:22 Hongjie Fang
  2026-04-30 17:30 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hongjie Fang @ 2026-04-30  4:22 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche, James.Bottomley,
	martin.petersen
  Cc: linux-scsi, linux-kernel

The vendor hibern8 notify callback always can be executed in the
PRE_CHANGE phase of hibern8 enter/exit. But it cannot be executed
in the POST_CHANGE phase if the hibern8 cmd fails.

When the hibern8 cmd fails, the vendor hibern8 notify callback
should still have the opportunity to execute.

Add a third enum ROLLBACK_CHANGE for the ufshcd_vops_hibern8_notify(),
pass the ROLLBACK_CHANGE when the hibern8 command returns a failure and
use the POST_CHANGE otherwise.

Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
---
 drivers/ufs/core/ufshcd.c | 11 ++++++-----
 include/ufs/ufshcd.h      |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 9ceb6d6d479d..1d4939bb7ec0 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4500,9 +4500,9 @@ int ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
 	if (ret)
 		dev_err(hba->dev, "%s: hibern8 enter failed. ret = %d\n",
 			__func__, ret);
-	else
-		ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER,
-								POST_CHANGE);
+
+	ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_ENTER,
+					ret ? ROLLBACK_CHANGE : POST_CHANGE);
 
 	return ret;
 }
@@ -4526,12 +4526,13 @@ int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
 		dev_err(hba->dev, "%s: hibern8 exit failed. ret = %d\n",
 			__func__, ret);
 	} else {
-		ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_EXIT,
-								POST_CHANGE);
 		hba->ufs_stats.last_hibern8_exit_tstamp = local_clock();
 		hba->ufs_stats.hibern8_exit_cnt++;
 	}
 
+	ufshcd_vops_hibern8_notify(hba, UIC_CMD_DME_HIBER_EXIT,
+					ret ? ROLLBACK_CHANGE : POST_CHANGE);
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_exit);
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 8563b6648976..4f7c619db324 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -270,6 +270,7 @@ struct ufs_clk_info {
 enum ufs_notify_change_status {
 	PRE_CHANGE,
 	POST_CHANGE,
+	ROLLBACK_CHANGE,
 };
 
 struct ufs_pa_layer_attr {
-- 
2.25.1


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

* Re: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
  2026-04-30  4:22 [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed Hongjie Fang
@ 2026-04-30 17:30 ` Bart Van Assche
  2026-05-01 12:53   ` Fang Hongjie(方洪杰)
  2026-05-02 10:05 ` kernel test robot
  2026-05-02 13:57 ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Bart Van Assche @ 2026-04-30 17:30 UTC (permalink / raw)
  To: Hongjie Fang, alim.akhtar, avri.altman, James.Bottomley,
	martin.petersen
  Cc: linux-scsi, linux-kernel

On 4/29/26 9:22 PM, Hongjie Fang wrote:
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 8563b6648976..4f7c619db324 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -270,6 +270,7 @@ struct ufs_clk_info {
>   enum ufs_notify_change_status {
>   	PRE_CHANGE,
>   	POST_CHANGE,
> +	ROLLBACK_CHANGE,
>   };
>   
>   struct ufs_pa_layer_attr {

This looks better to me but triggers compiler warnings:

drivers/ufs/host/ufs-exynos.c:1614:10: error: enumeration value 
'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
  1614 |         switch (status) {
       |                 ^~~~~~
drivers/ufs/host/ufs-exynos.c:1654:10: error: enumeration value 
'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
  1654 |         switch (status) {
       |                 ^~~~~~
drivers/ufs/host/ufs-exynos.c:1687:10: error: enumeration value 
'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
  1687 |         switch (status) {
       |                 ^~~~~~

These warnings can be reproduced on any Linux development system by
installing Clang and by running the following command:

build-scsi-drivers -c

See also https://github.com/bvanassche/build-scsi-drivers

Thanks,

Bart.

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

* RE: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
  2026-04-30 17:30 ` Bart Van Assche
@ 2026-05-01 12:53   ` Fang Hongjie(方洪杰)
  0 siblings, 0 replies; 5+ messages in thread
From: Fang Hongjie(方洪杰) @ 2026-05-01 12:53 UTC (permalink / raw)
  To: Bart Van Assche, alim.akhtar@samsung.com, avri.altman@wdc.com,
	James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com
  Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org

> From: Bart Van Assche [mailto:bvanassche@acm.org]
> Sent: Friday, May 1, 2026 1:31 AM
> To: Fang Hongjie  <hongjiefang@asrmicro.com>;
> alim.akhtar@samsung.com; avri.altman@wdc.com;
> James.Bottomley@HansenPartnership.com; martin.petersen@oracle.com
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd
> failed
> 
> On 4/29/26 9:22 PM, Hongjie Fang wrote:
> > diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> > index 8563b6648976..4f7c619db324 100644
> > --- a/include/ufs/ufshcd.h
> > +++ b/include/ufs/ufshcd.h
> > @@ -270,6 +270,7 @@ struct ufs_clk_info {
> >   enum ufs_notify_change_status {
> >   	PRE_CHANGE,
> >   	POST_CHANGE,
> > +	ROLLBACK_CHANGE,
> >   };
> >
> >   struct ufs_pa_layer_attr {
> 
> This looks better to me but triggers compiler warnings:
> 
> drivers/ufs/host/ufs-exynos.c:1614:10: error: enumeration value
> 'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
>   1614 |         switch (status) {
>        |                 ^~~~~~
> drivers/ufs/host/ufs-exynos.c:1654:10: error: enumeration value
> 'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
>   1654 |         switch (status) {
>        |                 ^~~~~~
> drivers/ufs/host/ufs-exynos.c:1687:10: error: enumeration value
> 'ROLLBACK_CHANGE' not handled in switch [-Werror,-Wswitch]
>   1687 |         switch (status) {
>        |                 ^~~~~~
> 
> These warnings can be reproduced on any Linux development system by
> installing Clang and by running the following command:
> 
> build-scsi-drivers -c
> 
> See also https://github.com/bvanassche/build-scsi-drivers
> 

Okay, I will fix and update it.

> Thanks,
> 
> Bart.

Best.

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

* Re: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
  2026-04-30  4:22 [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed Hongjie Fang
  2026-04-30 17:30 ` Bart Van Assche
@ 2026-05-02 10:05 ` kernel test robot
  2026-05-02 13:57 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-05-02 10:05 UTC (permalink / raw)
  To: Hongjie Fang, alim.akhtar, avri.altman, bvanassche,
	James.Bottomley, martin.petersen
  Cc: oe-kbuild-all, linux-scsi, linux-kernel

Hi Hongjie,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v7.1-rc1 next-20260430]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hongjie-Fang/scsi-ufs-core-call-hibern8-notify-when-hibern8-cmd-failed/20260501-050358
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20260430042212.3712251-1-hongjiefang%40asrmicro.com
patch subject: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20260502/202605021742.XyNEfM7G-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260502/202605021742.XyNEfM7G-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605021742.XyNEfM7G-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/ufs/host/ufs-exynos.c: In function 'exynos_ufs_hce_enable_notify':
>> drivers/ufs/host/ufs-exynos.c:1614:9: warning: enumeration value 'ROLLBACK_CHANGE' not handled in switch [-Wswitch]
    1614 |         switch (status) {
         |         ^~~~~~
   drivers/ufs/host/ufs-exynos.c: In function 'exynos_ufs_link_startup_notify':
   drivers/ufs/host/ufs-exynos.c:1654:9: warning: enumeration value 'ROLLBACK_CHANGE' not handled in switch [-Wswitch]
    1654 |         switch (status) {
         |         ^~~~~~
   drivers/ufs/host/ufs-exynos.c: In function 'exynos_ufs_pwr_change_notify':
   drivers/ufs/host/ufs-exynos.c:1687:9: warning: enumeration value 'ROLLBACK_CHANGE' not handled in switch [-Wswitch]
    1687 |         switch (status) {
         |         ^~~~~~


vim +/ROLLBACK_CHANGE +1614 drivers/ufs/host/ufs-exynos.c

55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1607  
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1608  static int exynos_ufs_hce_enable_notify(struct ufs_hba *hba,
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1609  					enum ufs_notify_change_status status)
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1610  {
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1611  	struct exynos_ufs *ufs = ufshcd_get_variant(hba);
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1612  	int ret = 0;
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1613  
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28 @1614  	switch (status) {
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1615  	case PRE_CHANGE:
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1616  		/*
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1617  		 * The maximum segment size must be set after scsi_host_alloc()
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1618  		 * has been called and before LUN scanning starts
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1619  		 * (ufshcd_async_scan()). Note: this callback may also be called
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1620  		 * from other functions than ufshcd_init().
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1621  		 */
c96499fcb403b18 drivers/ufs/host/ufs-exynos.c Eric Biggers    2024-07-08  1622  		hba->host->max_segment_size = DATA_UNIT_SIZE;
9a80bc5debf74b0 drivers/ufs/host/ufs-exynos.c Bart Van Assche 2023-01-12  1623  
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1624  		if (ufs->drv_data->pre_hce_enable) {
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1625  			ret = ufs->drv_data->pre_hce_enable(ufs);
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1626  			if (ret)
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1627  				return ret;
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1628  		}
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1629  
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1630  		ret = exynos_ufs_host_reset(hba);
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1631  		if (ret)
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1632  			return ret;
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1633  		exynos_ufs_dev_hw_reset(hba);
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1634  		break;
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1635  	case POST_CHANGE:
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1636  		exynos_ufs_calc_pwm_clk_div(ufs);
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1637  		if (!(ufs->opts & EXYNOS_UFS_OPT_BROKEN_AUTO_CLK_CTRL))
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1638  			exynos_ufs_enable_auto_ctrl_hcc(ufs);
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1639  
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1640  		if (ufs->drv_data->post_hce_enable)
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1641  			ret = ufs->drv_data->post_hce_enable(ufs);
52e5035f7b079be drivers/scsi/ufs/ufs-exynos.c Chanho Park     2021-10-18  1642  
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1643  		break;
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1644  	}
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1645  
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1646  	return ret;
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1647  }
55f4b1f73631a08 drivers/scsi/ufs/ufs-exynos.c Alim Akhtar     2020-05-28  1648  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
  2026-04-30  4:22 [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed Hongjie Fang
  2026-04-30 17:30 ` Bart Van Assche
  2026-05-02 10:05 ` kernel test robot
@ 2026-05-02 13:57 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-05-02 13:57 UTC (permalink / raw)
  To: Hongjie Fang, alim.akhtar, avri.altman, bvanassche,
	James.Bottomley, martin.petersen
  Cc: oe-kbuild-all, linux-scsi, linux-kernel

Hi Hongjie,

kernel test robot noticed the following build warnings:

[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next linus/master v7.1-rc1 next-20260430]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hongjie-Fang/scsi-ufs-core-call-hibern8-notify-when-hibern8-cmd-failed/20260501-050358
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
patch link:    https://lore.kernel.org/r/20260430042212.3712251-1-hongjiefang%40asrmicro.com
patch subject: [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20260502/202605022153.181ENp5n-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260502/202605022153.181ENp5n-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605022153.181ENp5n-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/ufs/host/ufs-qcom.c: In function 'ufs_qcom_setup_clocks':
>> drivers/ufs/host/ufs-qcom.c:1433:9: warning: enumeration value 'ROLLBACK_CHANGE' not handled in switch [-Wswitch]
    1433 |         switch (status) {
         |         ^~~~~~


vim +/ROLLBACK_CHANGE +1433 drivers/ufs/host/ufs-qcom.c

81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1401  
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1402  /**
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1403   * ufs_qcom_setup_clocks - enables/disable clocks
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1404   * @hba: host controller instance
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1405   * @on: If true, enable clocks else disable them.
1e879e8fa9f62e drivers/scsi/ufs/ufs-qcom.c Subhash Jadavani      2016-10-06  1406   * @status: PRE_CHANGE or POST_CHANGE notify
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1407   *
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1408   * There are certain clocks which comes from the PHY so it needs
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1409   * to be managed together along with controller clocks which also
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1410   * provides a better power saving. Hence keep phy_power_off/on calls
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1411   * in ufs_qcom_setup_clocks, so that PHY's regulators & clks can be
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1412   * turned on/off along with UFS's clocks.
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1413   *
3a17fefe0f1960 drivers/ufs/host/ufs-qcom.c Bart Van Assche       2023-07-27  1414   * Return: 0 on success, non-zero on failure.
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1415   */
1e879e8fa9f62e drivers/scsi/ufs/ufs-qcom.c Subhash Jadavani      2016-10-06  1416  static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
1e879e8fa9f62e drivers/scsi/ufs/ufs-qcom.c Subhash Jadavani      2016-10-06  1417  				 enum ufs_notify_change_status status)
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1418  {
1ce5898af55e23 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1419  	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
720fa0cb59e411 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-06-23  1420  	struct phy *phy;
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1421  	int err;
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1422  
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1423  	/*
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1424  	 * In case ufs_qcom_init() is not yet done, simply ignore.
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1425  	 * This ufs_qcom_setup_clocks() shall be called from
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1426  	 * ufs_qcom_init() after init is done.
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1427  	 */
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1428  	if (!host)
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1429  		return 0;
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1430  
720fa0cb59e411 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-06-23  1431  	phy = host->generic_phy;
720fa0cb59e411 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-06-23  1432  
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10 @1433  	switch (status) {
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1434  	case PRE_CHANGE:
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1435  		if (on) {
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1436  			ufs_qcom_icc_update_bw(host);
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1437  			if (ufs_qcom_is_link_hibern8(hba)) {
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1438  				err = ufs_qcom_enable_lane_clks(host);
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1439  				if (err) {
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1440  					dev_err(hba->dev, "enable lane clks failed, ret=%d\n", err);
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1441  					return err;
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1442  				}
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1443  			}
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1444  		} else {
feb3d79800ece1 drivers/scsi/ufs/ufs-qcom.c Vivek Gautam          2016-11-08  1445  			if (!ufs_qcom_is_link_active(hba)) {
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1446  				/* disable device ref_clk */
f06fcc7155dcbc drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-10-28  1447  				ufs_qcom_dev_ref_clk_ctrl(host, false);
feb3d79800ece1 drivers/scsi/ufs/ufs-qcom.c Vivek Gautam          2016-11-08  1448  			}
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1449  
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1450  			err = phy_power_off(phy);
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1451  			if (err) {
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1452  				dev_err(hba->dev, "phy power off failed, ret=%d\n", err);
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1453  				return err;
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1454  			}
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1455  		}
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1456  		break;
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1457  	case POST_CHANGE:
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1458  		if (on) {
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1459  			err = phy_power_on(phy);
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1460  			if (err) {
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1461  				dev_err(hba->dev, "phy power on failed, ret = %d\n", err);
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1462  				return err;
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1463  			}
77d2fa54a94574 drivers/ufs/host/ufs-qcom.c Nitin Rawat           2025-05-26  1464  
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1465  			/* enable the device ref clock for HS mode*/
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1466  			if (ufshcd_is_hs_mode(&hba->pwr_info))
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1467  				ufs_qcom_dev_ref_clk_ctrl(host, true);
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1468  		} else {
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1469  			if (ufs_qcom_is_link_hibern8(hba))
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1470  				ufs_qcom_disable_lane_clks(host);
c1553fc105dff2 drivers/ufs/host/ufs-qcom.c Palash Kambar         2025-09-09  1471  
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1472  			ufs_qcom_icc_set_bw(host, ufs_qcom_bw_table[MODE_MIN][0][0].mem_bw,
03ce80a1bb869f drivers/ufs/host/ufs-qcom.c Manivannan Sadhasivam 2023-07-31  1473  					    ufs_qcom_bw_table[MODE_MIN][0][0].cfg_bw);
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1474  		}
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1475  		break;
8240dd97cef424 drivers/scsi/ufs/ufs-qcom.c Can Guo               2020-02-10  1476  	}
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1477  
c4adf171e834da drivers/scsi/ufs/ufs-qcom.c ChanWoo Lee           2021-09-07  1478  	return 0;
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1479  }
81c0fc51b7a790 drivers/scsi/ufs/ufs-qcom.c Yaniv Gardi           2015-01-15  1480  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2026-05-02 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-30  4:22 [PATCH v3] scsi: ufs: core: call hibern8 notify when hibern8 cmd failed Hongjie Fang
2026-04-30 17:30 ` Bart Van Assche
2026-05-01 12:53   ` Fang Hongjie(方洪杰)
2026-05-02 10:05 ` kernel test robot
2026-05-02 13:57 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox