From: haojian.zhuang@gmail.com (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 07/11] ARM: mmp: move timer registers into driver
Date: Mon, 3 Jun 2013 17:30:41 +0800 [thread overview]
Message-ID: <1370251845-31373-8-git-send-email-haojian.zhuang@gmail.com> (raw)
In-Reply-To: <1370251845-31373-1-git-send-email-haojian.zhuang@gmail.com>
Move the definition of timer registers into timer-mmp driver.
And map timer registers in driver.
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
---
arch/arm/mach-mmp/include/mach/regs-timers.h | 44 ----------------------------
drivers/clocksource/timer-mmp.c | 38 ++++++++++++++++++++----
2 files changed, 33 insertions(+), 49 deletions(-)
delete mode 100644 arch/arm/mach-mmp/include/mach/regs-timers.h
diff --git a/arch/arm/mach-mmp/include/mach/regs-timers.h b/arch/arm/mach-mmp/include/mach/regs-timers.h
deleted file mode 100644
index 45589fe..0000000
--- a/arch/arm/mach-mmp/include/mach/regs-timers.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * linux/arch/arm/mach-mmp/include/mach/regs-timers.h
- *
- * Timers Module
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_MACH_REGS_TIMERS_H
-#define __ASM_MACH_REGS_TIMERS_H
-
-#include <mach/addr-map.h>
-
-#define TIMERS1_VIRT_BASE (APB_VIRT_BASE + 0x14000)
-#define TIMERS2_VIRT_BASE (APB_VIRT_BASE + 0x16000)
-
-#define TMR_CCR (0x0000)
-#define TMR_TN_MM(n, m) (0x0004 + ((n) << 3) + (((n) + (m)) << 2))
-#define TMR_CR(n) (0x0028 + ((n) << 2))
-#define TMR_SR(n) (0x0034 + ((n) << 2))
-#define TMR_IER(n) (0x0040 + ((n) << 2))
-#define TMR_PLVR(n) (0x004c + ((n) << 2))
-#define TMR_PLCR(n) (0x0058 + ((n) << 2))
-#define TMR_WMER (0x0064)
-#define TMR_WMR (0x0068)
-#define TMR_WVR (0x006c)
-#define TMR_WSR (0x0070)
-#define TMR_ICR(n) (0x0074 + ((n) << 2))
-#define TMR_WICR (0x0080)
-#define TMR_CER (0x0084)
-#define TMR_CMR (0x0088)
-#define TMR_ILR(n) (0x008c + ((n) << 2))
-#define TMR_WCR (0x0098)
-#define TMR_WFAR (0x009c)
-#define TMR_WSAR (0x00A0)
-#define TMR_CVWR(n) (0x00A4 + ((n) << 2))
-
-#define TMR_CCR_CS_0(x) (((x) & 0x3) << 0)
-#define TMR_CCR_CS_1(x) (((x) & 0x7) << 2)
-#define TMR_CCR_CS_2(x) (((x) & 0x3) << 5)
-
-#endif /* __ASM_MACH_REGS_TIMERS_H */
diff --git a/drivers/clocksource/timer-mmp.c b/drivers/clocksource/timer-mmp.c
index 553e3de..75cc961 100644
--- a/drivers/clocksource/timer-mmp.c
+++ b/drivers/clocksource/timer-mmp.c
@@ -30,19 +30,44 @@
#include <linux/of_irq.h>
#include <asm/sched_clock.h>
-#include <mach/addr-map.h>
-#include <mach/regs-timers.h>
-#include <mach/regs-apbc.h>
#include <mach/irqs.h>
#include <mach/cputype.h>
#include <asm/mach/time.h>
-#define TIMERS_VIRT_BASE TIMERS1_VIRT_BASE
+#define TMR_CCR (0x0000)
+#define TMR_TN_MM(n, m) (0x0004 + ((n) << 3) + (((n) + (m)) << 2))
+#define TMR_CR(n) (0x0028 + ((n) << 2))
+#define TMR_SR(n) (0x0034 + ((n) << 2))
+#define TMR_IER(n) (0x0040 + ((n) << 2))
+#define TMR_PLVR(n) (0x004c + ((n) << 2))
+#define TMR_PLCR(n) (0x0058 + ((n) << 2))
+#define TMR_WMER (0x0064)
+#define TMR_WMR (0x0068)
+#define TMR_WVR (0x006c)
+#define TMR_WSR (0x0070)
+#define TMR_ICR(n) (0x0074 + ((n) << 2))
+#define TMR_WICR (0x0080)
+#define TMR_CER (0x0084)
+#define TMR_CMR (0x0088)
+#define TMR_ILR(n) (0x008c + ((n) << 2))
+#define TMR_WCR (0x0098)
+#define TMR_WFAR (0x009c)
+#define TMR_WSAR (0x00A0)
+#define TMR_CVWR(n) (0x00A4 + ((n) << 2))
+
+#define TMR_CCR_CS_0(x) (((x) & 0x3) << 0)
+#define TMR_CCR_CS_1(x) (((x) & 0x7) << 2)
+#define TMR_CCR_CS_2(x) (((x) & 0x3) << 5)
+
+#define TIMERS1_PHY_BASE (0xd4000000 + 0x14000)
+#define TIMERS2_PHY_BASE (0xd4000000 + 0x16000)
+
+#define TIMERS_PHY_BASE TIMERS1_PHY_BASE
#define MAX_DELTA (0xfffffffe)
#define MIN_DELTA (16)
-static void __iomem *mmp_timer_base = TIMERS_VIRT_BASE;
+static void __iomem *mmp_timer_base;
/*
* FIXME: the timer needs some delay to stablize the counter capture
@@ -191,6 +216,9 @@ static struct irqaction timer_irq = {
void __init timer_init(int irq)
{
+ mmp_timer_base = ioremap(TIMERS_PHY_BASE, PAGE_SIZE);
+ BUG_ON(!mmp_timer_base);
+
timer_config();
setup_sched_clock(mmp_read_sched_clock, 32, CLOCK_TICK_RATE);
--
1.8.1.2
next prev parent reply other threads:[~2013-06-03 9:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 9:30 [PATCH v3 00/11] update irqchip, clocksource, clk in mmp Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 01/11] irqchip: move mmp irq driver Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 02/11] irqchip: mmp: support irqchip Haojian Zhuang
2013-06-03 9:42 ` Russell King - ARM Linux
2013-06-03 10:06 ` Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 03/11] irqchip: mmp: support MULTI_IRQ_HANDLER Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 04/11] ARM: mmp: avoid to include head file in mach-mmp Haojian Zhuang
2013-06-03 22:28 ` Arnd Bergmann
2013-06-03 9:30 ` [PATCH v3 05/11] irqchip: mmp: avoid to include irqs head file Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 06/11] clocksource: mmp: move mmp timer driver Haojian Zhuang
2013-06-03 9:30 ` Haojian Zhuang [this message]
2013-06-03 22:31 ` [PATCH v3 07/11] ARM: mmp: move timer registers into driver Arnd Bergmann
2013-06-03 9:30 ` [PATCH v3 08/11] ARM: pxa: init dma debugfs in late level Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 09/11] clk: mmp: parse clock from dts Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 10/11] ARM: mmp: avoid to use cpu_is_xxx in timer Haojian Zhuang
2013-06-03 22:34 ` Arnd Bergmann
2013-06-04 1:24 ` Haojian Zhuang
2013-06-03 9:30 ` [PATCH v3 11/11] ARCH: mmp: support clocksource " Haojian Zhuang
2013-06-03 17:07 ` John Stultz
2013-06-04 1:25 ` Haojian Zhuang
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=1370251845-31373-8-git-send-email-haojian.zhuang@gmail.com \
--to=haojian.zhuang@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).