* [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
@ 2007-11-01 12:52 Thomas Bogendoerfer
2007-11-01 15:07 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Bogendoerfer @ 2007-11-01 12:52 UTC (permalink / raw)
To: linux-mips; +Cc: ralf
PIT doesn't work, disable it completly
make r4030 clockevent code look like other mips clockevent code
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 97da953..c4f7e60 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -119,7 +119,6 @@ config MACH_JAZZ
select CEVT_R4K
select GENERIC_ISA_DMA
select IRQ_CPU
- select I8253
select I8259
select ISA
select PCSPEAKER
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index 1dac9e1..a629719 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -118,16 +118,16 @@ static void r4030_set_mode(enum clock_event_mode mode,
struct clock_event_device r4030_clockevent = {
.name = "r4030",
.features = CLOCK_EVT_FEAT_PERIODIC,
- .rating = 100,
+ .rating = 300,
.irq = JAZZ_TIMER_IRQ,
- .cpumask = CPU_MASK_CPU0,
.set_mode = r4030_set_mode,
};
static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
{
- r4030_clockevent.event_handler(&r4030_clockevent);
+ struct clock_event_device *cd = dev_id;
+ cd->event_handler(cd);
return IRQ_HANDLED;
}
@@ -135,15 +135,22 @@ static struct irqaction r4030_timer_irqaction = {
.handler = r4030_timer_interrupt,
.flags = IRQF_DISABLED,
.mask = CPU_MASK_CPU0,
- .name = "timer",
+ .name = "R4030 timer",
};
void __init plat_time_init(void)
{
- struct irqaction *irq = &r4030_timer_irqaction;
+ struct clock_event_device *cd = &r4030_clockevent;
+ struct irqaction *action = &r4030_timer_irqaction;
+ unsigned int cpu = smp_processor_id();
BUG_ON(HZ != 100);
+ cd->cpumask = cpumask_of_cpu(cpu);
+ clockevents_register_device(cd);
+ action->dev_id = cd;
+ setup_irq(JAZZ_TIMER_IRQ, action);
+
/*
* Set clock to 100Hz.
*
@@ -151,8 +158,4 @@ void __init plat_time_init(void)
* a programmable 4-bit divider. This makes it fairly inflexible.
*/
r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
- setup_irq(JAZZ_TIMER_IRQ, irq);
-
- clockevents_register_device(&r4030_clockevent);
- setup_pit_timer();
}
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-01 12:52 [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent Thomas Bogendoerfer
@ 2007-11-01 15:07 ` Ralf Baechle
2007-11-01 16:02 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-11-01 15:07 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips
On Thu, Nov 01, 2007 at 01:52:36PM +0100, Thomas Bogendoerfer wrote:
> PIT doesn't work, disable it completly
I think this is the explanation:
include/asm-mips/mach-jazz/timex.h:#define CLOCK_TICK_RATE 100
while the PIT code actually expects 1193182.
Turns out that due to a recent Qemu bug which made the probe for the cp0
compare interrupt fail the Malta code did fall back from the compare timer
to the i8253 PIT for the clockevent device. Works perfectly well.
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-01 15:07 ` Ralf Baechle
@ 2007-11-01 16:02 ` Ralf Baechle
2007-11-02 10:17 ` Thomas Bogendoerfer
0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-11-01 16:02 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips
On Thu, Nov 01, 2007 at 03:07:41PM +0000, Ralf Baechle wrote:
> On Thu, Nov 01, 2007 at 01:52:36PM +0100, Thomas Bogendoerfer wrote:
>
> > PIT doesn't work, disable it completly
>
> I think this is the explanation:
>
> include/asm-mips/mach-jazz/timex.h:#define CLOCK_TICK_RATE 100
>
> while the PIT code actually expects 1193182.
>
> Turns out that due to a recent Qemu bug which made the probe for the cp0
> compare interrupt fail the Malta code did fall back from the compare timer
> to the i8253 PIT for the clockevent device. Works perfectly well.
So I just fixed the MIPS part of the CLOCK_TICK_RATE mess which is really
all over the kernel. I hope this should bring the i2853 to life for you.
Could you test this? It's pretty much the only hope for Jazz to go tickless
so we should try to get it to work. Unfortunately there is a locking issue
lurking there as well so I need some feedback if you can get it to work.
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-01 16:02 ` Ralf Baechle
@ 2007-11-02 10:17 ` Thomas Bogendoerfer
2007-11-02 12:20 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Bogendoerfer @ 2007-11-02 10:17 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
On Thu, Nov 01, 2007 at 04:02:10PM +0000, Ralf Baechle wrote:
> all over the kernel. I hope this should bring the i2853 to life for you.
it does now, even pit clockevent works now (if you apply the patch
below).
Thomas.
Fix ISA irq acknowledge
make r4030 clockevent code look like other mips clockevent code
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c
index ae25b48..d7f8a78 100644
--- a/arch/mips/jazz/irq.c
+++ b/arch/mips/jazz/irq.c
@@ -97,9 +97,10 @@ asmlinkage void plat_irq_dispatch(void)
if (pending & IE_IRQ4) {
r4030_read_reg32(JAZZ_TIMER_REGISTER);
do_IRQ(JAZZ_TIMER_IRQ);
- } else if (pending & IE_IRQ2)
- do_IRQ(r4030_read_reg32(JAZZ_EISA_IRQ_ACK));
- else if (pending & IE_IRQ1) {
+ } else if (pending & IE_IRQ2) {
+ irq = *(volatile u8 *)JAZZ_EISA_IRQ_ACK;
+ do_IRQ(irq);
+ } else if (pending & IE_IRQ1) {
irq = *(volatile u8 *)JAZZ_IO_IRQ_SOURCE >> 2;
if (likely(irq > 0))
do_IRQ(irq + JAZZ_IRQ_START - 1);
@@ -117,16 +118,16 @@ static void r4030_set_mode(enum clock_event_mode mode,
struct clock_event_device r4030_clockevent = {
.name = "r4030",
.features = CLOCK_EVT_FEAT_PERIODIC,
- .rating = 100,
+ .rating = 300,
.irq = JAZZ_TIMER_IRQ,
- .cpumask = CPU_MASK_CPU0,
.set_mode = r4030_set_mode,
};
static irqreturn_t r4030_timer_interrupt(int irq, void *dev_id)
{
- r4030_clockevent.event_handler(&r4030_clockevent);
+ struct clock_event_device *cd = dev_id;
+ cd->event_handler(cd);
return IRQ_HANDLED;
}
@@ -134,15 +135,22 @@ static struct irqaction r4030_timer_irqaction = {
.handler = r4030_timer_interrupt,
.flags = IRQF_DISABLED,
.mask = CPU_MASK_CPU0,
- .name = "timer",
+ .name = "R4030 timer",
};
void __init plat_time_init(void)
{
- struct irqaction *irq = &r4030_timer_irqaction;
+ struct clock_event_device *cd = &r4030_clockevent;
+ struct irqaction *action = &r4030_timer_irqaction;
+ unsigned int cpu = smp_processor_id();
BUG_ON(HZ != 100);
+ cd->cpumask = cpumask_of_cpu(cpu);
+ clockevents_register_device(cd);
+ action->dev_id = cd;
+ setup_irq(JAZZ_TIMER_IRQ, action);
+
/*
* Set clock to 100Hz.
*
@@ -150,8 +158,5 @@ void __init plat_time_init(void)
* a programmable 4-bit divider. This makes it fairly inflexible.
*/
r4030_write_reg32(JAZZ_TIMER_INTERVAL, 9);
- setup_irq(JAZZ_TIMER_IRQ, irq);
-
- clockevents_register_device(&r4030_clockevent);
setup_pit_timer();
}
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-02 10:17 ` Thomas Bogendoerfer
@ 2007-11-02 12:20 ` Ralf Baechle
2007-11-02 22:08 ` Thomas Bogendoerfer
0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-11-02 12:20 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips
On Fri, Nov 02, 2007 at 11:17:13AM +0100, Thomas Bogendoerfer wrote:
> On Thu, Nov 01, 2007 at 04:02:10PM +0000, Ralf Baechle wrote:
> > all over the kernel. I hope this should bring the i2853 to life for you.
>
> it does now, even pit clockevent works now (if you apply the patch
> below).
Applied, thanks,
One thing I'm still wondering about, does the kernel actually go tickless
for you?
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-02 12:20 ` Ralf Baechle
@ 2007-11-02 22:08 ` Thomas Bogendoerfer
2007-11-04 0:33 ` Ralf Baechle
0 siblings, 1 reply; 8+ messages in thread
From: Thomas Bogendoerfer @ 2007-11-02 22:08 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
On Fri, Nov 02, 2007 at 12:20:01PM +0000, Ralf Baechle wrote:
> One thing I'm still wondering about, does the kernel actually go tickless
> for you?
a kernel with CONFIG_NO_HZ boots and acts normal. But it looks like
the PIT is still ticking at the selected 100HZ...
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-02 22:08 ` Thomas Bogendoerfer
@ 2007-11-04 0:33 ` Ralf Baechle
2007-11-04 10:05 ` Thomas Bogendoerfer
0 siblings, 1 reply; 8+ messages in thread
From: Ralf Baechle @ 2007-11-04 0:33 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: linux-mips
On Fri, Nov 02, 2007 at 11:08:19PM +0100, Thomas Bogendoerfer wrote:
> On Fri, Nov 02, 2007 at 12:20:01PM +0000, Ralf Baechle wrote:
> > One thing I'm still wondering about, does the kernel actually go tickless
> > for you?
>
> a kernel with CONFIG_NO_HZ boots and acts normal. But it looks like
> the PIT is still ticking at the selected 100HZ...
I think this happens because the R4030 clockevent device has a rather
high rating of 300 while the PIT because of an omission or intension
doesn't set it's rating at all so has rating of 0. So Linux prefers the
R4030. You can see which clockevent device is actually getting used
by Linux in /proc/timer_list.
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent
2007-11-04 0:33 ` Ralf Baechle
@ 2007-11-04 10:05 ` Thomas Bogendoerfer
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Bogendoerfer @ 2007-11-04 10:05 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
On Sun, Nov 04, 2007 at 12:33:38AM +0000, Ralf Baechle wrote:
> On Fri, Nov 02, 2007 at 11:08:19PM +0100, Thomas Bogendoerfer wrote:
>
> > On Fri, Nov 02, 2007 at 12:20:01PM +0000, Ralf Baechle wrote:
> > > One thing I'm still wondering about, does the kernel actually go tickless
> > > for you?
> >
> > a kernel with CONFIG_NO_HZ boots and acts normal. But it looks like
> > the PIT is still ticking at the selected 100HZ...
>
> I think this happens because the R4030 clockevent device has a rather
r4030 is of course disabled in my test.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-11-04 10:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-01 12:52 [PATCH] JAZZ: disable PIT; cleanup R4030 clockevent Thomas Bogendoerfer
2007-11-01 15:07 ` Ralf Baechle
2007-11-01 16:02 ` Ralf Baechle
2007-11-02 10:17 ` Thomas Bogendoerfer
2007-11-02 12:20 ` Ralf Baechle
2007-11-02 22:08 ` Thomas Bogendoerfer
2007-11-04 0:33 ` Ralf Baechle
2007-11-04 10:05 ` Thomas Bogendoerfer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.