* [U-Boot] [PATCH 1/2] rtc:ds3232/ds3231: Add support to generate 32KHz output
@ 2015-06-29 10:09 Priyanka Jain
2015-09-02 2:41 ` York Sun
0 siblings, 1 reply; 2+ messages in thread
From: Priyanka Jain @ 2015-06-29 10:09 UTC (permalink / raw)
To: u-boot
RTC devices can generate 32KHz output if for
-DS3232 device, EN32KHz bit and BB32KHz bit are set
-DS3231 device, EN32KHz bit is set, BB32KHz bit is don't care
Patch adds rtc_enable_32khz_output() which when called
will enable 32KHz output on 32KHz pin
Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
---
Based on git://git.denx.de/u-boot-fsl-qoriq
drivers/rtc/ds3231.c | 10 ++++++++++
include/rtc.h | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c
index c84bbc6..e5e1be1 100644
--- a/drivers/rtc/ds3231.c
+++ b/drivers/rtc/ds3231.c
@@ -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
diff --git a/include/rtc.h b/include/rtc.h
index bd8621d..69fe8d4 100644
--- a/include/rtc.h
+++ b/include/rtc.h
@@ -151,6 +151,7 @@ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value);
int rtc_get (struct rtc_time *);
int rtc_set (struct rtc_time *);
void rtc_reset (void);
+void rtc_enable_32khz_output(void);
/**
* rtc_read8() - Read an 8-bit register
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH 1/2] rtc:ds3232/ds3231: Add support to generate 32KHz output
2015-06-29 10:09 [U-Boot] [PATCH 1/2] rtc:ds3232/ds3231: Add support to generate 32KHz output Priyanka Jain
@ 2015-09-02 2:41 ` York Sun
0 siblings, 0 replies; 2+ messages in thread
From: York Sun @ 2015-09-02 2:41 UTC (permalink / raw)
To: u-boot
On 06/29/2015 05:09 AM, Priyanka Jain wrote:
> RTC devices can generate 32KHz output if for
> -DS3232 device, EN32KHz bit and BB32KHz bit are set
> -DS3231 device, EN32KHz bit is set, BB32KHz bit is don't care
>
> Patch adds rtc_enable_32khz_output() which when called
> will enable 32KHz output on 32KHz pin
>
> Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
Applied to fsl-qoriq master branch. Awaiting upstream.
York
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-02 2:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-29 10:09 [U-Boot] [PATCH 1/2] rtc:ds3232/ds3231: Add support to generate 32KHz output Priyanka Jain
2015-09-02 2:41 ` York Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox