diff options
| -rw-r--r-- | Documentation/devicetree/bindings/rtc/maxim,mcp795.txt | 11 | ||||
| -rw-r--r-- | drivers/rtc/rtc-mcp795.c | 10 |
2 files changed, 21 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt b/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt new file mode 100644 index 000000000000..a59fdd8c236d --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/maxim,mcp795.txt | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | * Maxim MCP795 SPI Serial Real-Time Clock | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: Should contain "maxim,mcp795". | ||
| 5 | - reg: SPI address for chip | ||
| 6 | |||
| 7 | Example: | ||
| 8 | mcp795: rtc@0 { | ||
| 9 | compatible = "maxim,mcp795"; | ||
| 10 | reg = <0>; | ||
| 11 | }; | ||
diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c index 1c91ce8a6d75..025bb33b9cd2 100644 --- a/drivers/rtc/rtc-mcp795.c +++ b/drivers/rtc/rtc-mcp795.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/printk.h> | 20 | #include <linux/printk.h> |
| 21 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
| 22 | #include <linux/rtc.h> | 22 | #include <linux/rtc.h> |
| 23 | #include <linux/of.h> | ||
| 23 | 24 | ||
| 24 | /* MCP795 Instructions, see datasheet table 3-1 */ | 25 | /* MCP795 Instructions, see datasheet table 3-1 */ |
| 25 | #define MCP795_EEREAD 0x03 | 26 | #define MCP795_EEREAD 0x03 |
| @@ -183,9 +184,18 @@ static int mcp795_probe(struct spi_device *spi) | |||
| 183 | return 0; | 184 | return 0; |
| 184 | } | 185 | } |
| 185 | 186 | ||
| 187 | #ifdef CONFIG_OF | ||
| 188 | static const struct of_device_id mcp795_of_match[] = { | ||
| 189 | { .compatible = "maxim,mcp795" }, | ||
| 190 | { } | ||
| 191 | }; | ||
| 192 | MODULE_DEVICE_TABLE(of, mcp795_of_match); | ||
| 193 | #endif | ||
| 194 | |||
| 186 | static struct spi_driver mcp795_driver = { | 195 | static struct spi_driver mcp795_driver = { |
| 187 | .driver = { | 196 | .driver = { |
| 188 | .name = "rtc-mcp795", | 197 | .name = "rtc-mcp795", |
| 198 | .of_match_table = of_match_ptr(mcp795_of_match), | ||
| 189 | }, | 199 | }, |
| 190 | .probe = mcp795_probe, | 200 | .probe = mcp795_probe, |
| 191 | }; | 201 | }; |
