From patchwork Thu Apr 2 11:00:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 457600 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-qg0-x23e.google.com (mail-qg0-x23e.google.com [IPv6:2607:f8b0:400d:c04::23e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C8545140083 for ; Thu, 2 Apr 2015 22:01:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="2048-bit key; unprotected key" header.d=googlegroups.com header.i=@googlegroups.com header.b=mLT4wtcN; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: by qgaj5 with SMTP id j5sf3571316qga.1 for ; Thu, 02 Apr 2015 04:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=mime-version:from:to:cc:subject:date:message-id:x-original-sender :x-original-authentication-results:reply-to:content-type:precedence :mailing-list:list-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe; bh=TqHg6LxYj31qypUhlwqgTaKDgSOSbiv/8lgIqkvRj3I=; b=mLT4wtcNyDvyRnvhDA6z74v3Z8RyddT1xuT7ZjLPyewJ85w6fnc+ADBWg0sIo44F39 rBEhXvcnXGy2k9WYP2w7dtSZgoGQbqcMmFueU7qVGcqDmX1AxMVM9zw/tX1fNvVELM+I +Sdst/07z4oY5Zm2amVpGMPWpuQBisSM2Bp1q7RCGfvLRYe+abChUTP+Rr60diNoqgQ7 XpKYA8l/EE3XWynz3cBCrt6zEbW17osUufCjr6eACiWzDK2W2cb2k8nkNe+ieY5oGi3+ JLxhQ5atYoWuoaE9FPtpKMpIwP1mAU630Zgd+1Ndm1qj2mKrcJcC3xkTjIz9jVJIgQzm 5mmQ== X-Received: by 10.182.220.229 with SMTP id pz5mr402039obc.34.1427972472280; Thu, 02 Apr 2015 04:01:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.182.55.99 with SMTP id r3ls253713obp.73.gmail; Thu, 02 Apr 2015 04:01:11 -0700 (PDT) X-Received: by 10.182.125.100 with SMTP id mp4mr52637880obb.21.1427972471969; Thu, 02 Apr 2015 04:01:11 -0700 (PDT) Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com. [210.118.77.11]) by gmr-mx.google.com with ESMTPS id oc12si565888pdb.1.2015.04.02.04.01.11 for (version=TLSv1 cipher=RC4-MD5 bits=128/128); Thu, 02 Apr 2015 04:01:11 -0700 (PDT) Received-SPF: none (google.com: k.kozlowski@samsung.com does not designate permitted sender hosts) client-ip=210.118.77.11; Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NM6004GLESOET70@mailout1.w1.samsung.com> for rtc-linux@googlegroups.com; Thu, 02 Apr 2015 12:05:12 +0100 (BST) X-AuditID: cbfec7f4-b7f126d000001e9a-9f-551d20c62a4a Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id F0.4A.07834.6C02D155; Thu, 02 Apr 2015 11:58:14 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NM60005IELR8K40@eusync1.samsung.com>; Thu, 02 Apr 2015 12:01:06 +0100 (BST) From: Krzysztof Kozlowski To: Alessandro Zummo , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Alexandre Belloni Cc: Marek Szyprowski , Krzysztof Kozlowski Subject: [rtc-linux] [PATCH] rtc: rtc-s3c: Fix failed first read of RTC time Date: Thu, 02 Apr 2015 13:00:59 +0200 Message-id: <1427972459-6480-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHJMWRmVeSWpSXmKPExsVy+t/xy7rHFGRDDb7eMrVYcvEqu0XHtcVM Fq9fGFpc3jWHzWLG+X1MFmuP3GW32N/ZwejA7vFk00VGjz0TT7J59G1Zxegxfd5PJo/Pm+QC WKO4bFJSczLLUov07RK4MqZeXs1a0MhXcXD6LfYGxnXcXYycHBICJhKfjp5mgbDFJC7cW8/W xcjFISSwlFHi9ZZ5jBBOH5PEl6UtzCBVbALGEpuXLwGrEhE4xihx4v0OJpAEs0CCxN35Z9hA bGEBB4njM5vB4iwCqhIXJy4Ei/MKuEnM6TjMBLFOTuLkscmsExi5FzAyrGIUTS1NLihOSs81 1CtOzC0uzUvXS87P3cQICZMvOxgXH7M6xCjAwajEw3vjk3SoEGtiWXFl7iFGCQ5mJRHeP+Ky oUK8KYmVValF+fFFpTmpxYcYmTg4pRoY2Vcs61geKbFsrsXCA6ej+t8e4yldIHPTcp7vajnT hZnPHy788EVj71OnWqnbu25xznTuPZJ9a13nrS3TYpdw/vbZWdR0LF1K1qR3YVC0rG586enD hdveicS7B8Rp+P4ykyh1W39cuqH0jq/Xo/C08k+LYmxDY++4/Wmt3l4mXFXgsK3xz+UsJZbi jERDLeai4kQA9ZXLyvEBAAA= X-Original-Sender: k.kozlowski@samsung.com X-Original-Authentication-Results: gmr-mx.google.com; spf=none (google.com: k.kozlowski@samsung.com does not designate permitted sender hosts) smtp.mail=k.kozlowski@samsung.com 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: , List-Unsubscribe: , Initialize the device time (if it is wrong) before registering RTC device to fix following error message during rtc-s3c probe: [ 2.215414] rtc (null): read_time: fail to read [ 2.216322] s3c-rtc 10070000.rtc: rtc core: registered s3c as rtc1 Signed-off-by: Krzysztof Kozlowski Reviewed-by: Chanwoo Choi --- drivers/rtc/rtc-s3c.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 5e162eaad277..1d3a4c58fec4 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -496,6 +496,22 @@ static int s3c_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); + /* Check RTC Time */ + s3c_rtc_gettime(&pdev->dev, &rtc_tm); + + if (rtc_valid_tm(&rtc_tm)) { + rtc_tm.tm_year = 100; + rtc_tm.tm_mon = 0; + rtc_tm.tm_mday = 1; + rtc_tm.tm_hour = 0; + rtc_tm.tm_min = 0; + rtc_tm.tm_sec = 0; + + s3c_rtc_settime(&pdev->dev, &rtc_tm); + + dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); + } + /* register RTC and exit */ info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops, THIS_MODULE); @@ -519,22 +535,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) goto err_nortc; } - /* Check RTC Time */ - s3c_rtc_gettime(&pdev->dev, &rtc_tm); - - if (rtc_valid_tm(&rtc_tm)) { - rtc_tm.tm_year = 100; - rtc_tm.tm_mon = 0; - rtc_tm.tm_mday = 1; - rtc_tm.tm_hour = 0; - rtc_tm.tm_min = 0; - rtc_tm.tm_sec = 0; - - s3c_rtc_settime(&pdev->dev, &rtc_tm); - - dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n"); - } - if (info->data->select_tick_clk) info->data->select_tick_clk(info);