OSDN Git Service

rtc: ds1307: add basic support for ds1341 chip
authorNikita Yushchenko <nikita.yoush@cogentembedded.com>
Thu, 24 Aug 2017 06:32:11 +0000 (09:32 +0300)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 31 Aug 2017 23:10:18 +0000 (01:10 +0200)
commit0759c886f4fbaadd1ea6a67a1e442207d6215f0d
tree2b1922937e52aed4514acbd2033156b2121eed78
parent969fa07b9479f435bc4363e4ff75db99fc9b24fb
rtc: ds1307: add basic support for ds1341 chip

This adds support for reading and writing date/time from/to ds1341 chip.

ds1341 chip has other features - alarms, input clock (can be used instead
of intercal oscillator for better accuracy), output clock ("square wave
generation"). However, not all of that is available at the same time.
Same chip pins, CLKIN/nINTA and SQW/nINTB, can be used either for
input/output clocks, or for alarm interrupts. Role of these pins on
particular board depends on hardware wiring.

We can add device tree properties that describe if each of pins is wired
as clock, or as interrupt, or left unconnected, and enable support for
corresponding functionality based on that. But that is cumbersome, requires
hardware for testing, and has to deal with bit enabling/disabling output
clock also affects which pins alarm interrupts are routed to.

Another factor is that there are hardware setups (i.e. ZII RDU2) that
power DS1341 from SuperCap, which makes power saving critical. For such
setups, kernel driver should leave register bits that control mentioned
pins in the state configured by bootloader.

Given all that, it was decided to limit support to "only date/time" for
now. That is enough for common use case. Full (and cumbersome)
implementation can be added later if ever needed.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/Kconfig
drivers/rtc/rtc-ds1307.c