[PATCH] scsi: ufs: pltfrm: Add quirk for R-Car S4 lacking lanes-per-direction

Geert Uytterhoeven posted 1 patch 1 week, 3 days ago
drivers/ufs/host/ufshcd-pltfrm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[PATCH] scsi: ufs: pltfrm: Add quirk for R-Car S4 lacking lanes-per-direction
Posted by Geert Uytterhoeven 1 week, 3 days ago
Since commit e72323f3b09f ("scsi: ufs: core: Configure only active lanes
during link"), the following error is observed on R-Car S4:

    ufshcd-renesas e6860000.ufs: Tx lane mismatch [config,reported] [2,1]
    ufshcd-renesas e6860000.ufs: link startup failed -67
    ufshcd-renesas e6860000.ufs: error -ENOLINK: Initialization failed with error -67
    ufshcd-renesas e6860000.ufs: probe with driver ufshcd-renesas failed with error -67

R-Car S4 has one UFS lane per direction, as described in section 152.1
of its hardware manual.  Without lanes-per-direction, the UFS platform
driver defaults to two lanes.

Previously, the core used PA_CONNECTEDRXDATALANES and
PA_CONNECTEDTXDATALANES to configure the link without checking them
against lanes-per-direction, so the missing property did not prevent
initialization.

While fixing the R-Car S4 DTS is the proper solution, doing only that
would still break backwards compatibility with existing DTBs.  Hence add
a quirk to let lanes-per-direction default to one on R-Car S4.

Fixes: e72323f3b09f9c89 ("scsi: ufs: core: Configure only active lanes during link")
Reported-by: Koichiro Den <den@valinux.co.jp>
Closes: https://lore.kernel.org/20260911073058.253000-1-den@valinux.co.jp
Cc: stable@vger.kernel.org # 7.2+
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Tested on S4SK.

 drivers/ufs/host/ufshcd-pltfrm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-pltfrm.c
index 5ac7afe759346deb..169dbc1a75fe5734 100644
--- a/drivers/ufs/host/ufshcd-pltfrm.c
+++ b/drivers/ufs/host/ufshcd-pltfrm.c
@@ -206,7 +206,11 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
 		dev_dbg(hba->dev,
 			"%s: failed to read lanes-per-direction, ret=%d\n",
 			__func__, ret);
-		hba->lanes_per_direction = UFSHCD_DEFAULT_LANES_PER_DIRECTION;
+		/* Old R-Car S4 DTBs lack "lanes-per-direction = <1>" */
+		if (of_device_is_compatible(dev->of_node, "renesas,r8a779f0-ufs"))
+			hba->lanes_per_direction = 1;
+		else
+			hba->lanes_per_direction = UFSHCD_DEFAULT_LANES_PER_DIRECTION;
 	}
 }
 
-- 
2.43.0
Re: [PATCH] scsi: ufs: pltfrm: Add quirk for R-Car S4 lacking lanes-per-direction
Posted by Martin K. Petersen (Oracle) 1 week, 1 day ago
On Mon, 14 Sep 2026 16:00:01 +0200, Geert Uytterhoeven wrote:

> Since commit e72323f3b09f ("scsi: ufs: core: Configure only active lanes
> during link"), the following error is observed on R-Car S4:
> 
>     ufshcd-renesas e6860000.ufs: Tx lane mismatch [config,reported] [2,1]
>     ufshcd-renesas e6860000.ufs: link startup failed -67
>     ufshcd-renesas e6860000.ufs: error -ENOLINK: Initialization failed with error -67
>     ufshcd-renesas e6860000.ufs: probe with driver ufshcd-renesas failed with error -67
> 
> [...]

Applied to 7.3/scsi-fixes, thanks!

[1/1] scsi: ufs: pltfrm: Add quirk for R-Car S4 lacking lanes-per-direction
      https://git.kernel.org/mkp/scsi/c/c9ee65113326

-- 
Martin K. Petersen