aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/au1000/common/power.c3
-rw-r--r--arch/mips/au1000/common/time.c5
-rw-r--r--arch/mips/kernel/cpu-probe.c43
3 files changed, 22 insertions, 29 deletions
diff --git a/arch/mips/au1000/common/power.c b/arch/mips/au1000/common/power.c
index c40daccbb5b1..d3aa067505b4 100644
--- a/arch/mips/au1000/common/power.c
+++ b/arch/mips/au1000/common/power.c
@@ -297,7 +297,6 @@ static int pm_do_suspend(ctl_table * ctl, int write, struct file *file,
297 void *buffer, size_t * len) 297 void *buffer, size_t * len)
298{ 298{
299 int retval = 0; 299 int retval = 0;
300 void au1k_wait(void);
301 300
302 if (!write) { 301 if (!write) {
303 *len = 0; 302 *len = 0;
@@ -306,7 +305,7 @@ static int pm_do_suspend(ctl_table * ctl, int write, struct file *file,
306 if (retval) 305 if (retval)
307 return retval; 306 return retval;
308 suspend_mode = 1; 307 suspend_mode = 1;
309 au1k_wait(); 308
310 retval = pm_send_all(PM_RESUME, (void *) 0); 309 retval = pm_send_all(PM_RESUME, (void *) 0);
311 } 310 }
312 return retval; 311 return retval;
diff --git a/arch/mips/au1000/common/time.c b/arch/mips/au1000/common/time.c
index 90a0755c832b..2bc33824807b 100644
--- a/arch/mips/au1000/common/time.c
+++ b/arch/mips/au1000/common/time.c
@@ -57,7 +57,7 @@ unsigned long missed_heart_beats = 0;
57static unsigned long r4k_offset; /* Amount to increment compare reg each time */ 57static unsigned long r4k_offset; /* Amount to increment compare reg each time */
58static unsigned long r4k_cur; /* What counter should be at next timer irq */ 58static unsigned long r4k_cur; /* What counter should be at next timer irq */
59int no_au1xxx_32khz; 59int no_au1xxx_32khz;
60void (*au1k_wait_ptr)(void); 60int allow_au1k_wait = 0; /* default off for CP0 Counter */
61 61
62/* Cycle counter value at the previous timer interrupt.. */ 62/* Cycle counter value at the previous timer interrupt.. */
63static unsigned int timerhi = 0, timerlo = 0; 63static unsigned int timerhi = 0, timerlo = 0;
@@ -387,7 +387,6 @@ void au1xxx_timer_setup(struct irqaction *irq)
387{ 387{
388 unsigned int est_freq; 388 unsigned int est_freq;
389 extern unsigned long (*do_gettimeoffset)(void); 389 extern unsigned long (*do_gettimeoffset)(void);
390 extern void au1k_wait(void);
391 390
392 printk("calculating r4koff... "); 391 printk("calculating r4koff... ");
393 r4k_offset = cal_r4koff(); 392 r4k_offset = cal_r4koff();
@@ -451,7 +450,7 @@ void au1xxx_timer_setup(struct irqaction *irq)
451 450
452 /* We can use the real 'wait' instruction. 451 /* We can use the real 'wait' instruction.
453 */ 452 */
454 au1k_wait_ptr = au1k_wait; 453 allow_au1k_wait = 1;
455 } 454 }
456 455
457#else 456#else
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 66c2a2788ffe..b7c8346df3ca 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -51,29 +51,25 @@ static void r4k_wait(void)
51 ".set\tmips0"); 51 ".set\tmips0");
52} 52}
53 53
54/* 54/* The Au1xxx wait is available only if using 32khz counter or
55 * The Au1xxx wait is available only if we run CONFIG_PM and 55 * external timer source, but specifically not CP0 Counter. */
56 * the timer setup found we had a 32KHz counter available. 56static void au1k_wait(void)
57 * There are still problems with functions that may call au1k_wait
58 * directly, but that will be discovered pretty quickly.
59 */
60extern void (*au1k_wait_ptr)(void);
61
62void au1k_wait(void)
63{ 57{
64#ifdef CONFIG_PM 58 unsigned long addr;
65 /* using the wait instruction makes CP0 counter unusable */ 59 /* using the wait instruction makes CP0 counter unusable */
66 __asm__(".set\tmips3\n\t" 60 __asm__("la %0,au1k_wait\n\t"
61 ".set mips3\n\t"
62 "cache 0x14,0(%0)\n\t"
63 "cache 0x14,32(%0)\n\t"
64 "sync\n\t"
65 "nop\n\t"
67 "wait\n\t" 66 "wait\n\t"
68 "nop\n\t" 67 "nop\n\t"
69 "nop\n\t" 68 "nop\n\t"
70 "nop\n\t" 69 "nop\n\t"
71 "nop\n\t" 70 "nop\n\t"
72 ".set\tmips0"); 71 ".set mips0\n\t"
73#else 72 : : "r" (addr));
74 __asm__("nop\n\t"
75 "nop");
76#endif
77} 73}
78 74
79static inline void check_wait(void) 75static inline void check_wait(void)
@@ -112,21 +108,20 @@ static inline void check_wait(void)
112 cpu_wait = r4k_wait; 108 cpu_wait = r4k_wait;
113 printk(" available.\n"); 109 printk(" available.\n");
114 break; 110 break;
115#ifdef CONFIG_PM
116 case CPU_AU1000: 111 case CPU_AU1000:
117 case CPU_AU1100: 112 case CPU_AU1100:
118 case CPU_AU1500: 113 case CPU_AU1500:
119 case CPU_AU1550: 114 case CPU_AU1550:
120 case CPU_AU1200: 115 case CPU_AU1200:
121 if (au1k_wait_ptr != NULL) { 116 {
122 cpu_wait = au1k_wait_ptr; 117 extern int allow_au1k_wait; /* au1000/common/time.c */
123 printk(" available.\n"); 118 if (allow_au1k_wait) {
124 } 119 cpu_wait = au1k_wait;
125 else { 120 printk(" available.\n");
126 printk(" unavailable.\n"); 121 } else
122 printk(" unavailable.\n");
127 } 123 }
128 break; 124 break;
129#endif
130 default: 125 default:
131 printk(" unavailable.\n"); 126 printk(" unavailable.\n");
132 break; 127 break;