diff options
author | Rob Herring <rob.herring@calxeda.com> | 2011-11-08 15:43:47 -0500 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2011-12-27 16:52:44 -0500 |
commit | af71100c7acf3ccaf95044cd5e9e866178e5f8a1 (patch) | |
tree | c32418dff60d957bd44ecc20cf91d4c2ff088e38 /drivers/i2c | |
parent | 02bca5ff270774d4b4929de8b62ab96708065386 (diff) |
i2c-designware: add OF binding support
Add of_match_table and DT style i2c registration to designware i2c
driver.
Refactored for pci/plat split by Dirk Brandewie.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Dirk Brandewie <dirk.brandewie@gmail.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 2d3657ab1258..5244c4724df7 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/err.h> | 35 | #include <linux/err.h> |
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/of_i2c.h> | ||
37 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
38 | #include <linux/io.h> | 39 | #include <linux/io.h> |
39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
@@ -137,6 +138,7 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev) | |||
137 | sizeof(adap->name)); | 138 | sizeof(adap->name)); |
138 | adap->algo = &i2c_dw_algo; | 139 | adap->algo = &i2c_dw_algo; |
139 | adap->dev.parent = &pdev->dev; | 140 | adap->dev.parent = &pdev->dev; |
141 | adap->dev.of_node = pdev->dev.of_node; | ||
140 | 142 | ||
141 | adap->nr = pdev->id; | 143 | adap->nr = pdev->id; |
142 | r = i2c_add_numbered_adapter(adap); | 144 | r = i2c_add_numbered_adapter(adap); |
@@ -144,6 +146,7 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev) | |||
144 | dev_err(&pdev->dev, "failure adding adapter\n"); | 146 | dev_err(&pdev->dev, "failure adding adapter\n"); |
145 | goto err_free_irq; | 147 | goto err_free_irq; |
146 | } | 148 | } |
149 | of_i2c_register_devices(adap); | ||
147 | 150 | ||
148 | return 0; | 151 | return 0; |
149 | 152 | ||
@@ -187,6 +190,14 @@ static int __devexit dw_i2c_remove(struct platform_device *pdev) | |||
187 | return 0; | 190 | return 0; |
188 | } | 191 | } |
189 | 192 | ||
193 | #ifdef CONFIG_OF | ||
194 | static const struct of_device_id dw_i2c_of_match[] = { | ||
195 | { .compatible = "snps,designware-i2c", }, | ||
196 | {}, | ||
197 | }; | ||
198 | MODULE_DEVICE_TABLE(of, dw_i2c_of_match); | ||
199 | #endif | ||
200 | |||
190 | /* work with hotplug and coldplug */ | 201 | /* work with hotplug and coldplug */ |
191 | MODULE_ALIAS("platform:i2c_designware"); | 202 | MODULE_ALIAS("platform:i2c_designware"); |
192 | 203 | ||
@@ -195,6 +206,7 @@ static struct platform_driver dw_i2c_driver = { | |||
195 | .driver = { | 206 | .driver = { |
196 | .name = "i2c_designware", | 207 | .name = "i2c_designware", |
197 | .owner = THIS_MODULE, | 208 | .owner = THIS_MODULE, |
209 | .of_match_table = of_match_ptr(dw_i2c_of_match), | ||
198 | }, | 210 | }, |
199 | }; | 211 | }; |
200 | 212 | ||