diff options
author | Pawel Moll <pawel.moll@arm.com> | 2012-02-23 18:17:21 +0000 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-02-24 22:25:07 +0100 |
commit | 237ab4062d084a3350ff2516d1b39401b2cb87c6 (patch) | |
tree | 6d8c7ed8ec65aca1f8fb6f775817a8d5b2d7cab1 /drivers/i2c | |
parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) | |
download | op-kernel-dev-237ab4062d084a3350ff2516d1b39401b2cb87c6.zip op-kernel-dev-237ab4062d084a3350ff2516d1b39401b2cb87c6.tar.gz |
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')
-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 6055601..f585aea 100644 --- a/drivers/i2c/busses/i2c-versatile.c +++ b/drivers/i2c/busses/i2c-versatile.c @@ -16,6 +16,7 @@ #include <linux/platform_device.h> #include <linux/slab.h> #include <linux/io.h> +#include <linux/of_i2c.h> #define I2C_CONTROL 0x00 #define I2C_CONTROLS 0x00 @@ -99,6 +100,7 @@ static int i2c_versatile_probe(struct platform_device *dev) strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); i2c->adap.algo_data = &i2c->algo; i2c->adap.dev.parent = &dev->dev; + i2c->adap.dev.of_node = dev->dev.of_node; i2c->algo = i2c_versatile_algo; i2c->algo.data = i2c; @@ -111,6 +113,7 @@ static int i2c_versatile_probe(struct platform_device *dev) ret = i2c_bit_add_bus(&i2c->adap); if (ret >= 0) { platform_set_drvdata(dev, i2c); + of_i2c_register_devices(&i2c->adap); return 0; } @@ -133,12 +136,19 @@ static int i2c_versatile_remove(struct platform_device *dev) return 0; } +static const struct of_device_id i2c_versatile_match[] = { + { .compatible = "arm,versatile-i2c", }, + {}, +}; +MODULE_DEVICE_TABLE(of, i2c_versatile_match); + static struct platform_driver i2c_versatile_driver = { .probe = i2c_versatile_probe, .remove = i2c_versatile_remove, .driver = { .name = "versatile-i2c", .owner = THIS_MODULE, + .of_match_table = i2c_versatile_match, }, }; |