mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
scsi: ufs: core: Configure only active lanes during link
The number of connected lanes detected during UFS link startup can be fewer than the lanes specified in the device tree. The current driver logic attempts to configure all lanes defined in the device tree, regardless of their actual availability. This mismatch may cause failures during power mode changes. Hence, Add a check during link startup to ensure that only the lanes actually discovered are considered valid. If a mismatch is detected, fail the initialization early, preventing the driver from entering an unsupported configuration that could cause power mode transition failures. Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Palash Kambar <palash.kambar@oss.qualcomm.com> Link: https://patch.msgid.link/20260423102023.3779489-2-palash.kambar@oss.qualcomm.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
aa3b8f56ef
commit
e72323f3b0
|
|
@ -5218,6 +5218,35 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist);
|
EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist);
|
||||||
|
|
||||||
|
static int ufshcd_validate_link_params(struct ufs_hba *hba)
|
||||||
|
{
|
||||||
|
int ret, val;
|
||||||
|
|
||||||
|
ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
|
||||||
|
&val);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (val != hba->lanes_per_direction) {
|
||||||
|
dev_err(hba->dev, "Tx lane mismatch [config,reported] [%d,%d]\n",
|
||||||
|
hba->lanes_per_direction, val);
|
||||||
|
return -ENOLINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDRXDATALANES),
|
||||||
|
&val);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (val != hba->lanes_per_direction) {
|
||||||
|
dev_err(hba->dev, "Rx lane mismatch [config,reported] [%d,%d]\n",
|
||||||
|
hba->lanes_per_direction, val);
|
||||||
|
return -ENOLINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ufshcd_link_startup - Initialize unipro link startup
|
* ufshcd_link_startup - Initialize unipro link startup
|
||||||
* @hba: per adapter instance
|
* @hba: per adapter instance
|
||||||
|
|
@ -5291,6 +5320,10 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = ufshcd_validate_link_params(hba);
|
||||||
|
if (ret)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* Include any host controller configuration via UIC commands */
|
/* Include any host controller configuration via UIC commands */
|
||||||
ret = ufshcd_vops_link_startup_notify(hba, POST_CHANGE);
|
ret = ufshcd_vops_link_startup_notify(hba, POST_CHANGE);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user