Thread (35 messages) 35 messages, 3 authors, 2021-03-19
STALE1932d REVIEWED: 1 (0M)
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 05/11] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work

From: Clark Wang <xiaoning.wang@nxp.com>
Date: 2021-03-17 06:54:57
Also in: linux-i2c, lkml
Subsystem: freescale imx lpi2c driver, i2c subsystem, i2c subsystem host drivers, the rest · Maintainers: Dong Aisheng, Andi Shyti, Linus Torvalds

From: Gao Pan <redacted>

add debug message when i2c peripheral clk rate is 0, then
directly return -EINVAL.

Signed-off-by: Gao Pan <redacted>
Reviewed-by: Andy Duan <redacted>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index e718bb6b2387..8f9dd3dd2951 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -209,7 +209,12 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
 
 	lpi2c_imx_set_mode(lpi2c_imx);
 
-	clk_rate = clk_get_rate(lpi2c_imx->clk);
+	clk_rate = clk_get_rate(lpi2c_imx->clk_per);
+	if (!clk_rate) {
+		dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n");
+		return -EINVAL;
+	}
+
 	if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
 		filt = 0;
 	else
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help