From patchwork Fri Mar 8 09:01:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Trumtrar X-Patchwork-Id: 226052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-ee0-f55.google.com (mail-ee0-f55.google.com [74.125.83.55]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D61702C032F for ; Fri, 8 Mar 2013 20:02:21 +1100 (EST) Received: by mail-ee0-f55.google.com with SMTP id d17sf624598eek.0 for ; Fri, 08 Mar 2013 01:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:mime-version:x-beenthere:x-received:received-spf:from:to :cc:subject:date:message-id:x-mailer:in-reply-to:references :x-sa-exim-connect-ip:x-sa-exim-mail-from:x-sa-exim-scanned :x-ptx-original-recipient:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=r0fIIUvC71MgYdlU4CLxv6BZPNDDdqy8VcQNR4m6w+I=; b=YVV8KRbrnVsOjapGqf/JzO+sCMSaCtf4Yyd8Tts2bjLwZrbZkWY/vyL9fQxLBcUOta m//zK/O5A5gaB+y/R4QWMZW8F/kmFhcG8z4fgOpaEIxkWVNqENjiV00268BMXZCBkOsn kFkAA6C/AfyDZf+AXGQVplJ7jPrGBnIqPD3QfsJideV6JqtpLjncCj0xKMfTQ/nXJ36H kcGsjFxgF9PFjehzR47+fhkWLnKZvp7u1Py5aS+cPjF/YumboGAFaX28QuPjvxaRJK9y Ik9Yea6jvm78ncsPjI0VsM6LS1taJto0uph+oFSE2qtjdraXKqluF+qNwxl+L5qNRHvu b/xQ== X-Received: by 10.180.102.200 with SMTP id fq8mr107796wib.12.1362733337135; Fri, 08 Mar 2013 01:02:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.180.93.201 with SMTP id cw9ls73419wib.14.gmail; Fri, 08 Mar 2013 01:02:16 -0800 (PST) X-Received: by 10.14.149.138 with SMTP id x10mr1394872eej.5.1362733336706; Fri, 08 Mar 2013 01:02:16 -0800 (PST) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de. [2001:6f8:1178:4:290:27ff:fe1d:cc33]) by gmr-mx.google.com with ESMTPS id 47si1436142eeh.1.2013.03.08.01.02.16 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Mar 2013 01:02:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of str@pengutronix.de designates 2001:6f8:1178:4:290:27ff:fe1d:cc33 as permitted sender) client-ip=2001:6f8:1178:4:290:27ff:fe1d:cc33; Received: from dude.hi.pengutronix.de ([2001:6f8:1178:2:21e:67ff:fe11:9c5c]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1UDtBv-0000lS-F8; Fri, 08 Mar 2013 10:02:15 +0100 Received: from str by dude.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1UDtBt-0006dY-Ej; Fri, 08 Mar 2013 10:02:13 +0100 From: Steffen Trumtrar To: rtc-linux@googlegroups.com, devicetree-discuss@lists.ozlabs.org Cc: Shawn Guo , Alessandro Zummo , Steffen Trumtrar Subject: [rtc-linux] [PATCH v2 9/9] rtc: stmp3xxx: Replace wait_time function Date: Fri, 8 Mar 2013 10:01:44 +0100 Message-Id: <1362733304-23037-10-git-send-email-s.trumtrar@pengutronix.de> X-Mailer: git-send-email 1.8.2.rc2 In-Reply-To: <1362733304-23037-1-git-send-email-s.trumtrar@pengutronix.de> References: <1362733304-23037-1-git-send-email-s.trumtrar@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:21e:67ff:fe11:9c5c X-SA-Exim-Mail-From: str@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: rtc-linux@googlegroups.com X-Original-Sender: s.trumtrar@pengutronix.de X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of str@pengutronix.de designates 2001:6f8:1178:4:290:27ff:fe1d:cc33 as permitted sender) smtp.mail=str@pengutronix.de Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Replace the wait_time function with the more generic wait_copy_ctrl function. Signed-off-by: Steffen Trumtrar --- drivers/rtc/rtc-stmp3xxx.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c index 3de868d..687bcb2 100644 --- a/drivers/rtc/rtc-stmp3xxx.c +++ b/drivers/rtc/rtc-stmp3xxx.c @@ -179,24 +179,13 @@ static inline void stmp3xxx_wait_copy_ctrl(const struct stmp3xxx_rtc_data *rtc_d } } -static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data) -{ - /* - * The datasheet doesn't say which way round the - * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0, - * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS - */ - while (readl(rtc_data->io + STMP3XXX_RTC_STAT) & - (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT)) - cpu_relax(); -} - /* Time read/write */ static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) { struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); - stmp3xxx_wait_time(rtc_data); + stmp3xxx_wait_copy_ctrl(rtc_data, STMP3XXX_RTC_STAT_STALE_SHIFT, + STMP3XXX_RTC_STAT_SEC_MASK); rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm); return 0; } @@ -206,7 +195,8 @@ static int stmp3xxx_rtc_set_mmss(struct device *dev, unsigned long t) struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev); writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS); - stmp3xxx_wait_time(rtc_data); + stmp3xxx_wait_copy_ctrl(rtc_data, STMP3XXX_RTC_STAT_NEW_SHIFT, + STMP3XXX_RTC_STAT_SEC_MASK); return 0; }