* [rtc-linux] [PATCH] rtc: rtc-ds3232: add device tree support
@ 2016-11-28 7:06 Peter Robinson
2016-11-28 8:24 ` [rtc-linux] " Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Peter Robinson @ 2016-11-28 7:06 UTC (permalink / raw)
To: Alessandro Zummo, Alexandre Belloni, rtc-linux; +Cc: Peter Robinson
Set the of_match_table for this driver so that devices can be described in
the device tree. This device is used in a number of NXP devices as well as
the CryptoCap and is already defined in the various device trees.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
drivers/rtc/rtc-ds3232.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
index b1f20d8..711cc5b 100644
--- a/drivers/rtc/rtc-ds3232.c
+++ b/drivers/rtc/rtc-ds3232.c
@@ -15,6 +15,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/interrupt.h>
#include <linux/i2c.h>
#include <linux/spi/spi.h>
@@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = {
};
MODULE_DEVICE_TABLE(i2c, ds3232_id);
+#ifdef CONFIG_OF
+static const struct of_device_id ds3232_of_match[] = {
+ { .compatible = "dallas,ds3232", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ds3232_of_match);
+#endif
+
static struct i2c_driver ds3232_driver = {
.driver = {
.name = "rtc-ds3232",
+ .of_match_table = of_match_ptr(ds3232_of_match),
.pm = &ds3232_pm_ops,
},
.probe = ds3232_i2c_probe,
--
2.9.3
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [rtc-linux] Re: [PATCH] rtc: rtc-ds3232: add device tree support
2016-11-28 7:06 [rtc-linux] [PATCH] rtc: rtc-ds3232: add device tree support Peter Robinson
@ 2016-11-28 8:24 ` Alexandre Belloni
2016-11-28 8:31 ` Peter Robinson
0 siblings, 1 reply; 4+ messages in thread
From: Alexandre Belloni @ 2016-11-28 8:24 UTC (permalink / raw)
To: Peter Robinson; +Cc: Alessandro Zummo, rtc-linux
Hi,
On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote :
> Set the of_match_table for this driver so that devices can be described in
> the device tree. This device is used in a number of NXP devices as well as
> the CryptoCap and is already defined in the various device trees.
>
This is useless (as you mention it is already used in various device
trees) as it will already be probed properly using the "dallas,ds3232"
compatible string.
> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> ---
> drivers/rtc/rtc-ds3232.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
> index b1f20d8..711cc5b 100644
> --- a/drivers/rtc/rtc-ds3232.c
> +++ b/drivers/rtc/rtc-ds3232.c
> @@ -15,6 +15,7 @@
>
> #include <linux/kernel.h>
> #include <linux/module.h>
> +#include <linux/of.h>
> #include <linux/interrupt.h>
> #include <linux/i2c.h>
> #include <linux/spi/spi.h>
> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = {
> };
> MODULE_DEVICE_TABLE(i2c, ds3232_id);
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id ds3232_of_match[] = {
> + { .compatible = "dallas,ds3232", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, ds3232_of_match);
> +#endif
> +
> static struct i2c_driver ds3232_driver = {
> .driver = {
> .name = "rtc-ds3232",
> + .of_match_table = of_match_ptr(ds3232_of_match),
> .pm = &ds3232_pm_ops,
> },
> .probe = ds3232_i2c_probe,
> --
> 2.9.3
>
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [rtc-linux] Re: [PATCH] rtc: rtc-ds3232: add device tree support
2016-11-28 8:24 ` [rtc-linux] " Alexandre Belloni
@ 2016-11-28 8:31 ` Peter Robinson
2016-11-28 8:39 ` Alexandre Belloni
0 siblings, 1 reply; 4+ messages in thread
From: Peter Robinson @ 2016-11-28 8:31 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: Alessandro Zummo, rtc-linux
On Mon, Nov 28, 2016 at 8:24 AM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> Hi,
>
> On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote :
>> Set the of_match_table for this driver so that devices can be described in
>> the device tree. This device is used in a number of NXP devices as well as
>> the CryptoCap and is already defined in the various device trees.
>>
>
> This is useless (as you mention it is already used in various device
> trees) as it will already be probed properly using the "dallas,ds3232"
> compatible string.
Why? The driver doesn't currently set the compatible string.
>> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
>> ---
>> drivers/rtc/rtc-ds3232.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
>> index b1f20d8..711cc5b 100644
>> --- a/drivers/rtc/rtc-ds3232.c
>> +++ b/drivers/rtc/rtc-ds3232.c
>> @@ -15,6 +15,7 @@
>>
>> #include <linux/kernel.h>
>> #include <linux/module.h>
>> +#include <linux/of.h>
>> #include <linux/interrupt.h>
>> #include <linux/i2c.h>
>> #include <linux/spi/spi.h>
>> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = {
>> };
>> MODULE_DEVICE_TABLE(i2c, ds3232_id);
>>
>> +#ifdef CONFIG_OF
>> +static const struct of_device_id ds3232_of_match[] = {
>> + { .compatible = "dallas,ds3232", },
>> + { }
>> +};
>> +MODULE_DEVICE_TABLE(of, ds3232_of_match);
>> +#endif
>> +
>> static struct i2c_driver ds3232_driver = {
>> .driver = {
>> .name = "rtc-ds3232",
>> + .of_match_table = of_match_ptr(ds3232_of_match),
>> .pm = &ds3232_pm_ops,
>> },
>> .probe = ds3232_i2c_probe,
>> --
>> 2.9.3
>>
>
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [rtc-linux] Re: [PATCH] rtc: rtc-ds3232: add device tree support
2016-11-28 8:31 ` Peter Robinson
@ 2016-11-28 8:39 ` Alexandre Belloni
0 siblings, 0 replies; 4+ messages in thread
From: Alexandre Belloni @ 2016-11-28 8:39 UTC (permalink / raw)
To: Peter Robinson; +Cc: Alessandro Zummo, rtc-linux
On 28/11/2016 at 08:31:20 +0000, Peter Robinson wrote :
> On Mon, Nov 28, 2016 at 8:24 AM, Alexandre Belloni
> <alexandre.belloni@free-electrons.com> wrote:
> > Hi,
> >
> > On 28/11/2016 at 07:06:44 +0000, Peter Robinson wrote :
> >> Set the of_match_table for this driver so that devices can be described in
> >> the device tree. This device is used in a number of NXP devices as well as
> >> the CryptoCap and is already defined in the various device trees.
> >>
> >
> > This is useless (as you mention it is already used in various device
> > trees) as it will already be probed properly using the "dallas,ds3232"
> > compatible string.
>
> Why? The driver doesn't currently set the compatible string.
>
The i2c core does that for you using the i2c_device_id array.
> >> Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
> >> ---
> >> drivers/rtc/rtc-ds3232.c | 10 ++++++++++
> >> 1 file changed, 10 insertions(+)
> >>
> >> diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c
> >> index b1f20d8..711cc5b 100644
> >> --- a/drivers/rtc/rtc-ds3232.c
> >> +++ b/drivers/rtc/rtc-ds3232.c
> >> @@ -15,6 +15,7 @@
> >>
> >> #include <linux/kernel.h>
> >> #include <linux/module.h>
> >> +#include <linux/of.h>
> >> #include <linux/interrupt.h>
> >> #include <linux/i2c.h>
> >> #include <linux/spi/spi.h>
> >> @@ -438,9 +439,18 @@ static const struct i2c_device_id ds3232_id[] = {
> >> };
> >> MODULE_DEVICE_TABLE(i2c, ds3232_id);
> >>
> >> +#ifdef CONFIG_OF
> >> +static const struct of_device_id ds3232_of_match[] = {
> >> + { .compatible = "dallas,ds3232", },
> >> + { }
> >> +};
> >> +MODULE_DEVICE_TABLE(of, ds3232_of_match);
> >> +#endif
> >> +
> >> static struct i2c_driver ds3232_driver = {
> >> .driver = {
> >> .name = "rtc-ds3232",
> >> + .of_match_table = of_match_ptr(ds3232_of_match),
> >> .pm = &ds3232_pm_ops,
> >> },
> >> .probe = ds3232_i2c_probe,
> >> --
> >> 2.9.3
> >>
> >
> > --
> > Alexandre Belloni, Free Electrons
> > Embedded Linux and Kernel engineering
> > http://free-electrons.com
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-28 8:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28 7:06 [rtc-linux] [PATCH] rtc: rtc-ds3232: add device tree support Peter Robinson
2016-11-28 8:24 ` [rtc-linux] " Alexandre Belloni
2016-11-28 8:31 ` Peter Robinson
2016-11-28 8:39 ` Alexandre Belloni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.