From 7b340aa70dbea4096f949a9ddceb169079a0603b Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Thu, 4 Apr 2024 17:03:33 +0100
Subject: [PATCH 1003/1085] i2c: designware: Make the SDA hold time half LCNT

In the absence of a value in Device Tree, set the SDA hold time to half
the SCL low time.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 drivers/i2c/busses/i2c-designware-master.c | 3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -194,6 +194,9 @@ static int i2c_dw_set_timings_master(str
 			dev->hs_hcnt, dev->hs_lcnt);
 	}
 
+	if (!dev->sda_hold_time)
+		dev->sda_hold_time = lcnt / 2;
+
 	ret = i2c_dw_set_sda_hold(dev);
 	if (ret)
 		return ret;
