From patchwork Fri May 9 12:09:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 29891 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A36D220534 for ; Fri, 9 May 2014 12:10:29 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x3sf11748376qcv.11 for ; Fri, 09 May 2014 05:10:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=tO+D4WVmMu6bIWR4yc9Pz6DimuggiNcI6jIBbagg574=; b=XuhRyGX06kbGdkf3B/mc8XBuGB163S+9++U5MpdE97ygPSVelkCKIVf0khFt9IBWDx NTE2yFHLDeKp8tjldP5w4cSw2V09t66f2xxoxV3p0jwEav7KQ32bF4NRixuWy94MCETw Dlc1TYKEGGHQJnK+BfvuxUAljKl+HDnA7dZpZfQE8R1MqBclpbyVUIeQMB0DHBVwIhQp bMXIUsx9xRhPTuQpjyRuReiwnGX2QFt8aXqzNw6M/UhjxDO05JkI2wk2y239sEhGPRyP thxD/I/4J+kb6CUWPbPRIf9xMDqyuNB+T8N43FR7Z9OO/W6Bmcs/FhhKVIIhQciFKPz6 xRUA== X-Gm-Message-State: ALoCoQlNLEIMPbTXpGMVpTwLHp69b5AyT/1Rt4Iqj7+P9dDULxcuX5NZbmQ7Dz/1zDuRNpjQcoiz X-Received: by 10.236.84.141 with SMTP id s13mr4613568yhe.5.1399637429019; Fri, 09 May 2014 05:10:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.17 with SMTP id 17ls251104qgu.58.gmail; Fri, 09 May 2014 05:10:28 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr8112659vcy.8.1399637428874; Fri, 09 May 2014 05:10:28 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id sj10si692164vcb.123.2014.05.09.05.10.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 09 May 2014 05:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id la4so5185275vcb.27 for ; Fri, 09 May 2014 05:10:28 -0700 (PDT) X-Received: by 10.58.38.40 with SMTP id d8mr167019vek.61.1399637428797; Fri, 09 May 2014 05:10:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp74067vcb; Fri, 9 May 2014 05:10:28 -0700 (PDT) X-Received: by 10.52.227.138 with SMTP id sa10mr6776630vdc.25.1399637428323; Fri, 09 May 2014 05:10:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id db3si2174966pbc.15.2014.05.09.05.10.27; Fri, 09 May 2014 05:10:27 -0700 (PDT) Received-SPF: none (google.com: linux-omap-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754241AbaEIMK1 (ORCPT + 6 others); Fri, 9 May 2014 08:10:27 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:54280 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754101AbaEIMK0 (ORCPT ); Fri, 9 May 2014 08:10:26 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s49C9Hv3018857; Fri, 9 May 2014 07:09:17 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s49C9HOw008024; Fri, 9 May 2014 07:09:17 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 9 May 2014 07:09:17 -0500 Received: from psplinux063.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 s49C99TB031720; Fri, 9 May 2014 07:09:15 -0500 From: Sekhar Nori To: Alessandro Zummo , Andrew Morton CC: Linux RTC Mailing List , Linux OMAP Mailing List , Sekhar Nori Subject: [PATCH 3/3] rtc: omap: add support for enabling 32khz clock Date: Fri, 9 May 2014 17:39:03 +0530 Message-ID: X-Mailer: git-send-email 1.7.10.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nsekhar@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Newer versions of OMAP RTC IP such as those found in AM335x and DRA7x need an explicit enable of 32khz functional clock which ticks the RTC. AM335x support was working so far because of settings done in U-Boot. However, the DRA7x U-Boot does no such enable of 32khz clock and this patch is need to get the RTC to work on DRA7x at least. In general, it is better to not depend on settings done in U-Boot. Thanks to Lokesh Vutla for noticing this. Signed-off-by: Sekhar Nori --- drivers/rtc/rtc-omap.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 734e408..03bce13 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -96,6 +96,9 @@ #define OMAP_RTC_INTERRUPTS_IT_ALARM BIT(3) #define OMAP_RTC_INTERRUPTS_IT_TIMER BIT(2) +/* OMAP_RTC_OSC_REG bit fields: */ +#define OMAP_RTC_OSC_32KCLK_EN BIT(6) + /* OMAP_RTC_IRQWAKEEN bit fields: */ #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEEN BIT(1) @@ -111,6 +114,12 @@ */ #define OMAP_RTC_HAS_IRQWAKEEN BIT(1) +/* + * Some RTC IP revisions (like those in AM335x and DRA7x) need + * the 32KHz clock to be explicitly enabled. + */ +#define OMAP_RTC_HAS_32KCLK_EN BIT(2) + static void __iomem *rtc_base; #define rtc_read(addr) readb(rtc_base + (addr)) @@ -319,7 +328,8 @@ static struct platform_device_id omap_rtc_devtype[] = { }, [OMAP_RTC_DATA_AM3352_IDX] = { .name = "am3352-rtc", - .driver_data = OMAP_RTC_HAS_KICKER | OMAP_RTC_HAS_IRQWAKEEN, + .driver_data = OMAP_RTC_HAS_KICKER | OMAP_RTC_HAS_IRQWAKEEN | + OMAP_RTC_HAS_32KCLK_EN, }, [OMAP_RTC_DATA_DA830_IDX] = { .name = "da830-rtc", @@ -398,6 +408,10 @@ static int __init omap_rtc_probe(struct platform_device *pdev) */ rtc_write(0, OMAP_RTC_INTERRUPTS_REG); + /* enable RTC functional clock */ + if (id_entry->driver_data & OMAP_RTC_HAS_32KCLK_EN) + rtc_writel(OMAP_RTC_OSC_32KCLK_EN, OMAP_RTC_OSC_REG); + /* clear old status */ reg = rtc_read(OMAP_RTC_STATUS_REG); if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) {