From patchwork Sat Mar 9 20:23:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2242521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 504EA3FCF6 for ; Sat, 9 Mar 2013 20:30:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UEQLm-0005E3-3r; Sat, 09 Mar 2013 20:26:39 +0000 Received: from mail-wg0-f53.google.com ([74.125.82.53]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UEQJ5-0004Rd-Ig for linux-arm-kernel@lists.infradead.org; Sat, 09 Mar 2013 20:24:00 +0000 Received: by mail-wg0-f53.google.com with SMTP id fn15so3785051wgb.20 for ; Sat, 09 Mar 2013 12:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=pXJAMYX1NZ6PZBcPNvmTcwTbkOdCYlehValbllyXngY=; b=Eb0PE2yoaYPRqICT9Gl4X04R7crovOz+DutLQkvDEVyw3uwjqxoisnHDxU9Q/RGk4g pFe1Zs2x8m/cdMRsfh4sDznEP9HCJ+cX59661V8QAoVfAZKY+Klgir0ntX1hehmMc0HI DWoPc83fYnampaKZ1uDFSMBgYLSegtjuMbKjVyA4btTSN9RwLyWEZJV+1XBiFGnAQhiA aMtxUOcIs/hFqIpDvq2MEc3n0EdlQMAPszOPajvMrJGq8UAEQmxZwpflyQRl7jVzbPXt 4Jlqt7RaMh0Zk5qWXww7MPctx+ReVnbxx/tXXpqqwNaEX4liJS24I+KXPAl4R5OfStni t3/w== X-Received: by 10.180.78.168 with SMTP id c8mr4842072wix.27.1362860629859; Sat, 09 Mar 2013 12:23:49 -0800 (PST) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPS id ed6sm6858911wib.9.2013.03.09.12.23.47 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 Mar 2013 12:23:49 -0800 (PST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping Date: Sat, 9 Mar 2013 21:23:15 +0100 Message-Id: <1362860601-18464-7-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1362860601-18464-1-git-send-email-tomasz.figa@gmail.com> References: <1362860601-18464-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130309_152351_911664_9F4CF7F2 X-CRM114-Status: GOOD ( 15.52 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.53 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomasz.figa[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: ghcstop@gmail.com, Mark Rutland , Kukjin Kim , linux@arm.linux.org.uk, =?UTF-8?q?Heiko=20St=C3=BCbner?= , kwangwoo.lee@gmail.com, broonie@opensource.wolfsonmicro.com, mcuelenaere@gmail.com, Tomasz Figa , christer@weinigel.se, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, buserror@gmail.com, augulis.darius@gmail.com, jacmet@sunsite.dk, Sylwester Nawrocki , linux@simtec.co.uk, jekhor@gmail.com 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 brings the samsung-time driver one step closer to multiplatform by replacing references to statically mapped registers with dynamic mapping using ioremap. The helper struct samsung_timer_variant is extended with reg_base field, which is used to pass platform-specific base address to the driver. Signed-off-by: Tomasz Figa --- arch/arm/mach-exynos/mach-universal_c210.c | 1 + arch/arm/mach-s3c24xx/common.c | 1 + arch/arm/mach-s3c64xx/common.c | 1 + arch/arm/mach-s5p64x0/common.c | 1 + arch/arm/mach-s5pc100/common.c | 1 + arch/arm/mach-s5pv210/common.c | 1 + drivers/clocksource/samsung-time.c | 9 +++++++-- include/clocksource/samsung-time.h | 2 ++ 8 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c index 8ce1206..3ece9e0 100644 --- a/arch/arm/mach-exynos/mach-universal_c210.c +++ b/arch/arm/mach-exynos/mach-universal_c210.c @@ -1090,6 +1090,7 @@ static struct platform_device *universal_devices[] __initdata = { }; static const struct samsung_timer_variant universal_timer_variant = { + .reg_base = EXYNOS4_PA_TIMER, .bits = 32, .prescale = 2, .divisor = 1, diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index fe054d6..5f142b2 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c @@ -218,6 +218,7 @@ static void s3c24xx_default_idle(void) } static const struct samsung_timer_variant s3c24xx_timer_variant = { + .reg_base = S3C24XX_PA_TIMER, .bits = 16, .prescale = 25, .divisor = 2, diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c index 0f7df6a..a4a370e 100644 --- a/arch/arm/mach-s3c64xx/common.c +++ b/arch/arm/mach-s3c64xx/common.c @@ -150,6 +150,7 @@ static struct device s3c64xx_dev = { }; static const struct samsung_timer_variant s3c64xx_timer_variant = { + .reg_base = S3C_PA_TIMER, .bits = 32, .prescale = 2, .divisor = 1, diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c index 2839022..407c5a7 100644 --- a/arch/arm/mach-s5p64x0/common.c +++ b/arch/arm/mach-s5p64x0/common.c @@ -158,6 +158,7 @@ static void s5p64x0_idle(void) } static const struct samsung_timer_variant s5p64x0_timer_variant = { + .reg_base = S5P_PA_TIMER, .bits = 32, .prescale = 2, .divisor = 1, diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c index 0df9124..0df734a 100644 --- a/arch/arm/mach-s5pc100/common.c +++ b/arch/arm/mach-s5pc100/common.c @@ -133,6 +133,7 @@ static struct map_desc s5pc100_iodesc[] __initdata = { }; static const struct samsung_timer_variant s5pc100_timer_variant = { + .reg_base = S5P_PA_TIMER, .bits = 32, .prescale = 2, .divisor = 1, diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c index 2d1bc6b..42108ca 100644 --- a/arch/arm/mach-s5pv210/common.c +++ b/arch/arm/mach-s5pv210/common.c @@ -150,6 +150,7 @@ void s5pv210_restart(char mode, const char *cmd) } static const struct samsung_timer_variant s5pv210_timer_variant = { + .reg_base = S5P_PA_TIMER, .bits = 32, .prescale = 2, .divisor = 1, diff --git a/drivers/clocksource/samsung-time.c b/drivers/clocksource/samsung-time.c index 259ce25..f14e3fa 100644 --- a/drivers/clocksource/samsung-time.c +++ b/drivers/clocksource/samsung-time.c @@ -24,10 +24,11 @@ #include #include -#include #include -#define S3C_TIMERREG(x) (S3C_VA_TIMER + (x)) +static void __iomem *timer_base; + +#define S3C_TIMERREG(x) (timer_base + (x)) #define S3C_TIMERREG2(tmr,reg) S3C_TIMERREG((reg)+0x0c+((tmr)*0x0c)) #define S3C2410_TCON S3C_TIMERREG(0x08) @@ -406,6 +407,10 @@ static void __init samsung_timer_resources(void) unsigned long source_id = timer_source.source_id; char devname[15]; + timer_base = ioremap_nocache(timer_variant.reg_base, SZ_4K); + if (!timer_base) + panic("failed to map timer registers"); + timerclk = clk_get(NULL, "timers"); if (IS_ERR(timerclk)) panic("failed to get timers clock for timer"); diff --git a/include/clocksource/samsung-time.h b/include/clocksource/samsung-time.h index d64d8a2..535a334 100644 --- a/include/clocksource/samsung-time.h +++ b/include/clocksource/samsung-time.h @@ -29,11 +29,13 @@ struct samsung_timer_source { /** * struct samsung_timer_variant - SoC-specific parameters of Samsung PWM timers + * @reg_base: physical base address of timer registers * @bits: bit width of time counters * @prescale: prescaler divisor * @divisor: main divisor */ struct samsung_timer_variant { + unsigned long reg_base; int bits; u16 prescale; u16 divisor;