[2/2] i2c: iop3xx: Add device tree probing

Message ID 20190128222534.32213-2-linus.walleij@linaro.org
State New
Headers show
Series
  • Untitled series #18202
Related show

Commit Message

Linus Walleij Jan. 28, 2019, 10:25 p.m.
This adds device tree probing support for the IOP3xx
I2C master.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/i2c/busses/i2c-iop3xx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.20.1

Comments

Wolfram Sang Feb. 5, 2019, 12:50 p.m. | #1
On Mon, Jan 28, 2019 at 11:25:34PM +0100, Linus Walleij wrote:
> This adds device tree probing support for the IOP3xx

> I2C master.

> 

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Applied to for-next, thanks!

Just... where on earth did you find a DT-enabled device with this IP
core? :)
Linus Walleij Feb. 5, 2019, 1 p.m. | #2
On Tue, Feb 5, 2019 at 1:50 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> On Mon, Jan 28, 2019 at 11:25:34PM +0100, Linus Walleij wrote:

> > This adds device tree probing support for the IOP3xx

> > I2C master.

> >

> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

>

> Applied to for-next, thanks!


Thanks!

> Just... where on earth did you find a DT-enabled device with this IP

> core? :)


This IP core is used in the IXP5xx and IXP6xx which is used by a
the ADI Engineering Sidewinder board for routers, which is supported
currently by OpenWrt, it goes upstream sooner or later.

Yours,
Linus Walleij
Wolfram Sang Feb. 5, 2019, 1:03 p.m. | #3
> This IP core is used in the IXP5xx and IXP6xx which is used by a

> the ADI Engineering Sidewinder board for routers, which is supported

> currently by OpenWrt, it goes upstream sooner or later.


Cool, a user! This driver definately needs some love.

Patch

diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 85cbe4b55578..a34cb3848280 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -471,6 +471,7 @@  iop3xx_i2c_probe(struct platform_device *pdev)
 	new_adapter->owner = THIS_MODULE;
 	new_adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
 	new_adapter->dev.parent = &pdev->dev;
+	new_adapter->dev.of_node = pdev->dev.of_node;
 	new_adapter->nr = pdev->id;
 
 	/*
@@ -508,12 +509,19 @@  iop3xx_i2c_probe(struct platform_device *pdev)
 	return ret;
 }
 
+static const struct of_device_id i2c_iop3xx_match[] = {
+	{ .compatible = "intel,iop3xx-i2c", },
+	{ .compatible = "intel,ixp4xx-i2c", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, i2c_iop3xx_match);
 
 static struct platform_driver iop3xx_i2c_driver = {
 	.probe		= iop3xx_i2c_probe,
 	.remove		= iop3xx_i2c_remove,
 	.driver		= {
 		.name	= "IOP3xx-I2C",
+		.of_match_table = i2c_iop3xx_match,
 	},
 };