* [PATCH] rtc: rtc-ds1742: Add devicetree support
@ 2013-11-14 12:32 Alexander Shiyan
2013-11-15 11:31 ` Mark Rutland
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-11-14 12:32 UTC (permalink / raw)
To: rtc-linux
Cc: Alessandro Zummo, linux-kernel, devicetree, Grant Likely,
Rob Herring, Pawel Moll, Mark Rutland, Stephen Warren,
Ian Campbell, Alexander Shiyan
This patch allows the driver to be enabled with devicetree.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
Documentation/devicetree/bindings/rtc/maxim,ds1742.txt | 14 ++++++++++++++
drivers/rtc/rtc-ds1742.c | 10 +++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
diff --git a/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt b/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
new file mode 100644
index 0000000..d2ddd71
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
@@ -0,0 +1,14 @@
+* Maxim (Dallas) DS1742/DS1743 Real Time Clock
+
+Register a Maxim DS1742-compatible RTC.
+
+Required properties:
+- compatible: Should be "maxim,ds1742".
+- reg: Physical base address of the RTC and length of memory
+ mapped region.
+
+Example:
+ rtc: rtc@10000000 {
+ compatible = "maxim,ds1742";
+ reg = <0x10000000 0x800>;
+ };
diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c
index 17b73fd..d7f74f5 100644
--- a/drivers/rtc/rtc-ds1742.c
+++ b/drivers/rtc/rtc-ds1742.c
@@ -13,12 +13,13 @@
*/
#include <linux/bcd.h>
-#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gfp.h>
#include <linux/delay.h>
#include <linux/jiffies.h>
#include <linux/rtc.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -215,12 +216,19 @@ static int ds1742_rtc_remove(struct platform_device *pdev)
return 0;
}
+static struct of_device_id __maybe_unused ds1742_rtc_of_match[] = {
+ { .compatible = "maxim,ds1742", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ds1742_rtc_of_match);
+
static struct platform_driver ds1742_rtc_driver = {
.probe = ds1742_rtc_probe,
.remove = ds1742_rtc_remove,
.driver = {
.name = "rtc-ds1742",
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(ds1742_rtc_of_match),
},
};
--
1.8.1.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: rtc-ds1742: Add devicetree support
2013-11-14 12:32 [PATCH] rtc: rtc-ds1742: Add devicetree support Alexander Shiyan
@ 2013-11-15 11:31 ` Mark Rutland
0 siblings, 0 replies; 2+ messages in thread
From: Mark Rutland @ 2013-11-15 11:31 UTC (permalink / raw)
To: Alexander Shiyan
Cc: rtc-linux, Alessandro Zummo, linux-kernel, devicetree,
grant.likely, rob.herring, Pawel Moll, Stephen Warren,
Ian Campbell
On Thu, Nov 14, 2013 at 12:32:42PM +0000, Alexander Shiyan wrote:
> This patch allows the driver to be enabled with devicetree.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> Documentation/devicetree/bindings/rtc/maxim,ds1742.txt | 14 ++++++++++++++
> drivers/rtc/rtc-ds1742.c | 10 +++++++++-
> 2 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
>
> diff --git a/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt b/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
> new file mode 100644
> index 0000000..d2ddd71
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rtc/maxim,ds1742.txt
> @@ -0,0 +1,14 @@
> +* Maxim (Dallas) DS1742/DS1743 Real Time Clock
> +
> +Register a Maxim DS1742-compatible RTC.
The driver registration has nothing to do with the binding.
Either add a brief description of the device or remove this line
entirely.
> +
> +Required properties:
> +- compatible: Should be "maxim,ds1742".
s/be/contain/
> +- reg: Physical base address of the RTC and length of memory
> + mapped region.
> +
> +Example:
> + rtc: rtc@10000000 {
> + compatible = "maxim,ds1742";
> + reg = <0x10000000 0x800>;
> + };
Otherwise this binding looks fine to me, with those changes.
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-15 11:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 12:32 [PATCH] rtc: rtc-ds1742: Add devicetree support Alexander Shiyan
2013-11-15 11:31 ` Mark Rutland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®