@ -46,22 +46,22 @@ DECLARE_GLOBAL_DATA_PTR;
/*
/*
* This driver uses 1 kHz clock source .
* This driver uses 1 kHz clock source .
*/
*/
# define MX28 _INCREMENTER_HZ 1000
# define MXS _INCREMENTER_HZ 1000
static inline unsigned long tick_to_time ( unsigned long tick )
static inline unsigned long tick_to_time ( unsigned long tick )
{
{
return tick / ( MX28 _INCREMENTER_HZ / CONFIG_SYS_HZ ) ;
return tick / ( MXS _INCREMENTER_HZ / CONFIG_SYS_HZ ) ;
}
}
static inline unsigned long time_to_tick ( unsigned long time )
static inline unsigned long time_to_tick ( unsigned long time )
{
{
return time * ( MX28 _INCREMENTER_HZ / CONFIG_SYS_HZ ) ;
return time * ( MXS _INCREMENTER_HZ / CONFIG_SYS_HZ ) ;
}
}
/* Calculate how many ticks happen in "us" microseconds */
/* Calculate how many ticks happen in "us" microseconds */
static inline unsigned long us_to_tick ( unsigned long us )
static inline unsigned long us_to_tick ( unsigned long us )
{
{
return ( us * MX28 _INCREMENTER_HZ ) / 1000000 ;
return ( us * MXS _INCREMENTER_HZ ) / 1000000 ;
}
}
int timer_init ( void )
int timer_init ( void )
@ -136,17 +136,17 @@ ulong get_timer(ulong base)
}
}
/* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
/* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */
# define MX28 _HW_DIGCTL_MICROSECONDS 0x8001c0c0
# define MXS _HW_DIGCTL_MICROSECONDS 0x8001c0c0
void __udelay ( unsigned long usec )
void __udelay ( unsigned long usec )
{
{
uint32_t old , new , incr ;
uint32_t old , new , incr ;
uint32_t counter = 0 ;
uint32_t counter = 0 ;
old = readl ( MX28 _HW_DIGCTL_MICROSECONDS ) ;
old = readl ( MXS _HW_DIGCTL_MICROSECONDS ) ;
while ( counter < usec ) {
while ( counter < usec ) {
new = readl ( MX28 _HW_DIGCTL_MICROSECONDS ) ;
new = readl ( MXS _HW_DIGCTL_MICROSECONDS ) ;
/* Check if the timer wrapped. */
/* Check if the timer wrapped. */
if ( new < old ) {
if ( new < old ) {
@ -171,5 +171,5 @@ void __udelay(unsigned long usec)
ulong get_tbclk ( void )
ulong get_tbclk ( void )
{
{
return MX28 _INCREMENTER_HZ ;
return MXS _INCREMENTER_HZ ;
}
}