Commit 65858014 authored by Stanley Chu's avatar Stanley Chu Committed by Martin K. Petersen

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.comReviewed-by: default avatarBean Huo <beanhuo@micron.com>
Signed-off-by: default avatarStanley Chu <stanley.chu@mediatek.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 54770cbe
......@@ -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
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment