From 82f2348eb321bbf80a7195e6eccf930ca5389b83 Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 9 May 2005 12:03:41 -0700 Subject: [PATCH] ARM: OMAP: Move OMAP1 specific core files to omap1 subdirectory Sync with linux-omap tree. Moves OMAP1 specific core files, such as irq.c, time.c and fpga.c to omap1 subdirectory. Signed-off-by: Tony Lindgren --- arch/arm/mach-omap/{ => omap1}/fpga.c | 0 arch/arm/mach-omap/{ => omap1}/irq.c | 17 ++++- .../mach-omap/{ => omap1}/leds-h2p2-debug.c | 0 .../mach-omap/{ => omap1}/leds-innovator.c | 0 arch/arm/mach-omap/{ => omap1}/leds-osk.c | 4 -- arch/arm/mach-omap/{ => omap1}/leds.c | 0 arch/arm/mach-omap/{ => omap1}/leds.h | 0 arch/arm/mach-omap/{ => omap1}/time.c | 70 ++++++++++++++++--- 8 files changed, 75 insertions(+), 16 deletions(-) rename arch/arm/mach-omap/{ => omap1}/fpga.c (100%) rename arch/arm/mach-omap/{ => omap1}/irq.c (94%) rename arch/arm/mach-omap/{ => omap1}/leds-h2p2-debug.c (100%) rename arch/arm/mach-omap/{ => omap1}/leds-innovator.c (100%) rename arch/arm/mach-omap/{ => omap1}/leds-osk.c (98%) rename arch/arm/mach-omap/{ => omap1}/leds.c (100%) rename arch/arm/mach-omap/{ => omap1}/leds.h (100%) rename arch/arm/mach-omap/{ => omap1}/time.c (87%) diff --git a/arch/arm/mach-omap/fpga.c b/arch/arm/mach-omap/omap1/fpga.c similarity index 100% rename from arch/arm/mach-omap/fpga.c rename to arch/arm/mach-omap/omap1/fpga.c diff --git a/arch/arm/mach-omap/irq.c b/arch/arm/mach-omap/omap1/irq.c similarity index 94% rename from arch/arm/mach-omap/irq.c rename to arch/arm/mach-omap/omap1/irq.c index f01c99266a8..a11b6d80735 100644 --- a/arch/arm/mach-omap/irq.c +++ b/arch/arm/mach-omap/omap1/irq.c @@ -56,6 +56,7 @@ struct omap_irq_bank { unsigned long base_reg; unsigned long trigger_map; + unsigned long wake_enable; }; static unsigned int irq_bank_count = 0; @@ -105,6 +106,19 @@ static void omap_mask_ack_irq(unsigned int irq) omap_ack_irq(irq); } +static int omap_wake_irq(unsigned int irq, unsigned int enable) +{ + int bank = IRQ_BANK(irq); + + if (enable) + irq_banks[bank].wake_enable |= IRQ_BIT(irq); + else + irq_banks[bank].wake_enable &= ~IRQ_BIT(irq); + + return 0; +} + + /* * Allows tuning the IRQ type and priority * @@ -145,7 +159,7 @@ static struct omap_irq_bank omap1510_irq_banks[] = { static struct omap_irq_bank omap1610_irq_banks[] = { { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f }, { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd }, - { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xfffff7ff }, + { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xffffb7ff }, { .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff }, }; #endif @@ -154,6 +168,7 @@ static struct irqchip omap_irq_chip = { .ack = omap_mask_ack_irq, .mask = omap_mask_irq, .unmask = omap_unmask_irq, + .wake = omap_wake_irq, }; void __init omap_init_irq(void) diff --git a/arch/arm/mach-omap/leds-h2p2-debug.c b/arch/arm/mach-omap/omap1/leds-h2p2-debug.c similarity index 100% rename from arch/arm/mach-omap/leds-h2p2-debug.c rename to arch/arm/mach-omap/omap1/leds-h2p2-debug.c diff --git a/arch/arm/mach-omap/leds-innovator.c b/arch/arm/mach-omap/omap1/leds-innovator.c similarity index 100% rename from arch/arm/mach-omap/leds-innovator.c rename to arch/arm/mach-omap/omap1/leds-innovator.c diff --git a/arch/arm/mach-omap/leds-osk.c b/arch/arm/mach-omap/omap1/leds-osk.c similarity index 98% rename from arch/arm/mach-omap/leds-osk.c rename to arch/arm/mach-omap/omap1/leds-osk.c index f5177f43079..4a0e8b9d4fc 100644 --- a/arch/arm/mach-omap/leds-osk.c +++ b/arch/arm/mach-omap/omap1/leds-osk.c @@ -129,14 +129,11 @@ void osk_leds_event(led_event_t evt) #ifdef CONFIG_FB_OMAP -#ifdef CONFIG_LEDS_TIMER case led_timer: hw_led_state ^= TIMER_LED; mistral_setled(); break; -#endif -#ifdef CONFIG_LEDS_CPU case led_idle_start: hw_led_state |= IDLE_LED; mistral_setled(); @@ -146,7 +143,6 @@ void osk_leds_event(led_event_t evt) hw_led_state &= ~IDLE_LED; mistral_setled(); break; -#endif #endif /* CONFIG_FB_OMAP */ diff --git a/arch/arm/mach-omap/leds.c b/arch/arm/mach-omap/omap1/leds.c similarity index 100% rename from arch/arm/mach-omap/leds.c rename to arch/arm/mach-omap/omap1/leds.c diff --git a/arch/arm/mach-omap/leds.h b/arch/arm/mach-omap/omap1/leds.h similarity index 100% rename from arch/arm/mach-omap/leds.h rename to arch/arm/mach-omap/omap1/leds.h diff --git a/arch/arm/mach-omap/time.c b/arch/arm/mach-omap/omap1/time.c similarity index 87% rename from arch/arm/mach-omap/time.c rename to arch/arm/mach-omap/omap1/time.c index 4205fdcb632..b5e3aa7c0d1 100644 --- a/arch/arm/mach-omap/time.c +++ b/arch/arm/mach-omap/omap1/time.c @@ -1,10 +1,10 @@ /* - * linux/arch/arm/mach-omap/time.c + * linux/arch/arm/mach-omap/omap1/time.c * * OMAP Timers * * Copyright (C) 2004 Nokia Corporation - * Partial timer rewrite and additional VST timer support by + * Partial timer rewrite and additional dynamic tick timer support by * Tony Lindgen and * Tuukka Tikkanen * @@ -58,17 +58,9 @@ struct sys_timer omap_timer; * MPU timer * --------------------------------------------------------------------------- */ -#define OMAP_MPU_TIMER1_BASE (0xfffec500) -#define OMAP_MPU_TIMER2_BASE (0xfffec600) -#define OMAP_MPU_TIMER3_BASE (0xfffec700) #define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE #define OMAP_MPU_TIMER_OFFSET 0x100 -#define MPU_TIMER_FREE (1 << 6) -#define MPU_TIMER_CLOCK_ENABLE (1 << 5) -#define MPU_TIMER_AR (1 << 1) -#define MPU_TIMER_ST (1 << 0) - /* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c, * converted to use kHz by Kevin Hilman */ /* convert from cycles(64bits) => nanoseconds (64bits) @@ -347,6 +339,54 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id, return IRQ_HANDLED; } +#ifdef CONFIG_NO_IDLE_HZ +/* + * Programs the next timer interrupt needed. Called when dynamic tick is + * enabled, and to reprogram the ticks to skip from pm_idle. + */ +void omap_32k_timer_next_dyn_tick_interrupt(void) +{ + unsigned long next; + + if (!system_timer->dyn_tick->state & DYN_TICK_ENABLED) + return; + + next = next_timer_interrupt() - jiffies; + + if (next > MAX_SKIP_JIFFIES) + next = MAX_SKIP_JIFFIES; + + /* + * We can keep the timer continuous, no need to set it to + * run in one-shot mode. When using dynamic tick, the timer + * will get reprogrammed again after the next interrupt. + */ + omap_32k_timer_start(JIFFIES_TO_HW_TICKS(next, 32768) + 1); +} + +static struct irqaction omap_32k_timer_irq; +extern struct timer_update_handler timer_update; + +static int omap_32k_timer_enable_dyn_tick(void) +{ + omap_32k_timer_next_dyn_tick_interrupt(); + return 0; +} + +static int omap_32k_timer_disable_dyn_tick(void) +{ + omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD); + return 0; +} + +static struct dyn_tick_timer omap_dyn_tick_timer = { + .enable = omap_32k_timer_enable_dyn_tick, + .disable = omap_32k_timer_disable_dyn_tick, + .reprogram = omap_32k_timer_next_dyn_tick_interrupt, + .handler = omap_32k_timer_interrupt, +}; +#endif /* CONFIG_NO_IDLE_HZ */ + static struct irqaction omap_32k_timer_irq = { .name = "32KHz timer", .flags = SA_INTERRUPT, @@ -355,6 +395,14 @@ static struct irqaction omap_32k_timer_irq = { static __init void omap_init_32k_timer(void) { + +#ifdef CONFIG_NO_IDLE_HZ + omap_timer.dyn_tick = &omap_dyn_tick_timer; + + /* Tell __do_irq not to duplicate timer ticks with dyn-tick */ + omap_32k_timer_irq.flags |= SA_TIMER; +#endif + setup_irq(INT_OS_TIMER, &omap_32k_timer_irq); omap_timer.offset = omap_32k_timer_gettimeoffset; omap_32k_last_tick = omap_32k_sync_timer_read(); @@ -367,7 +415,7 @@ static __init void omap_init_32k_timer(void) * Timer initialization * --------------------------------------------------------------------------- */ -void __init omap_timer_init(void) +static void __init omap_timer_init(void) { #if defined(CONFIG_OMAP_MPU_TIMER) omap_init_mpu_timer(); -- 2.41.1