From: Abdurrahman Hussain <abdurrahman@nexthop.ai>
The xiic driver is designed to operate without explicit clock configuration
when clocks are not specified in the firmware. This functionality is
already implemented in xiic_setclk(), which performs an early return when
either i2c_clk or input_clk are zero:
This condition is satisfied when clocks are missing, as clk_get_rate(NULL)
returns zero, allowing the driver to rely on hardware-configured timing.
Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
---
drivers/i2c/busses/i2c-xiic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 28015d77599d..603a246a1445 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -1464,7 +1464,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
mutex_init(&i2c->lock);
spin_lock_init(&i2c->atomic_lock);
- i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL);
+ i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
if (IS_ERR(i2c->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
"failed to enable input clock.\n");
--
2.52.0
On Fri, Jan 23, 2026 at 08:02:44AM +0000, Abdurrahman Hussain via B4 Relay wrote: > From: Abdurrahman Hussain <abdurrahman@nexthop.ai> > > The xiic driver is designed to operate without explicit clock configuration > when clocks are not specified in the firmware. This functionality is > already implemented in xiic_setclk(), which performs an early return when > either i2c_clk or input_clk are zero: > > This condition is satisfied when clocks are missing, as clk_get_rate(NULL) > returns zero, allowing the driver to rely on hardware-configured timing. https://elixir.bootlin.com/linux/v6.18.6/source/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml#L42 The binding indicates the clock is required. You need to update the binding to match the code. Andrew
On Fri Jan 23, 2026 at 7:20 PM UTC, Andrew Lunn wrote: > On Fri, Jan 23, 2026 at 08:02:44AM +0000, Abdurrahman Hussain via B4 Relay wrote: >> From: Abdurrahman Hussain <abdurrahman@nexthop.ai> >> >> The xiic driver is designed to operate without explicit clock configuration >> when clocks are not specified in the firmware. This functionality is >> already implemented in xiic_setclk(), which performs an early return when >> either i2c_clk or input_clk are zero: >> >> This condition is satisfied when clocks are missing, as clk_get_rate(NULL) >> returns zero, allowing the driver to rely on hardware-configured timing. > > https://elixir.bootlin.com/linux/v6.18.6/source/Documentation/devicetree/bindings/i2c/xlnx,xps-iic-2.00.a.yaml#L42 > > The binding indicates the clock is required. You need to update the > binding to match the code. > > Andrew Absolutely! Let me take care of it in v5. Will add the doc change before the code changes. Abdurrahman
On Fri, Jan 23, 2026 at 08:02:44AM +0000, Abdurrahman Hussain via B4 Relay wrote: > The xiic driver is designed to operate without explicit clock configuration > when clocks are not specified in the firmware. This functionality is > already implemented in xiic_setclk(), which performs an early return when > either i2c_clk or input_clk are zero: > > This condition is satisfied when clocks are missing, as clk_get_rate(NULL) > returns zero, allowing the driver to rely on hardware-configured timing. ... > mutex_init(&i2c->lock); > spin_lock_init(&i2c->atomic_lock); > > - i2c->clk = devm_clk_get_enabled(&pdev->dev, NULL); > + i2c->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); You also need to have struct device *dev = &pdev->dev; in *this* patch. > if (IS_ERR(i2c->clk)) > return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk), > "failed to enable input clock.\n"); -- With Best Regards, Andy Shevchenko
© 2016 - 2026 Red Hat, Inc.