Skip to content

Commit 06a34d9

Browse files
Daejun7Parkmartinkpetersen
authored andcommitted
scsi: ufs: core: Skip link param validation when lanes_per_direction is unset
ufshcd_validate_link_params(), added by commit e72323f ("scsi: ufs: core: Configure only active lanes during link"), is called unconditionally from ufshcd_link_startup() and fails link startup with -ENOLINK when the connected lane count read from the device differs from hba->lanes_per_direction. lanes_per_direction is only set by ufshcd-pltfrm (default 2, or the "lanes-per-direction" devicetree property); ufshcd-pci controllers (e.g. Intel) leave it 0. As the device always reports >= 1 connected lanes, the check can never match and link startup always fails. Reproduced with QEMU's UFS device. Skip the check when lanes_per_direction is unset: with no expected value to validate against, restore the behaviour from before that commit. Fixes: e72323f ("scsi: ufs: core: Configure only active lanes during link") Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20260520070009epcms2p6542f3abb7660839e9d8140b3f2f145c3@epcms2p6 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent be8fcd4 commit 06a34d9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/ufs/core/ufshcd.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5200,6 +5200,16 @@ static int ufshcd_validate_link_params(struct ufs_hba *hba)
52005200
{
52015201
int ret, val;
52025202

5203+
/*
5204+
* lanes_per_direction is only populated by the platform glue (it
5205+
* defaults to 2 or is read from the "lanes-per-direction" devicetree
5206+
* property). Controllers probed via ufshcd-pci leave it unset (0), in
5207+
* which case there is no expected lane count to validate the connected
5208+
* lanes against. Skip the check instead of failing link startup.
5209+
*/
5210+
if (!hba->lanes_per_direction)
5211+
return 0;
5212+
52035213
ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
52045214
&val);
52055215
if (ret)

0 commit comments

Comments
 (0)