Commit 8c58d891 authored by Linus Walleij's avatar Linus Walleij

i2c: stu300: device tree support

This adds device tree support for the ST DDC I2C driver known
as "stu300" in the kernel tree.
Reviewed-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 978577ea
ST Microelectronics DDC I2C
Required properties :
- compatible : Must be "st,ddci2c"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: interrupt number to the cpu.
- #address-cells = <1>;
- #size-cells = <0>;
Optional properties:
- Child nodes conforming to i2c bus binding
Examples :
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of_i2c.h>
/* the name of this kernel module */ /* the name of this kernel module */
#define NAME "stu300" #define NAME "stu300"
...@@ -923,6 +924,7 @@ stu300_probe(struct platform_device *pdev) ...@@ -923,6 +924,7 @@ stu300_probe(struct platform_device *pdev)
adap->nr = bus_nr; adap->nr = bus_nr;
adap->algo = &stu300_algo; adap->algo = &stu300_algo;
adap->dev.parent = &pdev->dev; adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
i2c_set_adapdata(adap, dev); i2c_set_adapdata(adap, dev);
/* i2c device drivers may be active on return from add_adapter() */ /* i2c device drivers may be active on return from add_adapter() */
...@@ -934,6 +936,10 @@ stu300_probe(struct platform_device *pdev) ...@@ -934,6 +936,10 @@ stu300_probe(struct platform_device *pdev)
} }
platform_set_drvdata(pdev, dev); 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; return 0;
} }
...@@ -978,11 +984,17 @@ stu300_remove(struct platform_device *pdev) ...@@ -978,11 +984,17 @@ stu300_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id stu300_dt_match[] = {
{ .compatible = "st,ddci2c" },
{},
};
static struct platform_driver stu300_i2c_driver = { static struct platform_driver stu300_i2c_driver = {
.driver = { .driver = {
.name = NAME, .name = NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = STU300_I2C_PM, .pm = STU300_I2C_PM,
.of_match_table = stu300_dt_match,
}, },
.remove = __exit_p(stu300_remove), .remove = __exit_p(stu300_remove),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment