]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
rtc: mcp795: add devicetree support
authorEmil Bartczak <emilbart@gmail.com>
Mon, 21 Mar 2016 00:06:10 +0000 (01:06 +0100)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Mon, 21 Mar 2016 21:55:29 +0000 (22:55 +0100)
Add device tree support to the rtc-mcp795 driver.

Signed-off-by: Emil Bartczak <emilbart@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Documentation/devicetree/bindings/rtc/maxim,mcp795.txt [new file with mode: 0644]
drivers/rtc/rtc-mcp795.c

diff --git a/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt b/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt
new file mode 100644 (file)
index 0000000..a59fdd8
--- /dev/null
@@ -0,0 +1,11 @@
+* Maxim MCP795         SPI Serial Real-Time Clock
+
+Required properties:
+- compatible: Should contain "maxim,mcp795".
+- reg: SPI address for chip
+
+Example:
+       mcp795: rtc@0 {
+               compatible = "maxim,mcp795";
+               reg = <0>;
+       };
index 1c91ce8a6d75f339ff04e483e43fa6a1637e5484..025bb33b9cd2d0b9ae31499f33e92c55460e703a 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/printk.h>
 #include <linux/spi/spi.h>
 #include <linux/rtc.h>
+#include <linux/of.h>
 
 /* MCP795 Instructions, see datasheet table 3-1 */
 #define MCP795_EEREAD  0x03
@@ -183,9 +184,18 @@ static int mcp795_probe(struct spi_device *spi)
        return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id mcp795_of_match[] = {
+       { .compatible = "maxim,mcp795" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, mcp795_of_match);
+#endif
+
 static struct spi_driver mcp795_driver = {
                .driver = {
                                .name = "rtc-mcp795",
+                               .of_match_table = of_match_ptr(mcp795_of_match),
                },
                .probe = mcp795_probe,
 };