diff options
author | Pawel Moll <pawel.moll@arm.com> | 2012-02-23 13:17:21 -0500 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-02-24 16:25:07 -0500 |
commit | 237ab4062d084a3350ff2516d1b39401b2cb87c6 (patch) | |
tree | 6d8c7ed8ec65aca1f8fb6f775817a8d5b2d7cab1 /drivers/i2c/busses/i2c-versatile.c | |
parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) |
i2c: versatile: Add Device Tree support
This patch adds Device Tree binding ("arm,versatile-i2c") and
basic support (bus population) to versatile-i2c driver.
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
[wsa: constified match-table]
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-versatile.c')
-rw-r--r-- | drivers/i2c/busses/i2c-versatile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c index 60556012312f..f585aead50cc 100644 --- a/drivers/i2c/busses/i2c-versatile.c +++ b/drivers/i2c/busses/i2c-versatile.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/of_i2c.h> | ||
19 | 20 | ||
20 | #define I2C_CONTROL 0x00 | 21 | #define I2C_CONTROL 0x00 |
21 | #define I2C_CONTROLS 0x00 | 22 | #define I2C_CONTROLS 0x00 |
@@ -99,6 +100,7 @@ static int i2c_versatile_probe(struct platform_device *dev) | |||
99 | strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); | 100 | strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); |
100 | i2c->adap.algo_data = &i2c->algo; | 101 | i2c->adap.algo_data = &i2c->algo; |
101 | i2c->adap.dev.parent = &dev->dev; | 102 | i2c->adap.dev.parent = &dev->dev; |
103 | i2c->adap.dev.of_node = dev->dev.of_node; | ||
102 | i2c->algo = i2c_versatile_algo; | 104 | i2c->algo = i2c_versatile_algo; |
103 | i2c->algo.data = i2c; | 105 | i2c->algo.data = i2c; |
104 | 106 | ||
@@ -111,6 +113,7 @@ static int i2c_versatile_probe(struct platform_device *dev) | |||
111 | ret = i2c_bit_add_bus(&i2c->adap); | 113 | ret = i2c_bit_add_bus(&i2c->adap); |
112 | if (ret >= 0) { | 114 | if (ret >= 0) { |
113 | platform_set_drvdata(dev, i2c); | 115 | platform_set_drvdata(dev, i2c); |
116 | of_i2c_register_devices(&i2c->adap); | ||
114 | return 0; | 117 | return 0; |
115 | } | 118 | } |
116 | 119 | ||
@@ -133,12 +136,19 @@ static int i2c_versatile_remove(struct platform_device *dev) | |||
133 | return 0; | 136 | return 0; |
134 | } | 137 | } |
135 | 138 | ||
139 | static const struct of_device_id i2c_versatile_match[] = { | ||
140 | { .compatible = "arm,versatile-i2c", }, | ||
141 | {}, | ||
142 | }; | ||
143 | MODULE_DEVICE_TABLE(of, i2c_versatile_match); | ||
144 | |||
136 | static struct platform_driver i2c_versatile_driver = { | 145 | static struct platform_driver i2c_versatile_driver = { |
137 | .probe = i2c_versatile_probe, | 146 | .probe = i2c_versatile_probe, |
138 | .remove = i2c_versatile_remove, | 147 | .remove = i2c_versatile_remove, |
139 | .driver = { | 148 | .driver = { |
140 | .name = "versatile-i2c", | 149 | .name = "versatile-i2c", |
141 | .owner = THIS_MODULE, | 150 | .owner = THIS_MODULE, |
151 | .of_match_table = i2c_versatile_match, | ||
142 | }, | 152 | }, |
143 | }; | 153 | }; |
144 | 154 | ||