Skip to content

Commit 1764fa2

Browse files
Stanley Chumartinkpetersen
authored andcommitted
scsi: ufs: set device as active power mode after resetting device
Currently ufshcd driver assumes that bInitPowerMode parameter is not changed by any vendors thus device power mode can be set as "Active" during initialization. According to UFS JEDEC specification, device power mode shall be "Active" after HW Reset is triggered if the bInitPowerMode parameter in Device Descriptor is default value. By above description, we can set device power mode as "Active" after device reset is triggered by vendor's callback. With this change, the link startup performance can be improved in some cases by not setting link_startup_again as true in ufshcd_link_startup(). Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Reviewed-by: Asutosh Das <[email protected]> Signed-off-by: Stanley Chu <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 13e60d3 commit 1764fa2

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

drivers/scsi/ufs/ufshcd.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,6 @@ enum {
172172
#define ufshcd_clear_eh_in_progress(h) \
173173
((h)->eh_flags &= ~UFSHCD_EH_IN_PROGRESS)
174174

175-
#define ufshcd_set_ufs_dev_active(h) \
176-
((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
177-
#define ufshcd_set_ufs_dev_sleep(h) \
178-
((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
179-
#define ufshcd_set_ufs_dev_poweroff(h) \
180-
((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
181-
#define ufshcd_is_ufs_dev_active(h) \
182-
((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
183-
#define ufshcd_is_ufs_dev_sleep(h) \
184-
((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
185-
#define ufshcd_is_ufs_dev_poweroff(h) \
186-
((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
187-
188175
struct ufs_pm_lvl_states ufs_pm_lvl_states[] = {
189176
{UFS_ACTIVE_PWR_MODE, UIC_LINK_ACTIVE_STATE},
190177
{UFS_ACTIVE_PWR_MODE, UIC_LINK_HIBERN8_STATE},

drivers/scsi/ufs/ufshcd.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,19 @@ enum uic_link_state {
130130
#define ufshcd_set_link_hibern8(hba) ((hba)->uic_link_state = \
131131
UIC_LINK_HIBERN8_STATE)
132132

133+
#define ufshcd_set_ufs_dev_active(h) \
134+
((h)->curr_dev_pwr_mode = UFS_ACTIVE_PWR_MODE)
135+
#define ufshcd_set_ufs_dev_sleep(h) \
136+
((h)->curr_dev_pwr_mode = UFS_SLEEP_PWR_MODE)
137+
#define ufshcd_set_ufs_dev_poweroff(h) \
138+
((h)->curr_dev_pwr_mode = UFS_POWERDOWN_PWR_MODE)
139+
#define ufshcd_is_ufs_dev_active(h) \
140+
((h)->curr_dev_pwr_mode == UFS_ACTIVE_PWR_MODE)
141+
#define ufshcd_is_ufs_dev_sleep(h) \
142+
((h)->curr_dev_pwr_mode == UFS_SLEEP_PWR_MODE)
143+
#define ufshcd_is_ufs_dev_poweroff(h) \
144+
((h)->curr_dev_pwr_mode == UFS_POWERDOWN_PWR_MODE)
145+
133146
/*
134147
* UFS Power management levels.
135148
* Each level is in increasing order of power savings.
@@ -1084,6 +1097,7 @@ static inline void ufshcd_vops_device_reset(struct ufs_hba *hba)
10841097
{
10851098
if (hba->vops && hba->vops->device_reset) {
10861099
hba->vops->device_reset(hba);
1100+
ufshcd_set_ufs_dev_active(hba);
10871101
ufshcd_update_reg_hist(&hba->ufs_stats.dev_reset, 0);
10881102
}
10891103
}

0 commit comments

Comments
 (0)