scsi: ufs: Introduce device parameter initialization function

Nowadays many vendors initialize their device parameters in their own
vendor drivers. The initialization code is almost the same as well as the
pre-defined definitions. Introduce a common device parameter initialization
function which assign the most common initial values. With this function,
we could remove those duplicated codes in vendor drivers.

Link: https://lore.kernel.org/r/20201116065054.7658-3-stanley.chu@mediatek.com
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Stanley Chu 2020-11-16 14:50:47 +08:00 committed by Martin K. Petersen
parent 54770cbebe
commit 65858014ee
2 changed files with 18 additions and 0 deletions

View File

@ -354,6 +354,23 @@ int ufshcd_get_pwr_dev_param(struct ufs_dev_params *pltfrm_param,
}
EXPORT_SYMBOL_GPL(ufshcd_get_pwr_dev_param);
void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param)
{
dev_param->tx_lanes = 2;
dev_param->rx_lanes = 2;
dev_param->hs_rx_gear = UFS_HS_G3;
dev_param->hs_tx_gear = UFS_HS_G3;
dev_param->pwm_rx_gear = UFS_PWM_G4;
dev_param->pwm_tx_gear = UFS_PWM_G4;
dev_param->rx_pwr_pwm = SLOW_MODE;
dev_param->tx_pwr_pwm = SLOW_MODE;
dev_param->rx_pwr_hs = FAST_MODE;
dev_param->tx_pwr_hs = FAST_MODE;
dev_param->hs_rate = PA_HS_MODE_B;
dev_param->desired_working_mode = UFS_HS_MODE;
}
EXPORT_SYMBOL_GPL(ufshcd_init_pwr_dev_param);
/**
* ufshcd_pltfrm_init - probe routine of the driver
* @pdev: pointer to Platform device handle

View File

@ -28,6 +28,7 @@ struct ufs_dev_params {
int ufshcd_get_pwr_dev_param(struct ufs_dev_params *dev_param,
struct ufs_pa_layer_attr *dev_max,
struct ufs_pa_layer_attr *agreed_pwr);
void ufshcd_init_pwr_dev_param(struct ufs_dev_params *dev_param);
int ufshcd_pltfrm_init(struct platform_device *pdev,
const struct ufs_hba_variant_ops *vops);
void ufshcd_pltfrm_shutdown(struct platform_device *pdev);