From patchwork Thu May 27 06:59:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wan ZongShun X-Patchwork-Id: 53697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-px0-f184.google.com (mail-px0-f184.google.com [209.85.212.184]) by ozlabs.org (Postfix) with ESMTP id A7715B7D12 for ; Thu, 27 May 2010 16:59:50 +1000 (EST) Received: by pxi15 with SMTP id 15sf1799118pxi.11 for ; Wed, 26 May 2010 23:59:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:received:received:message-id:date :from:user-agent:mime-version:to:subject :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :sender:list-subscribe:list-unsubscribe:content-type; bh=6JaPznKg+R9aco11NHK9eNo6ZTIkRAA5Z7gWF6Kfdo4=; b=E+R5d69szeMZD0pyX88cmRBmMy4ktQ0Fa0SLjmJ6JQ04nvhSGRYP6TUAUhPklecKtl 5zlAa9N5KkcuHTufHp+1LFG2lZWTfi86e4A0jzdUH8lFtRTak13DdMcX4MZbTtzpKXDc daLsq+e2rDMm/UpgxsGZKCsszQvuBQDqvNO8Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:message-id:date:from:user-agent :mime-version:to:subject:x-original-authentication-results :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=P2gKvzCOtMaUhBAViGVVfNJh68oJaTLsGuSlF1xRiA3pVHm0FbLgRDaMxExdDOMWgf Z847MoVcNgKb9rvbnTOPs7s7amjujHl7wpLkuS0gTS0unZ0QAOhxmHMFrUskGYW6F4nn Jcw2dqY630u2Nd57/gj2Vg37/VjFLGULu9IR0= Received: by 10.115.66.9 with SMTP id t9mr1315413wak.4.1274943589318; Wed, 26 May 2010 23:59:49 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.115.103.33 with SMTP id f33ls1182113wam.3.p; Wed, 26 May 2010 23:59:48 -0700 (PDT) Received: by 10.115.98.9 with SMTP id a9mr2665340wam.31.1274943588544; Wed, 26 May 2010 23:59:48 -0700 (PDT) Received: by 10.115.98.9 with SMTP id a9mr2665339wam.31.1274943588512; Wed, 26 May 2010 23:59:48 -0700 (PDT) Received: from mail-pw0-f50.google.com (mail-pw0-f50.google.com [209.85.160.50]) by gmr-mx.google.com with ESMTP id u10si1303340wak.6.2010.05.26.23.59.47; Wed, 26 May 2010 23:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of mcuos.com@gmail.com designates 209.85.160.50 as permitted sender) client-ip=209.85.160.50; Received: by pwi4 with SMTP id 4so850971pwi.23 for ; Wed, 26 May 2010 23:59:47 -0700 (PDT) Received: by 10.114.237.20 with SMTP id k20mr8612003wah.185.1274943587283; Wed, 26 May 2010 23:59:47 -0700 (PDT) Received: from [192.168.1.10] ([116.226.201.224]) by mx.google.com with ESMTPS id c14sm7508035waa.1.2010.05.26.23.59.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 26 May 2010 23:59:46 -0700 (PDT) Message-ID: <4BFE1853.5070105@gmail.com> Date: Thu, 27 May 2010 14:59:31 +0800 From: Wan ZongShun User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Andrew Morton , Alessandro Zummo , rtc-linux , linux-arm-kernel Subject: [rtc-linux] [PATCH] NUC900/rtc: change the waiting for device ready implement X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of mcuos.com@gmail.com designates 209.85.160.50 as permitted sender) smtp.mail=mcuos.com@gmail.com; dkim=pass (test mode) header.i=@gmail.com X-Original-Sender: mcuos.com@gmail.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , Dear Andrew, This patch is only to change the waiting for device ready implement for winbond nuc900 platform. Signed-off-by:Wan ZongShun --- drivers/rtc/rtc-nuc900.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/rtc/rtc-nuc900.c b/drivers/rtc/rtc-nuc900.c index a351bd5..21d1330 100644 --- a/drivers/rtc/rtc-nuc900.c +++ b/drivers/rtc/rtc-nuc900.c @@ -85,22 +85,21 @@ static irqreturn_t nuc900_rtc_interrupt(int irq, void *_rtc) static int *check_rtc_access_enable(struct nuc900_rtc *nuc900_rtc) { - unsigned int i; + unsigned int i, timeout = 0x1000; __raw_writel(INIRRESET, nuc900_rtc->rtc_reg + REG_RTC_INIR); mdelay(10); __raw_writel(AERPOWERON, nuc900_rtc->rtc_reg + REG_RTC_AER); - for (i = 0; i < 1000; i++) { - if (__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) - return 0; - } + while (!(__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) + && timeout--) + mdelay(1); - if ((__raw_readl(nuc900_rtc->rtc_reg + REG_RTC_AER) & AERRWENB) == 0x0) - return ERR_PTR(-ENODEV); + if (!timeout) + return ERR_PTR(-EPERM); - return ERR_PTR(-EPERM); + return 0; } static void nuc900_rtc_bcd2bin(unsigned int timereg,