Skip to contentSkip to conversation

init_early cleanup for omap init_irq and init_timer

PATCH New Tony Lindgren 4 participants 40 messages Jun 20, 2011 – Jun 27, 2011

Subsystems (5)
lore
Share & tools
lore

Tony Lindgren

author maintainer
#0 lore raw

cover init_early cleanup for omap init_irq and init_timer

Hi all,

Here's an updated version of the init_irq and init_timer patches against v3.0-rc3. This series sets up separate omap[123]_init_irq functions and omap[1234]_timer sys_timer so we can get rid of cpu_is_omap calls in the init_irq and init_timer.

This series also changes the dmtimer hardware init so we can initialize most of the hardware timers later on and further patch the dmtimer code so it eventually becomes just a regular device driver.

Regards,

Tony

---

Tony Lindgren (10):
omap: Use separate init_irq functions to avoid cpu_is_omap tests early
omap: Set separate timer init functions to avoid cpu_is_omap tests
omap: Move dmtimer defines to dmtimer.h
omap: Make a subset of dmtimer functions into inline functions omap2+: Use dmtimer macros for clockevent
omap2+: Remove gptimer_wakeup for now
omap2+: Reserve clocksource and timesource and initialize dmtimer later omap2+: Use dmtimer macros for clocksource
omap2+: Remove omap2_gp_clockevent_set_gptimer
omap2+: Rename timer-gp.c into timer.c to combine timer init functions

 arch/arm/mach-omap1/board-ams-delta.c      |    4 
 arch/arm/mach-omap1/board-fsample.c        |    4 
 arch/arm/mach-omap1/board-generic.c        |    4 
 arch/arm/mach-omap1/board-h2.c             |    4 
 arch/arm/mach-omap1/board-h3.c             |    4 
 arch/arm/mach-omap1/board-htcherald.c      |    4 
 arch/arm/mach-omap1/board-innovator.c      |    4 
 arch/arm/mach-omap1/board-nokia770.c       |    4 
 arch/arm/mach-omap1/board-osk.c            |    4 
 arch/arm/mach-omap1/board-palmte.c         |    4 
 arch/arm/mach-omap1/board-palmtt.c         |    4 
 arch/arm/mach-omap1/board-palmz71.c        |    4 
 arch/arm/mach-omap1/board-perseus2.c       |    4 
 arch/arm/mach-omap1/board-sx1.c            |    4 
 arch/arm/mach-omap1/board-voiceblue.c      |    4 
 arch/arm/mach-omap1/irq.c                  |    2 
 arch/arm/mach-omap1/time.c                 |    6 
 arch/arm/mach-omap1/timer32k.c             |    4 
 arch/arm/mach-omap2/Makefile               |    2 
 arch/arm/mach-omap2/board-2430sdp.c        |    4 
 arch/arm/mach-omap2/board-3430sdp.c        |    4 
 arch/arm/mach-omap2/board-3630sdp.c        |    4 
 arch/arm/mach-omap2/board-4430sdp.c        |    6 
 arch/arm/mach-omap2/board-am3517crane.c    |    4 
 arch/arm/mach-omap2/board-am3517evm.c      |    4 
 arch/arm/mach-omap2/board-apollon.c        |    4 
 arch/arm/mach-omap2/board-cm-t35.c         |    4 
 arch/arm/mach-omap2/board-cm-t3517.c       |    4 
 arch/arm/mach-omap2/board-devkit8000.c     |    8 -
 arch/arm/mach-omap2/board-generic.c        |    4 
 arch/arm/mach-omap2/board-h4.c             |    4 
 arch/arm/mach-omap2/board-igep0020.c       |    8 -
 arch/arm/mach-omap2/board-ldp.c            |    4 
 arch/arm/mach-omap2/board-n8x0.c           |   12 -
 arch/arm/mach-omap2/board-omap3beagle.c    |    8 -
 arch/arm/mach-omap2/board-omap3evm.c       |    4 
 arch/arm/mach-omap2/board-omap3logic.c     |    9 -
 arch/arm/mach-omap2/board-omap3pandora.c   |    4 
 arch/arm/mach-omap2/board-omap3stalker.c   |    8 -
 arch/arm/mach-omap2/board-omap3touchbook.c |    8 -
 arch/arm/mach-omap2/board-omap4panda.c     |    3 
 arch/arm/mach-omap2/board-overo.c          |    4 
 arch/arm/mach-omap2/board-rm680.c          |    4 
 arch/arm/mach-omap2/board-rx51.c           |    4 
 arch/arm/mach-omap2/board-ti8168evm.c      |    9 -
 arch/arm/mach-omap2/board-zoom.c           |    8 -
 arch/arm/mach-omap2/io.c                   |   17 -
 arch/arm/mach-omap2/irq.c                  |   32 ++-
 arch/arm/mach-omap2/omap4-common.c         |   10 -
 arch/arm/mach-omap2/pm-debug.c             |   28 --
 arch/arm/mach-omap2/pm.h                   |    6 
 arch/arm/mach-omap2/pm34xx.c               |    4 
 arch/arm/mach-omap2/timer-gp.c             |  266 ----------------------
 arch/arm/mach-omap2/timer-gp.h             |   16 -
 arch/arm/mach-omap2/timer.c                |  342 ++++++++++++++++++++++++++++
 arch/arm/plat-omap/counter_32k.c           |    2 
 arch/arm/plat-omap/dmtimer.c               |  207 ++---------------
 arch/arm/plat-omap/include/plat/common.h   |    6 
 arch/arm/plat-omap/include/plat/dmtimer.h  |  247 ++++++++++++++++++++
 arch/arm/plat-omap/include/plat/irqs.h     |    6 
 60 files changed, 748 insertions(+), 666 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/timer-gp.c
 delete mode 100644 arch/arm/mach-omap2/timer-gp.h
 create mode 100644 arch/arm/mach-omap2/timer.c
Signature · 1 line
Signature
author maintainer
#1 lore raw

PATCH 1/10 omap: Use separate init_irq functions to avoid cpu_is_omap tests early

This allows us to remove cpu_is_omap calls from init_irq functions. There should not be any need for cpu_is_omap calls as at this point. During the timer init we only care about SoC generation, and not about subrevisions.

The main reason for the patch is that we want to initialize only minimal omap specific code from the init_early call.

---
 arch/arm/mach-omap1/board-ams-delta.c      |    2 +-
 arch/arm/mach-omap1/board-fsample.c        |    2 +-
 arch/arm/mach-omap1/board-generic.c        |    2 +-
 arch/arm/mach-omap1/board-h2.c             |    2 +-
 arch/arm/mach-omap1/board-h3.c             |    2 +-
 arch/arm/mach-omap1/board-htcherald.c      |    2 +-
 arch/arm/mach-omap1/board-innovator.c      |    2 +-
 arch/arm/mach-omap1/board-nokia770.c       |    2 +-
 arch/arm/mach-omap1/board-osk.c            |    2 +-
 arch/arm/mach-omap1/board-palmte.c         |    2 +-
 arch/arm/mach-omap1/board-palmtt.c         |    2 +-
 arch/arm/mach-omap1/board-palmz71.c        |    2 +-
 arch/arm/mach-omap1/board-perseus2.c       |    2 +-
 arch/arm/mach-omap1/board-sx1.c            |    2 +-
 arch/arm/mach-omap1/board-voiceblue.c      |    2 +-
 arch/arm/mach-omap1/irq.c                  |    2 +-
 arch/arm/mach-omap2/board-2430sdp.c        |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c        |    2 +-
 arch/arm/mach-omap2/board-3630sdp.c        |    2 +-
 arch/arm/mach-omap2/board-am3517crane.c    |    2 +-
 arch/arm/mach-omap2/board-am3517evm.c      |    2 +-
 arch/arm/mach-omap2/board-apollon.c        |    2 +-
 arch/arm/mach-omap2/board-cm-t35.c         |    2 +-
 arch/arm/mach-omap2/board-cm-t3517.c       |    2 +-
 arch/arm/mach-omap2/board-devkit8000.c     |    2 +-
 arch/arm/mach-omap2/board-generic.c        |    2 +-
 arch/arm/mach-omap2/board-h4.c             |    2 +-
 arch/arm/mach-omap2/board-igep0020.c       |    4 ++--
 arch/arm/mach-omap2/board-ldp.c            |    2 +-
 arch/arm/mach-omap2/board-n8x0.c           |    6 +++--
 arch/arm/mach-omap2/board-omap3beagle.c    |    2 +-
 arch/arm/mach-omap2/board-omap3evm.c       |    2 +-
 arch/arm/mach-omap2/board-omap3logic.c     |    4 ++--
 arch/arm/mach-omap2/board-omap3pandora.c   |    2 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |    2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |    2 +-
 arch/arm/mach-omap2/board-overo.c          |    2 +-
 arch/arm/mach-omap2/board-rm680.c          |    2 +-
 arch/arm/mach-omap2/board-rx51.c           |    2 +-
 arch/arm/mach-omap2/board-ti8168evm.c      |    7 +-----
 arch/arm/mach-omap2/board-zoom.c           |    4 ++--
 arch/arm/mach-omap2/io.c                   |   17 +--------------
 arch/arm/mach-omap2/irq.c                  |   32 ++++++++++++++++++----------
 arch/arm/mach-omap2/omap4-common.c         |   10 ++++-----
 arch/arm/plat-omap/include/plat/irqs.h     |    6 ++++-
 45 files changed, 78 insertions(+), 84 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +1 -1
index de88c92..17ed757 100644
@@ -138,7 +138,7 @@ void ams_delta_latch2_write(u16 mask, u16 value)
 static void __init ams_delta_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static struct map_desc ams_delta_io_desc[] __initdata = {
arch/arm/mach-omap1/board-fsample.c +1 -1
index 87f173d..eaff305 100644
@@ -329,7 +329,7 @@ static void __init omap_fsample_init(void)
 static void __init omap_fsample_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
arch/arm/mach-omap1/board-generic.c +1 -1
index 23f4ab9..3fd6b40 100644
@@ -31,7 +31,7 @@
 static void __init omap_generic_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 /* assume no Mini-AB port */
arch/arm/mach-omap1/board-h2.c +1 -1
index ba3bd09..8147b04 100644
@@ -376,7 +376,7 @@ static struct i2c_board_info __initdata h2_i2c_board_info[] = {
 static void __init h2_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static struct omap_usb_config h2_usb_config __initdata = {
arch/arm/mach-omap1/board-h3.c +1 -1
index ac48677..1b448f6 100644
@@ -439,7 +439,7 @@ static void __init h3_init(void)
 static void __init h3_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static void __init h3_map_io(void)
arch/arm/mach-omap1/board-htcherald.c +1 -1
index ba05a51..1bd4d8e 100644
@@ -605,7 +605,7 @@ static void __init htcherald_init_irq(void)
 {
 	printk(KERN_INFO "htcherald_init_irq.\n");
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 MACHINE_START(HERALD, "HTC Herald")
arch/arm/mach-omap1/board-innovator.c +1 -1
index 2d9b8cb..5926b0c 100644
@@ -292,7 +292,7 @@ static void __init innovator_init_smc91x(void)
 static void __init innovator_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 #ifdef CONFIG_ARCH_OMAP15XX
arch/arm/mach-omap1/board-nokia770.c +1 -1
index cfd0849..e3cf21d 100644
@@ -51,7 +51,7 @@ static void __init omap_nokia770_init_irq(void)
 	omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
 
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static const unsigned int nokia770_keymap[] = {
arch/arm/mach-omap1/board-osk.c +1 -1
index e68dfde..1e7823d 100644
@@ -282,7 +282,7 @@ static void __init osk_init_cf(void)
 static void __init osk_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static struct omap_usb_config osk_usb_config __initdata = {
arch/arm/mach-omap1/board-palmte.c +1 -1
index c9d38f4..8b6a881 100644
@@ -62,7 +62,7 @@
 static void __init omap_palmte_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static const unsigned int palmte_keymap[] = {
arch/arm/mach-omap1/board-palmtt.c +1 -1
index f04f2d3..f2de43d 100644
@@ -266,7 +266,7 @@ static struct spi_board_info __initdata palmtt_boardinfo[] = {
 static void __init omap_palmtt_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static struct omap_usb_config palmtt_usb_config __initdata = {
arch/arm/mach-omap1/board-palmz71.c +1 -1
index 45f01d2..6665d2d 100644
@@ -61,7 +61,7 @@ static void __init
 omap_palmz71_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static const unsigned int palmz71_keymap[] = {
arch/arm/mach-omap1/board-perseus2.c +1 -1
index 3c8ee84..7f019e5 100644
@@ -297,7 +297,7 @@ static void __init omap_perseus2_init(void)
 static void __init omap_perseus2_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 /* Only FPGA needs to be mapped here. All others are done with ioremap */
 static struct map_desc omap_perseus2_io_desc[] __initdata = {
arch/arm/mach-omap1/board-sx1.c +1 -1
index 0ad781d..24f0f7b 100644
@@ -411,7 +411,7 @@ static void __init omap_sx1_init(void)
 static void __init omap_sx1_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 /*----------------------------------------*/
 
arch/arm/mach-omap1/board-voiceblue.c +1 -1
index 65d2420..98826e2 100644
@@ -162,7 +162,7 @@ static struct omap_board_config_kernel voiceblue_config[] = {
 static void __init voiceblue_init_irq(void)
 {
 	omap1_init_common_hw();
-	omap_init_irq();
+	omap1_init_irq();
 }
 
 static void __init voiceblue_map_io(void)
arch/arm/mach-omap1/irq.c +1 -1
index 5d3da7a..e2b9c90 100644
@@ -175,7 +175,7 @@ static struct irq_chip omap_irq_chip = {
 	.irq_set_wake	= omap_wake_irq,
 };
 
-void __init omap_init_irq(void)
+void __init omap1_init_irq(void)
 {
 	int i, j;
 
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index 5de6eac..45cabc5 100644
@@ -260,7 +260,7 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
 	.reserve	= omap_reserve,
 	.map_io		= omap_2430sdp_map_io,
 	.init_early	= omap_2430sdp_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_2430sdp_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-3430sdp.c +1 -1
index 5dac974..85b207f 100644
@@ -804,7 +804,7 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap_3430sdp_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_3430sdp_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-3630sdp.c +1 -1
index a5933cc..2ec2d76 100644
@@ -219,7 +219,7 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap_sdp_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_sdp_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-am3517crane.c +1 -1
index 5e438a7..0bed0a4 100644
@@ -104,7 +104,7 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= am3517_crane_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= am3517_crane_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-am3517evm.c +1 -1
index 63af417..0db0fb8 100644
@@ -494,7 +494,7 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= am3517_evm_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= am3517_evm_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-apollon.c +1 -1
index b124bdf..93576c8 100644
@@ -354,7 +354,7 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
 	.reserve	= omap_reserve,
 	.map_io		= omap_apollon_map_io,
 	.init_early	= omap_apollon_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_apollon_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-cm-t35.c +1 -1
index 77456de..2940d64 100644
@@ -646,7 +646,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= cm_t35_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= cm_t35_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-cm-t3517.c +1 -1
index c3a9fd3..8f15222 100644
@@ -304,7 +304,7 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
 	.reserve        = omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= cm_t3517_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= cm_t3517_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-devkit8000.c +1 -1
index 34956ec..00f6cb6 100644
@@ -438,7 +438,7 @@ static void __init devkit8000_init_early(void)
 
 static void __init devkit8000_init_irq(void)
 {
-	omap_init_irq();
+	omap3_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
arch/arm/mach-omap2/board-generic.c +1 -1
index 73e3c31..ccd503a 100644
@@ -70,7 +70,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
 	.reserve	= omap_reserve,
 	.map_io		= omap_generic_map_io,
 	.init_early	= omap_generic_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_generic_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-h4.c +1 -1
index bac7933..2e16d6c 100644
@@ -298,7 +298,7 @@ static void __init omap_h4_init_early(void)
 
 static void __init omap_h4_init_irq(void)
 {
-	omap_init_irq();
+	omap2_init_irq();
 }
 
 static struct at24_platform_data m24c01 = {
arch/arm/mach-omap2/board-igep0020.c +2 -2
index 0c1bfca..359b765 100644
@@ -703,7 +703,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= igep_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= igep_init,
 	.timer		= &omap_timer,
 MACHINE_END
@@ -713,7 +713,7 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= igep_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= igep_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-ldp.c +1 -1
index f7d6038..a054f54 100644
@@ -350,7 +350,7 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap_ldp_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_ldp_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-n8x0.c +3 -3
index 8d74318..9c791a2 100644
@@ -699,7 +699,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
 	.reserve	= omap_reserve,
 	.map_io		= n8x0_map_io,
 	.init_early	= n8x0_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
 	.timer		= &omap_timer,
 MACHINE_END
@@ -709,7 +709,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
 	.reserve	= omap_reserve,
 	.map_io		= n8x0_map_io,
 	.init_early	= n8x0_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
 	.timer		= &omap_timer,
 MACHINE_END
@@ -719,7 +719,7 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
 	.reserve	= omap_reserve,
 	.map_io		= n8x0_map_io,
 	.init_early	= n8x0_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
index 7f21d24..4560055 100644
@@ -486,7 +486,7 @@ static void __init omap3_beagle_init_early(void)
 
 static void __init omap3_beagle_init_irq(void)
 {
-	omap_init_irq();
+	omap3_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
arch/arm/mach-omap2/board-omap3evm.c +1 -1
index b4d4346..79d5362 100644
@@ -740,7 +740,7 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap3_evm_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3_evm_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3logic.c +2 -2
index 60d9be4..739fdfc 100644
@@ -215,7 +215,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
 	.boot_params	= 0x80000100,
 	.map_io		= omap3_map_io,
 	.init_early	= omap3logic_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3logic_init,
 	.timer		= &omap_timer,
 MACHINE_END
@@ -224,7 +224,7 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
 	.boot_params	= 0x80000100,
 	.map_io		= omap3_map_io,
 	.init_early	= omap3logic_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3logic_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3pandora.c +1 -1
index 2a0bb48..7b4e139 100644
@@ -642,7 +642,7 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap3pandora_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3pandora_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3stalker.c +1 -1
index 0c108a2..0161626 100644
@@ -494,7 +494,7 @@ static void __init omap3_stalker_init_early(void)
 
 static void __init omap3_stalker_init_irq(void)
 {
-	omap_init_irq();
+	omap3_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 5f649fa..3cc5531 100644
@@ -371,7 +371,7 @@ static void __init omap3_touchbook_init_early(void)
 
 static void __init omap3_touchbook_init_irq(void)
 {
-	omap_init_irq();
+	omap3_init_irq();
 #ifdef CONFIG_OMAP_32K_TIMER
 	omap2_gp_clockevent_set_gptimer(12);
 #endif
arch/arm/mach-omap2/board-overo.c +1 -1
index 175e1ab..9c9f20c 100644
@@ -615,7 +615,7 @@ MACHINE_START(OVERO, "Gumstix Overo")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= overo_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= overo_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-rm680.c +1 -1
index 42d10b1..9c3d115 100644
@@ -163,7 +163,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
 	.reserve	= omap_reserve,
 	.map_io		= rm680_map_io,
 	.init_early	= rm680_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= rm680_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-rx51.c +1 -1
index fec4cac..ee35e4e 100644
@@ -160,7 +160,7 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
 	.reserve	= rx51_reserve,
 	.map_io		= rx51_map_io,
 	.init_early	= rx51_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= rx51_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/board-ti8168evm.c +1 -6
index 09fa7bf..713c20f 100644
@@ -33,11 +33,6 @@ static void __init ti8168_init_early(void)
 	omap2_init_common_devices(NULL, NULL);
 }
 
-static void __init ti8168_evm_init_irq(void)
-{
-	omap_init_irq();
-}
-
 static void __init ti8168_evm_init(void)
 {
 	omap_serial_init();
@@ -56,7 +51,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
 	.boot_params	= 0x80000100,
 	.map_io		= ti8168_evm_map_io,
 	.init_early	= ti8168_init_early,
-	.init_irq	= ti8168_evm_init_irq,
+	.init_irq	= ti816x_init_irq,
 	.timer		= &omap_timer,
 	.init_machine	= ti8168_evm_init,
 MACHINE_END
arch/arm/mach-omap2/board-zoom.c +2 -2
index 4b133d7..97a3f0b 100644
@@ -137,7 +137,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap_zoom_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_zoom_init,
 	.timer		= &omap_timer,
 MACHINE_END
@@ -147,7 +147,7 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap_zoom_init_early,
-	.init_irq	= omap_init_irq,
+	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_zoom_init,
 	.timer		= &omap_timer,
 MACHINE_END
arch/arm/mach-omap2/io.c +1 -16
index 441e79d..2ce1ce6 100644
@@ -333,23 +333,9 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 	return omap_hwmod_set_postsetup_state(oh, *(u8 *)data);
 }
 
+/* See irq.c, omap4-common.c and entry-macro.S */
 void __iomem *omap_irq_base;
 
-/*
- * Initialize asm_irq_base for entry-macro.S
- */
-static inline void omap_irq_base_init(void)
-{
-	if (cpu_is_omap24xx())
-		omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE);
-	else if (cpu_is_omap34xx())
-		omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE);
-	else if (cpu_is_omap44xx())
-		omap_irq_base = OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE);
-	else
-		pr_err("Could not initialize omap_irq_base\n");
-}
-
 void __init omap2_init_common_infrastructure(void)
 {
 	u8 postsetup_state;
@@ -422,7 +408,6 @@ void __init omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0,
 		_omap2_init_reprogram_sdrc();
 	}
 
-	omap_irq_base_init();
 }
 
 /*
arch/arm/mach-omap2/irq.c +21 -11
index 3af2b7a..3a12f75 100644
@@ -141,25 +141,20 @@ omap_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
 				IRQ_NOREQUEST | IRQ_NOPROBE, 0);
 }
 
-void __init omap_init_irq(void)
+static void __init omap_init_irq(u32 base, int nr_irqs)
 {
 	unsigned long nr_of_irqs = 0;
 	unsigned int nr_banks = 0;
 	int i, j;
 
+	omap_irq_base = ioremap(base, SZ_4K);
+	if (WARN_ON(!omap_irq_base))
+		return;
+
 	for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
-		unsigned long base = 0;
 		struct omap_irq_bank *bank = irq_banks + i;
 
-		if (cpu_is_omap24xx())
-			base = OMAP24XX_IC_BASE;
-		else if (cpu_is_omap34xx())
-			base = OMAP34XX_IC_BASE;
-
-		BUG_ON(!base);
-
-		if (cpu_is_ti816x())
-			bank->nr_irqs = 128;
+		bank->nr_irqs = nr_irqs;
 
 		/* Static mapping, never released */
 		bank->base_reg = ioremap(base, SZ_4K);
@@ -181,6 +176,21 @@ void __init omap_init_irq(void)
 	       nr_of_irqs, nr_banks, nr_banks > 1 ? "s" : "");
 }
 
+void __init omap2_init_irq(void)
+{
+	omap_init_irq(OMAP24XX_IC_BASE, 96);
+}
+
+void __init omap3_init_irq(void)
+{
+	omap_init_irq(OMAP34XX_IC_BASE, 96);
+}
+
+void __init ti816x_init_irq(void)
+{
+	omap_init_irq(OMAP34XX_IC_BASE, 128);
+}
+
 #ifdef CONFIG_ARCH_OMAP3
 static struct omap3_intc_regs intc_context[ARRAY_SIZE(irq_banks)];
 
arch/arm/mach-omap2/omap4-common.c +5 -5
index 9ef8c29..35ac3e5 100644
@@ -19,6 +19,8 @@
 #include <asm/hardware/gic.h>
 #include <asm/hardware/cache-l2x0.h>
 
+#include <plat/irqs.h>
+
 #include <mach/hardware.h>
 #include <mach/omap4-common.h>
 
@@ -31,17 +33,15 @@ void __iomem *gic_dist_base_addr;
 
 void __init gic_init_irq(void)
 {
-	void __iomem *gic_cpu_base;
-
 	/* Static mapping, never released */
 	gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
 	BUG_ON(!gic_dist_base_addr);
 
 	/* Static mapping, never released */
-	gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
-	BUG_ON(!gic_cpu_base);
+	omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
+	BUG_ON(!omap_irq_base);
 
-	gic_init(0, 29, gic_dist_base_addr, gic_cpu_base);
+	gic_init(0, 29, gic_dist_base_addr, omap_irq_base);
 }
 
 #ifdef CONFIG_CACHE_L2X0
arch/arm/plat-omap/include/plat/irqs.h +5 -1
index 5a25098..c884320 100644
@@ -428,7 +428,11 @@
 #define INTCPS_NR_IRQS		96
 
 #ifndef __ASSEMBLY__
-extern void omap_init_irq(void);
+extern void __iomem *omap_irq_base;
+void omap1_init_irq(void);
+void omap2_init_irq(void);
+void omap3_init_irq(void);
+void ti816x_init_irq(void);
 extern int omap_irq_pending(void);
 void omap_intc_save_context(void);
 void omap_intc_restore_context(void);
#2 lore raw

PATCH 1/10 omap: Use separate init_irq functions to avoid cpu_is_omap tests early

Quoted 6 lines · Tony Lindgren

void __init gic_init_irq(void)
{

arch/arm/mach-omap2/omap4-common.c +0 -2
-	void __iomem *gic_cpu_base;
-
 	/* Static mapping, never released */
 	gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);

arch/arm/mach-omap2/omap4-common.c void __iomem *gic_dist_base_addr; · line 44

Quoted 10 lines
arch/arm/mach-omap2/omap4-common.c +3 -3
 	BUG_ON(!gic_dist_base_addr);
 
 	/* Static mapping, never released */
-	gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
-	BUG_ON(!gic_cpu_base);
+	omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
+	BUG_ON(!omap_irq_base);
 
-	gic_init(0, 29, gic_dist_base_addr, gic_cpu_base);
+	gic_init(0, 29, gic_dist_base_addr, omap_irq_base);

Why do you change this? Nothing should be using 'omap_irq_base' directly because it doesn't know what type of interrupt controller you have.

The GIC IRQ entry code should be using gic_cpu_base_addr provided by the common gic driver rather than anything else.

author maintainer
#3 lore raw

PATCH 1/10 omap: Use separate init_irq functions to avoid cpu_is_omap tests early

Quoted 15 lines · Russell King - ARM Linux
Quoted 14 lines · Tony Lindgren

void __init gic_init_irq(void)
{

arch/arm/mach-omap2/omap4-common.c +2 -4
-	void __iomem *gic_cpu_base;
-
 	/* Static mapping, never released */
 	gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
 	BUG_ON(!gic_dist_base_addr);
 
 	/* Static mapping, never released */
-	gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
-	BUG_ON(!gic_cpu_base);
+	omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
+	BUG_ON(!omap_irq_base);
Quoted 5 lines

arch/arm/mach-omap2/omap4-common.c void __iomem *gic_dist_base_addr; · line 44

Quoted 2 lines
arch/arm/mach-omap2/omap4-common.c +1 -1
-	gic_init(0, 29, gic_dist_base_addr, gic_cpu_base);
+	gic_init(0, 29, gic_dist_base_addr, omap_irq_base);

Why do you change this? Nothing should be using 'omap_irq_base' directly because it doesn't know what type of interrupt controller you have.

We need to set omap_irq_base for entry-macro.S for the MULTI_OMAP2 case. So no need to have separate gic_cpu_base for gic_init_irq.

Quoted 2 lines

The GIC IRQ entry code should be using gic_cpu_base_addr provided by the common gic driver rather than anything else.

You mean for get_irqnr_and_base? That is the case when we don't have omap2 or 3 compiled in with omap4. For the multi-omap case we are using omap_irq_base for get_irqnr_and_base as we need to handle two different kind of irq controllers.

Regards,

Tony

#4 lore raw

PATCH 1/10 omap: Use separate init_irq functions to avoid cpu_is_omap tests early

In reply to Tony Lindgren
Quoted 26 lines · Tony Lindgren

This allows us to remove cpu_is_omap calls from init_irq functions. There should not be any need for cpu_is_omap calls as at this point. During the timer init we only care about SoC generation, and not about subrevisions.

The main reason for the patch is that we want to initialize only minimal omap specific code from the init_early call.

---
 arch/arm/mach-omap1/board-ams-delta.c      |    2 +-
 arch/arm/mach-omap1/board-fsample.c        |    2 +-
 arch/arm/mach-omap1/board-generic.c        |    2 +-
 arch/arm/mach-omap1/board-h2.c             |    2 +-
 arch/arm/mach-omap1/board-h3.c             |    2 +-
 arch/arm/mach-omap1/board-htcherald.c      |    2 +-
 arch/arm/mach-omap1/board-innovator.c      |    2 +-
 arch/arm/mach-omap1/board-nokia770.c       |    2 +-
 arch/arm/mach-omap1/board-osk.c            |    2 +-
 arch/arm/mach-omap1/board-palmte.c         |    2 +-
 arch/arm/mach-omap1/board-palmtt.c         |    2 +-
 arch/arm/mach-omap1/board-palmz71.c        |    2 +-
 arch/arm/mach-omap1/board-perseus2.c       |    2 +-
 arch/arm/mach-omap1/board-sx1.c            |    2 +-
 arch/arm/mach-omap1/board-voiceblue.c      |    2 +-
Quoted 8 lines
 arch/arm/mach-omap1/irq.c                  |    2 +-
 arch/arm/mach-omap2/board-2430sdp.c        |    2 +-
 arch/arm/mach-omap2/board-3430sdp.c        |    2 +-
 arch/arm/mach-omap2/board-3630sdp.c        |    2 +-
 arch/arm/mach-omap2/board-am3517crane.c    |    2 +-
 arch/arm/mach-omap2/board-am3517evm.c      |    2 +-
 arch/arm/mach-omap2/board-apollon.c        |    2 +-
 arch/arm/mach-omap2/board-cm-t35.c         |    2 +-

Note this board has another machine_desc added in devel-board which doesn't have the changes necessary for this.

When using devel-timer + devel-board, this is also needed to compile, so devel-timer should probably be rebased on devel-board (or vice versa.)

Kevin

arch/arm/mach-omap2/board-cm-t35.c +2 -2
index 43dda76..b5d0d77 100644
@@ -687,7 +687,7 @@ MACHINE_START(CM_T3730, "Compulab CM-T3730")
 	.reserve        = omap_reserve,
 	.map_io         = omap3_map_io,
 	.init_early     = cm_t35_init_early,
-	.init_irq       = omap_init_irq,
+	.init_irq       = omap3_init_irq,
 	.init_machine   = cm_t3730_init,
-	.timer          = &omap_timer,
+	.timer          = &omap3_timer,
 MACHINE_END
author maintainer
#5 lore raw

PATCH 2/10 omap: Set separate timer init functions to avoid cpu_is_omap tests

In reply to Tony Lindgren

This is needed for the following patches so we can initialize the rest of the hardware timers later on.

As with the init_irq calls, there's no need to do cpu_is_omap calls during the timer init as we only care about the major omap generation. This means that we can initialize the sys_timer with the .timer entries alone.

Note that for now we just set stubs for the various sys_timer entries that will get populated in a later patch. The following patches will also remove the omap_dm_timer_init calls and change the init for the rest of the hardware timers to happen with an arch_initcall.

---
 arch/arm/mach-omap1/board-ams-delta.c      |    2 +
 arch/arm/mach-omap1/board-fsample.c        |    2 +
 arch/arm/mach-omap1/board-generic.c        |    2 +
 arch/arm/mach-omap1/board-h2.c             |    2 +
 arch/arm/mach-omap1/board-h3.c             |    2 +
 arch/arm/mach-omap1/board-htcherald.c      |    2 +
 arch/arm/mach-omap1/board-innovator.c      |    2 +
 arch/arm/mach-omap1/board-nokia770.c       |    2 +
 arch/arm/mach-omap1/board-osk.c            |    2 +
 arch/arm/mach-omap1/board-palmte.c         |    2 +
 arch/arm/mach-omap1/board-palmtt.c         |    2 +
 arch/arm/mach-omap1/board-palmz71.c        |    2 +
 arch/arm/mach-omap1/board-perseus2.c       |    2 +
 arch/arm/mach-omap1/board-sx1.c            |    2 +
 arch/arm/mach-omap1/board-voiceblue.c      |    2 +
 arch/arm/mach-omap1/time.c                 |    6 ++--
 arch/arm/mach-omap2/board-2430sdp.c        |    2 +
 arch/arm/mach-omap2/board-3430sdp.c        |    2 +
 arch/arm/mach-omap2/board-3630sdp.c        |    2 +
 arch/arm/mach-omap2/board-4430sdp.c        |    2 +
 arch/arm/mach-omap2/board-am3517crane.c    |    2 +
 arch/arm/mach-omap2/board-am3517evm.c      |    2 +
 arch/arm/mach-omap2/board-apollon.c        |    2 +
 arch/arm/mach-omap2/board-cm-t35.c         |    2 +
 arch/arm/mach-omap2/board-cm-t3517.c       |    2 +
 arch/arm/mach-omap2/board-devkit8000.c     |    2 +
 arch/arm/mach-omap2/board-generic.c        |    2 +
 arch/arm/mach-omap2/board-h4.c             |    2 +
 arch/arm/mach-omap2/board-igep0020.c       |    4 +--
 arch/arm/mach-omap2/board-ldp.c            |    2 +
 arch/arm/mach-omap2/board-n8x0.c           |    6 ++--
 arch/arm/mach-omap2/board-omap3beagle.c    |    2 +
 arch/arm/mach-omap2/board-omap3evm.c       |    2 +
 arch/arm/mach-omap2/board-omap3logic.c     |    4 +--
 arch/arm/mach-omap2/board-omap3pandora.c   |    2 +
 arch/arm/mach-omap2/board-omap3stalker.c   |    2 +
 arch/arm/mach-omap2/board-omap3touchbook.c |    2 +
 arch/arm/mach-omap2/board-omap4panda.c     |    2 +
 arch/arm/mach-omap2/board-overo.c          |    2 +
 arch/arm/mach-omap2/board-rm680.c          |    2 +
 arch/arm/mach-omap2/board-rx51.c           |    2 +
 arch/arm/mach-omap2/board-ti8168evm.c      |    2 +
 arch/arm/mach-omap2/board-zoom.c           |    4 +--
 arch/arm/mach-omap2/timer-gp.c             |   41 +++++++++++++++++++++-------
 arch/arm/plat-omap/include/plat/common.h   |    6 +++-
 arch/arm/plat-omap/include/plat/dmtimer.h  |    1 -
 46 files changed, 86 insertions(+), 62 deletions(-)
arch/arm/mach-omap1/board-ams-delta.c +1 -1
index 17ed757..f1ac7fb 100644
@@ -391,7 +391,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
 	.reserve	= omap_reserve,
 	.init_irq	= ams_delta_init_irq,
 	.init_machine	= ams_delta_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
 
 EXPORT_SYMBOL(ams_delta_latch1_write);
arch/arm/mach-omap1/board-fsample.c +1 -1
index eaff305..a6b1bea 100644
@@ -394,5 +394,5 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_fsample_init_irq,
 	.init_machine	= omap_fsample_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-generic.c +1 -1
index 3fd6b40..04fc356 100644
@@ -99,5 +99,5 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_generic_init_irq,
 	.init_machine	= omap_generic_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-h2.c +1 -1
index 8147b04..cb7fb1a 100644
@@ -466,5 +466,5 @@ MACHINE_START(OMAP_H2, "TI-H2")
 	.reserve	= omap_reserve,
 	.init_irq	= h2_init_irq,
 	.init_machine	= h2_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-h3.c +1 -1
index 1b448f6..31f3487 100644
@@ -454,5 +454,5 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
 	.reserve	= omap_reserve,
 	.init_irq	= h3_init_irq,
 	.init_machine	= h3_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-htcherald.c +1 -1
index 1bd4d8e..36e06ea 100644
@@ -616,5 +616,5 @@ MACHINE_START(HERALD, "HTC Herald")
 	.reserve	= omap_reserve,
 	.init_irq       = htcherald_init_irq,
 	.init_machine   = htcherald_init,
-	.timer          = &omap_timer,
+	.timer          = &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-innovator.c +1 -1
index 5926b0c..0b1ba46 100644
@@ -464,5 +464,5 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
 	.reserve	= omap_reserve,
 	.init_irq	= innovator_init_irq,
 	.init_machine	= innovator_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-nokia770.c +1 -1
index e3cf21d..5469ce2 100644
@@ -269,5 +269,5 @@ MACHINE_START(NOKIA770, "Nokia 770")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_nokia770_init_irq,
 	.init_machine	= omap_nokia770_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-osk.c +1 -1
index 1e7823d..b08a213 100644
@@ -588,5 +588,5 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
 	.reserve	= omap_reserve,
 	.init_irq	= osk_init_irq,
 	.init_machine	= osk_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-palmte.c +1 -1
index 8b6a881..459cb6b 100644
@@ -280,5 +280,5 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_palmte_init_irq,
 	.init_machine	= omap_palmte_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-palmtt.c +1 -1
index f2de43d..b214f45 100644
@@ -326,5 +326,5 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_palmtt_init_irq,
 	.init_machine	= omap_palmtt_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-palmz71.c +1 -1
index 6665d2d..9b0ea48 100644
@@ -346,5 +346,5 @@ MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_palmz71_init_irq,
 	.init_machine	= omap_palmz71_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-perseus2.c +1 -1
index 7f019e5..67acd41 100644
@@ -355,5 +355,5 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_perseus2_init_irq,
 	.init_machine	= omap_perseus2_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-sx1.c +1 -1
index 24f0f7b..9c3b7c5 100644
@@ -426,5 +426,5 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
 	.reserve	= omap_reserve,
 	.init_irq	= omap_sx1_init_irq,
 	.init_machine	= omap_sx1_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/board-voiceblue.c +1 -1
index 98826e2..036edc0 100644
@@ -306,5 +306,5 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
 	.reserve	= omap_reserve,
 	.init_irq	= voiceblue_init_irq,
 	.init_machine	= voiceblue_init,
-	.timer		= &omap_timer,
+	.timer		= &omap1_timer,
 MACHINE_END
arch/arm/mach-omap1/time.c +3 -3
index 03e1e10..a183777 100644
@@ -297,7 +297,7 @@ static inline int omap_32k_timer_usable(void)
  * Timer initialization
  * ---------------------------------------------------------------------------
  */
-static void __init omap_timer_init(void)
+static void __init omap1_timer_init(void)
 {
 	if (omap_32k_timer_usable()) {
 		preferred_sched_clock_init(1);
@@ -307,6 +307,6 @@ static void __init omap_timer_init(void)
 	}
 }
 
-struct sys_timer omap_timer = {
-	.init		= omap_timer_init,
+struct sys_timer omap1_timer = {
+	.init		= omap1_timer_init,
 };
arch/arm/mach-omap2/board-2430sdp.c +1 -1
index 45cabc5..2028464 100644
@@ -262,5 +262,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
 	.init_early	= omap_2430sdp_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_2430sdp_init,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
arch/arm/mach-omap2/board-3430sdp.c +1 -1
index 85b207f..12fae21 100644
@@ -806,5 +806,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
 	.init_early	= omap_3430sdp_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_3430sdp_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-3630sdp.c +1 -1
index 2ec2d76..e4f37b5 100644
@@ -221,5 +221,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
 	.init_early	= omap_sdp_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_sdp_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-4430sdp.c +1 -1
index 63de2d3..128efb5 100644
@@ -773,5 +773,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
 	.init_early	= omap_4430sdp_init_early,
 	.init_irq	= gic_init_irq,
 	.init_machine	= omap_4430sdp_init,
-	.timer		= &omap_timer,
+	.timer		= &omap4_timer,
 MACHINE_END
arch/arm/mach-omap2/board-am3517crane.c +1 -1
index 0bed0a4..5f2b55f 100644
@@ -106,5 +106,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
 	.init_early	= am3517_crane_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= am3517_crane_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-am3517evm.c +1 -1
index 0db0fb8..f3006c3 100644
@@ -496,5 +496,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
 	.init_early	= am3517_evm_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= am3517_evm_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-apollon.c +1 -1
index 93576c8..7021170 100644
@@ -356,5 +356,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
 	.init_early	= omap_apollon_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_apollon_init,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
arch/arm/mach-omap2/board-cm-t35.c +1 -1
index 2940d64..8b49dc2 100644
@@ -648,5 +648,5 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
 	.init_early	= cm_t35_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= cm_t35_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-cm-t3517.c +1 -1
index 8f15222..aa67240 100644
@@ -306,5 +306,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
 	.init_early	= cm_t3517_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= cm_t3517_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-devkit8000.c +1 -1
index 00f6cb6..671aaea 100644
@@ -707,5 +707,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
 	.init_early	= devkit8000_init_early,
 	.init_irq	= devkit8000_init_irq,
 	.init_machine	= devkit8000_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_secure_timer,
 MACHINE_END
arch/arm/mach-omap2/board-generic.c +1 -1
index ccd503a..c6ecf60 100644
@@ -72,5 +72,5 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
 	.init_early	= omap_generic_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= omap_generic_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-h4.c +1 -1
index 2e16d6c..45de2b3 100644
@@ -388,5 +388,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
 	.init_early	= omap_h4_init_early,
 	.init_irq	= omap_h4_init_irq,
 	.init_machine	= omap_h4_init,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
arch/arm/mach-omap2/board-igep0020.c +2 -2
index 359b765..381a27c 100644
@@ -705,7 +705,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
 	.init_early	= igep_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= igep_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
 
 MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@@ -715,5 +715,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
 	.init_early	= igep_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= igep_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-ldp.c +1 -1
index a054f54..75ebc99 100644
@@ -352,5 +352,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
 	.init_early	= omap_ldp_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_ldp_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-n8x0.c +3 -3
index 9c791a2..e11f0c5 100644
@@ -701,7 +701,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
 	.init_early	= n8x0_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
 
 MACHINE_START(NOKIA_N810, "Nokia N810")
@@ -711,7 +711,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
 	.init_early	= n8x0_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
 
 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@@ -721,5 +721,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
 	.init_early	= n8x0_init_early,
 	.init_irq	= omap2_init_irq,
 	.init_machine	= n8x0_init_machine,
-	.timer		= &omap_timer,
+	.timer		= &omap2_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
index 4560055..3d41654 100644
@@ -599,5 +599,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
 	.init_early	= omap3_beagle_init_early,
 	.init_irq	= omap3_beagle_init_irq,
 	.init_machine	= omap3_beagle_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_secure_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3evm.c +1 -1
index 79d5362..7cbcf60 100644
@@ -742,5 +742,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
 	.init_early	= omap3_evm_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3_evm_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3logic.c +2 -2
index 739fdfc..693eba1 100644
@@ -217,7 +217,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
 	.init_early	= omap3logic_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3logic_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
 
 MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@@ -226,5 +226,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
 	.init_early	= omap3logic_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3logic_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3pandora.c +1 -1
index 7b4e139..ff0be83 100644
@@ -644,5 +644,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
 	.init_early	= omap3pandora_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3pandora_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3stalker.c +1 -1
index 0161626..96fec1f 100644
@@ -560,5 +560,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
 	.init_early		= omap3_stalker_init_early,
 	.init_irq		= omap3_stalker_init_irq,
 	.init_machine		= omap3_stalker_init,
-	.timer			= &omap_timer,
+	.timer			= &omap3_secure_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap3touchbook.c +1 -1
index 3cc5531..9447bc0 100644
@@ -449,5 +449,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
 	.init_early	= omap3_touchbook_init_early,
 	.init_irq	= omap3_touchbook_init_irq,
 	.init_machine	= omap3_touchbook_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_secure_timer,
 MACHINE_END
arch/arm/mach-omap2/board-omap4panda.c +1 -1
index 0cfe200..e76fe98 100644
@@ -716,5 +716,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
 	.init_early	= omap4_panda_init_early,
 	.init_irq	= gic_init_irq,
 	.init_machine	= omap4_panda_init,
-	.timer		= &omap_timer,
+	.timer		= &omap4_timer,
 MACHINE_END
arch/arm/mach-omap2/board-overo.c +1 -1
index 9c9f20c..d06248f 100644
@@ -617,5 +617,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
 	.init_early	= overo_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= overo_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-rm680.c +1 -1
index 9c3d115..54dceb1 100644
@@ -165,5 +165,5 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
 	.init_early	= rm680_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= rm680_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-rx51.c +1 -1
index ee35e4e..5ea142f 100644
@@ -162,5 +162,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
 	.init_early	= rx51_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= rx51_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/board-ti8168evm.c +1 -1
index 713c20f..a85d5b0 100644
@@ -52,6 +52,6 @@ MACHINE_START(TI8168EVM, "ti8168evm")
 	.map_io		= ti8168_evm_map_io,
 	.init_early	= ti8168_init_early,
 	.init_irq	= ti816x_init_irq,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 	.init_machine	= ti8168_evm_init,
 MACHINE_END
arch/arm/mach-omap2/board-zoom.c +2 -2
index 97a3f0b..8a98c3c 100644
@@ -139,7 +139,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
 	.init_early	= omap_zoom_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_zoom_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
 
 MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@@ -149,5 +149,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
 	.init_early	= omap_zoom_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap_zoom_init,
-	.timer		= &omap_timer,
+	.timer		= &omap3_timer,
 MACHINE_END
arch/arm/mach-omap2/timer-gp.c +31 -10

51 lines not on this page · raw message

arch/arm/plat-omap/include/plat/common.h +5 -1
index 5288130..4564cc6 100644
@@ -34,7 +34,11 @@
 struct sys_timer;
 
 extern void omap_map_common_io(void);
-extern struct sys_timer omap_timer;
+extern struct sys_timer omap1_timer;
+extern struct sys_timer omap2_timer;
+extern struct sys_timer omap3_timer;
+extern struct sys_timer omap3_secure_timer;
+extern struct sys_timer omap4_timer;
 extern bool omap_32k_timer_init(void);
 extern int __init omap_init_clocksource_32k(void);
 extern unsigned long long notrace omap_32k_sched_clock(void);
arch/arm/plat-omap/include/plat/dmtimer.h +0 -1
index d6c70d2..330bd17 100644
@@ -57,7 +57,6 @@
 #define OMAP_TIMER_IP_VERSION_1                        0x1
 struct omap_dm_timer;
 extern struct omap_dm_timer *gptimer_wakeup;
-extern struct sys_timer omap_timer;
 struct clk;
 
 int omap_dm_timer_init(void);
author maintainer
#6 lore raw

PATCH 3/10 omap: Move dmtimer defines to dmtimer.h

In reply to Tony Lindgren

These will be needed when dmtimer platform init code gets split for omap1 and omap2+. These will also be needed for separate sys_timer init and driver init for the rest of the hardware timers in the following patches. No functional changes.

---
 arch/arm/plat-omap/dmtimer.c              |  121 ----------------------------
 arch/arm/plat-omap/include/plat/dmtimer.h |  125 +++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 121 deletions(-)
arch/arm/plat-omap/dmtimer.c +0 -121
index ee9f6eb..dfdc3b2 100644
@@ -41,127 +41,6 @@
 #include <plat/dmtimer.h>
 #include <mach/irqs.h>
 
-/* register offsets */
-#define _OMAP_TIMER_ID_OFFSET		0x00
-#define _OMAP_TIMER_OCP_CFG_OFFSET	0x10
-#define _OMAP_TIMER_SYS_STAT_OFFSET	0x14
-#define _OMAP_TIMER_STAT_OFFSET		0x18
-#define _OMAP_TIMER_INT_EN_OFFSET	0x1c
-#define _OMAP_TIMER_WAKEUP_EN_OFFSET	0x20
-#define _OMAP_TIMER_CTRL_OFFSET		0x24
-#define		OMAP_TIMER_CTRL_GPOCFG		(1 << 14)
-#define		OMAP_TIMER_CTRL_CAPTMODE	(1 << 13)
-#define		OMAP_TIMER_CTRL_PT		(1 << 12)
-#define		OMAP_TIMER_CTRL_TCM_LOWTOHIGH	(0x1 << 8)
-#define		OMAP_TIMER_CTRL_TCM_HIGHTOLOW	(0x2 << 8)
-#define		OMAP_TIMER_CTRL_TCM_BOTHEDGES	(0x3 << 8)
-#define		OMAP_TIMER_CTRL_SCPWM		(1 << 7)
-#define		OMAP_TIMER_CTRL_CE		(1 << 6) /* compare enable */
-#define		OMAP_TIMER_CTRL_PRE		(1 << 5) /* prescaler enable */
-#define		OMAP_TIMER_CTRL_PTV_SHIFT	2 /* prescaler value shift */
-#define		OMAP_TIMER_CTRL_POSTED		(1 << 2)
-#define		OMAP_TIMER_CTRL_AR		(1 << 1) /* auto-reload enable */
-#define		OMAP_TIMER_CTRL_ST		(1 << 0) /* start timer */
-#define _OMAP_TIMER_COUNTER_OFFSET	0x28
-#define _OMAP_TIMER_LOAD_OFFSET		0x2c
-#define _OMAP_TIMER_TRIGGER_OFFSET	0x30
-#define _OMAP_TIMER_WRITE_PEND_OFFSET	0x34
-#define		WP_NONE			0	/* no write pending bit */
-#define		WP_TCLR			(1 << 0)
-#define		WP_TCRR			(1 << 1)
-#define		WP_TLDR			(1 << 2)
-#define		WP_TTGR			(1 << 3)
-#define		WP_TMAR			(1 << 4)
-#define		WP_TPIR			(1 << 5)
-#define		WP_TNIR			(1 << 6)
-#define		WP_TCVR			(1 << 7)
-#define		WP_TOCR			(1 << 8)
-#define		WP_TOWR			(1 << 9)
-#define _OMAP_TIMER_MATCH_OFFSET	0x38
-#define _OMAP_TIMER_CAPTURE_OFFSET	0x3c
-#define _OMAP_TIMER_IF_CTRL_OFFSET	0x40
-#define _OMAP_TIMER_CAPTURE2_OFFSET		0x44	/* TCAR2, 34xx only */
-#define _OMAP_TIMER_TICK_POS_OFFSET		0x48	/* TPIR, 34xx only */
-#define _OMAP_TIMER_TICK_NEG_OFFSET		0x4c	/* TNIR, 34xx only */
-#define _OMAP_TIMER_TICK_COUNT_OFFSET		0x50	/* TCVR, 34xx only */
-#define _OMAP_TIMER_TICK_INT_MASK_SET_OFFSET	0x54	/* TOCR, 34xx only */
-#define _OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET	0x58	/* TOWR, 34xx only */
-
-/* register offsets with the write pending bit encoded */
-#define	WPSHIFT					16
-
-#define OMAP_TIMER_ID_REG			(_OMAP_TIMER_ID_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_OCP_CFG_REG			(_OMAP_TIMER_OCP_CFG_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_SYS_STAT_REG			(_OMAP_TIMER_SYS_STAT_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_STAT_REG			(_OMAP_TIMER_STAT_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_INT_EN_REG			(_OMAP_TIMER_INT_EN_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_WAKEUP_EN_REG		(_OMAP_TIMER_WAKEUP_EN_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_CTRL_REG			(_OMAP_TIMER_CTRL_OFFSET \
-							| (WP_TCLR << WPSHIFT))
-
-#define OMAP_TIMER_COUNTER_REG			(_OMAP_TIMER_COUNTER_OFFSET \
-							| (WP_TCRR << WPSHIFT))
-
-#define OMAP_TIMER_LOAD_REG			(_OMAP_TIMER_LOAD_OFFSET \
-							| (WP_TLDR << WPSHIFT))
-
-#define OMAP_TIMER_TRIGGER_REG			(_OMAP_TIMER_TRIGGER_OFFSET \
-							| (WP_TTGR << WPSHIFT))
-
-#define OMAP_TIMER_WRITE_PEND_REG		(_OMAP_TIMER_WRITE_PEND_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_MATCH_REG			(_OMAP_TIMER_MATCH_OFFSET \
-							| (WP_TMAR << WPSHIFT))
-
-#define OMAP_TIMER_CAPTURE_REG			(_OMAP_TIMER_CAPTURE_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_IF_CTRL_REG			(_OMAP_TIMER_IF_CTRL_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_CAPTURE2_REG			(_OMAP_TIMER_CAPTURE2_OFFSET \
-							| (WP_NONE << WPSHIFT))
-
-#define OMAP_TIMER_TICK_POS_REG			(_OMAP_TIMER_TICK_POS_OFFSET \
-							| (WP_TPIR << WPSHIFT))
-
-#define OMAP_TIMER_TICK_NEG_REG			(_OMAP_TIMER_TICK_NEG_OFFSET \
-							| (WP_TNIR << WPSHIFT))
-
-#define OMAP_TIMER_TICK_COUNT_REG		(_OMAP_TIMER_TICK_COUNT_OFFSET \
-							| (WP_TCVR << WPSHIFT))
-
-#define OMAP_TIMER_TICK_INT_MASK_SET_REG				\
-		(_OMAP_TIMER_TICK_INT_MASK_SET_OFFSET | (WP_TOCR << WPSHIFT))
-
-#define OMAP_TIMER_TICK_INT_MASK_COUNT_REG				\
-		(_OMAP_TIMER_TICK_INT_MASK_COUNT_OFFSET | (WP_TOWR << WPSHIFT))
-
-struct omap_dm_timer {
-	unsigned long phys_base;
-	int irq;
-#ifdef CONFIG_ARCH_OMAP2PLUS
-	struct clk *iclk, *fclk;
-#endif
-	void __iomem *io_base;
-	unsigned reserved:1;
-	unsigned enabled:1;
-	unsigned posted:1;
-};
-
 static int dm_timer_count;
 
 #ifdef CONFIG_ARCH_OMAP1
arch/arm/plat-omap/include/plat/dmtimer.h +125 -0

130 lines not on this page · raw message

#7 lore raw

PATCH 3/10 omap: Move dmtimer defines to dmtimer.h

Quoted 4 lines · Tony Lindgren

These will be needed when dmtimer platform init code gets split for omap1 and omap2+. These will also be needed for separate sys_timer init and driver init for the rest of the hardware timers in the following patches. No functional changes.

If dmtimer.c is the only user of these definitions, then its quite correct for them to be in there. If not, they should be in dmtimer.h in the local directory - they're private definitions to the .c file and so should not be exported outside of that .c file.

author maintainer
#8 lore raw

PATCH 3/10 omap: Move dmtimer defines to dmtimer.h

Quoted 10 lines · Russell King - ARM Linux
Quoted 4 lines · Tony Lindgren

These will be needed when dmtimer platform init code gets split for omap1 and omap2+. These will also be needed for separate sys_timer init and driver init for the rest of the hardware timers in the following patches. No functional changes.

If dmtimer.c is the only user of these definitions, then its quite correct for them to be in there. If not, they should be in dmtimer.h in the local directory - they're private definitions to the .c file and so should not be exported outside of that .c file.

There will be more patches coming to make the rest of the dmtimer code be just a regular device driver. These inline functions will be used by sys_timer related code, and dmtimer device driver.

This way we can make the dmtimer a loadable module and don't need to initialize any of that early.

Tony

author maintainer
#9 lore raw

PATCH 4/10 omap: Make a subset of dmtimer functions into inline functions

In reply to Tony Lindgren

This will allow us to share the code between system timer and dmtimer device driver code without having to initialize all the dmtimers early. This change will also make the timer_set_next_event more efficient as the inline functions will optimize the code better for the timer reprogramming.

---
 arch/arm/plat-omap/dmtimer.c              |   78 ++++---------------
 arch/arm/plat-omap/include/plat/dmtimer.h |  119 +++++++++++++++++++++++++++++
 2 files changed, 136 insertions(+), 61 deletions(-)
arch/arm/plat-omap/dmtimer.c +17 -61
index dfdc3b2..7c5cb4e 100644
@@ -170,11 +170,7 @@ static spinlock_t dm_timer_lock;
  */
 static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
 {
-	if (timer->posted)
-		while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
-				& (reg >> WPSHIFT))
-			cpu_relax();
-	return readl(timer->io_base + (reg & 0xff));
+	return __omap_dm_timer_read(timer->io_base, reg, timer->posted);
 }
 
 /*
@@ -186,11 +182,7 @@ static inline u32 omap_dm_timer_read_reg(struct omap_dm_timer *timer, u32 reg)
 static void omap_dm_timer_write_reg(struct omap_dm_timer *timer, u32 reg,
 						u32 value)
 {
-	if (timer->posted)
-		while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff))
-				& (reg >> WPSHIFT))
-			cpu_relax();
-	writel(value, timer->io_base + (reg & 0xff));
+	__omap_dm_timer_write(timer->io_base, reg, value, timer->posted);
 }
 
 static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
@@ -209,7 +201,7 @@ static void omap_dm_timer_wait_for_reset(struct omap_dm_timer *timer)
 
 static void omap_dm_timer_reset(struct omap_dm_timer *timer)
 {
-	u32 l;
+	int autoidle = 0, wakeup = 0;
 
 	if (!cpu_class_is_omap2() || timer != &dm_timers[0]) {
 		omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG, 0x06);
@@ -217,28 +209,21 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer)
 	}
 	omap_dm_timer_set_source(timer, OMAP_TIMER_SRC_32_KHZ);
 
-	l = omap_dm_timer_read_reg(timer, OMAP_TIMER_OCP_CFG_REG);
-	l |= 0x02 << 3;  /* Set to smart-idle mode */
-	l |= 0x2 << 8;   /* Set clock activity to perserve f-clock on idle */
-
 	/* Enable autoidle on OMAP2 / OMAP3 */
 	if (cpu_is_omap24xx() || cpu_is_omap34xx())
-		l |= 0x1 << 0;
+		autoidle = 1;
 
 	/*
 	 * Enable wake-up on OMAP2 CPUs.
 	 */
 	if (cpu_class_is_omap2())
-		l |= 1 << 2;
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_OCP_CFG_REG, l);
+		wakeup = 1;
 
-	/* Match hardware reset default of posted mode */
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_IF_CTRL_REG,
-			OMAP_TIMER_CTRL_POSTED);
+	__omap_dm_timer_reset(timer->io_base, autoidle, wakeup);
 	timer->posted = 1;
 }
 
-static void omap_dm_timer_prepare(struct omap_dm_timer *timer)
+void omap_dm_timer_prepare(struct omap_dm_timer *timer)
 {
 	omap_dm_timer_enable(timer);
 	omap_dm_timer_reset(timer);
@@ -410,25 +395,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_start);
 
 void omap_dm_timer_stop(struct omap_dm_timer *timer)
 {
-	u32 l;
+	unsigned long rate = 0;
 
-	l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
-	if (l & OMAP_TIMER_CTRL_ST) {
-		l &= ~0x1;
-		omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 #ifdef CONFIG_ARCH_OMAP2PLUS
-		/* Readback to make sure write has completed */
-		omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
-		 /*
-		  * Wait for functional clock period x 3.5 to make sure that
-		  * timer is stopped
-		  */
-		udelay(3500000 / clk_get_rate(timer->fclk) + 1);
+	rate = clk_get_rate(timer->fclk);
 #endif
-	}
-	/* Ack possibly pending interrupt */
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG,
-			OMAP_TIMER_INT_OVERFLOW);
+
+	__omap_dm_timer_stop(timer->io_base, timer->posted, rate);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_stop);
 
@@ -451,22 +424,11 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
 int omap_dm_timer_set_source(struct omap_dm_timer *timer, int source)
 {
-	int ret = -EINVAL;
-
 	if (source < 0 || source >= 3)
 		return -EINVAL;
 
-	clk_disable(timer->fclk);
-	ret = clk_set_parent(timer->fclk, dm_source_clocks[source]);
-	clk_enable(timer->fclk);
-
-	/*
-	 * When the functional clock disappears, too quick writes seem
-	 * to cause an abort. XXX Is this still necessary?
-	 */
-	__delay(300000);
-
-	return ret;
+	return __omap_dm_timer_set_source(timer->fclk,
+						dm_source_clocks[source]);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_source);
 
@@ -504,8 +466,7 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	}
 	l |= OMAP_TIMER_CTRL_ST;
 
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
+	__omap_dm_timer_load_start(timer->io_base, l, load, timer->posted);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_load_start);
 
@@ -558,8 +519,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_set_prescaler);
 void omap_dm_timer_set_int_enable(struct omap_dm_timer *timer,
 				  unsigned int value)
 {
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_INT_EN_REG, value);
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_WAKEUP_EN_REG, value);
+	__omap_dm_timer_int_enable(timer->io_base, value);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_set_int_enable);
 
@@ -575,17 +535,13 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_read_status);
 
 void omap_dm_timer_write_status(struct omap_dm_timer *timer, unsigned int value)
 {
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_STAT_REG, value);
+	__omap_dm_timer_write_status(timer->io_base, value);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
 
 unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
 {
-	unsigned int l;
-
-	l = omap_dm_timer_read_reg(timer, OMAP_TIMER_COUNTER_REG);
-
-	return l;
+	return __omap_dm_timer_read_counter(timer->io_base, timer->posted);
 }
 EXPORT_SYMBOL_GPL(omap_dm_timer_read_counter);
 
arch/arm/plat-omap/include/plat/dmtimer.h +119 -0

129 lines not on this page · raw message

author maintainer
#10 lore raw

PATCH 5/10 omap2+: Use dmtimer macros for clockevent

In reply to Tony Lindgren

This patch makes timer-gp.c to use only a subset of dmtimer functions without the need to initialize dmtimer code early.

Also note that now with the inline functions, timer_set_next_event becomes more efficient in the lines of assembly code.

---
 arch/arm/mach-omap2/timer-gp.c            |  147 ++++++++++++++++++++++-------
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 
 2 files changed, 113 insertions(+), 35 deletions(-)
arch/arm/mach-omap2/timer-gp.c +112 -35
index a0d8e83..62c0d5c 100644
@@ -45,10 +45,33 @@
 
 #include "timer-gp.h"
 
+/* Parent clocks, eventually these will come from the clock framework */
+
+#define OMAP2_MPU_SOURCE	"sys_ck"
+#define OMAP3_MPU_SOURCE	OMAP2_MPU_SOURCE
+#define OMAP4_MPU_SOURCE	"sys_clkin_ck"
+#define OMAP2_32K_SOURCE	"func_32k_ck"
+#define OMAP3_32K_SOURCE	"omap_32k_fck"
+#define OMAP4_32K_SOURCE	"sys_32k_ck"
+
+#ifdef CONFIG_OMAP_32K_TIMER
+#define OMAP2_CLKEV_SOURCE	OMAP2_32K_SOURCE
+#define OMAP3_CLKEV_SOURCE	OMAP3_32K_SOURCE
+#define OMAP4_CLKEV_SOURCE	OMAP4_32K_SOURCE
+#define OMAP3_SECURE_TIMER	12
+#else
+#define OMAP2_CLKEV_SOURCE	OMAP2_MPU_SOURCE
+#define OMAP3_CLKEV_SOURCE	OMAP3_MPU_SOURCE
+#define OMAP4_CLKEV_SOURCE	OMAP4_MPU_SOURCE
+#define OMAP3_SECURE_TIMER	1
+#endif
 
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID		12
 
+/* Clockevent code */
+
+static struct omap_dm_timer clkev;
 static struct omap_dm_timer *gptimer;
 static struct clock_event_device clockevent_gpt;
 static u8 __initdata gptimer_id = 1;
@@ -57,10 +80,9 @@ struct omap_dm_timer *gptimer_wakeup;
 
 static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
-	struct omap_dm_timer *gpt = (struct omap_dm_timer *)dev_id;
 	struct clock_event_device *evt = &clockevent_gpt;
 
-	omap_dm_timer_write_status(gpt, OMAP_TIMER_INT_OVERFLOW);
+	__omap_dm_timer_write_status(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
 
 	evt->event_handler(evt);
 	return IRQ_HANDLED;
@@ -75,7 +97,8 @@ static struct irqaction omap2_gp_timer_irq = {
 static int omap2_gp_timer_set_next_event(unsigned long cycles,
 					 struct clock_event_device *evt)
 {
-	omap_dm_timer_set_load_start(gptimer, 0, 0xffffffff - cycles);
+	__omap_dm_timer_load_start(clkev.io_base, OMAP_TIMER_CTRL_ST,
+						0xffffffff - cycles, 1);
 
 	return 0;
 }
@@ -85,13 +108,18 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
 {
 	u32 period;
 
-	omap_dm_timer_stop(gptimer);
+	__omap_dm_timer_stop(clkev.io_base, 1, clkev.rate);
 
 	switch (mode) {
 	case CLOCK_EVT_MODE_PERIODIC:
-		period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ;
+		period = clkev.rate / HZ;
 		period -= 1;
-		omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period);
+		/* Looks like we need to first set the load value separately */
+		__omap_dm_timer_write(clkev.io_base, OMAP_TIMER_LOAD_REG,
+					0xffffffff - period, 1);
+		__omap_dm_timer_load_start(clkev.io_base,
+					OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
+						0xffffffff - period, 1);
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 		break;
@@ -130,43 +158,89 @@ int __init omap2_gp_clockevent_set_gptimer(u8 id)
 	return 0;
 }
 
-static void __init omap2_gp_clockevent_init(void)
+static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
+						int gptimer_id,
+						const char *fck_source)
 {
-	u32 tick_rate;
-	int src;
-	char clockevent_hwmod_name[8]; /* 8 = sizeof("timerXX0") */
+	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
+	struct omap_hwmod *oh;
+	size_t size;
+	int res = 0;
+
+	sprintf(name, "timer%d", gptimer_id);
+	omap_hwmod_setup_one(name);
+	oh = omap_hwmod_lookup(name);
+	if (!oh)
+		return -ENODEV;
+
+	timer->irq = oh->mpu_irqs[0].irq;
+	timer->phys_base = oh->slaves[0]->addr->pa_start;
+	size = oh->slaves[0]->addr->pa_end - timer->phys_base;
+
+	/* Static mapping, never released */
+	timer->io_base = ioremap(timer->phys_base, size);
+	if (!timer->io_base)
+		return -ENXIO;
+
+	/* After the dmtimer is using hwmod these clocks won't be needed */
+	sprintf(name, "gpt%d_fck", gptimer_id);
+	timer->fclk = clk_get(NULL, name);
+	if (IS_ERR(timer->fclk))
+		return -ENODEV;
+
+	sprintf(name, "gpt%d_ick", gptimer_id);
+	timer->iclk = clk_get(NULL, name);
+	if (IS_ERR(timer->iclk)) {
+		clk_put(timer->fclk);
+		return -ENODEV;
+	}
 
-	inited = 1;
+	omap_hwmod_enable(oh);
+
+	if (gptimer_id != 12) {
+		struct clk *src;
+
+		src = clk_get(NULL, fck_source);
+		if (IS_ERR(src)) {
+			res = -EINVAL;
+		} else {
+			res = __omap_dm_timer_set_source(timer->fclk, src);
+			if (IS_ERR_VALUE(res))
+				pr_warning("%s: timer%i cannot set source\n",
+						__func__, gptimer_id);
+			clk_put(src);
+		}
+	}
+	__omap_dm_timer_reset(timer->io_base, 1, 1);
+	timer->posted = 1;
+
+	timer->rate = clk_get_rate(timer->fclk);
 
-	sprintf(clockevent_hwmod_name, "timer%d", gptimer_id);
-	omap_hwmod_setup_one(clockevent_hwmod_name);
+	timer->reserved = 1;
 
 	gptimer = omap_dm_timer_request_specific(gptimer_id);
 	BUG_ON(gptimer == NULL);
 	gptimer_wakeup = gptimer;
 
-#if defined(CONFIG_OMAP_32K_TIMER)
-	src = OMAP_TIMER_SRC_32_KHZ;
-#else
-	src = OMAP_TIMER_SRC_SYS_CLK;
-	WARN(gptimer_id == 12, "WARNING: GPTIMER12 can only use the "
-	     "secure 32KiHz clock source\n");
-#endif
+	return res;
+}
 
-	if (gptimer_id != 12)
-		WARN(IS_ERR_VALUE(omap_dm_timer_set_source(gptimer, src)),
-		     "timer-gp: omap_dm_timer_set_source() failed\n");
+static void __init omap2_gp_clockevent_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
 
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer));
+	inited = 1;
 
-	pr_info("OMAP clockevent source: GPTIMER%d at %u Hz\n",
-		gptimer_id, tick_rate);
+	res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
+	BUG_ON(res);
 
 	omap2_gp_timer_irq.dev_id = (void *)gptimer;
-	setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq);
-	omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW);
+	setup_irq(clkev.irq, &omap2_gp_timer_irq);
 
-	clockevent_gpt.mult = div_sc(tick_rate, NSEC_PER_SEC,
+	__omap_dm_timer_int_enable(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
+
+	clockevent_gpt.mult = div_sc(clkev.rate, NSEC_PER_SEC,
 				     clockevent_gpt.shift);
 	clockevent_gpt.max_delta_ns =
 		clockevent_delta2ns(0xffffffff, &clockevent_gpt);
@@ -176,6 +250,9 @@ static void __init omap2_gp_clockevent_init(void)
 
 	clockevent_gpt.cpumask = cpumask_of(0);
 	clockevents_register_device(&clockevent_gpt);
+
+	pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n",
+		gptimer_id, clkev.rate);
 }
 
 /* Clocksource code */
@@ -247,11 +324,11 @@ static void __init omap2_gp_clocksource_init(void)
 }
 #endif
 
-#define OMAP_SYS_TIMER_INIT(name)					\
+#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
 	omap_dm_timer_init();						\
-	omap2_gp_clockevent_init();					\
+	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
 	omap2_gp_clocksource_init();					\
 }
 
@@ -261,14 +338,14 @@ struct sys_timer omap##name##_timer = {					\
 };
 
 #ifdef CONFIG_ARCH_OMAP2
-OMAP_SYS_TIMER_INIT(2)
+OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE)
 OMAP_SYS_TIMER(2)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-OMAP_SYS_TIMER_INIT(3)
+OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE)
 OMAP_SYS_TIMER(3)
-OMAP_SYS_TIMER_INIT(3_secure)
+OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE)
 OMAP_SYS_TIMER(3_secure)
 #endif
 
@@ -280,7 +357,7 @@ static void __init omap4_timer_init(void)
 	BUG_ON(!twd_base);
 #endif
 	omap_dm_timer_init();
-	omap2_gp_clockevent_init();
+	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
 	omap2_gp_clocksource_init();
 }
 OMAP_SYS_TIMER(4)
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
index 54664a7..dd8b3ff 100644
@@ -216,6 +216,7 @@ struct omap_dm_timer {
 	struct clk *iclk, *fclk;
 #endif
 	void __iomem *io_base;
+	unsigned long rate;
 	unsigned reserved:1;
 	unsigned enabled:1;
 	unsigned posted:1;
#11 lore raw

PATCH 5/10 omap2+: Use dmtimer macros for clockevent

Quoted 8 lines · Tony Lindgren

This patch makes timer-gp.c to use only a subset of dmtimer functions without the need to initialize dmtimer code early.

Also note that now with the inline functions, timer_set_next_event becomes more efficient in the lines of assembly code.

In order for this to work, *all* the dmtimer functions need to be converted. Some still call the real driver, which may not yet be initialized (as pointed out for [7/10]...

[...]

Quoted 57 lines
arch/arm/mach-omap2/timer-gp.c +51 -4
+static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
+						int gptimer_id,
+						const char *fck_source)
 {
-	u32 tick_rate;
-	int src;
-	char clockevent_hwmod_name[8]; /* 8 = sizeof("timerXX0") */
+	char name[10]; /* 10 = sizeof("gptXX_Xck0") */
+	struct omap_hwmod *oh;
+	size_t size;
+	int res = 0;
+
+	sprintf(name, "timer%d", gptimer_id);
+	omap_hwmod_setup_one(name);
+	oh = omap_hwmod_lookup(name);
+	if (!oh)
+		return -ENODEV;
+
+	timer->irq = oh->mpu_irqs[0].irq;
+	timer->phys_base = oh->slaves[0]->addr->pa_start;
+	size = oh->slaves[0]->addr->pa_end - timer->phys_base;
+
+	/* Static mapping, never released */
+	timer->io_base = ioremap(timer->phys_base, size);
+	if (!timer->io_base)
+		return -ENXIO;
+
+	/* After the dmtimer is using hwmod these clocks won't be needed */
+	sprintf(name, "gpt%d_fck", gptimer_id);
+	timer->fclk = clk_get(NULL, name);
+	if (IS_ERR(timer->fclk))
+		return -ENODEV;
+
+	sprintf(name, "gpt%d_ick", gptimer_id);
+	timer->iclk = clk_get(NULL, name);
+	if (IS_ERR(timer->iclk)) {
+		clk_put(timer->fclk);
+		return -ENODEV;
+	}
 
-	inited = 1;
+	omap_hwmod_enable(oh);
+
+	if (gptimer_id != 12) {
+		struct clk *src;
+
+		src = clk_get(NULL, fck_source);
+		if (IS_ERR(src)) {
+			res = -EINVAL;
+		} else {
+			res = __omap_dm_timer_set_source(timer->fclk, src);
+			if (IS_ERR_VALUE(res))
+				pr_warning("%s: timer%i cannot set source\n",
+						__func__, gptimer_id);
+			clk_put(src);
+		}
+	}

arch/arm/mach-omap2/timer-gp.c int __init omap2_gp_clockevent_set_gptimer(u8 id) · line 221

Quoted 10 lines
arch/arm/mach-omap2/timer-gp.c +5 -2
+	__omap_dm_timer_reset(timer->io_base, 1, 1);
+	timer->posted = 1;
+
+	timer->rate = clk_get_rate(timer->fclk);
 
-	sprintf(clockevent_hwmod_name, "timer%d", gptimer_id);
-	omap_hwmod_setup_one(clockevent_hwmod_name);
+	timer->reserved = 1;
 
 	gptimer = omap_dm_timer_request_specific(gptimer_id);

Here remains a call to the real driver, which is not yet initialized when called from sys_timer.init.

arch/arm/mach-omap2/timer-gp.c int __init omap2_gp_clockevent_set_gptimer(u8 id) · line 226

Quoted 12 lines
arch/arm/mach-omap2/timer-gp.c +2 -7
 	BUG_ON(gptimer == NULL);
 	gptimer_wakeup = gptimer;
 
-#if defined(CONFIG_OMAP_32K_TIMER)
-	src = OMAP_TIMER_SRC_32_KHZ;
-#else
-	src = OMAP_TIMER_SRC_SYS_CLK;
-	WARN(gptimer_id == 12, "WARNING: GPTIMER12 can only use the "
-	     "secure 32KiHz clock source\n");
-#endif
+	return res;
+}

Kevin

author maintainer
#12 lore raw

PATCH 5/10 omap2+: Use dmtimer macros for clockevent

Quoted 8 lines · Kevin Hilman
Quoted 6 lines · Tony Lindgren

This patch makes timer-gp.c to use only a subset of dmtimer functions without the need to initialize dmtimer code early.

Also note that now with the inline functions, timer_set_next_event becomes more efficient in the lines of assembly code.

Quoted 6 lines
Quoted 2 lines

In order for this to work, *all* the dmtimer functions need to be converted. Some still call the real driver, which may not yet be initialized (as pointed out for [7/10]...

Well omap_dm_timer_init_one is a static omap2plus specific implementation that can then be then passed as a function pointer to the dmtimer device driver in later patches.

Quoted 4 lines
Quoted 1 line

gptimer = omap_dm_timer_request_specific(gptimer_id);

Here remains a call to the real driver, which is not yet initialized when called from sys_timer.init.

There's no need for omap_dm_timer_request_specific after the later patches. It gets removed in the PM_DEBUG sysfs interface removal patch.

Tony

author maintainer
#13 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

In reply to Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

---
 arch/arm/mach-omap2/pm-debug.c |   28 ----------------------------
 arch/arm/mach-omap2/pm.h       |    6 ------
 arch/arm/mach-omap2/pm34xx.c   |    4 ----
 arch/arm/mach-omap2/timer-gp.c |    8 +-------
 4 files changed, 1 insertions(+), 45 deletions(-)
arch/arm/mach-omap2/pm-debug.c +0 -28
index a5a83b3..c56d1d4 100644
@@ -31,7 +31,6 @@
 #include <plat/board.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
-#include <plat/dmtimer.h>
 #include <plat/omap-pm.h>
 
 #include "cm2xxx_3xxx.h"
@@ -41,8 +40,6 @@
 int omap2_pm_debug;
 u32 enable_off_mode;
 u32 sleep_while_idle;
-u32 wakeup_timer_seconds;
-u32 wakeup_timer_milliseconds;
 
 #define DUMP_PRM_MOD_REG(mod, reg)    \
 	regs[reg_count].name = #mod "." #reg; \
@@ -162,23 +159,6 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)
 		printk(KERN_INFO "%-20s: 0x%08x\n", regs[i].name, regs[i].val);
 }
 
-void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
-{
-	u32 tick_rate, cycles;
-
-	if (!seconds && !milliseconds)
-		return;
-
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
-	cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
-	omap_dm_timer_stop(gptimer_wakeup);
-	omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
-
-	pr_info("PM: Resume timer in %u.%03u secs"
-		" (%d ticks at %d ticks/sec.)\n",
-		seconds, milliseconds, cycles, tick_rate);
-}
-
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
@@ -576,9 +556,6 @@ static int option_set(void *data, u64 val)
 {
 	u32 *option = data;
 
-	if (option == &wakeup_timer_milliseconds && val >= 1000)
-		return -EINVAL;
-
 	*option = val;
 
 	if (option == &enable_off_mode) {
@@ -641,11 +618,6 @@ static int __init pm_dbg_init(void)
 				   &enable_off_mode, &pm_dbg_option_fops);
 	(void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d,
 				   &sleep_while_idle, &pm_dbg_option_fops);
-	(void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d,
-				   &wakeup_timer_seconds, &pm_dbg_option_fops);
-	(void) debugfs_create_file("wakeup_timer_milliseconds",
-			S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds,
-			&pm_dbg_option_fops);
 	pm_dbg_init_done = 1;
 
 	return 0;
arch/arm/mach-omap2/pm.h +0 -6
index 45bcfce..c3a367e 100644
@@ -60,19 +60,13 @@ inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
 extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
 extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
-extern u32 wakeup_timer_seconds;
-extern u32 wakeup_timer_milliseconds;
-extern struct omap_dm_timer *gptimer_wakeup;
-
 #ifdef CONFIG_PM_DEBUG
 extern void omap2_pm_dump(int mode, int resume, unsigned int us);
-extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds);
 extern int omap2_pm_debug;
 extern u32 enable_off_mode;
 extern u32 sleep_while_idle;
 #else
 #define omap2_pm_dump(mode, resume, us)		do {} while (0);
-#define omap2_pm_wakeup_on_timer(seconds, milliseconds)	do {} while (0);
 #define omap2_pm_debug				0
 #define enable_off_mode 0
 #define sleep_while_idle 0
arch/arm/mach-omap2/pm34xx.c +0 -4
index c155c9d..4cb636a 100644
@@ -534,10 +534,6 @@ static int omap3_pm_suspend(void)
 	struct power_state *pwrst;
 	int state, ret = 0;
 
-	if (wakeup_timer_seconds || wakeup_timer_milliseconds)
-		omap2_pm_wakeup_on_timer(wakeup_timer_seconds,
-					 wakeup_timer_milliseconds);
-
 	/* Read current next_pwrsts */
 	list_for_each_entry(pwrst, &pwrst_list, node)
 		pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
arch/arm/mach-omap2/timer-gp.c +1 -7
index 62c0d5c..578e9df 100644
@@ -72,11 +72,9 @@
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
-static struct omap_dm_timer *gptimer;
 static struct clock_event_device clockevent_gpt;
 static u8 __initdata gptimer_id = 1;
 static u8 __initdata inited;
-struct omap_dm_timer *gptimer_wakeup;
 
 static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
@@ -218,10 +216,6 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	timer->reserved = 1;
 
-	gptimer = omap_dm_timer_request_specific(gptimer_id);
-	BUG_ON(gptimer == NULL);
-	gptimer_wakeup = gptimer;
-
 	return res;
 }
 
@@ -235,7 +229,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
 	res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
 	BUG_ON(res);
 
-	omap2_gp_timer_irq.dev_id = (void *)gptimer;
+	omap2_gp_timer_irq.dev_id = (void *)&clkev;
 	setup_irq(clkev.irq, &omap2_gp_timer_irq);
 
 	__omap_dm_timer_int_enable(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
#14 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 8 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

---

Kevin cleaned up this with a better patch.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg50015.html

May be we can use that patch instead of this.

Regards
Santosh

author maintainer
#15 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

Quoted 8 lines
Quoted 3 lines

---

Kevin cleaned up this with a better patch.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg50015.html

May be we can use that patch instead of this.

The thing is that it's a omap specific debug interface.

I'd rather just get rid of it until there's some generic way of doing it. Maybe Kevin can just carry it along in the PM branch for now?

Tony

#16 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Santosh Shilimkar
Quoted 8 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

---

Quoted 6 lines
Quoted 4 lines

Kevin cleaned up this with a better patch.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg50015.html

May be we can use that patch instead of this.

The thing is that it's a omap specific debug interface.

What's wrong with OMAP-specific debug interfaces? We have plenty of
them: clock, omap_mux and pm_debug.

Quoted 2 lines

I'd rather just get rid of it until there's some generic way of doing it.

Well, we won't have a truly generic way of doing it until we have a generic way of doing HW timers.

The implementation is now mostly generic in the patch Santosh referened above in that the timer programming is now done as part of the clockevent code, and not external timer programming.

So now, the only thing OMAP-specific is the debugfs file used to trigger it.

Quoted 1 line

Maybe Kevin can just carry it along in the PM branch for now?

I'd prefer to keep it in mainline as this is a very important feature for the PM functionality already in mainline.

Kevin

#17 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 33 lines · Kevin Hilman
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Santosh Shilimkar
Quoted 8 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

---

Quoted 6 lines
Quoted 4 lines

Kevin cleaned up this with a better patch.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg50015.html

May be we can use that patch instead of this.

The thing is that it's a omap specific debug interface.

What's wrong with OMAP-specific debug interfaces? We have plenty of
them: clock, omap_mux and pm_debug.

Quoted 2 lines

I'd rather just get rid of it until there's some generic way of doing it.

Well, we won't have a truly generic way of doing it until we have a generic way of doing HW timers.

The implementation is now mostly generic in the patch Santosh referened above in that the timer programming is now done as part of the clockevent code, and not external timer programming.

Quoted 8 lines

So now, the only thing OMAP-specific is the debugfs file used to trigger it.

Quoted 1 line

Maybe Kevin can just carry it along in the PM branch for now?

I'd prefer to keep it in mainline as this is a very important feature for the PM functionality already in mainline.

I agree with Kevin and that's what have been saying from begining when we decided to drop this feature. The new patch from Kevin is already doing this in more generic way than that was before.

Regards
Santosh

author maintainer
#18 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Kevin Hilman

Tony Lindgren<[email protected]> writes:

So now, the only thing OMAP-specific is the debugfs file used to trigger it.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Maybe Kevin can just carry it along in the PM branch for now?

I'd prefer to keep it in mainline as this is a very important feature for the PM functionality already in mainline.

I agree with Kevin and that's what have been saying from begining when we decided to drop this feature. The new patch from Kevin is already doing this in more generic way than that was before.

To me Kevin's later patch makes more sense, but still has few issues:

- It keeps the dependency between PM debug code and sys_timer code. That's yet another artificial blocker for making PM code a loadable module. We really don't want to export anything from the sys_timer code.

- The interface for programming a wake-up timer should be Linux generic, not omap specific.

Further, it's a CONFIG_PM_DEBUG patch. So that code should not be in the mainline kernel.

Regards,

Tony

#19 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 22 lines · Tony Lindgren
Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Kevin Hilman

Tony Lindgren<[email protected]> writes:

So now, the only thing OMAP-specific is the debugfs file used to trigger it.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Maybe Kevin can just carry it along in the PM branch for now?

I'd prefer to keep it in mainline as this is a very important feature for the PM functionality already in mainline.

I agree with Kevin and that's what have been saying from begining when we decided to drop this feature. The new patch from Kevin is already doing this in more generic way than that was before.

To me Kevin's later patch makes more sense, but still has few issues:

- It keeps the dependency between PM debug code and sys_timer code. That's yet another artificial blocker for making PM code a loadable module. We really don't want to export anything from the sys_timer code.

Quoted 5 lines

- The interface for programming a wake-up timer should be Linux generic, not omap specific.

Further, it's a CONFIG_PM_DEBUG patch. So that code should not be in the mainline kernel.

Huh?

Please clarify why PM debug code shouldn't be in mainline?

Kevin

author maintainer
#20 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 27 lines · Kevin Hilman
Quoted 25 lines · Tony Lindgren
Quoted 6 lines · Santosh Shilimkar
Quoted 5 lines · Kevin Hilman

Tony Lindgren<[email protected]> writes:

So now, the only thing OMAP-specific is the debugfs file used to trigger it.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Maybe Kevin can just carry it along in the PM branch for now?

I'd prefer to keep it in mainline as this is a very important feature for the PM functionality already in mainline.

I agree with Kevin and that's what have been saying from begining when we decided to drop this feature. The new patch from Kevin is already doing this in more generic way than that was before.

To me Kevin's later patch makes more sense, but still has few issues:

- It keeps the dependency between PM debug code and sys_timer code. That's yet another artificial blocker for making PM code a loadable module. We really don't want to export anything from the sys_timer code.

- The interface for programming a wake-up timer should be Linux generic, not omap specific.

Quoted 6 lines
Quoted 2 lines

Further, it's a CONFIG_PM_DEBUG patch. So that code should not be in the mainline kernel.

Huh?

Please clarify why PM debug code shouldn't be in mainline?

Oh sorry I did not mean that. I meant that it's a debug interface so it's not like we should freeze it. My main issues are the dependencies and the interface above.

Anyways, I guess you are using this to test suspend on a remote system with no hardware trigger to wake it back up?

If so, how about some RTC alarm like interface to set the wake-up event after suspending? There may be a way to do this already and have it triggered from rtc-omap..

Regards,

Tony

#21 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

In reply to Tony Lindgren
Quoted 7 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

Another minor change to fold into patch: gptimer_wakeup doesn't exist anymore, so should probably be removed from dmtimer.h

Kevin

arch/arm/plat-omap/include/plat/dmtimer.h +0 -1
index 40d7936..d0f3a2d 100644
@@ -59,7 +59,6 @@
  */
 #define OMAP_TIMER_IP_VERSION_1                        0x1
 struct omap_dm_timer;
-extern struct omap_dm_timer *gptimer_wakeup;
 struct clk;
 
 struct omap_dm_timer *omap_dm_timer_request(void);
author maintainer
#22 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 4 lines · Kevin Hilman
Quoted 2 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Quoted 8 lines
Quoted 5 lines

Later on we can reserve gptimer1 for PM code only and have similar functionality.

Another minor change to fold into patch: gptimer_wakeup doesn't exist anymore, so should probably be removed from dmtimer.h

Thanks, updated patch below. Still with your Reviewed-by despite causing you more work with the removal of the interface :)

Tony

From: Tony Lindgren <[email protected]>
Date: Tue, 29 Mar 2011 15:54:49 -0700
Subject: [PATCH] omap2+: Remove gptimer_wakeup for now

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

arch/arm/mach-omap2/pm-debug.c +0 -28
index a5a83b3..c56d1d4 100644
@@ -31,7 +31,6 @@
 #include <plat/board.h>
 #include "powerdomain.h"
 #include "clockdomain.h"
-#include <plat/dmtimer.h>
 #include <plat/omap-pm.h>
 
 #include "cm2xxx_3xxx.h"
@@ -41,8 +40,6 @@
 int omap2_pm_debug;
 u32 enable_off_mode;
 u32 sleep_while_idle;
-u32 wakeup_timer_seconds;
-u32 wakeup_timer_milliseconds;
 
 #define DUMP_PRM_MOD_REG(mod, reg)    \
 	regs[reg_count].name = #mod "." #reg; \
@@ -162,23 +159,6 @@ void omap2_pm_dump(int mode, int resume, unsigned int us)
 		printk(KERN_INFO "%-20s: 0x%08x\n", regs[i].name, regs[i].val);
 }
 
-void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds)
-{
-	u32 tick_rate, cycles;
-
-	if (!seconds && !milliseconds)
-		return;
-
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer_wakeup));
-	cycles = tick_rate * seconds + tick_rate * milliseconds / 1000;
-	omap_dm_timer_stop(gptimer_wakeup);
-	omap_dm_timer_set_load_start(gptimer_wakeup, 0, 0xffffffff - cycles);
-
-	pr_info("PM: Resume timer in %u.%03u secs"
-		" (%d ticks at %d ticks/sec.)\n",
-		seconds, milliseconds, cycles, tick_rate);
-}
-
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
@@ -576,9 +556,6 @@ static int option_set(void *data, u64 val)
 {
 	u32 *option = data;
 
-	if (option == &wakeup_timer_milliseconds && val >= 1000)
-		return -EINVAL;
-
 	*option = val;
 
 	if (option == &enable_off_mode) {
@@ -641,11 +618,6 @@ static int __init pm_dbg_init(void)
 				   &enable_off_mode, &pm_dbg_option_fops);
 	(void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d,
 				   &sleep_while_idle, &pm_dbg_option_fops);
-	(void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d,
-				   &wakeup_timer_seconds, &pm_dbg_option_fops);
-	(void) debugfs_create_file("wakeup_timer_milliseconds",
-			S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds,
-			&pm_dbg_option_fops);
 	pm_dbg_init_done = 1;
 
 	return 0;
arch/arm/mach-omap2/pm.h +0 -6
index 45bcfce..c3a367e 100644
@@ -60,19 +60,13 @@ inline void omap3_pm_init_cpuidle(struct cpuidle_params *cpuidle_board_params)
 extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
 extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
 
-extern u32 wakeup_timer_seconds;
-extern u32 wakeup_timer_milliseconds;
-extern struct omap_dm_timer *gptimer_wakeup;
-
 #ifdef CONFIG_PM_DEBUG
 extern void omap2_pm_dump(int mode, int resume, unsigned int us);
-extern void omap2_pm_wakeup_on_timer(u32 seconds, u32 milliseconds);
 extern int omap2_pm_debug;
 extern u32 enable_off_mode;
 extern u32 sleep_while_idle;
 #else
 #define omap2_pm_dump(mode, resume, us)		do {} while (0);
-#define omap2_pm_wakeup_on_timer(seconds, milliseconds)	do {} while (0);
 #define omap2_pm_debug				0
 #define enable_off_mode 0
 #define sleep_while_idle 0
arch/arm/mach-omap2/pm34xx.c +0 -4
index c155c9d..4cb636a 100644
@@ -534,10 +534,6 @@ static int omap3_pm_suspend(void)
 	struct power_state *pwrst;
 	int state, ret = 0;
 
-	if (wakeup_timer_seconds || wakeup_timer_milliseconds)
-		omap2_pm_wakeup_on_timer(wakeup_timer_seconds,
-					 wakeup_timer_milliseconds);
-
 	/* Read current next_pwrsts */
 	list_for_each_entry(pwrst, &pwrst_list, node)
 		pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
arch/arm/mach-omap2/timer-gp.c +1 -7
index 62c0d5c..578e9df 100644
@@ -72,11 +72,9 @@
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
-static struct omap_dm_timer *gptimer;
 static struct clock_event_device clockevent_gpt;
 static u8 __initdata gptimer_id = 1;
 static u8 __initdata inited;
-struct omap_dm_timer *gptimer_wakeup;
 
 static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
@@ -218,10 +216,6 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	timer->reserved = 1;
 
-	gptimer = omap_dm_timer_request_specific(gptimer_id);
-	BUG_ON(gptimer == NULL);
-	gptimer_wakeup = gptimer;
-
 	return res;
 }
 
@@ -235,7 +229,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
 	res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
 	BUG_ON(res);
 
-	omap2_gp_timer_irq.dev_id = (void *)gptimer;
+	omap2_gp_timer_irq.dev_id = (void *)&clkev;
 	setup_irq(clkev.irq, &omap2_gp_timer_irq);
 
 	__omap_dm_timer_int_enable(clkev.io_base, OMAP_TIMER_INT_OVERFLOW);
arch/arm/plat-omap/include/plat/dmtimer.h +0 -1
index dd8b3ff..8adcb18 100644
@@ -59,7 +59,6 @@
  */
 #define OMAP_TIMER_IP_VERSION_1                        0x1
 struct omap_dm_timer;
-extern struct omap_dm_timer *gptimer_wakeup;
 struct clk;
 
 int omap_dm_timer_init(void);
#23 lore raw

PATCH 6/10 omap2+: Remove gptimer_wakeup for now

Quoted 8 lines · Tony Lindgren
Quoted 7 lines · Kevin Hilman
Quoted 5 lines · Tony Lindgren

This removes the support for setting the wake-up timer for debugging.

Later on we can reserve gptimer1 for PM code only and have similar functionality.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Another minor change to fold into patch: gptimer_wakeup doesn't exist anymore, so should probably be removed from dmtimer.h

Thanks, updated patch below. Still with your Reviewed-by

Thanks.

Quoted 2 lines

despite causing you more work with the removal of the interface :)

Well, part of me wants to keep it because I use it all the time, but I know it's an ugly hack so I won't fight for it. Also the timer cleanups are nice and more important. So for now I'll just keep a patch in the PM branch for the wakeup timer.

I'm talking with tglx offline if we can make a generic interface for this in the clockevents layer. The clockevents already have a notification on suspend that we could use for this.

Kevin

author maintainer
#24 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

In reply to Tony Lindgren

There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

---
 arch/arm/mach-omap1/timer32k.c            |    4 ----
 arch/arm/mach-omap2/timer-gp.c            |    6 ++++--
 arch/arm/plat-omap/dmtimer.c              |    8 ++++++++
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 +
 4 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/mach-omap1/timer32k.c +0 -4
index 13d7b8f..96604a5 100644
@@ -183,10 +183,6 @@ static __init void omap_init_32k_timer(void)
 bool __init omap_32k_timer_init(void)
 {
 	omap_init_clocksource_32k();
-
-#ifdef CONFIG_OMAP_DM_TIMER
-	omap_dm_timer_init();
-#endif
 	omap_init_32k_timer();
 
 	return true;
arch/arm/mach-omap2/timer-gp.c +4 -2
index 578e9df..cf2ec85 100644
@@ -69,6 +69,8 @@
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID		12
 
+u32 sys_timer_reserved;
+
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
@@ -195,6 +197,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	omap_hwmod_enable(oh);
 
+	sys_timer_reserved |= (1 << (gptimer_id - 1));
+
 	if (gptimer_id != 12) {
 		struct clk *src;
 
@@ -321,7 +325,6 @@ static void __init omap2_gp_clocksource_init(void)
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
-	omap_dm_timer_init();						\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
 	omap2_gp_clocksource_init();					\
 }
@@ -350,7 +353,6 @@ static void __init omap4_timer_init(void)
 	twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
 	BUG_ON(!twd_base);
 #endif
-	omap_dm_timer_init();
 	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
 	omap2_gp_clocksource_init();
 }
arch/arm/plat-omap/dmtimer.c +8 -0
index 7c5cb4e..1462784 100644
@@ -625,8 +625,16 @@ int __init omap_dm_timer_init(void)
 			sprintf(clk_name, "gpt%d_fck", i + 1);
 			timer->fclk = clk_get(NULL, clk_name);
 		}
+
+		/* One or two timers may be set up early for sys_timer */
+		if (sys_timer_reserved & (1  << i)) {
+			timer->reserved = 1;
+			timer->posted = 1;
+		}
 #endif
 	}
 
 	return 0;
 }
+
+arch_initcall(omap_dm_timer_init);
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
index dd8b3ff..f6dc77a 100644
@@ -222,6 +222,7 @@ struct omap_dm_timer {
 	unsigned posted:1;
 };
 
+extern u32 sys_timer_reserved;
 void omap_dm_timer_prepare(struct omap_dm_timer *timer);
 
 static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,
#25 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

Quoted 1 line · Tony Lindgren

There's no need to initialize the dmtimer framework early.

Actually, there is, because it's being used from the early code.

The sys_timer.init functions are called before arch_initcalls, so before omap_dm_timer_init() is called, you have:

omap3_timer_init()
omap2_gp_clockevent_init()
omap_dm_timer_init_one()
omap_dm_timer_request_specific()

Among other things, the spinlock is taken before it has been initialized in omap_dm_timer_init() (that's how I noticed this problem), but the rest of the init of course hasn't been done either.

Basically, the problem is that this "early init" code is not only using the new macros, but it's also using functions from the "real" driver, which is not yet initialized.

Kevin

Quoted 98 lines

Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

---
 arch/arm/mach-omap1/timer32k.c            |    4 ----
 arch/arm/mach-omap2/timer-gp.c            |    6 ++++--
 arch/arm/plat-omap/dmtimer.c              |    8 ++++++++
 arch/arm/plat-omap/include/plat/dmtimer.h |    1 +
 4 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/mach-omap1/timer32k.c +0 -4
index 13d7b8f..96604a5 100644
@@ -183,10 +183,6 @@ static __init void omap_init_32k_timer(void)
 bool __init omap_32k_timer_init(void)
 {
 	omap_init_clocksource_32k();
-
-#ifdef CONFIG_OMAP_DM_TIMER
-	omap_dm_timer_init();
-#endif
 	omap_init_32k_timer();
 
 	return true;
arch/arm/mach-omap2/timer-gp.c +4 -2
index 578e9df..cf2ec85 100644
@@ -69,6 +69,8 @@
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID		12
 
+u32 sys_timer_reserved;
+
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
@@ -195,6 +197,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	omap_hwmod_enable(oh);
 
+	sys_timer_reserved |= (1 << (gptimer_id - 1));
+
 	if (gptimer_id != 12) {
 		struct clk *src;
 
@@ -321,7 +325,6 @@ static void __init omap2_gp_clocksource_init(void)
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
-	omap_dm_timer_init();						\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
 	omap2_gp_clocksource_init();					\
 }
@@ -350,7 +353,6 @@ static void __init omap4_timer_init(void)
 	twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
 	BUG_ON(!twd_base);
 #endif
-	omap_dm_timer_init();
 	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
 	omap2_gp_clocksource_init();
 }
arch/arm/plat-omap/dmtimer.c +8 -0
index 7c5cb4e..1462784 100644
@@ -625,8 +625,16 @@ int __init omap_dm_timer_init(void)
 			sprintf(clk_name, "gpt%d_fck", i + 1);
 			timer->fclk = clk_get(NULL, clk_name);
 		}
+
+		/* One or two timers may be set up early for sys_timer */
+		if (sys_timer_reserved & (1  << i)) {
+			timer->reserved = 1;
+			timer->posted = 1;
+		}
 #endif
 	}
 
 	return 0;
 }
+
+arch_initcall(omap_dm_timer_init);
arch/arm/plat-omap/include/plat/dmtimer.h +1 -0
index dd8b3ff..f6dc77a 100644
@@ -222,6 +222,7 @@ struct omap_dm_timer {
 	unsigned posted:1;
 };
 
+extern u32 sys_timer_reserved;
 void omap_dm_timer_prepare(struct omap_dm_timer *timer);
 
 static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,
author maintainer
#26 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

Quoted 15 lines · Kevin Hilman
Quoted 1 line · Tony Lindgren

There's no need to initialize the dmtimer framework early.

Actually, there is, because it's being used from the early code.

The sys_timer.init functions are called before arch_initcalls, so before omap_dm_timer_init() is called, you have:

omap3_timer_init()
omap2_gp_clockevent_init()
omap_dm_timer_init_one()
omap_dm_timer_request_specific()

Quoted 7 lines

Among other things, the spinlock is taken before it has been initialized in omap_dm_timer_init() (that's how I noticed this problem), but the rest of the init of course hasn't been done either.

Basically, the problem is that this "early init" code is not only using the new macros, but it's also using functions from the "real" driver, which is not yet initialized.

Sounds like you did not apply the previous patch to remove the PM hack?

There's no need to call to omap_dm_timer_request_specific here unless you added back the PM hack.

Regards,

Tony

#27 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

Quoted 20 lines · Tony Lindgren
Quoted 19 lines · Kevin Hilman
Quoted 1 line · Tony Lindgren

There's no need to initialize the dmtimer framework early.

Actually, there is, because it's being used from the early code.

The sys_timer.init functions are called before arch_initcalls, so before omap_dm_timer_init() is called, you have:

omap3_timer_init()
omap2_gp_clockevent_init()
omap_dm_timer_init_one()
omap_dm_timer_request_specific()

Among other things, the spinlock is taken before it has been initialized in omap_dm_timer_init() (that's how I noticed this problem), but the rest of the init of course hasn't been done either.

Quoted 8 lines
Quoted 3 lines

Basically, the problem is that this "early init" code is not only using the new macros, but it's also using functions from the "real" driver, which is not yet initialized.

Sounds like you did not apply the previous patch to remove the PM hack?

There's no need to call to omap_dm_timer_request_specific here unless you added back the PM hack.

Right, I added it back not noticing that it also removed the _request_specific call.

Thanks for the clarification,

Kevin

#28 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

In reply to Tony Lindgren
Quoted 6 lines · Tony Lindgren

There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

Also, when you are able to fully get rid of omap_dm_timer_init(), you can probably remove it from dmtimer.h and make it static in dmtimer.c

Kevin

author maintainer
#29 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

Quoted 11 lines · Kevin Hilman
Quoted 6 lines · Tony Lindgren

There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

Also, when you are able to fully get rid of omap_dm_timer_init(), you can probably remove it from dmtimer.h and make it static in dmtimer.c

Good catch. That can be made static now.

Tony

author maintainer
#30 lore raw

PATCH 7/10 omap2+: Reserve clocksource and timesource and initialize dmtimer later

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Kevin Hilman
Quoted 4 lines · Tony Lindgren

There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Also, when you are able to fully get rid of omap_dm_timer_init(), you can probably remove it from dmtimer.h and make it static in dmtimer.c

Good catch. That can be made static now.

Here's an updated version of this patch.

Tony

From: Tony Lindgren <[email protected]>
Date: Tue, 29 Mar 2011 15:54:49 -0700
Subject: [PATCH] omap2+: Reserve clocksource and timesource and initialize dmtimer later

There's no need to initialize the dmtimer framework early. Just mark the clocksource and timesource as reserved, and initialize dmtimer with an arch_initcall.

arch/arm/mach-omap1/timer32k.c +0 -4
index 13d7b8f..96604a5 100644
@@ -183,10 +183,6 @@ static __init void omap_init_32k_timer(void)
 bool __init omap_32k_timer_init(void)
 {
 	omap_init_clocksource_32k();
-
-#ifdef CONFIG_OMAP_DM_TIMER
-	omap_dm_timer_init();
-#endif
 	omap_init_32k_timer();
 
 	return true;
arch/arm/mach-omap2/timer-gp.c +4 -2
index 578e9df..cf2ec85 100644
@@ -69,6 +69,8 @@
 /* MAX_GPTIMER_ID: number of GPTIMERs on the chip */
 #define MAX_GPTIMER_ID		12
 
+u32 sys_timer_reserved;
+
 /* Clockevent code */
 
 static struct omap_dm_timer clkev;
@@ -195,6 +197,8 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 
 	omap_hwmod_enable(oh);
 
+	sys_timer_reserved |= (1 << (gptimer_id - 1));
+
 	if (gptimer_id != 12) {
 		struct clk *src;
 
@@ -321,7 +325,6 @@ static void __init omap2_gp_clocksource_init(void)
 #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
-	omap_dm_timer_init();						\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
 	omap2_gp_clocksource_init();					\
 }
@@ -350,7 +353,6 @@ static void __init omap4_timer_init(void)
 	twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
 	BUG_ON(!twd_base);
 #endif
-	omap_dm_timer_init();
 	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
 	omap2_gp_clocksource_init();
 }
arch/arm/plat-omap/dmtimer.c +9 -1
index 7c5cb4e..8dfb818 100644
@@ -572,7 +572,7 @@ int omap_dm_timers_active(void)
 }
 EXPORT_SYMBOL_GPL(omap_dm_timers_active);
 
-int __init omap_dm_timer_init(void)
+static int __init omap_dm_timer_init(void)
 {
 	struct omap_dm_timer *timer;
 	int i, map_size = SZ_8K;	/* Module 4KB + L4 4KB except on omap1 */
@@ -625,8 +625,16 @@ int __init omap_dm_timer_init(void)
 			sprintf(clk_name, "gpt%d_fck", i + 1);
 			timer->fclk = clk_get(NULL, clk_name);
 		}
+
+		/* One or two timers may be set up early for sys_timer */
+		if (sys_timer_reserved & (1  << i)) {
+			timer->reserved = 1;
+			timer->posted = 1;
+		}
 #endif
 	}
 
 	return 0;
 }
+
+arch_initcall(omap_dm_timer_init);
arch/arm/plat-omap/include/plat/dmtimer.h +1 -2
index dd8b3ff..40d7936 100644
@@ -62,8 +62,6 @@ struct omap_dm_timer;
 extern struct omap_dm_timer *gptimer_wakeup;
 struct clk;
 
-int omap_dm_timer_init(void);
-
 struct omap_dm_timer *omap_dm_timer_request(void);
 struct omap_dm_timer *omap_dm_timer_request_specific(int timer_id);
 void omap_dm_timer_free(struct omap_dm_timer *timer);
@@ -222,6 +220,7 @@ struct omap_dm_timer {
 	unsigned posted:1;
 };
 
+extern u32 sys_timer_reserved;
 void omap_dm_timer_prepare(struct omap_dm_timer *timer);
 
 static inline u32 __omap_dm_timer_read(void __iomem *base, u32 reg,
author maintainer
#31 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

In reply to Tony Lindgren

Use dmtimer macros for clocksource. As with the clockevent, this allows us to initialize the rest of dmtimer code later on.

Note that eventually we will be initializing the timesource from init_early so sched_clock will work properly for CONFIG_PRINTK_TIME.

---
 arch/arm/mach-omap2/timer-gp.c   |   64 +++++++++++++++++++++-----------------
 arch/arm/plat-omap/counter_32k.c |    2 +
 2 files changed, 37 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/timer-gp.c +36 -28
index cf2ec85..52e295e 100644
@@ -262,20 +262,22 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
  * sync counter.  See clocksource setup in plat-omap/counter_32k.c
  */
 
-static void __init omap2_gp_clocksource_init(void)
+static void __init omap2_gp_clocksource_init(int unused, const char *dummy)
 {
 	omap_init_clocksource_32k();
 }
 
 #else
+
+static struct omap_dm_timer clksrc;
+
 /*
  * clocksource
  */
 static DEFINE_CLOCK_DATA(cd);
-static struct omap_dm_timer *gpt_clocksource;
 static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
-	return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
+	return (cycle_t)__omap_dm_timer_read_counter(clksrc.io_base, 1);
 }
 
 static struct clocksource clocksource_gpt = {
@@ -290,43 +292,48 @@ static void notrace dmtimer_update_sched_clock(void)
 {
 	u32 cyc;
 
-	cyc = omap_dm_timer_read_counter(gpt_clocksource);
+	cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
-/* Setup free-running counter for clocksource */
-static void __init omap2_gp_clocksource_init(void)
+unsigned long long notrace sched_clock(void)
 {
-	static struct omap_dm_timer *gpt;
-	u32 tick_rate;
-	static char err1[] __initdata = KERN_ERR
-		"%s: failed to request dm-timer\n";
-	static char err2[] __initdata = KERN_ERR
-		"%s: can't register clocksource!\n";
+	u32 cyc = 0;
 
-	gpt = omap_dm_timer_request();
-	if (!gpt)
-		printk(err1, clocksource_gpt.name);
-	gpt_clocksource = gpt;
+	if (clksrc.reserved)
+		cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
-	omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));
+	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+/* Setup free-running counter for clocksource */
+static void __init omap2_gp_clocksource_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);
+	BUG_ON(res);
 
-	omap_dm_timer_set_load_start(gpt, 1, 0);
+	pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
+		gptimer_id, clksrc.rate);
 
-	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
+	omap_dm_timer_set_load_start(&clksrc, 1, 0);
+	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
-	if (clocksource_register_hz(&clocksource_gpt, tick_rate))
-		printk(err2, clocksource_gpt.name);
+	if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
+		pr_err("Could not register clocksource %s\n",
+			clocksource_gpt.name);
 }
 #endif
 
-#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
+#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,			\
+				clksrc_nr, clksrc_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
-	omap2_gp_clocksource_init();					\
+	omap2_gp_clocksource_init((clksrc_nr), clksrc_src);		\
 }
 
 #define OMAP_SYS_TIMER(name)						\
@@ -335,14 +342,15 @@ struct sys_timer omap##name##_timer = {					\
 };
 
 #ifdef CONFIG_ARCH_OMAP2
-OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, 2, OMAP2_MPU_SOURCE)
 OMAP_SYS_TIMER(2)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, 2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3)
-OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
+			2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3_secure)
 #endif
 
@@ -354,7 +362,7 @@ static void __init omap4_timer_init(void)
 	BUG_ON(!twd_base);
 #endif
 	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
-	omap2_gp_clocksource_init();
+	omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE);
 }
 OMAP_SYS_TIMER(4)
 #endif
arch/arm/plat-omap/counter_32k.c +1 -1
index f7fed60..c13bc3d 100644
@@ -126,7 +126,7 @@ static inline unsigned long long notrace _omap_32k_sched_clock(void)
 	return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
 }
 
-#ifndef CONFIG_OMAP_MPU_TIMER
+#if defined(CONFIG_OMAP_32K_TIMER) && !defined(CONFIG_OMAP_MPU_TIMER)
 unsigned long long notrace sched_clock(void)
 {
 	return _omap_32k_sched_clock();
#32 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

Quoted 9 lines · Tony Lindgren

Use dmtimer macros for clocksource. As with the clockevent, this allows us to initialize the rest of dmtimer code later on.

Note that eventually we will be initializing the timesource from init_early so sched_clock will work properly for CONFIG_PRINTK_TIME.

[...]

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 317

Quoted 8 lines
arch/arm/mach-omap2/timer-gp.c +8 -0
+/* Setup free-running counter for clocksource */
+static void __init omap2_gp_clocksource_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);
+	BUG_ON(res);

This is a change from previous code where the clocksource was requesting any timer, not a specific one.

Also, you're using the same gptimer_id here as the clockevent, which means this is guaranteed to fail.

Kevin

#33 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

Quoted 26 lines · Kevin Hilman
Quoted 9 lines · Tony Lindgren

Use dmtimer macros for clocksource. As with the clockevent, this allows us to initialize the rest of dmtimer code later on.

Note that eventually we will be initializing the timesource from init_early so sched_clock will work properly for CONFIG_PRINTK_TIME.

[...]

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 317

Quoted 8 lines
arch/arm/mach-omap2/timer-gp.c +8 -0
+/* Setup free-running counter for clocksource */
+static void __init omap2_gp_clocksource_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);
+	BUG_ON(res);

This is a change from previous code where the clocksource was requesting any timer, not a specific one.

Quoted 2 lines

Also, you're using the same gptimer_id here as the clockevent, which means this is guaranteed to fail.

Nevermind, ignore this comment.

I misread the macros.

Sorry for the noise.

Kevin

#34 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

In reply to Tony Lindgren
Quoted 75 lines · Tony Lindgren

Use dmtimer macros for clocksource. As with the clockevent, this allows us to initialize the rest of dmtimer code later on.

Note that eventually we will be initializing the timesource from init_early so sched_clock will work properly for CONFIG_PRINTK_TIME.

---
 arch/arm/mach-omap2/timer-gp.c   |   64 +++++++++++++++++++++-----------------
 arch/arm/plat-omap/counter_32k.c |    2 +
 2 files changed, 37 insertions(+), 29 deletions(-)
arch/arm/mach-omap2/timer-gp.c +10 -18
index cf2ec85..52e295e 100644
@@ -262,20 +262,22 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
  * sync counter.  See clocksource setup in plat-omap/counter_32k.c
  */
 
-static void __init omap2_gp_clocksource_init(void)
+static void __init omap2_gp_clocksource_init(int unused, const char *dummy)
 {
 	omap_init_clocksource_32k();
 }
 
 #else
+
+static struct omap_dm_timer clksrc;
+
 /*
  * clocksource
  */
 static DEFINE_CLOCK_DATA(cd);
-static struct omap_dm_timer *gpt_clocksource;
 static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
-	return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
+	return (cycle_t)__omap_dm_timer_read_counter(clksrc.io_base, 1);
 }
 
 static struct clocksource clocksource_gpt = {
@@ -290,43 +292,48 @@ static void notrace dmtimer_update_sched_clock(void)
 {
 	u32 cyc;
 
-	cyc = omap_dm_timer_read_counter(gpt_clocksource);
+	cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
-/* Setup free-running counter for clocksource */
-static void __init omap2_gp_clocksource_init(void)
+unsigned long long notrace sched_clock(void)
 {
-	static struct omap_dm_timer *gpt;
-	u32 tick_rate;
-	static char err1[] __initdata = KERN_ERR
-		"%s: failed to request dm-timer\n";
-	static char err2[] __initdata = KERN_ERR
-		"%s: can't register clocksource!\n";
+	u32 cyc = 0;
 
-	gpt = omap_dm_timer_request();
-	if (!gpt)
-		printk(err1, clocksource_gpt.name);
-	gpt_clocksource = gpt;
+	if (clksrc.reserved)
+		cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
-	omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 316

Quoted 10 lines
arch/arm/mach-omap2/timer-gp.c +10 -0
+	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+/* Setup free-running counter for clocksource */
+static void __init omap2_gp_clocksource_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);

This function makes calls into "real" driver, but is called from sys_timer.init so happens before driver is initialized.

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 322

Quoted 8 lines
arch/arm/mach-omap2/timer-gp.c +4 -2
+	BUG_ON(res);
 
-	omap_dm_timer_set_load_start(gpt, 1, 0);
+	pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
+		gptimer_id, clksrc.rate);
 
-	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
+	omap_dm_timer_set_load_start(&clksrc, 1, 0);

Here's another call into the real driver. I think you need __omap_dm_timer_set_load_start() here.

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 329

Quoted 9 lines
arch/arm/mach-omap2/timer-gp.c +4 -2
+	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
-	if (clocksource_register_hz(&clocksource_gpt, tick_rate))
-		printk(err2, clocksource_gpt.name);
+	if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
+		pr_err("Could not register clocksource %s\n",
+			clocksource_gpt.name);
 }
 #endif

Kevin

author maintainer
#35 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

Quoted 6 lines · Kevin Hilman

Review

Quoted 2 lines · Tony Lindgren
(quoted diff) +2 -0
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);

This function makes calls into "real" driver, but is called from sys_timer.init so happens before driver is initialized.

That one is the static omap2+ specific function that can be passed to the dmtimer device driver as a function pointer in the later patches.

Quoted 4 lines

arch/arm/mach-omap2/timer-gp.c static void notrace dmtimer_update_sched_clock(void) · line 322

Quoted 1 line
arch/arm/mach-omap2/timer-gp.c +1 -0
+	omap_dm_timer_set_load_start(&clksrc, 1, 0);

Here's another call into the real driver. I think you need __omap_dm_timer_set_load_start() here.

Thanks, that's correct. Will fix that one.

Tony

author maintainer
#36 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

Quoted 12 lines · Tony Lindgren
Quoted 6 lines · Kevin Hilman

Review

Quoted 2 lines · Tony Lindgren
(quoted diff) +2 -0
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);

This function makes calls into "real" driver, but is called from sys_timer.init so happens before driver is initialized.

That one is the static omap2+ specific function that can be passed to the dmtimer device driver as a function pointer in the later patches.

Quoted 6 lines
Quoted 4 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap_dm_timer_set_load_start(&clksrc, 1, 0);

Here's another call into the real driver. I think you need __omap_dm_timer_set_load_start() here.

Thanks, that's correct. Will fix that one.

Here's this one updated. Looks like I still have your Reviewed-by lines from the last time this series got posted. Can you please check if those are still valid?

Regards,

Tony

From: Tony Lindgren <[email protected]>
Date: Tue, 29 Mar 2011 15:54:49 -0700
Subject: [PATCH] omap2+: Use dmtimer macros for clocksource

Use dmtimer macros for clocksource. As with the clockevent, this allows us to initialize the rest of dmtimer code later on.

Note that eventually we will be initializing the timesource from init_early so sched_clock will work properly for CONFIG_PRINTK_TIME.

arch/arm/mach-omap2/timer-gp.c +36 -28
index cf2ec85..2b8cb70 100644
@@ -262,20 +262,22 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
  * sync counter.  See clocksource setup in plat-omap/counter_32k.c
  */
 
-static void __init omap2_gp_clocksource_init(void)
+static void __init omap2_gp_clocksource_init(int unused, const char *dummy)
 {
 	omap_init_clocksource_32k();
 }
 
 #else
+
+static struct omap_dm_timer clksrc;
+
 /*
  * clocksource
  */
 static DEFINE_CLOCK_DATA(cd);
-static struct omap_dm_timer *gpt_clocksource;
 static cycle_t clocksource_read_cycles(struct clocksource *cs)
 {
-	return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
+	return (cycle_t)__omap_dm_timer_read_counter(clksrc.io_base, 1);
 }
 
 static struct clocksource clocksource_gpt = {
@@ -290,43 +292,48 @@ static void notrace dmtimer_update_sched_clock(void)
 {
 	u32 cyc;
 
-	cyc = omap_dm_timer_read_counter(gpt_clocksource);
+	cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
 	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
-/* Setup free-running counter for clocksource */
-static void __init omap2_gp_clocksource_init(void)
+unsigned long long notrace sched_clock(void)
 {
-	static struct omap_dm_timer *gpt;
-	u32 tick_rate;
-	static char err1[] __initdata = KERN_ERR
-		"%s: failed to request dm-timer\n";
-	static char err2[] __initdata = KERN_ERR
-		"%s: can't register clocksource!\n";
+	u32 cyc = 0;
 
-	gpt = omap_dm_timer_request();
-	if (!gpt)
-		printk(err1, clocksource_gpt.name);
-	gpt_clocksource = gpt;
+	if (clksrc.reserved)
+		cyc = __omap_dm_timer_read_counter(clksrc.io_base, 1);
 
-	omap_dm_timer_set_source(gpt, OMAP_TIMER_SRC_SYS_CLK);
-	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt));
+	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
+/* Setup free-running counter for clocksource */
+static void __init omap2_gp_clocksource_init(int gptimer_id,
+						const char *fck_source)
+{
+	int res;
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);
+	BUG_ON(res);
 
-	omap_dm_timer_set_load_start(gpt, 1, 0);
+	pr_info("OMAP clocksource: GPTIMER%d at %lu Hz\n",
+		gptimer_id, clksrc.rate);
 
-	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
+	__omap_dm_timer_load_start(clksrc.io_base, OMAP_TIMER_CTRL_ST, 0, 1);
+	init_sched_clock(&cd, dmtimer_update_sched_clock, 32, clksrc.rate);
 
-	if (clocksource_register_hz(&clocksource_gpt, tick_rate))
-		printk(err2, clocksource_gpt.name);
+	if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
+		pr_err("Could not register clocksource %s\n",
+			clocksource_gpt.name);
 }
 #endif
 
-#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src)			\
+#define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src,			\
+				clksrc_nr, clksrc_src)			\
 static void __init omap##name##_timer_init(void)			\
 {									\
 	omap2_gp_clockevent_init((clkev_nr), clkev_src);		\
-	omap2_gp_clocksource_init();					\
+	omap2_gp_clocksource_init((clksrc_nr), clksrc_src);		\
 }
 
 #define OMAP_SYS_TIMER(name)						\
@@ -335,14 +342,15 @@ struct sys_timer omap##name##_timer = {					\
 };
 
 #ifdef CONFIG_ARCH_OMAP2
-OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, 2, OMAP2_MPU_SOURCE)
 OMAP_SYS_TIMER(2)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, 2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3)
-OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE)
+OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE,
+			2, OMAP3_MPU_SOURCE)
 OMAP_SYS_TIMER(3_secure)
 #endif
 
@@ -354,7 +362,7 @@ static void __init omap4_timer_init(void)
 	BUG_ON(!twd_base);
 #endif
 	omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE);
-	omap2_gp_clocksource_init();
+	omap2_gp_clocksource_init(2, OMAP4_MPU_SOURCE);
 }
 OMAP_SYS_TIMER(4)
 #endif
arch/arm/plat-omap/counter_32k.c +1 -1
index f7fed60..c13bc3d 100644
@@ -126,7 +126,7 @@ static inline unsigned long long notrace _omap_32k_sched_clock(void)
 	return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
 }
 
-#ifndef CONFIG_OMAP_MPU_TIMER
+#if defined(CONFIG_OMAP_32K_TIMER) && !defined(CONFIG_OMAP_MPU_TIMER)
 unsigned long long notrace sched_clock(void)
 {
 	return _omap_32k_sched_clock();
#37 lore raw

PATCH 8/10 omap2+: Use dmtimer macros for clocksource

Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Tony Lindgren
Quoted 6 lines · Kevin Hilman

Review

Quoted 2 lines · Tony Lindgren
(quoted diff) +2 -0
+
+	res = omap_dm_timer_init_one(&clksrc, gptimer_id, fck_source);

This function makes calls into "real" driver, but is called from sys_timer.init so happens before driver is initialized.

That one is the static omap2+ specific function that can be passed to the dmtimer device driver as a function pointer in the later patches.

Quoted 4 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	omap_dm_timer_set_load_start(&clksrc, 1, 0);

Here's another call into the real driver. I think you need __omap_dm_timer_set_load_start() here.

Quoted 5 lines
Quoted 1 line

Thanks, that's correct. Will fix that one.

Here's this one updated. Looks like I still have your Reviewed-by lines from the last time this series got posted. Can you please check if those are still valid?

Yes, they're still valid as I've now been through the whole series.

Kevin

author maintainer
#38 lore raw

PATCH 9/10 omap2+: Remove omap2_gp_clockevent_set_gptimer

In reply to Tony Lindgren

This is no longer needed as we now just set the desired .timer in MACHINE_START. We can now also remove timer-gp.h.

---
 arch/arm/mach-omap2/board-4430sdp.c        |    4 ----
 arch/arm/mach-omap2/board-devkit8000.c     |    4 ----
 arch/arm/mach-omap2/board-omap3beagle.c    |    4 ----
 arch/arm/mach-omap2/board-omap3logic.c     |    1 -
 arch/arm/mach-omap2/board-omap3stalker.c   |    4 ----
 arch/arm/mach-omap2/board-omap3touchbook.c |    4 ----
 arch/arm/mach-omap2/board-omap4panda.c     |    1 -
 arch/arm/mach-omap2/timer-gp.c             |   26 --------------------------
 arch/arm/mach-omap2/timer-gp.h             |   16 ----------------
 9 files changed, 0 insertions(+), 64 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/timer-gp.h
arch/arm/mach-omap2/board-4430sdp.c +0 -4
index 128efb5..f88505a 100644
@@ -40,7 +40,6 @@
 
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "control.h"
 #include "common-board-devices.h"
 
@@ -295,9 +294,6 @@ static void __init omap_4430sdp_init_early(void)
 {
 	omap2_init_common_infrastructure();
 	omap2_init_common_devices(NULL, NULL);
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(1);
-#endif
 }
 
 static struct omap_musb_board_data musb_board_data = {
arch/arm/mach-omap2/board-devkit8000.c +0 -4
index 671aaea..360ba7b 100644
@@ -58,7 +58,6 @@
 
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "common-board-devices.h"
 
 #define OMAP_DM9000_GPIO_IRQ	25
@@ -439,9 +438,6 @@ static void __init devkit8000_init_early(void)
 static void __init devkit8000_init_irq(void)
 {
 	omap3_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(12);
-#endif
 }
 
 #define OMAP_DM9000_BASE	0x2c000000
arch/arm/mach-omap2/board-omap3beagle.c +0 -4
index 3d41654..5a830df 100644
@@ -50,7 +50,6 @@
 
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "pm.h"
 #include "common-board-devices.h"
 
@@ -487,9 +486,6 @@ static void __init omap3_beagle_init_early(void)
 static void __init omap3_beagle_init_irq(void)
 {
 	omap3_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(12);
-#endif
 }
 
 static struct platform_device *omap3_beagle_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3logic.c +0 -1
index 693eba1..8e67567 100644
@@ -35,7 +35,6 @@
 
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "control.h"
 #include "common-board-devices.h"
 
arch/arm/mach-omap2/board-omap3stalker.c +0 -4
index 96fec1f..c8e53d0 100644
@@ -52,7 +52,6 @@
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "common-board-devices.h"
 
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
@@ -495,9 +494,6 @@ static void __init omap3_stalker_init_early(void)
 static void __init omap3_stalker_init_irq(void)
 {
 	omap3_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(12);
-#endif
 }
 
 static struct platform_device *omap3_stalker_devices[] __initdata = {
arch/arm/mach-omap2/board-omap3touchbook.c +0 -4
index 9447bc0..729565c 100644
@@ -51,7 +51,6 @@
 
 #include "mux.h"
 #include "hsmmc.h"
-#include "timer-gp.h"
 #include "common-board-devices.h"
 
 #include <asm/setup.h>
@@ -372,9 +371,6 @@ static void __init omap3_touchbook_init_early(void)
 static void __init omap3_touchbook_init_irq(void)
 {
 	omap3_init_irq();
-#ifdef CONFIG_OMAP_32K_TIMER
-	omap2_gp_clockevent_set_gptimer(12);
-#endif
 }
 
 static struct platform_device *omap3_touchbook_devices[] __initdata = {
arch/arm/mach-omap2/board-omap4panda.c +0 -1
index e76fe98..f106489 100644
@@ -41,7 +41,6 @@
 #include <plat/usb.h>
 #include <plat/mmc.h>
 #include <video/omap-panel-generic-dpi.h>
-#include "timer-gp.h"
 
 #include "hsmmc.h"
 #include "control.h"
arch/arm/mach-omap2/timer-gp.c +0 -26
index 52e295e..08cbb34 100644
@@ -43,8 +43,6 @@
 #include <plat/common.h>
 #include <plat/omap_hwmod.h>
 
-#include "timer-gp.h"
-
 /* Parent clocks, eventually these will come from the clock framework */
 
 #define OMAP2_MPU_SOURCE	"sys_ck"
@@ -75,8 +73,6 @@ u32 sys_timer_reserved;
 
 static struct omap_dm_timer clkev;
 static struct clock_event_device clockevent_gpt;
-static u8 __initdata gptimer_id = 1;
-static u8 __initdata inited;
 
 static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 {
@@ -138,26 +134,6 @@ static struct clock_event_device clockevent_gpt = {
 	.set_mode	= omap2_gp_timer_set_mode,
 };
 
-/**
- * omap2_gp_clockevent_set_gptimer - set which GPTIMER is used for clockevents
- * @id: GPTIMER to use (1..MAX_GPTIMER_ID)
- *
- * Define the GPTIMER that the system should use for the tick timer.
- * Meant to be called from board-*.c files in the event that GPTIMER1, the
- * default, is unsuitable.  Returns -EINVAL on error or 0 on success.
- */
-int __init omap2_gp_clockevent_set_gptimer(u8 id)
-{
-	if (id < 1 || id > MAX_GPTIMER_ID)
-		return -EINVAL;
-
-	BUG_ON(inited);
-
-	gptimer_id = id;
-
-	return 0;
-}
-
 static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 						int gptimer_id,
 						const char *fck_source)
@@ -228,8 +204,6 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
 {
 	int res;
 
-	inited = 1;
-
 	res = omap_dm_timer_init_one(&clkev, gptimer_id, fck_source);
 	BUG_ON(res);
 
arch/arm/mach-omap2/timer-gp.h deleted +0 -16
deleted file mode 100644
index 5c1072c..0000000
@@ -1,16 +0,0 @@
-/*
- * OMAP2/3 GPTIMER support.headers
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H
-#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H
-
-extern int __init omap2_gp_clockevent_set_gptimer(u8 id);
-
-#endif
author maintainer
#39 lore raw

PATCH 10/10 omap2+: Rename timer-gp.c into timer.c to combine timer init functions

In reply to Tony Lindgren

We can keep everything sys_timer and gptimer.c related code in timer.c as the code will be very minimal.

Later on we can also remove timer-mpu.c, as it can be called from omap4_timer_init function.

This allows us to get rid of confusing existing files. We currently have timer-gp.c, timer-mpu.c, and patches have been posted to add dmtimer.c. There's no need to have these multiple files, we can put everything into timer.c.

---
 arch/arm/mach-omap2/Makefile   |    2 +-
 arch/arm/mach-omap2/timer.c    |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
 rename arch/arm/mach-omap2/{timer-gp.c => timer.c} (99%)
arch/arm/mach-omap2/Makefile +1 -1
index b148077..adbe82d 100644
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o pm.o \
+obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
 	 common.o gpio.o dma.o wd_timer.o
 
 omap-2-3-common				= irq.o sdrc.o
arch/arm/mach-omap2/timer.c renamed from arch/arm/mach-omap2/timer-gp.c +2 -2
similarity index 99%
rename from arch/arm/mach-omap2/timer-gp.c
rename to arch/arm/mach-omap2/timer.c
index 08cbb34..796b935 100644
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap2/timer-gp.c
+ * linux/arch/arm/mach-omap2/timer.c
  *
  * OMAP2 GP timer support.
  *
@@ -230,7 +230,7 @@ static void __init omap2_gp_clockevent_init(int gptimer_id,
 /* Clocksource code */
 
 #ifdef CONFIG_OMAP_32K_TIMER
-/* 
+/*
  * When 32k-timer is enabled, don't use GPTimer for clocksource
  * instead, just leave default clocksource which uses the 32k
  * sync counter.  See clocksource setup in plat-omap/counter_32k.c