Commit 7f8a5892 authored by Emil Bartczak's avatar Emil Bartczak Committed by Alexandre Belloni

rtc: mcp795: add devicetree support

Add device tree support to the rtc-mcp795 driver.
Signed-off-by: default avatarEmil Bartczak <emilbart@gmail.com>
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 15c6ea6f
* 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>;
};
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/rtc.h> #include <linux/rtc.h>
#include <linux/of.h>
/* MCP795 Instructions, see datasheet table 3-1 */ /* MCP795 Instructions, see datasheet table 3-1 */
#define MCP795_EEREAD 0x03 #define MCP795_EEREAD 0x03
...@@ -183,9 +184,18 @@ static int mcp795_probe(struct spi_device *spi) ...@@ -183,9 +184,18 @@ static int mcp795_probe(struct spi_device *spi)
return 0; 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 = { static struct spi_driver mcp795_driver = {
.driver = { .driver = {
.name = "rtc-mcp795", .name = "rtc-mcp795",
.of_match_table = of_match_ptr(mcp795_of_match),
}, },
.probe = mcp795_probe, .probe = mcp795_probe,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment