Loading drivers/scsi/ufs/ufshcd.c +22 −11 Original line number Diff line number Diff line Loading @@ -4383,18 +4383,25 @@ out: } /** * ufshcd_force_reset_auto_bkops - force enable of auto bkops * ufshcd_force_reset_auto_bkops - force reset auto bkops state * @hba: per adapter instance * * After a device reset the device may toggle the BKOPS_EN flag * to default value. The s/w tracking variables should be updated * as well. Do this by forcing enable of auto bkops. * as well. This function would change the auto-bkops state based on * UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND. */ static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba) { if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) { hba->auto_bkops_enabled = false; hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS; ufshcd_enable_auto_bkops(hba); } else { hba->auto_bkops_enabled = true; hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS; ufshcd_disable_auto_bkops(hba); } } static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status) Loading Loading @@ -6564,11 +6571,15 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) goto set_old_link_state; } if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) ufshcd_enable_auto_bkops(hba); else /* * If BKOPs operations are urgently needed at this moment then * keep auto-bkops enabled or else disable it. */ ufshcd_urgent_bkops(hba); hba->clk_gating.is_suspended = false; hba->hibern8_on_idle.is_suspended = false; Loading include/linux/scsi/ufs/ufshcd.h +13 −0 Original line number Diff line number Diff line Loading @@ -617,6 +617,14 @@ struct ufs_hba { #define UFSHCD_CAP_INTR_AGGR (1 << 4) /* Allow standalone Hibern8 enter on idle */ #define UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE (1 << 5) /* * This capability allows the device auto-bkops to be always enabled * except during suspend (both runtime and suspend). * Enabling this capability means that device will always be allowed * to do background operation when it's active but it might degrade * the performance of ongoing read/write operations. */ #define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5) struct devfreq *devfreq; struct ufs_clk_scaling clk_scaling; Loading Loading @@ -654,6 +662,11 @@ static inline bool ufshcd_is_hibern8_on_idle_allowed(struct ufs_hba *hba) { return hba->caps & UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE; } static inline bool ufshcd_keep_autobkops_enabled_except_suspend( struct ufs_hba *hba) { return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; } #define ufshcd_writel(hba, val, reg) \ writel_relaxed((val), (hba)->mmio_base + (reg)) Loading Loading
drivers/scsi/ufs/ufshcd.c +22 −11 Original line number Diff line number Diff line Loading @@ -4383,18 +4383,25 @@ out: } /** * ufshcd_force_reset_auto_bkops - force enable of auto bkops * ufshcd_force_reset_auto_bkops - force reset auto bkops state * @hba: per adapter instance * * After a device reset the device may toggle the BKOPS_EN flag * to default value. The s/w tracking variables should be updated * as well. Do this by forcing enable of auto bkops. * as well. This function would change the auto-bkops state based on * UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND. */ static void ufshcd_force_reset_auto_bkops(struct ufs_hba *hba) { if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) { hba->auto_bkops_enabled = false; hba->ee_ctrl_mask |= MASK_EE_URGENT_BKOPS; ufshcd_enable_auto_bkops(hba); } else { hba->auto_bkops_enabled = true; hba->ee_ctrl_mask &= ~MASK_EE_URGENT_BKOPS; ufshcd_disable_auto_bkops(hba); } } static inline int ufshcd_get_bkops_status(struct ufs_hba *hba, u32 *status) Loading Loading @@ -6564,11 +6571,15 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) goto set_old_link_state; } if (ufshcd_keep_autobkops_enabled_except_suspend(hba)) ufshcd_enable_auto_bkops(hba); else /* * If BKOPs operations are urgently needed at this moment then * keep auto-bkops enabled or else disable it. */ ufshcd_urgent_bkops(hba); hba->clk_gating.is_suspended = false; hba->hibern8_on_idle.is_suspended = false; Loading
include/linux/scsi/ufs/ufshcd.h +13 −0 Original line number Diff line number Diff line Loading @@ -617,6 +617,14 @@ struct ufs_hba { #define UFSHCD_CAP_INTR_AGGR (1 << 4) /* Allow standalone Hibern8 enter on idle */ #define UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE (1 << 5) /* * This capability allows the device auto-bkops to be always enabled * except during suspend (both runtime and suspend). * Enabling this capability means that device will always be allowed * to do background operation when it's active but it might degrade * the performance of ongoing read/write operations. */ #define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5) struct devfreq *devfreq; struct ufs_clk_scaling clk_scaling; Loading Loading @@ -654,6 +662,11 @@ static inline bool ufshcd_is_hibern8_on_idle_allowed(struct ufs_hba *hba) { return hba->caps & UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE; } static inline bool ufshcd_keep_autobkops_enabled_except_suspend( struct ufs_hba *hba) { return hba->caps & UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND; } #define ufshcd_writel(hba, val, reg) \ writel_relaxed((val), (hba)->mmio_base + (reg)) Loading