summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-stu300.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 0a6f941133f6..d1a6b204af00 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -17,6 +17,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/of_i2c.h>
/* the name of this kernel module */
#define NAME "stu300"
@@ -867,7 +868,6 @@ stu300_probe(struct platform_device *pdev)
struct resource *res;
int bus_nr;
int ret = 0;
- char clk_name[] = "I2C0";
dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL);
if (!dev) {
@@ -876,8 +876,7 @@ stu300_probe(struct platform_device *pdev)
}
bus_nr = pdev->id;
- clk_name[3] += (char)bus_nr;
- dev->clk = devm_clk_get(&pdev->dev, clk_name);
+ dev->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(dev->clk)) {
dev_err(&pdev->dev, "could not retrieve i2c bus clock\n");
return PTR_ERR(dev->clk);
@@ -923,6 +922,7 @@ stu300_probe(struct platform_device *pdev)
adap->nr = bus_nr;
adap->algo = &stu300_algo;
adap->dev.parent = &pdev->dev;
+ adap->dev.of_node = pdev->dev.of_node;
i2c_set_adapdata(adap, dev);
/* i2c device drivers may be active on return from add_adapter() */
@@ -934,6 +934,10 @@ stu300_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, dev);
+ dev_info(&pdev->dev, "ST DDC I2C @ %p, irq %d\n",
+ dev->virtbase, dev->irq);
+ of_i2c_register_devices(adap);
+
return 0;
}
@@ -978,11 +982,17 @@ stu300_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id stu300_dt_match[] = {
+ { .compatible = "st,ddci2c" },
+ {},
+};
+
static struct platform_driver stu300_i2c_driver = {
.driver = {
.name = NAME,
.owner = THIS_MODULE,
.pm = STU300_I2C_PM,
+ .of_match_table = stu300_dt_match,
},
.remove = __exit_p(stu300_remove),