From patchwork Thu Apr 4 16:37:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2394121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 87E73DF25A for ; Thu, 4 Apr 2013 16:42:11 +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 1UNnEo-0002ZH-NF for patchwork-linux-arm@patchwork.kernel.org; Thu, 04 Apr 2013 16:42:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNnE2-0005If-FS; Thu, 04 Apr 2013 16:41:22 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UNnC4-0003oK-9d for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2013 16:39:22 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKQ00MOCOXJSC90@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 05 Apr 2013 01:39:19 +0900 (KST) X-AuditID: cbfee61a-b7fa86d0000045ae-85-515dacb66a00 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EF.88.17838.6BCAD515; Fri, 05 Apr 2013 01:39:19 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKQ00F2OOU1P170@mmp1.samsung.com>; Fri, 05 Apr 2013 01:39:18 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 10/14] clocksource: samsung-time: Use master driver to configure dividers Date: Thu, 04 Apr 2013 18:37:07 +0200 Message-id: <1365093431-30621-11-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1365093431-30621-1-git-send-email-t.figa@samsung.com> References: <1365093431-30621-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWRW0iTcRjG/X9nR4uPafmhpDQqItImevEHZUSB/LUMd5MoWC79UPOwsaml XTTNgpaaxzW0hpZWigfazKlZ6MpITWdK81AaOToxM2Vm1Eprk+5+7/M+z/tcvAwuaiH8mYyc XF6VI88SUwJidMPOBpvbkmSS6jUG/ql6TsPHXzcA3KgfoeCcc5GGD1pWKThQ/56EQ6VSuLno IOHopA3AwY5mEr50BcOyhtcUvP9wgoBjxUs0NNptJNRbn2DwzZQQurqLCNj+bJ6GzdOvMDhp KCbgj/V1Co5eI6HB2YvBTr2DgCZjLQ5b+36DwwGozdAGUMmlUgq5flUB1Fs3T6O3tn4KLY+P 08gwLEOmpovIqm8E6Euli0LlXa0AWZdqCWS2GXCkc1gp5DQGIsdMPYhjEwWRqXxWRj6vOiRN FqR/d1ZgSpf4/N3aXkoD1nZpgTfDseHc7KaJ3uKd3MRCJ6UFAkbE3gacs/sFvTVoMa723k3c 7aLYfZxTs0i52Zfdz9Vo7Z40zl4lub4bvm72YU9xjXVNmJsJdi835Sgj3Sxkj3KbM0Vgqy2I +/Cu3HPH262PrXj8IvYId8VlARVA2AC8WsEOXpmiVJ9Jyw4NUcuz1Xk5aSEpimwj8Dzwo38P aNFAC2AZIN4mTC9PkolIeb66INsCOAYX+wqHSv5JwlR5QSGvUpxW5WXxagsIYAixn3DgcoRM xKbJc/lMnlfyqv9bjPH214DMhOQe8/GQLGDsiSFsiQnRcaaa9rCxEl04gyIsK5KgBbtitTB5 9uSqRKI+8ejn9eSzmMXHJ37lKX1wOu6WVHGuo1oae6fyWz/XlcvqPi17Tc4vRMn9AnWD5j16 02dzfOD2KHIkkl0PiwyKqWlsHI4NirYPzO2uCujHL6weExPqdHnoAVyllv8FauxrKbwCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130404_123920_843186_8A300BCE X-CRM114-Status: GOOD ( 11.51 ) X-Spam-Score: -7.5 (-------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-7.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] 1.7 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: mark.rutland@arm.com, heiko@sntech.de, Tomasz Figa , tomasz.figa@gmail.com, buserror@gmail.com, jacmet@sunsite.dk, augulis.darius@gmail.com, christer@weinigel.se, sylvester.nawrocki@gmail.com, m.szyprowski@samsung.com, kgene.kim@samsung.com, linux@arm.linux.org.uk, sameo@linux.intel.com, kwangwoo.lee@gmail.com, mcuelenaere@gmail.com, arnd@arndb.de, devicetree-discuss@lists.ozlabs.org, linux-samsung-soc@vger.kernel.org, john.stultz@linaro.org, ghcstop@gmail.com, linux@simtec.co.uk, broonie@opensource.wolfsonmicro.com, jekhor@gmail.com, kyungmin.park@samsung.com, tglx@linutronix.de 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 This patch modifies the driver to use functions provided by master driver to configure PWM frequency dividers. Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park --- drivers/clocksource/samsung-time.c | 61 +++++--------------------------------- 1 file changed, 8 insertions(+), 53 deletions(-) diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c index 4fa6f6f..e617d37 100644 --- a/drivers/clocksource/samsung-time.c +++ b/drivers/clocksource/samsung-time.c @@ -19,7 +19,6 @@ #include -#include #define S3C_TIMERREG(x) (pwm->base + (x)) #define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c)) @@ -72,10 +71,6 @@ struct samsung_timer_source { }; static struct samsung_pwm *pwm; -static struct clk *tin_event; -static struct clk *tin_source; -static struct clk *tdiv_event; -static struct clk *tdiv_source; static struct clk *timerclk; static struct samsung_timer_source timer_source; static unsigned long clock_count_per_tick; @@ -267,9 +262,6 @@ static void samsung_timer_resume(void) samsung_time_start(timer_source.source_id, true); } - s3c_device_timer[event].dev.bus = &platform_bus_type; - s3c_device_timer[source].dev.bus = &platform_bus_type; - static struct clock_event_device time_event_device = { .name = "samsung_event_timer", .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, @@ -299,18 +291,14 @@ static void __init samsung_clockevent_init(void) unsigned long pclk; unsigned long clock_rate; unsigned int irq_number; - struct clk *tscaler; pclk = clk_get_rate(timerclk); - tscaler = clk_get_parent(tdiv_event); - - clk_set_rate(tscaler, pclk / timer_source.tscaler_div); - clk_set_rate(tdiv_event, - pclk / (timer_source.tscaler_div * timer_source.tdiv)); - clk_set_parent(tin_event, tdiv_event); + samsung_pwm_set_prescale(pwm, timer_source.event_id, + timer_source.tscaler_div); + samsung_pwm_set_divisor(pwm, timer_source.event_id, timer_source.tdiv); - clock_rate = clk_get_rate(tin_event); + clock_rate = pclk / (timer_source.tscaler_div * timer_source.tdiv); clock_count_per_tick = clock_rate / HZ; time_event_device.cpumask = cpumask_of(0); @@ -370,11 +358,11 @@ static void __init samsung_clocksource_init(void) pclk = clk_get_rate(timerclk); - clk_set_rate(tdiv_source, - pclk / (timer_source.tscaler_div * timer_source.tdiv)); - clk_set_parent(tin_source, tdiv_source); + samsung_pwm_set_prescale(pwm, timer_source.source_id, + timer_source.tscaler_div); + samsung_pwm_set_divisor(pwm, timer_source.source_id, timer_source.tdiv); - clock_rate = clk_get_rate(tin_source); + clock_rate = pclk / (timer_source.tscaler_div * timer_source.tdiv); samsung_time_setup(timer_source.source_id, timer_source.tcnt_max); samsung_time_start(timer_source.source_id, true); @@ -391,43 +379,10 @@ static void __init samsung_clocksource_init(void) static void __init samsung_timer_resources(void) { - - unsigned long event_id = timer_source.event_id; - unsigned long source_id = timer_source.source_id; - char devname[15]; - timerclk = clk_get(NULL, "timers"); if (IS_ERR(timerclk)) panic("failed to get timers clock for timer"); - clk_enable(timerclk); - - sprintf(devname, "s3c24xx-pwm.%lu", event_id); - s3c_device_timer[event_id].id = event_id; - s3c_device_timer[event_id].dev.init_name = devname; - - tin_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tin"); - if (IS_ERR(tin_event)) - panic("failed to get pwm-tin clock for event timer"); - - tdiv_event = clk_get(&s3c_device_timer[event_id].dev, "pwm-tdiv"); - if (IS_ERR(tdiv_event)) - panic("failed to get pwm-tdiv clock for event timer"); - - clk_enable(tin_event); - - sprintf(devname, "s3c24xx-pwm.%lu", source_id); - s3c_device_timer[source_id].id = source_id; - s3c_device_timer[source_id].dev.init_name = devname; - - tin_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tin"); - if (IS_ERR(tin_source)) - panic("failed to get pwm-tin clock for source timer"); - - tdiv_source = clk_get(&s3c_device_timer[source_id].dev, "pwm-tdiv"); - if (IS_ERR(tdiv_source)) - panic("failed to get pwm-tdiv clock for source timer"); - clk_enable(tin_source); timer_source.tcnt_max = (1UL << pwm->variant.bits) - 1;