Skip to content

Commit

Permalink
m68knommu: cleanup m68knommu timer code
Browse files Browse the repository at this point in the history
Reduce the function pointer mess of the m68knommu timer code by calling
directly to the local hardware's timer setup, and expose the local
common timer interrupt handler to the lower level hardware timer.

Ultimately this will save definitions of all these functions across all
the platform code to setup the function pointers (which for any given
m68knommu CPU family member can be only one set of hardware timer
functions).

Signed-off-by: Greg Ungerer <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Greg Ungerer authored and Linus Torvalds committed Oct 23, 2007
1 parent 49aa49b commit 2f2c267
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 137 deletions.
9 changes: 0 additions & 9 deletions arch/m68knommu/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,3 @@ struct seq_operations cpuinfo_op = {
.show = show_cpuinfo,
};

void arch_gettod(int *year, int *mon, int *day, int *hour,
int *min, int *sec)
{
if (mach_gettod)
mach_gettod(year, mon, day, hour, min, sec);
else
*year = *mon = *day = *hour = *min = *sec = 0;
}

22 changes: 8 additions & 14 deletions arch/m68knommu/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#define TICK_SIZE (tick_nsec / 1000)


static inline int set_rtc_mmss(unsigned long nowtime)
{
if (mach_set_clock_mmss)
Expand All @@ -39,15 +38,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
* timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick
*/
static irqreturn_t timer_interrupt(int irq, void *dummy)
irqreturn_t arch_timer_interrupt(int irq, void *dummy)
{
/* last time the cmos clock got updated */
static long last_rtc_update=0;

/* may need to kick the hardware timer */
if (mach_tick)
mach_tick();

write_seqlock(&xtime_lock);

do_timer(1);
Expand Down Expand Up @@ -103,18 +98,18 @@ void time_init(void)
{
unsigned int year, mon, day, hour, min, sec;

extern void arch_gettod(int *year, int *mon, int *day, int *hour,
int *min, int *sec);

arch_gettod(&year, &mon, &day, &hour, &min, &sec);
if (mach_gettod)
mach_gettod(&year, &mon, &day, &hour, &min, &sec);
else
year = mon = day = hour = min = sec = 0;

if ((year += 1900) < 1970)
year += 100;
xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;

mach_sched_init(timer_interrupt);
hw_timer_init();
}

/*
Expand All @@ -128,7 +123,7 @@ void do_gettimeofday(struct timeval *tv)

do {
seq = read_seqbegin_irqsave(&xtime_lock, flags);
usec = mach_gettimeoffset ? mach_gettimeoffset() : 0;
usec = hw_timer_offset();
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
Expand Down Expand Up @@ -160,8 +155,7 @@ int do_settimeofday(struct timespec *tv)
* Discover what correction gettimeofday
* would have done, and then undo it!
*/
if (mach_gettimeoffset)
nsec -= (mach_gettimeoffset() * 1000);
nsec -= (hw_timer_offset() * 1000);

wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
Expand Down
9 changes: 0 additions & 9 deletions arch/m68knommu/platform/5206/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
Expand All @@ -25,9 +22,6 @@

/***************************************************************************/

void coldfire_tick(void);
void coldfire_timer_init(irq_handler_t handler);
unsigned long coldfire_timer_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -97,9 +91,6 @@ int mcf_timerirqpending(int timer)
void config_BSP(char *commandp, int size)
{
mcf_setimr(MCFSIM_IMR_MASKALL);
mach_sched_init = coldfire_timer_init;
mach_tick = coldfire_tick;
mach_gettimeoffset = coldfire_timer_offset;
mach_reset = coldfire_reset;
}

Expand Down
10 changes: 0 additions & 10 deletions arch/m68knommu/platform/5206e/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,16 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_tick(void);
void coldfire_timer_init(irq_handler_t handler);
unsigned long coldfire_timer_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -102,9 +95,6 @@ void config_BSP(char *commandp, int size)
commandp[size-1] = 0;
#endif /* CONFIG_NETtel */

mach_sched_init = coldfire_timer_init;
mach_tick = coldfire_tick;
mach_gettimeoffset = coldfire_timer_offset;
mach_reset = coldfire_reset;
}

Expand Down
8 changes: 1 addition & 7 deletions arch/m68knommu/platform/520x/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];

/***************************************************************************/

void coldfire_pit_tick(void);
void coldfire_pit_init(irq_handler_t handler);
unsigned long coldfire_pit_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand All @@ -47,10 +44,7 @@ void mcf_autovector(unsigned int vec)

void config_BSP(char *commandp, int size)
{
mach_sched_init = coldfire_pit_init;
mach_tick = coldfire_pit_tick;
mach_gettimeoffset = coldfire_pit_offset;
mach_reset = coldfire_reset;
mach_reset = coldfire_reset;
}

/***************************************************************************/
8 changes: 0 additions & 8 deletions arch/m68knommu/platform/523x/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_pit_tick(void);
void coldfire_pit_init(irq_handler_t handler);
unsigned long coldfire_pit_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -62,9 +57,6 @@ void mcf_autovector(unsigned int vec)
void config_BSP(char *commandp, int size)
{
mcf_disableall();
mach_sched_init = coldfire_pit_init;
mach_tick = coldfire_pit_tick;
mach_gettimeoffset = coldfire_pit_offset;
mach_reset = coldfire_reset;
}

Expand Down
10 changes: 0 additions & 10 deletions arch/m68knommu/platform/5249/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,17 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_tick(void);
void coldfire_timer_init(irq_handler_t handler);
unsigned long coldfire_timer_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -95,9 +88,6 @@ int mcf_timerirqpending(int timer)
void config_BSP(char *commandp, int size)
{
mcf_setimr(MCFSIM_IMR_MASKALL);
mach_sched_init = coldfire_timer_init;
mach_tick = coldfire_tick;
mach_gettimeoffset = coldfire_timer_offset;
mach_reset = coldfire_reset;
}

Expand Down
10 changes: 0 additions & 10 deletions arch/m68knommu/platform/5272/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,17 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_tick(void);
void coldfire_timer_init(irq_handler_t handler);
unsigned long coldfire_timer_offset(void);
void coldfire_reset(void);

extern unsigned int mcf_timervector;
Expand Down Expand Up @@ -128,9 +121,6 @@ void config_BSP(char *commandp, int size)

mcf_timervector = 69;
mcf_profilevector = 70;
mach_sched_init = coldfire_timer_init;
mach_tick = coldfire_tick;
mach_gettimeoffset = coldfire_timer_offset;
mach_reset = coldfire_reset;
}

Expand Down
8 changes: 0 additions & 8 deletions arch/m68knommu/platform/527x/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_pit_tick(void);
void coldfire_pit_init(irq_handler_t handler);
unsigned long coldfire_pit_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -62,9 +57,6 @@ void mcf_autovector(unsigned int vec)
void config_BSP(char *commandp, int size)
{
mcf_disableall();
mach_sched_init = coldfire_pit_init;
mach_tick = coldfire_pit_tick;
mach_gettimeoffset = coldfire_pit_offset;
mach_reset = coldfire_reset;
}

Expand Down
8 changes: 0 additions & 8 deletions arch/m68knommu/platform/528x/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_pit_tick(void);
void coldfire_pit_init(irq_handler_t handler);
unsigned long coldfire_pit_offset(void);
void coldfire_reset(void);

/***************************************************************************/
Expand Down Expand Up @@ -62,9 +57,6 @@ void mcf_autovector(unsigned int vec)
void config_BSP(char *commandp, int size)
{
mcf_disableall();
mach_sched_init = coldfire_pit_init;
mach_tick = coldfire_pit_tick;
mach_gettimeoffset = coldfire_pit_offset;
mach_reset = coldfire_reset;
}

Expand Down
10 changes: 0 additions & 10 deletions arch/m68knommu/platform/5307/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,18 @@
/***************************************************************************/

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/dma.h>
#include <asm/traps.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
#include <asm/mcfsim.h>
#include <asm/mcfdma.h>
#include <asm/mcfwdebug.h>

/***************************************************************************/

void coldfire_tick(void);
void coldfire_timer_init(irq_handler_t handler);
unsigned long coldfire_timer_offset(void);
void coldfire_reset(void);

extern unsigned int mcf_timervector;
Expand Down Expand Up @@ -122,9 +115,6 @@ void config_BSP(char *commandp, int size)
mcf_timerlevel = 6;
#endif

mach_sched_init = coldfire_timer_init;
mach_tick = coldfire_tick;
mach_gettimeoffset = coldfire_timer_offset;
mach_reset = coldfire_reset;

#ifdef MCF_BDM_DISABLE
Expand Down
Loading

0 comments on commit 2f2c267

Please sign in to comment.