From: Tomasz Figa <tomasz.figa@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-samsung-soc@vger.kernel.org,
"Kukjin Kim" <kgene.kim@samsung.com>,
kyungmin.park@samsung.com, linux@simtec.co.uk,
broonie@opensource.wolfsonmicro.com, kwangwoo.lee@gmail.com,
jacmet@sunsite.dk, augulis.darius@gmail.com,
mcuelenaere@gmail.com, linux@arm.linux.org.uk,
"Sylwester Nawrocki" <sylvester.nawrocki@gmail.com>,
buserror@gmail.com, christer@weinigel.se, jekhor@gmail.com,
ghcstop@gmail.com, "Mark Rutland" <mark.rutland@arm.com>,
"Tomasz Figa" <tomasz.figa@gmail.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Rob Herring" <robherring2@gmail.com>
Subject: [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping
Date: Sat, 9 Mar 2013 21:23:15 +0100 [thread overview]
Message-ID: <1362860601-18464-7-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1362860601-18464-1-git-send-email-tomasz.figa@gmail.com>
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 <tomasz.figa@gmail.com>
---
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 <asm/mach/map.h>
#include <asm/sched_clock.h>
-#include <mach/map.h>
#include <plat/devs.h>
-#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;
--
1.8.1.5
WARNING: multiple messages have this Message-ID (diff)
From: tomasz.figa@gmail.com (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 [thread overview]
Message-ID: <1362860601-18464-7-git-send-email-tomasz.figa@gmail.com> (raw)
In-Reply-To: <1362860601-18464-1-git-send-email-tomasz.figa@gmail.com>
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 <tomasz.figa@gmail.com>
---
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 <asm/mach/map.h>
#include <asm/sched_clock.h>
-#include <mach/map.h>
#include <plat/devs.h>
-#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;
--
1.8.1.5
next prev parent reply other threads:[~2013-03-09 20:23 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 20:23 [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 01/12] ARM: SAMSUNG: Move samsung-time to drivers/clocksource Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 02/12] clocksource: samsung-time: Set platform-specific parameters at runtime Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 03/12] clocksource: samsung-time: Drop useless defines from public header Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 04/12] ARM: SAMSUNG: Move samsung-time.h header to inlude/clocksource Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 05/12] clocksource: samsung-time: Use local register definitions Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa [this message]
2013-03-09 20:23 ` [PATCH v3 06/12] clocksource: samsung-time: Remove use of static register mapping Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 07/12] clocksource: samsung-time: Use clk_get_sys for getting clocks Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 08/12] ARM: SAMSUNG: devs: Drop unnecessary IRQ resources of timer devices Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 09/12] clocksource: samsung-time: Do not use static IRQ definition Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 10/12] clocksource: samsung-time: Move IRQ mask/ack handling to the driver Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 11/12] ARM: SAMSUNG: Remove unused PWM timer IRQ chip code Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-09 20:23 ` [PATCH v3 12/12] clocksource: samsung-time: Add Device Tree support Tomasz Figa
2013-03-09 20:23 ` Tomasz Figa
2013-03-28 12:30 ` Mark Brown
2013-03-28 12:30 ` Mark Brown
2013-03-23 12:27 ` [PATCH v3 00/12] ARM: samsung-time: Prepare for multiplatform support Tomasz Figa
2013-03-23 12:27 ` Tomasz Figa
2013-03-28 13:02 ` Mark Brown
2013-03-28 13:02 ` Mark Brown
2013-03-28 22:29 ` Tomasz Figa
2013-03-28 22:29 ` Tomasz Figa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362860601-18464-7-git-send-email-tomasz.figa@gmail.com \
--to=tomasz.figa@gmail.com \
--cc=augulis.darius@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=buserror@gmail.com \
--cc=christer@weinigel.se \
--cc=ghcstop@gmail.com \
--cc=heiko@sntech.de \
--cc=jacmet@sunsite.dk \
--cc=jekhor@gmail.com \
--cc=kgene.kim@samsung.com \
--cc=kwangwoo.lee@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=linux@simtec.co.uk \
--cc=mark.rutland@arm.com \
--cc=mcuelenaere@gmail.com \
--cc=robherring2@gmail.com \
--cc=sylvester.nawrocki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.