提交 3984903a 编写于 作者: L Lokesh Vutla 提交者: Alexandre Belloni

rtc: omap: Fix selecting external osc

RTC can be clocked from an external 32KHz oscillator, or from the
Peripheral PLL. The RTC has an internal oscillator buffer to support
direct operation with a crystal.

            ----------------------------------------
            |       Device          ---------       |
            |                       |       |       |
            |                       | RTCSS |       |
            |       ---------       |       |       |
    OSC     |<------| RTC   |       |       |       |
            |------>| OSC   |---    |       |       |
            |       --------   |    |       |       |
            |                   ----|clk    |       |
            |       --------   |    |       |       |
            |       | PRCM  |---    |       |       |
            |       --------        --------        |
            ----------------------------------------

The RTC functional clock is sourced by default from the clock derived
from the Peripheral PLL. In order to select source as external osc clk
the following changes needs to be done:
- Enable the RTC OSC (RTC_OSC_REG[4]OSC32K_GZ = 0)
- Enable the clock mux(RTC_OSC_REG[6]K32CLK_EN = 1)
- Select the external clock source (RTC_OSC_REG[3]32KCLK_SEL = 1)

Fixes: 399cf0f6 ("rtc: omap: Add external clock enabling support")
Signed-off-by: NKeerthy <j-keerthy@ti.com>
Signed-off-by: NLokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: NDave Gerlach <d-gerlach@ti.com>
Signed-off-by: NAlexandre Belloni <alexandre.belloni@free-electrons.com>
上级 368e21ae
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
/* OMAP_RTC_OSC_REG bit fields: */ /* OMAP_RTC_OSC_REG bit fields: */
#define OMAP_RTC_OSC_32KCLK_EN BIT(6) #define OMAP_RTC_OSC_32KCLK_EN BIT(6)
#define OMAP_RTC_OSC_SEL_32KCLK_SRC BIT(3) #define OMAP_RTC_OSC_SEL_32KCLK_SRC BIT(3)
#define OMAP_RTC_OSC_OSC32K_GZ_DISABLE BIT(4)
/* OMAP_RTC_IRQWAKEEN bit fields: */ /* OMAP_RTC_IRQWAKEEN bit fields: */
#define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1) #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1)
...@@ -786,8 +787,9 @@ static int omap_rtc_probe(struct platform_device *pdev) ...@@ -786,8 +787,9 @@ static int omap_rtc_probe(struct platform_device *pdev)
*/ */
if (rtc->has_ext_clk) { if (rtc->has_ext_clk) {
reg = rtc_read(rtc, OMAP_RTC_OSC_REG); reg = rtc_read(rtc, OMAP_RTC_OSC_REG);
rtc_write(rtc, OMAP_RTC_OSC_REG, reg &= ~OMAP_RTC_OSC_OSC32K_GZ_DISABLE;
reg | OMAP_RTC_OSC_SEL_32KCLK_SRC); reg |= OMAP_RTC_OSC_32KCLK_EN | OMAP_RTC_OSC_SEL_32KCLK_SRC;
rtc_writel(rtc, OMAP_RTC_OSC_REG, reg);
} }
rtc->type->lock(rtc); rtc->type->lock(rtc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册