From patchwork Wed Dec 2 11:13:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 11945699 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EA08C64E8A for ; Wed, 2 Dec 2020 11:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4C3222240 for ; Wed, 2 Dec 2020 11:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729603AbgLBLOW (ORCPT ); Wed, 2 Dec 2020 06:14:22 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:34356 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgLBLOV (ORCPT ); Wed, 2 Dec 2020 06:14:21 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201202111329euoutp019338554986b6a2ebb96bfa771cc97195~M4fTyaONs2923429234euoutp01A for ; Wed, 2 Dec 2020 11:13:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201202111329euoutp019338554986b6a2ebb96bfa771cc97195~M4fTyaONs2923429234euoutp01A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1606907609; bh=xmrBZT9PAblDAQ4lFT7oqHGPc2pHJzj/SjrNxGbO85o=; h=From:To:Cc:Subject:Date:References:From; b=c78T2JiNgVXlt/On6oMh/7Vdk7Kd5/2deSUihPynogf4cX5fTmvL9qyv3uM+76NB7 4Al44U5/1mxetbom8NS62fZ3jTB8egcRN4CRPPDNjXr5osXPd7PInWT0EV7H+nT9wW v1wq2alYNWmqAiT6FnJ+5O5JJMrpcAtP46w8fFW8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201202111328eucas1p178dd8a6f2d433b5e7c97923ddc1d232e~M4fTV_Wa40216502165eucas1p1j; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 3D.56.27958.8D677CF5; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201202111328eucas1p25b7a68b4fe94addf6088cc3ad4bedcf1~M4fS0nBfc2390323903eucas1p2h; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201202111328eusmtrp28d714f322085be8fb44a35e60d742960~M4fSz3ntr2916129161eusmtrp27; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) X-AuditID: cbfec7f2-efdff70000006d36-20-5fc776d8faf0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 08.8C.16282.7D677CF5; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201202111327eusmtip1c96926d5adc1fe6c3e8f721c59434203~M4fSUNQt71371613716eusmtip1T; Wed, 2 Dec 2020 11:13:27 +0000 (GMT) From: Marek Szyprowski To: linux-rtc@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Alexandre Belloni , Alessandro Zummo , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/2] rtc: s3c: Disable all enable (RTC, tick) bits in the probe Date: Wed, 2 Dec 2020 12:13:17 +0100 Message-Id: <20201202111318.5353-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA0VSa0hTYRjmO+d4zlFaHDdjX2YGkmlWWwuNSRYWUkuCrJCkkrXawSSdtTm1 pDINLyPDylvLTLqYTJc11Myi5tKpCbOlecEZXsAi2zTtpq2Vp1P273mfy/e8vHwkyh3GvMl4 RTKtVMgS/HAPrME8a1nXn9ImXV9UFSC+Y31DiHMclYT4YWmtm7ir6wEhNlf34OLSrmeIWN8y RIQTkvKadIlBl4dLLtXpgKSkfBaRzBh8o9wOeITJ6YT4FFop3HLY49hH+0vkRBmR5nw7CzKA 000DSBJSwfCCPlYDPEguVQXg09lKjB0+Azg0UktogPv8MANgZq2cwUzgdZ8NsKZ7AGo7byEL iXbjDGBcOCWCGrsGZ7AXFQ6/OO1/nkUpx3yHvgZjBB61B75ztWLMHhjlDwcH1QzNocLgiMaG sW0rYPUDI8pkIfWTgC+cJpQVIqBttAVhMQ9+aKsjWOwDfz2+ibCBLABHLHqCHS4C2J1ZCljX JmizzOFMM0qthrVNQpbeCie1dsAeZjHst3syNDoPrzSUoCzNgbnZXNa9Cmrb7i/UNr96/Xc1 Ccy99ujv5WLhgF5HFABf7f+uCgB0gE+rVYlxtEqkoFMFKlmiSq2IExxNSjSA+U/Q6WqbbgQ3 PnwSmABCAhOAJOrnxcFcLVIuRy47dZpWJkmV6gRaZQLLSMyPz9Fdr5FyqThZMn2cpk/Qyn8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7asvRAmpKq1YOnU7AORAjM3LVEwsrjqqz3z4SmVY/pFd/ycHXqq 1LtaQvQ22ShePxu6TbF5Y8bynF3rfS50qUZeFYx4b+xUkPctXeCO4CmzJeLvlfK4s6P1InJ2 3nI9xGzxe+q/b/byvNpT21t/fNn1t/FqsOBWj7O1s9bNtF4nlC2tlP/vkGrPxWPiN83/TCo7 y3/AffnL0C6GsmWKqx429CpGVHlmL7PtENnZ83xy5wb2NQuqU8Q+NLxY91Iy0vmZ8+XZSizF GYmGWsxFxYkAstkmaMkCAAA= X-CMS-MailID: 20201202111328eucas1p25b7a68b4fe94addf6088cc3ad4bedcf1 X-Msg-Generator: CA X-RootMTR: 20201202111328eucas1p25b7a68b4fe94addf6088cc3ad4bedcf1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201202111328eucas1p25b7a68b4fe94addf6088cc3ad4bedcf1 References: Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Bootloader might use RTC hardware and leave it in the enabled state. Ensure that the potentially enabled periodic tick interrupts are disabled before enabling the driver, because they might cause lockup if tick interrupt happens after disabling RTC gate clock. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski --- drivers/rtc/rtc-s3c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 24a41909f049..16a326e95d46 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -503,6 +503,10 @@ static int s3c_rtc_probe(struct platform_device *pdev) goto err_src_clk; } + /* disable RTC enable bits potentially set by the bootloader */ + if (info->data->disable) + info->data->disable(info); + /* check to see if everything is setup correctly */ if (info->data->enable) info->data->enable(info); From patchwork Wed Dec 2 11:13:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 11945701 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77662C71155 for ; Wed, 2 Dec 2020 11:14:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1FBB422244 for ; Wed, 2 Dec 2020 11:14:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbgLBLOW (ORCPT ); Wed, 2 Dec 2020 06:14:22 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47377 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbgLBLOW (ORCPT ); Wed, 2 Dec 2020 06:14:22 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201202111329euoutp02a06cd87132203e9a673b4e4181c15867~M4fT7aD3e1608416084euoutp02N for ; Wed, 2 Dec 2020 11:13:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201202111329euoutp02a06cd87132203e9a673b4e4181c15867~M4fT7aD3e1608416084euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1606907609; bh=jTE/5TlH7r5bEbbuRbnmUFGZRSeaoxxMfiR/QX3kpcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aZPKMlcINOCGr5vBIAI8wd6TyrDhpHqtQQ86w/SkmwJrvOypox/wfNi6uA7+7e2mu +TalQln0D8VNuOgCRzK4qEYUhhtQWijSNdUB1s1/1t0aaPSs/ZSYSYA3T5JEotoQ7U xm7wBjXK2xof23yUP5uq8x+n5Hb36r5EkoxHkd/g= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201202111329eucas1p109471ea74f1762955baaf83aeba967ad~M4fTrTzc50205202052eucas1p1B; Wed, 2 Dec 2020 11:13:29 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 40.33.45488.8D677CF5; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201202111328eucas1p1e6fff3706b790d104b76f95085dbb0c1~M4fTH3na51250912509eucas1p13; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201202111328eusmtrp2e62a86aa6cb7ea8736a49f0ddd285809~M4fTHJVss2918929189eusmtrp2g; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) X-AuditID: cbfec7f5-c77ff7000000b1b0-39-5fc776d8f14f Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B2.CF.21957.8D677CF5; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201202111328eusmtip145f6f2e39106641bd754b78e2c8e47ed~M4fSshUGC1196811968eusmtip1r; Wed, 2 Dec 2020 11:13:28 +0000 (GMT) From: Marek Szyprowski To: linux-rtc@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Alexandre Belloni , Alessandro Zummo , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 2/2] rtc: s3c: Remove dead code related to periodic tick handling Date: Wed, 2 Dec 2020 12:13:18 +0100 Message-Id: <20201202111318.5353-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201202111318.5353-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0VSWUwTURTN6wwz08biWDBeFCUh2sQNNECsG+ISLR8aFwzGRGsDY0ELQgfc iEuoayUKKKVCgqhsQqFQVokSIEDFhVZFQAJG/ChCpAERg2haGQf175xzz7kn9+VRmMSBz6ei YxMYTaxS7UuI8Jq2H9aVPSctilW1n2SyvNfvSNlVRwEpqzCY3GRWazkpayvpJGQGa4NAVtrS T4aQ8hxjktxcfJ2Q36wqRvLMnB8C+bh50W63g6INkYw6+iSj8Q8+Iorqbehxi9PvOm0eykUX UUGIDgkpoANBm5GCdEhESegiBLaaXpwn3xD0D+hInowjyKjMQ38jrpQJgh8UInA6PqB/EW16 Jcm5CHo16EZ0BIc96RCY+DXyZy9GOxA8KTVOE4ryoPdB3ns158HpJWBIe45zWExvgDJTN863 +UBJeSPG2YX0RqjtjOPWAH2XgoH+hzOebXBZpyd57AHDlqoZ7A2ux/cEfECLYKCjlORJCoK3 yYaZe9ZDX8cUwTVg9FIw1fvz8mZod5pITgbaHXpG5nAyNg3TazIxXhbDtSsS3i2FLEvZv9om 2xuMx3K4UT2B8e+TiiB7MlmQinyy/pflIlSM5jGJbIyKYQNimVN+rDKGTYxV+UWciDGj6S/x wmmZqENFw2N+zUhAoWYEFObrKcadLQqJOFJ55iyjOaHQJKoZthktoHDfeeL6aqNCQquUCcxx holjNH+nAko4/6Ig9GFo3WFFq3VR46Gg9Env/cOWq6O35BGWwIidCx/9PLB1qdgVfy/X/1TK bFYvCFPd188aDugo83C7rMgb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CR+Pz00XkP9/OGDuR+2p E96c+V5Vq/zfKGKx/6myBU8jzgu5h0jNulK8NZfd6Kxk55faWtH4/ZUr6z6tLVvxc/mz59Nv 1BsGT2U9/OtqrKy+W9SPkou7+o5/2bb69cqXFcEyDI+rjs6dvtL25U8n82X3jTcyWh9I7Ezq eZknfOLRyT8ZM+saM2tXLFFiKc5INNRiLipOBADtkFUZ4AIAAA== X-CMS-MailID: 20201202111328eucas1p1e6fff3706b790d104b76f95085dbb0c1 X-Msg-Generator: CA X-RootMTR: 20201202111328eucas1p1e6fff3706b790d104b76f95085dbb0c1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201202111328eucas1p1e6fff3706b790d104b76f95085dbb0c1 References: <20201202111318.5353-1-m.szyprowski@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Support for periodic tick interrupts has been moved from the RTC class to the HR-timers long time ago. Then it has been removed from this driver by commits 80d4bb515b78 ("RTC: Cleanup rtc_class_ops->irq_set_state") and 696160fec162 ("RTC: Cleanup rtc_class_ops->irq_set_freq()"). They however did not remove all the code related to the tick handling. Do it now then. Signed-off-by: Marek Szyprowski Reviewed-by: Krzysztof Kozlowski --- drivers/rtc/rtc-s3c.c | 226 +----------------------------------------- 1 file changed, 2 insertions(+), 224 deletions(-) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 16a326e95d46..fab326ba9cec 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -42,26 +42,15 @@ struct s3c_rtc { const struct s3c_rtc_data *data; int irq_alarm; - int irq_tick; - - spinlock_t pie_lock; spinlock_t alarm_lock; - int ticnt_save; - int ticnt_en_save; bool wake_en; }; struct s3c_rtc_data { - int max_user_freq; bool needs_src_clk; void (*irq_handler) (struct s3c_rtc *info, int mask); - void (*set_freq) (struct s3c_rtc *info, int freq); - void (*enable_tick) (struct s3c_rtc *info, struct seq_file *seq); - void (*select_tick_clk) (struct s3c_rtc *info); - void (*save_tick_cnt) (struct s3c_rtc *info); - void (*restore_tick_cnt) (struct s3c_rtc *info); void (*enable) (struct s3c_rtc *info); void (*disable) (struct s3c_rtc *info); }; @@ -91,17 +80,7 @@ static void s3c_rtc_disable_clk(struct s3c_rtc *info) clk_disable(info->rtc_clk); } -/* IRQ Handlers */ -static irqreturn_t s3c_rtc_tickirq(int irq, void *id) -{ - struct s3c_rtc *info = (struct s3c_rtc *)id; - - if (info->data->irq_handler) - info->data->irq_handler(info, S3C2410_INTP_TIC); - - return IRQ_HANDLED; -} - +/* IRQ Handler */ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) { struct s3c_rtc *info = (struct s3c_rtc *)id; @@ -148,28 +127,6 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) return ret; } -/* Set RTC frequency */ -static int s3c_rtc_setfreq(struct s3c_rtc *info, int freq) -{ - int ret; - - if (!is_power_of_2(freq)) - return -EINVAL; - - ret = s3c_rtc_enable_clk(info); - if (ret) - return ret; - spin_lock_irq(&info->pie_lock); - - if (info->data->set_freq) - info->data->set_freq(info, freq); - - spin_unlock_irq(&info->pie_lock); - s3c_rtc_disable_clk(info); - - return 0; -} - /* Time read/write */ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) { @@ -348,29 +305,11 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) return 0; } -static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) -{ - struct s3c_rtc *info = dev_get_drvdata(dev); - int ret; - - ret = s3c_rtc_enable_clk(info); - if (ret) - return ret; - - if (info->data->enable_tick) - info->data->enable_tick(info, seq); - - s3c_rtc_disable_clk(info); - - return 0; -} - static const struct rtc_class_ops s3c_rtcops = { .read_time = s3c_rtc_gettime, .set_time = s3c_rtc_settime, .read_alarm = s3c_rtc_getalarm, .set_alarm = s3c_rtc_setalarm, - .proc = s3c_rtc_proc, .alarm_irq_enable = s3c_rtc_setaie, }; @@ -450,18 +389,12 @@ static int s3c_rtc_probe(struct platform_device *pdev) if (!info) return -ENOMEM; - /* find the IRQs */ - info->irq_tick = platform_get_irq(pdev, 1); - if (info->irq_tick < 0) - return info->irq_tick; - info->dev = &pdev->dev; info->data = of_device_get_match_data(&pdev->dev); if (!info->data) { dev_err(&pdev->dev, "failed getting s3c_rtc_data\n"); return -EINVAL; } - spin_lock_init(&info->pie_lock); spin_lock_init(&info->alarm_lock); platform_set_drvdata(pdev, info); @@ -470,8 +403,7 @@ static int s3c_rtc_probe(struct platform_device *pdev) if (info->irq_alarm < 0) return info->irq_alarm; - dev_dbg(&pdev->dev, "s3c2410_rtc: tick irq %d, alarm irq %d\n", - info->irq_tick, info->irq_alarm); + dev_dbg(&pdev->dev, "s3c2410_rtc: alarm irq %d\n", info->irq_alarm); /* get the memory region */ info->base = devm_platform_ioremap_resource(pdev, 0); @@ -546,18 +478,6 @@ static int s3c_rtc_probe(struct platform_device *pdev) goto err_nortc; } - ret = devm_request_irq(&pdev->dev, info->irq_tick, s3c_rtc_tickirq, - 0, "s3c2410-rtc tick", info); - if (ret) { - dev_err(&pdev->dev, "IRQ%d error %d\n", info->irq_tick, ret); - goto err_nortc; - } - - if (info->data->select_tick_clk) - info->data->select_tick_clk(info); - - s3c_rtc_setfreq(info, 1); - s3c_rtc_disable_clk(info); return 0; @@ -585,10 +505,6 @@ static int s3c_rtc_suspend(struct device *dev) if (ret) return ret; - /* save TICNT for anyone using periodic interrupts */ - if (info->data->save_tick_cnt) - info->data->save_tick_cnt(info); - if (info->data->disable) info->data->disable(info); @@ -609,9 +525,6 @@ static int s3c_rtc_resume(struct device *dev) if (info->data->enable) info->data->enable(info); - if (info->data->restore_tick_cnt) - info->data->restore_tick_cnt(info); - s3c_rtc_disable_clk(info); if (device_may_wakeup(dev) && info->wake_en) { @@ -635,162 +548,27 @@ static void s3c6410_rtc_irq(struct s3c_rtc *info, int mask) writeb(mask, info->base + S3C2410_INTP); } -static void s3c2410_rtc_setfreq(struct s3c_rtc *info, int freq) -{ - unsigned int tmp = 0; - int val; - - tmp = readb(info->base + S3C2410_TICNT); - tmp &= S3C2410_TICNT_ENABLE; - - val = (info->rtc->max_user_freq / freq) - 1; - tmp |= val; - - writel(tmp, info->base + S3C2410_TICNT); -} - -static void s3c2416_rtc_setfreq(struct s3c_rtc *info, int freq) -{ - unsigned int tmp = 0; - int val; - - tmp = readb(info->base + S3C2410_TICNT); - tmp &= S3C2410_TICNT_ENABLE; - - val = (info->rtc->max_user_freq / freq) - 1; - - tmp |= S3C2443_TICNT_PART(val); - writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1); - - writel(S3C2416_TICNT2_PART(val), info->base + S3C2416_TICNT2); - - writel(tmp, info->base + S3C2410_TICNT); -} - -static void s3c2443_rtc_setfreq(struct s3c_rtc *info, int freq) -{ - unsigned int tmp = 0; - int val; - - tmp = readb(info->base + S3C2410_TICNT); - tmp &= S3C2410_TICNT_ENABLE; - - val = (info->rtc->max_user_freq / freq) - 1; - - tmp |= S3C2443_TICNT_PART(val); - writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1); - - writel(tmp, info->base + S3C2410_TICNT); -} - -static void s3c6410_rtc_setfreq(struct s3c_rtc *info, int freq) -{ - int val; - - val = (info->rtc->max_user_freq / freq) - 1; - writel(val, info->base + S3C2410_TICNT); -} - -static void s3c24xx_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq) -{ - unsigned int ticnt; - - ticnt = readb(info->base + S3C2410_TICNT); - ticnt &= S3C2410_TICNT_ENABLE; - - seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no"); -} - -static void s3c2416_rtc_select_tick_clk(struct s3c_rtc *info) -{ - unsigned int con; - - con = readw(info->base + S3C2410_RTCCON); - con |= S3C2443_RTCCON_TICSEL; - writew(con, info->base + S3C2410_RTCCON); -} - -static void s3c6410_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq) -{ - unsigned int ticnt; - - ticnt = readw(info->base + S3C2410_RTCCON); - ticnt &= S3C64XX_RTCCON_TICEN; - - seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no"); -} - -static void s3c24xx_rtc_save_tick_cnt(struct s3c_rtc *info) -{ - info->ticnt_save = readb(info->base + S3C2410_TICNT); -} - -static void s3c24xx_rtc_restore_tick_cnt(struct s3c_rtc *info) -{ - writeb(info->ticnt_save, info->base + S3C2410_TICNT); -} - -static void s3c6410_rtc_save_tick_cnt(struct s3c_rtc *info) -{ - info->ticnt_en_save = readw(info->base + S3C2410_RTCCON); - info->ticnt_en_save &= S3C64XX_RTCCON_TICEN; - info->ticnt_save = readl(info->base + S3C2410_TICNT); -} - -static void s3c6410_rtc_restore_tick_cnt(struct s3c_rtc *info) -{ - unsigned int con; - - writel(info->ticnt_save, info->base + S3C2410_TICNT); - if (info->ticnt_en_save) { - con = readw(info->base + S3C2410_RTCCON); - writew(con | info->ticnt_en_save, info->base + S3C2410_RTCCON); - } -} - static struct s3c_rtc_data const s3c2410_rtc_data = { - .max_user_freq = 128, .irq_handler = s3c24xx_rtc_irq, - .set_freq = s3c2410_rtc_setfreq, - .enable_tick = s3c24xx_rtc_enable_tick, - .save_tick_cnt = s3c24xx_rtc_save_tick_cnt, - .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, }; static struct s3c_rtc_data const s3c2416_rtc_data = { - .max_user_freq = 32768, .irq_handler = s3c24xx_rtc_irq, - .set_freq = s3c2416_rtc_setfreq, - .enable_tick = s3c24xx_rtc_enable_tick, - .select_tick_clk = s3c2416_rtc_select_tick_clk, - .save_tick_cnt = s3c24xx_rtc_save_tick_cnt, - .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, }; static struct s3c_rtc_data const s3c2443_rtc_data = { - .max_user_freq = 32768, .irq_handler = s3c24xx_rtc_irq, - .set_freq = s3c2443_rtc_setfreq, - .enable_tick = s3c24xx_rtc_enable_tick, - .select_tick_clk = s3c2416_rtc_select_tick_clk, - .save_tick_cnt = s3c24xx_rtc_save_tick_cnt, - .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt, .enable = s3c24xx_rtc_enable, .disable = s3c24xx_rtc_disable, }; static struct s3c_rtc_data const s3c6410_rtc_data = { - .max_user_freq = 32768, .needs_src_clk = true, .irq_handler = s3c6410_rtc_irq, - .set_freq = s3c6410_rtc_setfreq, - .enable_tick = s3c6410_rtc_enable_tick, - .save_tick_cnt = s3c6410_rtc_save_tick_cnt, - .restore_tick_cnt = s3c6410_rtc_restore_tick_cnt, .enable = s3c24xx_rtc_enable, .disable = s3c6410_rtc_disable, };