diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:20:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-02-15 16:20:33 -0500 |
commit | 2f68ffd11aa76b251921976c982b814df9ebe890 (patch) | |
tree | f117190925b6e9eca9025ded221f1da7cb298861 | |
parent | 56012808f4d5606e401539f663d92009d964425b (diff) | |
parent | a602f0f2f04f150fa1f7312b9e601e8e1a5afe10 (diff) |
Merge branch 'arm/clock-event' of git://git.pengutronix.de/git/ukl/linux-2.6 into devel-stable
-rw-r--r-- | arch/arm/mach-at91/at91rm9200_time.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam926x_time.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-pxa/time.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-sa1100/time.c | 8 | ||||
-rw-r--r-- | arch/arm/plat-nomadik/timer.c | 9 |
5 files changed, 15 insertions, 43 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c index 309f3511aa20..2500f41d8d2d 100644 --- a/arch/arm/mach-at91/at91rm9200_time.c +++ b/arch/arm/mach-at91/at91rm9200_time.c | |||
@@ -58,6 +58,12 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id) | |||
58 | { | 58 | { |
59 | u32 sr = at91_sys_read(AT91_ST_SR) & irqmask; | 59 | u32 sr = at91_sys_read(AT91_ST_SR) & irqmask; |
60 | 60 | ||
61 | /* | ||
62 | * irqs should be disabled here, but as the irq is shared they are only | ||
63 | * guaranteed to be off if the timer irq is registered first. | ||
64 | */ | ||
65 | WARN_ON_ONCE(!irqs_disabled()); | ||
66 | |||
61 | /* simulate "oneshot" timer with alarm */ | 67 | /* simulate "oneshot" timer with alarm */ |
62 | if (sr & AT91_ST_ALMS) { | 68 | if (sr & AT91_ST_ALMS) { |
63 | clkevt.event_handler(&clkevt); | 69 | clkevt.event_handler(&clkevt); |
@@ -132,24 +138,11 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev) | |||
132 | static int | 138 | static int |
133 | clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) | 139 | clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) |
134 | { | 140 | { |
135 | unsigned long flags; | ||
136 | u32 alm; | 141 | u32 alm; |
137 | int status = 0; | 142 | int status = 0; |
138 | 143 | ||
139 | BUG_ON(delta < 2); | 144 | BUG_ON(delta < 2); |
140 | 145 | ||
141 | /* Use "raw" primitives so we behave correctly on RT kernels. */ | ||
142 | raw_local_irq_save(flags); | ||
143 | |||
144 | /* | ||
145 | * According to Thomas Gleixner irqs are already disabled here. Simply | ||
146 | * removing raw_local_irq_save above (and the matching | ||
147 | * raw_local_irq_restore) was not accepted. See | ||
148 | * http://thread.gmane.org/gmane.linux.ports.arm.kernel/41174 | ||
149 | * So for now (2008-11-20) just warn once if irqs were not disabled ... | ||
150 | */ | ||
151 | WARN_ON_ONCE(!raw_irqs_disabled_flags(flags)); | ||
152 | |||
153 | /* The alarm IRQ uses absolute time (now+delta), not the relative | 146 | /* The alarm IRQ uses absolute time (now+delta), not the relative |
154 | * time (delta) in our calling convention. Like all clockevents | 147 | * time (delta) in our calling convention. Like all clockevents |
155 | * using such "match" hardware, we have a race to defend against. | 148 | * using such "match" hardware, we have a race to defend against. |
@@ -169,7 +162,6 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev) | |||
169 | alm += delta; | 162 | alm += delta; |
170 | at91_sys_write(AT91_ST_RTAR, alm); | 163 | at91_sys_write(AT91_ST_RTAR, alm); |
171 | 164 | ||
172 | raw_local_irq_restore(flags); | ||
173 | return status; | 165 | return status; |
174 | } | 166 | } |
175 | 167 | ||
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c index 4bd56aee4370..608a63240b64 100644 --- a/arch/arm/mach-at91/at91sam926x_time.c +++ b/arch/arm/mach-at91/at91sam926x_time.c | |||
@@ -62,16 +62,12 @@ static struct clocksource pit_clk = { | |||
62 | static void | 62 | static void |
63 | pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) | 63 | pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) |
64 | { | 64 | { |
65 | unsigned long flags; | ||
66 | |||
67 | switch (mode) { | 65 | switch (mode) { |
68 | case CLOCK_EVT_MODE_PERIODIC: | 66 | case CLOCK_EVT_MODE_PERIODIC: |
69 | /* update clocksource counter, then enable the IRQ */ | 67 | /* update clocksource counter */ |
70 | raw_local_irq_save(flags); | ||
71 | pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); | 68 | pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); |
72 | at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN | 69 | at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN |
73 | | AT91_PIT_PITIEN); | 70 | | AT91_PIT_PITIEN); |
74 | raw_local_irq_restore(flags); | ||
75 | break; | 71 | break; |
76 | case CLOCK_EVT_MODE_ONESHOT: | 72 | case CLOCK_EVT_MODE_ONESHOT: |
77 | BUG(); | 73 | BUG(); |
@@ -100,6 +96,11 @@ static struct clock_event_device pit_clkevt = { | |||
100 | */ | 96 | */ |
101 | static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id) | 97 | static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id) |
102 | { | 98 | { |
99 | /* | ||
100 | * irqs should be disabled here, but as the irq is shared they are only | ||
101 | * guaranteed to be off if the timer irq is registered first. | ||
102 | */ | ||
103 | WARN_ON_ONCE(!irqs_disabled()); | ||
103 | 104 | ||
104 | /* The PIT interrupt may be disabled, and is shared */ | 105 | /* The PIT interrupt may be disabled, and is shared */ |
105 | if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC) | 106 | if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC) |
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c index 750c448db672..293e40aeaf29 100644 --- a/arch/arm/mach-pxa/time.c +++ b/arch/arm/mach-pxa/time.c | |||
@@ -76,14 +76,12 @@ pxa_ost0_interrupt(int irq, void *dev_id) | |||
76 | static int | 76 | static int |
77 | pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) | 77 | pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) |
78 | { | 78 | { |
79 | unsigned long flags, next, oscr; | 79 | unsigned long next, oscr; |
80 | 80 | ||
81 | raw_local_irq_save(flags); | ||
82 | OIER |= OIER_E0; | 81 | OIER |= OIER_E0; |
83 | next = OSCR + delta; | 82 | next = OSCR + delta; |
84 | OSMR0 = next; | 83 | OSMR0 = next; |
85 | oscr = OSCR; | 84 | oscr = OSCR; |
86 | raw_local_irq_restore(flags); | ||
87 | 85 | ||
88 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; | 86 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; |
89 | } | 87 | } |
@@ -91,23 +89,17 @@ pxa_osmr0_set_next_event(unsigned long delta, struct clock_event_device *dev) | |||
91 | static void | 89 | static void |
92 | pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) | 90 | pxa_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *dev) |
93 | { | 91 | { |
94 | unsigned long irqflags; | ||
95 | |||
96 | switch (mode) { | 92 | switch (mode) { |
97 | case CLOCK_EVT_MODE_ONESHOT: | 93 | case CLOCK_EVT_MODE_ONESHOT: |
98 | raw_local_irq_save(irqflags); | ||
99 | OIER &= ~OIER_E0; | 94 | OIER &= ~OIER_E0; |
100 | OSSR = OSSR_M0; | 95 | OSSR = OSSR_M0; |
101 | raw_local_irq_restore(irqflags); | ||
102 | break; | 96 | break; |
103 | 97 | ||
104 | case CLOCK_EVT_MODE_UNUSED: | 98 | case CLOCK_EVT_MODE_UNUSED: |
105 | case CLOCK_EVT_MODE_SHUTDOWN: | 99 | case CLOCK_EVT_MODE_SHUTDOWN: |
106 | /* initializing, released, or preparing for suspend */ | 100 | /* initializing, released, or preparing for suspend */ |
107 | raw_local_irq_save(irqflags); | ||
108 | OIER &= ~OIER_E0; | 101 | OIER &= ~OIER_E0; |
109 | OSSR = OSSR_M0; | 102 | OSSR = OSSR_M0; |
110 | raw_local_irq_restore(irqflags); | ||
111 | break; | 103 | break; |
112 | 104 | ||
113 | case CLOCK_EVT_MODE_RESUME: | 105 | case CLOCK_EVT_MODE_RESUME: |
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c index b9cbb56d6e9d..74b6e0e570b6 100644 --- a/arch/arm/mach-sa1100/time.c +++ b/arch/arm/mach-sa1100/time.c | |||
@@ -35,14 +35,12 @@ static irqreturn_t sa1100_ost0_interrupt(int irq, void *dev_id) | |||
35 | static int | 35 | static int |
36 | sa1100_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c) | 36 | sa1100_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c) |
37 | { | 37 | { |
38 | unsigned long flags, next, oscr; | 38 | unsigned long next, oscr; |
39 | 39 | ||
40 | raw_local_irq_save(flags); | ||
41 | OIER |= OIER_E0; | 40 | OIER |= OIER_E0; |
42 | next = OSCR + delta; | 41 | next = OSCR + delta; |
43 | OSMR0 = next; | 42 | OSMR0 = next; |
44 | oscr = OSCR; | 43 | oscr = OSCR; |
45 | raw_local_irq_restore(flags); | ||
46 | 44 | ||
47 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; | 45 | return (signed)(next - oscr) <= MIN_OSCR_DELTA ? -ETIME : 0; |
48 | } | 46 | } |
@@ -50,16 +48,12 @@ sa1100_osmr0_set_next_event(unsigned long delta, struct clock_event_device *c) | |||
50 | static void | 48 | static void |
51 | sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) | 49 | sa1100_osmr0_set_mode(enum clock_event_mode mode, struct clock_event_device *c) |
52 | { | 50 | { |
53 | unsigned long flags; | ||
54 | |||
55 | switch (mode) { | 51 | switch (mode) { |
56 | case CLOCK_EVT_MODE_ONESHOT: | 52 | case CLOCK_EVT_MODE_ONESHOT: |
57 | case CLOCK_EVT_MODE_UNUSED: | 53 | case CLOCK_EVT_MODE_UNUSED: |
58 | case CLOCK_EVT_MODE_SHUTDOWN: | 54 | case CLOCK_EVT_MODE_SHUTDOWN: |
59 | raw_local_irq_save(flags); | ||
60 | OIER &= ~OIER_E0; | 55 | OIER &= ~OIER_E0; |
61 | OSSR = OSSR_M0; | 56 | OSSR = OSSR_M0; |
62 | raw_local_irq_restore(flags); | ||
63 | break; | 57 | break; |
64 | 58 | ||
65 | case CLOCK_EVT_MODE_RESUME: | 59 | case CLOCK_EVT_MODE_RESUME: |
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c index 62f18ad43a28..fa7cb3a57cbf 100644 --- a/arch/arm/plat-nomadik/timer.c +++ b/arch/arm/plat-nomadik/timer.c | |||
@@ -49,24 +49,17 @@ static struct clocksource nmdk_clksrc = { | |||
49 | static void nmdk_clkevt_mode(enum clock_event_mode mode, | 49 | static void nmdk_clkevt_mode(enum clock_event_mode mode, |
50 | struct clock_event_device *dev) | 50 | struct clock_event_device *dev) |
51 | { | 51 | { |
52 | unsigned long flags; | ||
53 | |||
54 | switch (mode) { | 52 | switch (mode) { |
55 | case CLOCK_EVT_MODE_PERIODIC: | 53 | case CLOCK_EVT_MODE_PERIODIC: |
56 | /* enable interrupts -- and count current value? */ | 54 | /* count current value? */ |
57 | raw_local_irq_save(flags); | ||
58 | writel(readl(mtu_base + MTU_IMSC) | 1, mtu_base + MTU_IMSC); | 55 | writel(readl(mtu_base + MTU_IMSC) | 1, mtu_base + MTU_IMSC); |
59 | raw_local_irq_restore(flags); | ||
60 | break; | 56 | break; |
61 | case CLOCK_EVT_MODE_ONESHOT: | 57 | case CLOCK_EVT_MODE_ONESHOT: |
62 | BUG(); /* Not supported, yet */ | 58 | BUG(); /* Not supported, yet */ |
63 | /* FALLTHROUGH */ | 59 | /* FALLTHROUGH */ |
64 | case CLOCK_EVT_MODE_SHUTDOWN: | 60 | case CLOCK_EVT_MODE_SHUTDOWN: |
65 | case CLOCK_EVT_MODE_UNUSED: | 61 | case CLOCK_EVT_MODE_UNUSED: |
66 | /* disable irq */ | ||
67 | raw_local_irq_save(flags); | ||
68 | writel(readl(mtu_base + MTU_IMSC) & ~1, mtu_base + MTU_IMSC); | 62 | writel(readl(mtu_base + MTU_IMSC) & ~1, mtu_base + MTU_IMSC); |
69 | raw_local_irq_restore(flags); | ||
70 | break; | 63 | break; |
71 | case CLOCK_EVT_MODE_RESUME: | 64 | case CLOCK_EVT_MODE_RESUME: |
72 | break; | 65 | break; |