aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy/common/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/alchemy/common/time.c')
-rw-r--r--arch/mips/alchemy/common/time.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/arch/mips/alchemy/common/time.c b/arch/mips/alchemy/common/time.c
index 93fa586d52e2..50e17e13c18b 100644
--- a/arch/mips/alchemy/common/time.c
+++ b/arch/mips/alchemy/common/time.c
@@ -46,7 +46,7 @@
46 46
47static cycle_t au1x_counter1_read(struct clocksource *cs) 47static cycle_t au1x_counter1_read(struct clocksource *cs)
48{ 48{
49 return au_readl(SYS_RTCREAD); 49 return alchemy_rdsys(AU1000_SYS_RTCREAD);
50} 50}
51 51
52static struct clocksource au1x_counter1_clocksource = { 52static struct clocksource au1x_counter1_clocksource = {
@@ -60,12 +60,11 @@ static struct clocksource au1x_counter1_clocksource = {
60static int au1x_rtcmatch2_set_next_event(unsigned long delta, 60static int au1x_rtcmatch2_set_next_event(unsigned long delta,
61 struct clock_event_device *cd) 61 struct clock_event_device *cd)
62{ 62{
63 delta += au_readl(SYS_RTCREAD); 63 delta += alchemy_rdsys(AU1000_SYS_RTCREAD);
64 /* wait for register access */ 64 /* wait for register access */
65 while (au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_M21) 65 while (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_M21)
66 ; 66 ;
67 au_writel(delta, SYS_RTCMATCH2); 67 alchemy_wrsys(delta, AU1000_SYS_RTCMATCH2);
68 au_sync();
69 68
70 return 0; 69 return 0;
71} 70}
@@ -112,31 +111,29 @@ static int __init alchemy_time_init(unsigned int m2int)
112 * (the 32S bit seems to be stuck set to 1 once a single clock- 111 * (the 32S bit seems to be stuck set to 1 once a single clock-
113 * edge is detected, hence the timeouts). 112 * edge is detected, hence the timeouts).
114 */ 113 */
115 if (CNTR_OK != (au_readl(SYS_COUNTER_CNTRL) & CNTR_OK)) 114 if (CNTR_OK != (alchemy_rdsys(AU1000_SYS_CNTRCTRL) & CNTR_OK))
116 goto cntr_err; 115 goto cntr_err;
117 116
118 /* 117 /*
119 * setup counter 1 (RTC) to tick at full speed 118 * setup counter 1 (RTC) to tick at full speed
120 */ 119 */
121 t = 0xffffff; 120 t = 0xffffff;
122 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T1S) && --t) 121 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_T1S) && --t)
123 asm volatile ("nop"); 122 asm volatile ("nop");
124 if (!t) 123 if (!t)
125 goto cntr_err; 124 goto cntr_err;
126 125
127 au_writel(0, SYS_RTCTRIM); /* 32.768 kHz */ 126 alchemy_wrsys(0, AU1000_SYS_RTCTRIM); /* 32.768 kHz */
128 au_sync();
129 127
130 t = 0xffffff; 128 t = 0xffffff;
131 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) 129 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_C1S) && --t)
132 asm volatile ("nop"); 130 asm volatile ("nop");
133 if (!t) 131 if (!t)
134 goto cntr_err; 132 goto cntr_err;
135 au_writel(0, SYS_RTCWRITE); 133 alchemy_wrsys(0, AU1000_SYS_RTCWRITE);
136 au_sync();
137 134
138 t = 0xffffff; 135 t = 0xffffff;
139 while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_C1S) && --t) 136 while ((alchemy_rdsys(AU1000_SYS_CNTRCTRL) & SYS_CNTRL_C1S) && --t)
140 asm volatile ("nop"); 137 asm volatile ("nop");
141 if (!t) 138 if (!t)
142 goto cntr_err; 139 goto cntr_err;