@ -21,13 +21,13 @@
static struct tmu_regs * tmu = ( struct tmu_regs * ) TMU_BASE ;
static struct tmu_regs * tmu = ( struct tmu_regs * ) TMU_BASE ;
static u16 bit ;
static unsigned long last_tcnt ;
static unsigned long last_tcnt ;
static unsigned long long overflow_ticks ;
static unsigned long long overflow_ticks ;
unsigned long get_tbclk ( void )
unsigned long get_tbclk ( void )
{
{
return get_tmu0_clk_rate ( ) > > ( ( bit + 1 ) * 2 ) ;
u16 tmu_bit = ( ffs ( CONFIG_SYS_TMU_CLK_DIV ) > > 1 ) - 1 ;
return get_tmu0_clk_rate ( ) > > ( ( tmu_bit + 1 ) * 2 ) ;
}
}
static inline unsigned long long tick_to_time ( unsigned long long tick )
static inline unsigned long long tick_to_time ( unsigned long long tick )
@ -62,8 +62,8 @@ static void tmu_timer_stop(unsigned int timer)
int timer_init ( void )
int timer_init ( void )
{
{
bit = ( ffs ( CONFIG_SYS_TMU_CLK_DIV ) > > 1 ) - 1 ;
u16 tmu_ bit = ( ffs ( CONFIG_SYS_TMU_CLK_DIV ) > > 1 ) - 1 ;
writew ( ( readw ( & tmu - > tcr0 ) & ~ TCR_TPSC ) | bit , & tmu - > tcr0 ) ;
writew ( ( readw ( & tmu - > tcr0 ) & ~ TCR_TPSC ) | tmu_ bit, & tmu - > tcr0 ) ;
tmu_timer_stop ( 0 ) ;
tmu_timer_stop ( 0 ) ;
tmu_timer_start ( 0 ) ;
tmu_timer_start ( 0 ) ;