rtc:ds3232/ds3231: Add support to generate 32KHz output
[oweals/u-boot.git] / drivers / rtc / ds3231.c
index c84bbc647f5fe78032d76bb02acf56e70ef8c548..e5e1be134ccee80a4a9f3a56a7c7438c76e8c394 100644 (file)
@@ -49,6 +49,8 @@
 #define RTC_STAT_BIT_A1F       0x1     /* Alarm 1 flag                 */
 #define RTC_STAT_BIT_A2F       0x2     /* Alarm 2 flag                 */
 #define RTC_STAT_BIT_OSF       0x80    /* Oscillator stop flag         */
+#define RTC_STAT_BIT_BB32KHZ   0x40    /* Battery backed 32KHz Output  */
+#define RTC_STAT_BIT_EN32KHZ   0x8     /* Enable 32KHz Output  */
 
 
 static uchar rtc_read (uchar reg);
@@ -141,6 +143,14 @@ void rtc_reset (void)
        rtc_write (RTC_CTL_REG_ADDR, RTC_CTL_BIT_RS1 | RTC_CTL_BIT_RS2);
 }
 
+/*
+ * Enable 32KHz output
+ */
+void rtc_enable_32khz_output(void)
+{
+       rtc_write(RTC_STAT_REG_ADDR,
+                 RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ);
+}
 
 /*
  * Helper functions