From patchwork Mon Dec 12 22:47:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 130940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-yx0-f184.google.com (mail-yx0-f184.google.com [209.85.213.184]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id DB9CD1007F2 for ; Tue, 13 Dec 2011 09:48:03 +1100 (EST) Received: by yenl2 with SMTP id l2sf9293912yen.11 for ; Mon, 12 Dec 2011 14:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:message-id:subject:from:to:cc:date :in-reply-to:references:x-mailer:mime-version:x-cbid :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=PGPE1iSSPTNx5mYJUHVGh3afmgUzW95qddfdjYdCdk8=; b=dc6oggs+ALoUm5S2jGk9N4NVSLNEZEDGG1Cg41oCjYX4xwVviSlac1K+1qPp4N+3yA 68wKpO1ZVWoImsOTbmPJgT0n+Uf9ZBjXbNSU8icJ75CecgB0iQtkOyD6QyW3uC+07h3p hhyQE6Ba5xn0PtixB9aaseEEbqvsmeg9KbZbs= Received: by 10.236.183.229 with SMTP id q65mr1552yhm.18.1323730079909; Mon, 12 Dec 2011 14:47:59 -0800 (PST) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.101.88.2 with SMTP id q2ls15071476anl.7.gmail; Mon, 12 Dec 2011 14:47:59 -0800 (PST) Received: by 10.236.190.200 with SMTP id e48mr109522yhn.5.1323730079504; Mon, 12 Dec 2011 14:47:59 -0800 (PST) Received: by 10.236.190.200 with SMTP id e48mr109514yhn.5.1323730079483; Mon, 12 Dec 2011 14:47:59 -0800 (PST) Received: from e8.ny.us.ibm.com (e8.ny.us.ibm.com. [32.97.182.138]) by gmr-mx.google.com with ESMTPS id r27si5246148yhm.4.2011.12.12.14.47.59 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 12 Dec 2011 14:47:59 -0800 (PST) Received-SPF: neutral (google.com: 32.97.182.138 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=32.97.182.138; Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 12 Dec 2011 17:47:58 -0500 Received: from d01relay06.pok.ibm.com (9.56.227.116) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 12 Dec 2011 17:47:56 -0500 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pBCMluRO3428400 for ; Mon, 12 Dec 2011 17:47:56 -0500 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pBCMltWA019790 for ; Mon, 12 Dec 2011 20:47:55 -0200 Received: from [9.49.139.229] (sig-9-49-139-229.mts.ibm.com [9.49.139.229]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pBCMls4v019622; Mon, 12 Dec 2011 20:47:55 -0200 Message-ID: <1323730073.4078.97.camel@work-vm> Subject: [rtc-linux] Re: sam460ex, rtc-m41t80 incorrect behaviour with kernel >=linux-2.6.38 From: John Stultz To: "acrux_it@libero.it" Cc: rtc-linux@googlegroups.com, Alexander Bigga Date: Mon, 12 Dec 2011 14:47:53 -0800 In-Reply-To: <9365263.8063121322965766294.JavaMail.defaultUser@defaultHost> References: <9365263.8063121322965766294.JavaMail.defaultUser@defaultHost> X-Mailer: Evolution 3.2.1- Mime-Version: 1.0 x-cbid: 11121222-9360-0000-0000-0000017492E1 X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 32.97.182.138 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) smtp.mail=john.stultz@linaro.org 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: , On Sun, 2011-12-04 at 03:29 +0100, acrux_it@libero.it wrote: > Acube Sam460ex is a 460ex SoC (PowerPC) based board with m41t81 like RTC. > The wrong beahviour it seems to be caused this commit: > > Thu, 3 Feb 2011 21:02:35 +0000 (13:02 -0800) > commit 16380c153a69c3784d2afaddfe0a22f353046cf6 > RTC: Convert rtc drivers to use the alarm_irq_enable method > http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=commit; > h=16380c153a69c3784d2afaddfe0a22f353046cf6 Yea. This was reported earlier, but it seems none of the proposed solutions have been implemented. The cause is that the m41t80 driver's alarm functionality is somehow broken. The alarm mode is actually now used for UIE, so where before 2.6.38, UIE mode returned -EINVAL, it will now succeed, setting the alarm to fire a second away. However, since the alarm code is broken, no alarm arrives and you get the timeout you see. Could you test the following patch to see if it resolves the issue for you? If it does, I'll queue it for inclusion. thanks -john [PATCH] rtc: m41t80: Workaround broken alarm functionality The m41t80 driver doesn't seem to have a functional alarm. This causes failures when the generic core sees alarm functions, but then cannot use them properly for things like UIE mode. Disabling the alarm functions allows proper error reporting, and possible fallback to emulated modes. Once someone fixes the alarm functions, this can be restored. Signed-off-by: John Stultz Tested-by: Nico Macrionitis --- drivers/rtc/rtc-m41t80.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c index eda128f..64aedd8 100644 --- a/drivers/rtc/rtc-m41t80.c +++ b/drivers/rtc/rtc-m41t80.c @@ -357,10 +357,19 @@ static int m41t80_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *t) static struct rtc_class_ops m41t80_rtc_ops = { .read_time = m41t80_rtc_read_time, .set_time = m41t80_rtc_set_time, + /* + * XXX - m41t80 alarm functionality is reported broken. + * until it is fixed, don't register alarm functions. + * .read_alarm = m41t80_rtc_read_alarm, .set_alarm = m41t80_rtc_set_alarm, + */ .proc = m41t80_rtc_proc, + /* + * See above comment on broken alarm + * .alarm_irq_enable = m41t80_rtc_alarm_irq_enable, + */ }; #if defined(CONFIG_RTC_INTF_SYSFS) || defined(CONFIG_RTC_INTF_SYSFS_MODULE)