Skip to content

Commit 1dfb26d

Browse files
Finn Thaingregkh
authored andcommitted
m68k: mvme147,mvme16x: Don't wipe PCC timer config bits
[ Upstream commit 4326217 ] Don't clear the timer 1 configuration bits when clearing the interrupt flag and counter overflow. As Michael reported, "This results in no timer interrupts being delivered after the first. Initialization then hangs in calibrate_delay as the jiffies counter is not updated." On mvme16x, enable the timer after requesting the irq, consistent with mvme147. Cc: Michael Pavone <pavone@retrodev.com> Fixes: 7529b90 ("m68k: mvme147: Handle timer counter overflow") Fixes: 19999a8 ("m68k: mvme16x: Handle timer counter overflow") Reported-and-tested-by: Michael Pavone <pavone@retrodev.com> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Link: https://lore.kernel.org/r/4fdaa113db089b8fb607f7dd818479f8cdcc4547.1617089871.git.fthain@telegraphics.com.au Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7c468de commit 1dfb26d

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎arch/m68k/include/asm/mvme147hw.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ struct pcc_regs {
6666
#define PCC_INT_ENAB 0x08
6767

6868
#define PCC_TIMER_INT_CLR 0x80
69+
70+
#define PCC_TIMER_TIC_EN 0x01
71+
#define PCC_TIMER_COC_EN 0x02
6972
#define PCC_TIMER_CLR_OVF 0x04
7073

7174
#define PCC_LEVEL_ABORT 0x07

‎arch/m68k/mvme147/config.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ static irqreturn_t mvme147_timer_int (int irq, void *dev_id)
116116
unsigned long flags;
117117

118118
local_irq_save(flags);
119-
m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR;
120-
m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF;
119+
m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF | PCC_TIMER_COC_EN |
120+
PCC_TIMER_TIC_EN;
121+
m147_pcc->t1_int_cntrl = PCC_INT_ENAB | PCC_TIMER_INT_CLR |
122+
PCC_LEVEL_TIMER1;
121123
clk_total += PCC_TIMER_CYCLES;
122124
timer_routine(0, NULL);
123125
local_irq_restore(flags);
@@ -135,10 +137,10 @@ void mvme147_sched_init (irq_handler_t timer_routine)
135137
/* Init the clock with a value */
136138
/* The clock counter increments until 0xFFFF then reloads */
137139
m147_pcc->t1_preload = PCC_TIMER_PRELOAD;
138-
m147_pcc->t1_cntrl = 0x0; /* clear timer */
139-
m147_pcc->t1_cntrl = 0x3; /* start timer */
140-
m147_pcc->t1_int_cntrl = PCC_TIMER_INT_CLR; /* clear pending ints */
141-
m147_pcc->t1_int_cntrl = PCC_INT_ENAB|PCC_LEVEL_TIMER1;
140+
m147_pcc->t1_cntrl = PCC_TIMER_CLR_OVF | PCC_TIMER_COC_EN |
141+
PCC_TIMER_TIC_EN;
142+
m147_pcc->t1_int_cntrl = PCC_INT_ENAB | PCC_TIMER_INT_CLR |
143+
PCC_LEVEL_TIMER1;
142144

143145
clocksource_register_hz(&mvme147_clk, PCC_TIMER_CLOCK_FREQ);
144146
}

‎arch/m68k/mvme16x/config.c‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ static u32 clk_total;
367367
#define PCCTOVR1_COC_EN 0x02
368368
#define PCCTOVR1_OVR_CLR 0x04
369369

370+
#define PCCTIC1_INT_LEVEL 6
370371
#define PCCTIC1_INT_CLR 0x08
371372
#define PCCTIC1_INT_EN 0x10
372373

@@ -376,8 +377,8 @@ static irqreturn_t mvme16x_timer_int (int irq, void *dev_id)
376377
unsigned long flags;
377378

378379
local_irq_save(flags);
379-
out_8(PCCTIC1, in_8(PCCTIC1) | PCCTIC1_INT_CLR);
380-
out_8(PCCTOVR1, PCCTOVR1_OVR_CLR);
380+
out_8(PCCTOVR1, PCCTOVR1_OVR_CLR | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
381+
out_8(PCCTIC1, PCCTIC1_INT_EN | PCCTIC1_INT_CLR | PCCTIC1_INT_LEVEL);
381382
clk_total += PCC_TIMER_CYCLES;
382383
timer_routine(0, NULL);
383384
local_irq_restore(flags);
@@ -391,14 +392,15 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
391392
int irq;
392393

393394
/* Using PCCchip2 or MC2 chip tick timer 1 */
394-
out_be32(PCCTCNT1, 0);
395-
out_be32(PCCTCMP1, PCC_TIMER_CYCLES);
396-
out_8(PCCTOVR1, in_8(PCCTOVR1) | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
397-
out_8(PCCTIC1, PCCTIC1_INT_EN | 6);
398395
if (request_irq(MVME16x_IRQ_TIMER, mvme16x_timer_int, IRQF_TIMER, "timer",
399396
timer_routine))
400397
panic ("Couldn't register timer int");
401398

399+
out_be32(PCCTCNT1, 0);
400+
out_be32(PCCTCMP1, PCC_TIMER_CYCLES);
401+
out_8(PCCTOVR1, PCCTOVR1_OVR_CLR | PCCTOVR1_TIC_EN | PCCTOVR1_COC_EN);
402+
out_8(PCCTIC1, PCCTIC1_INT_EN | PCCTIC1_INT_CLR | PCCTIC1_INT_LEVEL);
403+
402404
clocksource_register_hz(&mvme16x_clk, PCC_TIMER_CLOCK_FREQ);
403405

404406
if (brdno == 0x0162 || brdno == 0x172)

0 commit comments

Comments
 (0)