Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/rtc-pcf2123.c: add support for devicetree

Add compatible string "nxp,rtc-pcf2123"
Document the binding

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Joshua Clayton and committed by
Linus Torvalds
3fc70077 69d54b91

+26
+16
Documentation/devicetree/bindings/rtc/nxp,rtc-2123.txt
··· 1 + NXP PCF2123 SPI Real Time Clock 2 + 3 + Required properties: 4 + - compatible: should be: "nxp,rtc-pcf2123" 5 + - reg: should be the SPI slave chipselect address 6 + 7 + Optional properties: 8 + - spi-cs-high: PCF2123 needs chipselect high 9 + 10 + Example: 11 + 12 + rtc: nxp,rtc-pcf2123@3 { 13 + compatible = "nxp,rtc-pcf2123" 14 + reg = <3> 15 + spi-cs-high; 16 + };
+10
drivers/rtc/rtc-pcf2123.c
··· 38 38 #include <linux/errno.h> 39 39 #include <linux/init.h> 40 40 #include <linux/kernel.h> 41 + #include <linux/of.h> 41 42 #include <linux/string.h> 42 43 #include <linux/slab.h> 43 44 #include <linux/rtc.h> ··· 341 340 return 0; 342 341 } 343 342 343 + #ifdef CONFIG_OF 344 + static const struct of_device_id pcf2123_dt_ids[] = { 345 + { .compatible = "nxp,rtc-pcf2123", }, 346 + { /* sentinel */ } 347 + }; 348 + MODULE_DEVICE_TABLE(of, pcf2123_dt_ids); 349 + #endif 350 + 344 351 static struct spi_driver pcf2123_driver = { 345 352 .driver = { 346 353 .name = "rtc-pcf2123", 347 354 .owner = THIS_MODULE, 355 + .of_match_table = of_match_ptr(pcf2123_dt_ids), 348 356 }, 349 357 .probe = pcf2123_probe, 350 358 .remove = pcf2123_remove,