From patchwork Tue Mar 3 09:42:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 5920901 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0F7429F318 for ; Tue, 3 Mar 2015 09:47:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28352202B4 for ; Tue, 3 Mar 2015 09:47:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35FE620122 for ; Tue, 3 Mar 2015 09:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756045AbbCCJrJ (ORCPT ); Tue, 3 Mar 2015 04:47:09 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:35974 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755147AbbCCJrH (ORCPT ); Tue, 3 Mar 2015 04:47:07 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t239jw6X012010; Tue, 3 Mar 2015 03:45:58 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t239juNX020709; Tue, 3 Mar 2015 03:45:56 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Tue, 3 Mar 2015 03:45:56 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t239jsxe029533; Tue, 3 Mar 2015 03:45:55 -0600 From: Keerthy To: CC: , , , Subject: [PATCH] rtc: OMAP: Add external 32k clock feature Date: Tue, 3 Mar 2015 15:12:02 +0530 Message-ID: <1425375722-13412-1-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add external 32k clock feature. The internal clock will be gated during suspend. Hence make use of the external 32k clock so that rtc is functional accross suspend/resume. Signed-off-by: Keerthy --- Tested on DRA7-EVM. drivers/rtc/rtc-omap.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 8e5851a..4f803ca 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -107,6 +107,8 @@ /* OMAP_RTC_OSC_REG bit fields: */ #define OMAP_RTC_OSC_32KCLK_EN BIT(6) +#define OMAP_RTC_OSC_OSC32K_GZ BIT(4) +#define OMAP_RTC_OSC_EXT_32K BIT(3) /* OMAP_RTC_IRQWAKEEN bit fields: */ #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1) @@ -120,6 +122,7 @@ struct omap_rtc_device_type { bool has_32kclk_en; + bool has_osc_ext_32k; bool has_kicker; bool has_irqwakeen; bool has_pmic_mode; @@ -446,6 +449,7 @@ static const struct omap_rtc_device_type omap_rtc_default_type = { static const struct omap_rtc_device_type omap_rtc_am3352_type = { .has_32kclk_en = true, + .has_osc_ext_32k = true, .has_kicker = true, .has_irqwakeen = true, .has_pmic_mode = true, @@ -543,7 +547,16 @@ static int __init omap_rtc_probe(struct platform_device *pdev) if (rtc->type->has_32kclk_en) { reg = rtc_read(rtc, OMAP_RTC_OSC_REG); rtc_writel(rtc, OMAP_RTC_OSC_REG, - reg | OMAP_RTC_OSC_32KCLK_EN); + reg | OMAP_RTC_OSC_32KCLK_EN); + } + + /* Enable External clock as the source */ + + if (rtc->type->has_osc_ext_32k) { + rtc_writel(rtc, OMAP_RTC_OSC_REG, + (OMAP_RTC_OSC_EXT_32K | + rtc_read(rtc, OMAP_RTC_OSC_REG)) & + (~OMAP_RTC_OSC_OSC32K_GZ)); } /* clear old status */