From: wdenk Date: Fri, 17 Nov 2000 08:46:02 +0000 (+0000) Subject: Working on timer/timebase handling X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=9af3e350210086532dea8361b52b52d22a7e15fd;p=users%2Frw%2Fppcboot.git Working on timer/timebase handling --- diff --git a/include/ppcboot.h b/include/ppcboot.h index 5ca3ee7..3d6f2c6 100644 --- a/include/ppcboot.h +++ b/include/ppcboot.h @@ -261,7 +261,6 @@ ulong get_gclk_freq (void); #endif ulong get_bus_freq (ulong); -void init_timebase (void); #if defined(CONFIG_PPC405GP) void get_sys_info (PPC405_SYS_INFO *); @@ -301,6 +300,7 @@ void wait_ticks (unsigned long); void udelay (unsigned long); ulong usec2ticks (unsigned long usec); ulong ticks2usec (unsigned long ticks); +void init_timebase (void); /* ppc/vsprintf.c */ ulong simple_strtoul(const char *cp,char **endp,unsigned int base); diff --git a/mpc8xx/cpu_init.c b/mpc8xx/cpu_init.c index 462552d..7018452 100644 --- a/mpc8xx/cpu_init.c +++ b/mpc8xx/cpu_init.c @@ -171,7 +171,9 @@ cpu_init_f (volatile immap_t *immr) void cpu_init_r (bd_t *bd) { +#if defined(CFG_RTCSC) || defined(CFG_RCCR) || defined(CFG_RMDS) volatile immap_t *immr = (volatile immap_t *)(bd->bi_immr_base); +#endif #ifdef CFG_RTCSC /* Unlock RTSC register */ diff --git a/mpc8xx/speed.c b/mpc8xx/speed.c index ddba857..07dfb6d 100644 --- a/mpc8xx/speed.c +++ b/mpc8xx/speed.c @@ -133,23 +133,3 @@ ulong get_bus_freq (ulong gclk_freq) } /* ------------------------------------------------------------------------- */ - -void init_timebase (void) -{ -#ifdef CONFIG_8xx - volatile immap_t *immap = (immap_t *)CFG_IMMR; - - /* unlock */ - immap->im_sitk.sitk_tbk = KAPWR_KEY; -#endif - - /* reset */ - asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;"); - -#ifdef CONFIG_8xx - /* enable */ - immap->im_sit.sit_tbscr |= TBSCR_TBE; -#endif -} - -/* ------------------------------------------------------------------------- */ diff --git a/ppc/time.c b/ppc/time.c index dcbe913..128fee4 100644 --- a/ppc/time.c +++ b/ppc/time.c @@ -65,3 +65,25 @@ unsigned long ticks2usec(unsigned long ticks) return ((ulong)ticks); } +/* ------------------------------------------------------------------------- */ + +void init_timebase (void) +{ +#ifdef CONFIG_8xx + volatile immap_t *immap = (immap_t *)CFG_IMMR; + + /* unlock */ + immap->im_sitk.sitk_tbk = KAPWR_KEY; +#endif + + /* reset */ + asm ("li 3,0 ; mttbu 3 ; mttbl 3 ;"); + +#ifdef CONFIG_8xx + /* enable */ + immap->im_sit.sit_tbscr |= TBSCR_TBE; +#endif +} + +/* ------------------------------------------------------------------------- */ +