lkml.org 
[lkml]   [2024]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 6.8 08/98] scsi: ufs: qcom: Avoid re-init quirk when gears match
    Date
    From: Eric Chanudet <echanude@redhat.com>

    [ Upstream commit 10a39667a117daf0c1baaebcbe589715ee79178b ]

    On sa8775p-ride, probing the HBA will go through the
    UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH path although the power info is
    the same during the second init.

    The REINIT quirk only applies starting with controller v4. For these,
    ufs_qcom_get_hs_gear() reads the highest supported gear when setting the
    host_params. After the negotiation, if the host and device are on the same
    gear, it is the highest gear supported between the two. Skip REINIT to save
    some time.

    Signed-off-by: Eric Chanudet <echanude@redhat.com>
    Link: https://lore.kernel.org/r/20240123192854.1724905-4-echanude@redhat.com
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/ufs/host/ufs-qcom.c | 13 +++++++++++--
    1 file changed, 11 insertions(+), 2 deletions(-)

    diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
    index 39eef470f8fa5..f7dba7236c6e5 100644
    --- a/drivers/ufs/host/ufs-qcom.c
    +++ b/drivers/ufs/host/ufs-qcom.c
    @@ -738,8 +738,17 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
    * the second init can program the optimal PHY settings. This allows one to start
    * the first init with either the minimum or the maximum support gear.
    */
    - if (hba->ufshcd_state == UFSHCD_STATE_RESET)
    - host->phy_gear = dev_req_params->gear_tx;
    + if (hba->ufshcd_state == UFSHCD_STATE_RESET) {
    + /*
    + * Skip REINIT if the negotiated gear matches with the
    + * initial phy_gear. Otherwise, update the phy_gear to
    + * program the optimal gear setting during REINIT.
    + */
    + if (host->phy_gear == dev_req_params->gear_tx)
    + hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
    + else
    + host->phy_gear = dev_req_params->gear_tx;
    + }

    /* enable the device ref clock before changing to HS mode */
    if (!ufshcd_is_hs_mode(&hba->pwr_info) &&
    --
    2.43.0

    \
     
     \ /
      Last update: 2024-05-27 16:15    [W:3.660 / U:0.872 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site