* [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver
@ 2011-09-08 9:43 Pawel Moll
[not found] ` <1315475019-10088-1-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Pawel Moll @ 2011-09-08 9:43 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-mnsaURCQ41sdnm+yROfE0A
Cc: Pawel Moll, Russell King
This patch adds Device Tree binding ("arm,versatile-i2c") and
basic support (bus population) to versatile-i2c driver.
Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Signed-off-by: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
---
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..7bfdf40 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 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,
},
};
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver
[not found] ` <1315475019-10088-1-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
@ 2011-09-14 21:15 ` Ben Dooks
[not found] ` <20110914211556.GB2146-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
2011-11-01 9:23 ` Pawel Moll
1 sibling, 1 reply; 5+ messages in thread
From: Ben Dooks @ 2011-09-14 21:15 UTC (permalink / raw)
To: Pawel Moll
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-mnsaURCQ41sdnm+yROfE0A, Russell King
On Thu, Sep 08, 2011 at 10:43:39AM +0100, Pawel Moll wrote:
> This patch adds Device Tree binding ("arm,versatile-i2c") and
> basic support (bus population) to versatile-i2c driver.
what happens when !CONFIG_OF ?
> Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Signed-off-by: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> ---
> 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..7bfdf40 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 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,
> },
> };
>
> --
> 1.6.3.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver
[not found] ` <20110914211556.GB2146-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
@ 2011-09-15 8:55 ` Pawel Moll
0 siblings, 0 replies; 5+ messages in thread
From: Pawel Moll @ 2011-09-15 8:55 UTC (permalink / raw)
To: Ben Dooks
Cc: Russell King, devicetree-discuss-mnsaURCQ41sdnm+yROfE0A,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
Morning,
> > This patch adds Device Tree binding ("arm,versatile-i2c") and
> > basic support (bus population) to versatile-i2c driver.
>
> what happens when !CONFIG_OF ?
Nothing sinister, really...
> > @@ -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;
include/linux/device.h:551
struct device {
<...>
struct dev_archdata archdata;
struct device_node *of_node; /* associated device tree node */
dev_t devt; /* dev_t, creates the sysfs "dev" */
<...>
}
As you see of_node is always present...
> > @@ -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;
> > }
include/linux/of_i2c.h:
#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
<...>
#else
static inline void of_i2c_register_devices(struct i2c_adapter *adap)
{
return;
}
#endif /* CONFIG_OF_I2C */
> > @@ -133,12 +136,19 @@ static int i2c_versatile_remove(struct platform_device *dev)
> > return 0;
> > }
> >
> > +static 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,
> > },
> > };
include/linux/device.h:185:
struct device_driver {
<...>
bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
const struct of_device_id *of_match_table;
int (*probe) (struct device *dev);
<...>
}
Same here.
Generally Grant claims that there is no more need for #ifdef CONFIG_OF,
and I trust him :-)
Cheers!
Paweł
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver
[not found] ` <1315475019-10088-1-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-09-14 21:15 ` Ben Dooks
@ 2011-11-01 9:23 ` Pawel Moll
[not found] ` <1320139394.3287.121.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Pawel Moll @ 2011-11-01 9:23 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Hi Ben,
On Thu, 2011-09-08 at 10:43 +0100, Pawel Moll wrote:
> This patch adds Device Tree binding ("arm,versatile-i2c") and
> basic support (bus population) to versatile-i2c driver.
>
> Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> Signed-off-by: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> ---
> drivers/i2c/busses/i2c-versatile.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
I guess I missed the 3.2 bus? Any chance to get it in later, around rc1
maybe?
cheers!
Paweł
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver
[not found] ` <1320139394.3287.121.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
@ 2011-11-29 9:23 ` Pawel Moll
0 siblings, 0 replies; 5+ messages in thread
From: Pawel Moll @ 2011-11-29 9:23 UTC (permalink / raw)
To: Ben Dooks; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Morning,
On Tue, 2011-11-01 at 09:23 +0000, Pawel Moll wrote:
> Hi Ben,
>
> On Thu, 2011-09-08 at 10:43 +0100, Pawel Moll wrote:
> > This patch adds Device Tree binding ("arm,versatile-i2c") and
> > basic support (bus population) to versatile-i2c driver.
> >
> > Cc: Russell King <rmk+kernel-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
> > Signed-off-by: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> > ---
> > drivers/i2c/busses/i2c-versatile.c | 10 ++++++++++
> > 1 files changed, 10 insertions(+), 0 deletions(-)
>
> I guess I missed the 3.2 bus? Any chance to get it in later, around rc1
> maybe?
How about 3.3 then? ;-)
Cheers!
Paweł
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-29 9:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-08 9:43 [PATCH v2] i2c: Add Device Tree support to versatile-i2c driver Pawel Moll
[not found] ` <1315475019-10088-1-git-send-email-pawel.moll-5wv7dgnIgG8@public.gmane.org>
2011-09-14 21:15 ` Ben Dooks
[not found] ` <20110914211556.GB2146-RazCHl0VsYgkUSuvROHNpA@public.gmane.org>
2011-09-15 8:55 ` Pawel Moll
2011-11-01 9:23 ` Pawel Moll
[not found] ` <1320139394.3287.121.camel-okZbbLrgpR/YkXV2EHHjLW3o5bpOHsLO@public.gmane.org>
2011-11-29 9:23 ` Pawel Moll
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).