From patchwork Sat Jul 20 00:04:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2830747 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 235AAC0319 for ; Sat, 20 Jul 2013 00:07:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4ED55201E3 for ; Sat, 20 Jul 2013 00:07:47 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5F0A0200DE for ; Sat, 20 Jul 2013 00:07:46 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0Kgg-0004EO-Ri; Sat, 20 Jul 2013 00:06:16 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0KgN-0005er-II; Sat, 20 Jul 2013 00:05:55 +0000 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V0Kfj-0005Vx-He for linux-arm-kernel@lists.infradead.org; Sat, 20 Jul 2013 00:05:16 +0000 Received: by mail-ea0-f174.google.com with SMTP id o10so2667705eaj.5 for ; Fri, 19 Jul 2013 17:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=6kUPxeoB8rrQxfKjdcTbxzB/k5HGQxmjHgDEH+DOfDw=; b=veZETpUV3dMmZcJbaygiPgFoJ3PTTX2zx/7/KIcKr+CIbTF1E+ZnXxaUQXiYK2yfzO kLXCzU81BiDjQljYGI3qG3op8tlxu2ZvjDs2+yX3YlJowJZ0o9h41hVStVuX3f3+tJoQ orJpsWzp2ccafFhWuBKuzw9ORuP2Hj4HCnhOSV64H2x9j7cC9wJ6ceIoNyfbz4z3BZxh bjHKL0LjMfvGuYzh7fq/UtaerstV3CxRzWThytrv3+Tj75gzPZTXH2VeWr7e4h3SfZax RPExQZ1cyr9vSajGQhqyjhXVRm7WSzx///QZWsdk+dP6jU8zw5fIRla8/3dGYhdkwAX9 8umg== X-Received: by 10.15.32.67 with SMTP id z43mr18274667eeu.24.1374278696731; Fri, 19 Jul 2013 17:04:56 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id bj46sm31186249eeb.13.2013.07.19.17.04.54 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Jul 2013 17:04:55 -0700 (PDT) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH v4 04/20] clocksource: samsung_pwm_timer: Do not use clocksource_mmio Date: Sat, 20 Jul 2013 02:04:17 +0200 Message-Id: <1374278673-25615-6-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1374278673-25615-1-git-send-email-tomasz.figa@gmail.com> References: <1374278673-25615-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130719_200515_774437_AC23B576 X-CRM114-Status: GOOD ( 13.70 ) X-Spam-Score: -2.0 (--) Cc: linux-pwm@vger.kernel.org, Kukjin Kim , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Arnd Bergmann , Tomasz Figa , Mark Brown , Thierry Reding , Olof Johansson , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case of Samsung PWM timer, clocksource MMIO can not be used, because custom suspend/resume callbacks are required. Signed-off-by: Tomasz Figa Reviewed-by: Daniel Lezcano --- drivers/clocksource/Kconfig | 1 - drivers/clocksource/samsung_pwm_timer.c | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index b7b9b04..41c6946 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -99,7 +99,6 @@ config CLKSRC_EXYNOS_MCT config CLKSRC_SAMSUNG_PWM bool - select CLKSRC_MMIO help This is a new clocksource driver for the PWM timer found in Samsung S3C, S5P and Exynos SoCs, replacing an earlier driver diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c index 823279b..753ffec 100644 --- a/drivers/clocksource/samsung_pwm_timer.c +++ b/drivers/clocksource/samsung_pwm_timer.c @@ -288,6 +288,18 @@ static void __init samsung_clockevent_init(void) } } +static cycle_t samsung_clocksource_read(struct clocksource *c) +{ + return ~readl_relaxed(pwm.source_reg); +} + +static struct clocksource samsung_clocksource = { + .name = "samsung_clocksource_timer", + .rating = 250, + .read = samsung_clocksource_read, + .flags = CLOCK_SOURCE_IS_CONTINUOUS, +}; + /* * Override the global weak sched_clock symbol with this * local implementation which uses the clocksource to get some @@ -297,7 +309,7 @@ static void __init samsung_clockevent_init(void) */ static u32 notrace samsung_read_sched_clock(void) { - return ~__raw_readl(pwm.source_reg); + return samsung_clocksource_read(NULL); } static void __init samsung_clocksource_init(void) @@ -324,9 +336,8 @@ static void __init samsung_clocksource_init(void) setup_sched_clock(samsung_read_sched_clock, pwm.variant.bits, clock_rate); - ret = clocksource_mmio_init(pwm.source_reg, "samsung_clocksource_timer", - clock_rate, 250, pwm.variant.bits, - clocksource_mmio_readl_down); + samsung_clocksource.mask = CLOCKSOURCE_MASK(pwm.variant.bits); + ret = clocksource_register_hz(&samsung_clocksource, clock_rate); if (ret) panic("samsung_clocksource_timer: can't register clocksource\n"); }