Skip to content

Commit 55820a7

Browse files
quic-cangmartinkpetersen
authored andcommitted
scsi: ufs: ufs-qcom: Setup host power mode during init
Setup host power mode and its limitations during UFS host driver init to avoid repetitive work during every power mode change. Acked-by: Andrew Halaney <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Co-developed-by: Bao D. Nguyen <[email protected]> Signed-off-by: Bao D. Nguyen <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
1 parent dc604b4 commit 55820a7

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
898898
struct ufs_pa_layer_attr *dev_req_params)
899899
{
900900
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
901-
struct ufs_host_params host_params;
901+
struct ufs_host_params *host_params = &host->host_params;
902902
int ret = 0;
903903

904904
if (!dev_req_params) {
@@ -908,12 +908,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
908908

909909
switch (status) {
910910
case PRE_CHANGE:
911-
ufshcd_init_host_params(&host_params);
912-
913-
/* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */
914-
host_params.hs_tx_gear = host_params.hs_rx_gear = ufs_qcom_get_hs_gear(hba);
915-
916-
ret = ufshcd_negotiate_pwr_params(&host_params, dev_max_params, dev_req_params);
911+
ret = ufshcd_negotiate_pwr_params(host_params, dev_max_params, dev_req_params);
917912
if (ret) {
918913
dev_err(hba->dev, "%s: failed to determine capabilities\n",
919914
__func__);
@@ -1048,6 +1043,17 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
10481043
hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
10491044
}
10501045

1046+
static void ufs_qcom_set_host_params(struct ufs_hba *hba)
1047+
{
1048+
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
1049+
struct ufs_host_params *host_params = &host->host_params;
1050+
1051+
ufshcd_init_host_params(host_params);
1052+
1053+
/* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */
1054+
host_params->hs_tx_gear = host_params->hs_rx_gear = ufs_qcom_get_hs_gear(hba);
1055+
}
1056+
10511057
static void ufs_qcom_set_caps(struct ufs_hba *hba)
10521058
{
10531059
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
@@ -1272,6 +1278,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
12721278

12731279
ufs_qcom_set_caps(hba);
12741280
ufs_qcom_advertise_quirks(hba);
1281+
ufs_qcom_set_host_params(hba);
12751282

12761283
err = ufs_qcom_ice_init(host);
12771284
if (err)

drivers/ufs/host/ufs-qcom.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ struct ufs_qcom_host {
238238

239239
struct gpio_desc *device_reset;
240240

241+
struct ufs_host_params host_params;
241242
u32 phy_gear;
242243

243244
bool esi_enabled;

0 commit comments

Comments
 (0)