diff mbox series

[v2,2/3] i2c: xiic: defer the probe if clock is not found

Message ID 87adb91cc1a459dc6d523ed2c28123330ab6e49d.1578569758.git.shubhrajyoti.datta@xilinx.com
State Accepted
Headers show
Series [v2,1/3] i2c: xiic: Add timeout to the rx fifo wait loop | expand

Commit Message

Shubhrajyoti Datta Jan. 9, 2020, 11:37 a.m. UTC
From: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>

It's not always the case that clock is already available when i2c
driver get probed at the first time, e.g. the clock is provided by
clock wizard which may be probed after i2c driver. So let's defer
the probe when devm_clk_get() call fails and give it chance to
try later.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/i2c/busses/i2c-xiic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Wolfram Sang Jan. 15, 2020, 8:14 p.m. UTC | #1
On Thu, Jan 09, 2020 at 05:07:59PM +0530, shubhrajyoti.datta@gmail.com wrote:
> From: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
> 
> It's not always the case that clock is already available when i2c
> driver get probed at the first time, e.g. the clock is provided by
> clock wizard which may be probed after i2c driver. So let's defer
> the probe when devm_clk_get() call fails and give it chance to
> try later.
> 
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 700b401..7d2a8c1 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -788,7 +788,8 @@  static int xiic_i2c_probe(struct platform_device *pdev)
 
 	i2c->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(i2c->clk)) {
-		dev_err(&pdev->dev, "input clock not found.\n");
+		if (PTR_ERR(i2c->clk) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "input clock not found.\n");
 		return PTR_ERR(i2c->clk);
 	}
 	ret = clk_prepare_enable(i2c->clk);