From patchwork Fri Mar 15 13:35:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10854743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D67DF1669 for ; Fri, 15 Mar 2019 13:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B67D12A8CF for ; Fri, 15 Mar 2019 13:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AABEC2A9D2; Fri, 15 Mar 2019 13:35:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F13E2A531 for ; Fri, 15 Mar 2019 13:35:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=eOpG2q2cl5TNgwTaD/417Lq6snPr+duxS848wjkcxHk=; b=qp5xPLhmEiNKAZ /3M1D0IrGKETnKeJlUSX7reYEukwuT3jbkPeRPj+UOmU3n+MUmRzOsFo47v32CqC+GnZoR3i0W4xe yVg5Ojto7JD4S7tFiLplP/NXqxHISByaXME8BfFx9n1LkrHWuuLcQPbI26QlqwylSgMNByZ8AZUUG NQJwaFBqcYLA4fENoyPiZqS1XTm+8UjgT6nIppNqg9EcMyoYzPp/fJzVw9EMiJwpDaZDM7SuotD0g DX93FKt9/xqjCw/kQJBfmxzx9KVytG66tx27/8kHdJsgZi6upDt/SuGUDkv1UCrTiis2K1BD5aay1 NW20Vx1SIk/mLOk1M+QA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4mzs-0002Q5-2A; Fri, 15 Mar 2019 13:35:40 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4mzp-0002PS-Sl for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 13:35:38 +0000 X-Originating-IP: 109.213.80.250 Received: from localhost (alyon-652-1-57-250.w109-213.abo.wanadoo.fr [109.213.80.250]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id D68A4C000B; Fri, 15 Mar 2019 13:35:33 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 1/3] rtc: mv: convert to SPDX identifier Date: Fri, 15 Mar 2019 14:35:08 +0100 Message-Id: <20190315133513.9909-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_063538_080191_DA195269 X-CRM114-Status: UNSURE ( 9.50 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gregory Clement , Alexandre Belloni , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use SPDX-License-Identifier instead of a verbose license text. The original text refers to version 2 so also update MODULE_LICENSE() to "GPL v2" instead of "GPL". Signed-off-by: Alexandre Belloni Reviewed-by: Gregory CLEMENT --- drivers/rtc/rtc-mv.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index e7f14bd12fe3..d13d06ea6709 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -1,9 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Driver for the RTC in Marvell SoCs. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #include @@ -322,5 +319,5 @@ module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe); MODULE_AUTHOR("Saeed Bishara "); MODULE_DESCRIPTION("Marvell RTC driver"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:rtc-mv"); From patchwork Fri Mar 15 13:35:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10854747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C15621515 for ; Fri, 15 Mar 2019 13:36:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A46D62A90E for ; Fri, 15 Mar 2019 13:36:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2F4C2A9CF; Fri, 15 Mar 2019 13:36:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5DAEE2A9C0 for ; Fri, 15 Mar 2019 13:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VwL86my0IUyspQpdbzK3OzDPjgwi+u5G/nPHDrAueiI=; b=oGRWvgNEwZwMfM 8RCMRksqo0k/P5ou2LZ6wosEXQHk6OzR61YwRjly9HN7zxYwYAsyxTmwEcXupadyYU4Yi59U4u83B 1A0WJ1Rvg4C/9X9RQDvYnoHqco2HSJJIbIB1uYkxNnXQ9TucdFmk2y1rknftozP6cKGt31TnpTLPR OO3aN8EHZQQRke1+spbGCjQ+wFSTP1E/VhXMgGQNuAjJt7CzpfcBX8nXvSkbmJe9YVKGstF9pvL6j 197jxp0P4G1LjIAJXRkOCTOOyNWi/0JKE44Pg5fLMrpB9CIijsguksbakor5EzZ6/mI5HwgG+LjPT xBDfWPmMuHXzgzVdO7Ow==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4n0A-0002r0-IN; Fri, 15 Mar 2019 13:35:58 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4mzr-0002PV-8V for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 13:35:41 +0000 X-Originating-IP: 109.213.80.250 Received: from localhost (alyon-652-1-57-250.w109-213.abo.wanadoo.fr [109.213.80.250]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 50390E0013; Fri, 15 Mar 2019 13:35:35 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 2/3] rtc: mv: convert to devm_rtc_allocate_device Date: Fri, 15 Mar 2019 14:35:09 +0100 Message-Id: <20190315133513.9909-2-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315133513.9909-1-alexandre.belloni@bootlin.com> References: <20190315133513.9909-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_063539_466051_721D246C X-CRM114-Status: GOOD ( 11.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gregory Clement , Alexandre Belloni , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This allows further improvement of the driver. Signed-off-by: Alexandre Belloni Tested-by: Gregory CLEMENT --- drivers/rtc/rtc-mv.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index d13d06ea6709..ef704aef8663 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev) platform_set_drvdata(pdev, pdata); - if (pdata->irq >= 0) { - device_init_wakeup(&pdev->dev, 1); - pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, - &mv_rtc_alarm_ops, - THIS_MODULE); - } else { - pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, - &mv_rtc_ops, THIS_MODULE); - } + pdata->rtc = devm_rtc_allocate_device(&pdev->dev); if (IS_ERR(pdata->rtc)) { ret = PTR_ERR(pdata->rtc); goto out; @@ -278,7 +270,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev) } } - return 0; + if (pdata->irq >= 0) { + device_init_wakeup(&pdev->dev, 1); + pdata->rtc->ops = &mv_rtc_alarm_ops; + } else { + pdata->rtc->ops = &mv_rtc_ops; + } + + ret = rtc_register_device(pdata->rtc); + if (!ret) + return 0; out: if (!IS_ERR(pdata->clk)) clk_disable_unprepare(pdata->clk); From patchwork Fri Mar 15 13:35:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10854745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27FA61669 for ; Fri, 15 Mar 2019 13:35:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B4ED2A9D8 for ; Fri, 15 Mar 2019 13:35:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 09A5E2A9C8; Fri, 15 Mar 2019 13:35:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B16032A9DF for ; Fri, 15 Mar 2019 13:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nFjD2RpFHANKYu8PXMEln40JEU+XGIzKCk5l7/fyRws=; b=cNdcZG9i5O0f6F owqDF8p3aC6hCybmMTMKl364RqjyeCXBBH1YxhKiaFpufIv8FoiyhThJw7qJg0Dq9Ss7qzkTNjT8i t+K7ohS/1j5PkIVy2QAZDoeHqNydEryxxiNQ2LVroRm1HCwZFHiL4DKPERlpSB4vtI/5nRsWZ8KEz l+fzDOyX8JPYBmh4F6Xctr0kYP2VoUNcBIv7bTQwtYVbXMrydRi9pvSW5/s2MXijddqRfGkuVnNca HglE/STr7n8zh8a1KTXFOT6+nEOk/ofOEGj0fKKZE2AzNNMzPvWbmwctwjWzQDHk8Y2E3Cr/zAy1T m5J4KFEoTA4XftL05NwA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4n03-0002eo-J6; Fri, 15 Mar 2019 13:35:51 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4mzq-0002PZ-Ow for linux-arm-kernel@lists.infradead.org; Fri, 15 Mar 2019 13:35:40 +0000 X-Originating-IP: 109.213.80.250 Received: from localhost (alyon-652-1-57-250.w109-213.abo.wanadoo.fr [109.213.80.250]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B48B3C0002; Fri, 15 Mar 2019 13:35:36 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Subject: [PATCH 3/3] rtc: mv: add range Date: Fri, 15 Mar 2019 14:35:10 +0100 Message-Id: <20190315133513.9909-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190315133513.9909-1-alexandre.belloni@bootlin.com> References: <20190315133513.9909-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_063538_956223_AF315284 X-CRM114-Status: GOOD ( 10.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gregory Clement , Alexandre Belloni , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This RTC handles time from 2000-01-01 00:00:00 to 2099-12-31 23:59:59 with a weird rollover to 2000-06-23 00:00:00. Signed-off-by: Alexandre Belloni Tested-by: Gregory CLEMENT --- drivers/rtc/rtc-mv.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index ef704aef8663..e357a0b3f612 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -57,7 +57,7 @@ static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) | (bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) | - (bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS); + (bin2bcd(tm->tm_year - 100) << RTC_YEAR_OFFS); writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS); return 0; @@ -156,7 +156,7 @@ static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) << RTC_MONTH_OFFS; if (alm->time.tm_year >= 0) - rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100)) + rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year - 100)) << RTC_YEAR_OFFS; writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS); @@ -277,6 +277,9 @@ static int __init mv_rtc_probe(struct platform_device *pdev) pdata->rtc->ops = &mv_rtc_ops; } + pdata->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; + pdata->rtc->range_max = RTC_TIMESTAMP_END_2099; + ret = rtc_register_device(pdata->rtc); if (!ret) return 0;