Message ID | 20200305040704.10645-3-stanley.chu@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | scsi: ufs: some cleanups and make the delay for host enabling customizable | expand |
Hi Stanley, On 2020-03-05 12:07, Stanley Chu wrote: > Use an enum to specify the host capabilities instead of #defines inside > the > structure definition. > > Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> Reviewed-by: Can Guo <cang@codeaurora.org> > --- > drivers/scsi/ufs/ufshcd.h | 65 ++++++++++++++++++++++----------------- > 1 file changed, 37 insertions(+), 28 deletions(-) > > diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h > index 4e235cef99bc..49ade1bfd085 100644 > --- a/drivers/scsi/ufs/ufshcd.h > +++ b/drivers/scsi/ufs/ufshcd.h > @@ -510,6 +510,43 @@ enum ufshcd_quirks { > UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION = 1 << 5, > }; > > +enum ufshcd_caps { > + /* Allow dynamic clk gating */ > + UFSHCD_CAP_CLK_GATING = 1 << 0, > + > + /* Allow hiberb8 with clk gating */ > + UFSHCD_CAP_HIBERN8_WITH_CLK_GATING = 1 << 1, > + > + /* Allow dynamic clk scaling */ > + UFSHCD_CAP_CLK_SCALING = 1 << 2, > + > + /* Allow auto bkops to enabled during runtime suspend */ > + UFSHCD_CAP_AUTO_BKOPS_SUSPEND = 1 << 3, > + > + /* > + * This capability allows host controller driver to use the UFS HCI's > + * interrupt aggregation capability. > + * CAUTION: Enabling this might reduce overall UFS throughput. > + */ > + UFSHCD_CAP_INTR_AGGR = 1 << 4, > + > + /* > + * 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. > + */ > + UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND = 1 << 5, > + > + /* > + * This capability allows host controller driver to automatically > + * enable runtime power management by itself instead of waiting > + * for userspace to control the power management. > + */ > + UFSHCD_CAP_RPM_AUTOSUSPEND = 1 << 6, > +}; > + > /** > * struct ufs_hba - per adapter private structure > * @mmio_base: UFSHCI base register address > @@ -662,34 +699,6 @@ struct ufs_hba { > struct ufs_clk_gating clk_gating; > /* Control to enable/disable host capabilities */ > u32 caps; > - /* Allow dynamic clk gating */ > -#define UFSHCD_CAP_CLK_GATING (1 << 0) > - /* Allow hiberb8 with clk gating */ > -#define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1) > - /* Allow dynamic clk scaling */ > -#define UFSHCD_CAP_CLK_SCALING (1 << 2) > - /* Allow auto bkops to enabled during runtime suspend */ > -#define UFSHCD_CAP_AUTO_BKOPS_SUSPEND (1 << 3) > - /* > - * This capability allows host controller driver to use the UFS HCI's > - * interrupt aggregation capability. > - * CAUTION: Enabling this might reduce overall UFS throughput. > - */ > -#define UFSHCD_CAP_INTR_AGGR (1 << 4) > - /* > - * 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) > - /* > - * This capability allows host controller driver to automatically > - * enable runtime power management by itself instead of waiting > - * for userspace to control the power management. > - */ > -#define UFSHCD_CAP_RPM_AUTOSUSPEND (1 << 6) > > struct devfreq *devfreq; > struct ufs_clk_scaling clk_scaling;
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 4e235cef99bc..49ade1bfd085 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -510,6 +510,43 @@ enum ufshcd_quirks { UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION = 1 << 5, }; +enum ufshcd_caps { + /* Allow dynamic clk gating */ + UFSHCD_CAP_CLK_GATING = 1 << 0, + + /* Allow hiberb8 with clk gating */ + UFSHCD_CAP_HIBERN8_WITH_CLK_GATING = 1 << 1, + + /* Allow dynamic clk scaling */ + UFSHCD_CAP_CLK_SCALING = 1 << 2, + + /* Allow auto bkops to enabled during runtime suspend */ + UFSHCD_CAP_AUTO_BKOPS_SUSPEND = 1 << 3, + + /* + * This capability allows host controller driver to use the UFS HCI's + * interrupt aggregation capability. + * CAUTION: Enabling this might reduce overall UFS throughput. + */ + UFSHCD_CAP_INTR_AGGR = 1 << 4, + + /* + * 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. + */ + UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND = 1 << 5, + + /* + * This capability allows host controller driver to automatically + * enable runtime power management by itself instead of waiting + * for userspace to control the power management. + */ + UFSHCD_CAP_RPM_AUTOSUSPEND = 1 << 6, +}; + /** * struct ufs_hba - per adapter private structure * @mmio_base: UFSHCI base register address @@ -662,34 +699,6 @@ struct ufs_hba { struct ufs_clk_gating clk_gating; /* Control to enable/disable host capabilities */ u32 caps; - /* Allow dynamic clk gating */ -#define UFSHCD_CAP_CLK_GATING (1 << 0) - /* Allow hiberb8 with clk gating */ -#define UFSHCD_CAP_HIBERN8_WITH_CLK_GATING (1 << 1) - /* Allow dynamic clk scaling */ -#define UFSHCD_CAP_CLK_SCALING (1 << 2) - /* Allow auto bkops to enabled during runtime suspend */ -#define UFSHCD_CAP_AUTO_BKOPS_SUSPEND (1 << 3) - /* - * This capability allows host controller driver to use the UFS HCI's - * interrupt aggregation capability. - * CAUTION: Enabling this might reduce overall UFS throughput. - */ -#define UFSHCD_CAP_INTR_AGGR (1 << 4) - /* - * 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) - /* - * This capability allows host controller driver to automatically - * enable runtime power management by itself instead of waiting - * for userspace to control the power management. - */ -#define UFSHCD_CAP_RPM_AUTOSUSPEND (1 << 6) struct devfreq *devfreq; struct ufs_clk_scaling clk_scaling;
Use an enum to specify the host capabilities instead of #defines inside the structure definition. Signed-off-by: Stanley Chu <stanley.chu@mediatek.com> --- drivers/scsi/ufs/ufshcd.h | 65 ++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 28 deletions(-)