aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/sun4c_irq.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-14 01:47:43 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-20 00:18:02 -0400
commit8bd8deead7f00006781c366887da8cf6a02c69ce (patch)
tree79a964a943a01990ba676d4a5cc49988a82fa26d /arch/sparc/kernel/sun4c_irq.c
parent45bb5a7cbfa28dedc07730d6ecedbd574faf5459 (diff)
sparc32: Use PROM device probing for sun4c timers.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/sun4c_irq.c')
-rw-r--r--arch/sparc/kernel/sun4c_irq.c59
1 files changed, 39 insertions, 20 deletions
diff --git a/arch/sparc/kernel/sun4c_irq.c b/arch/sparc/kernel/sun4c_irq.c
index 8033132eda8c..92096ba31d58 100644
--- a/arch/sparc/kernel/sun4c_irq.c
+++ b/arch/sparc/kernel/sun4c_irq.c
@@ -119,16 +119,18 @@ static void sun4c_enable_irq(unsigned int irq_nr)
119 local_irq_restore(flags); 119 local_irq_restore(flags);
120} 120}
121 121
122#define TIMER_IRQ 10 /* Also at level 14, but we ignore that one. */ 122struct sun4c_timer_info {
123#define PROFILE_IRQ 14 /* Level14 ticker.. used by OBP for polling */ 123 u32 l10_count;
124 u32 l10_limit;
125 u32 l14_count;
126 u32 l14_limit;
127};
124 128
125volatile struct sun4c_timer_info *sun4c_timers; 129static struct sun4c_timer_info __iomem *sun4c_timers;
126 130
127static void sun4c_clear_clock_irq(void) 131static void sun4c_clear_clock_irq(void)
128{ 132{
129 volatile unsigned int clear_intr; 133 sbus_readl(&sun4c_timers->l10_limit);
130
131 clear_intr = sun4c_timers->timer_limit10;
132} 134}
133 135
134static void sun4c_load_profile_irq(int cpu, unsigned int limit) 136static void sun4c_load_profile_irq(int cpu, unsigned int limit)
@@ -138,32 +140,49 @@ static void sun4c_load_profile_irq(int cpu, unsigned int limit)
138 140
139static void __init sun4c_init_timers(irq_handler_t counter_fn) 141static void __init sun4c_init_timers(irq_handler_t counter_fn)
140{ 142{
141 int irq; 143 const struct linux_prom_irqs *irq;
144 struct device_node *dp;
145 const u32 *addr;
146 int err;
142 147
143 /* Map the Timer chip, this is implemented in hardware inside 148 dp = of_find_node_by_name(NULL, "counter-timer");
144 * the cache chip on the sun4c. 149 if (!dp) {
145 */ 150 prom_printf("sun4c_init_timers: Unable to find counter-timer\n");
146 sun4c_timers = ioremap(SUN_TIMER_PHYSADDR, 151 prom_halt();
147 sizeof(struct sun4c_timer_info)); 152 }
153
154 addr = of_get_property(dp, "address", NULL);
155 if (!addr) {
156 prom_printf("sun4c_init_timers: No address property\n");
157 prom_halt();
158 }
159
160 sun4c_timers = (void __iomem *) (unsigned long) addr[0];
161
162 irq = of_get_property(dp, "intr", NULL);
163 if (!irq) {
164 prom_printf("sun4c_init_timers: No intr property\n");
165 prom_halt();
166 }
148 167
149 /* Have the level 10 timer tick at 100HZ. We don't touch the 168 /* Have the level 10 timer tick at 100HZ. We don't touch the
150 * level 14 timer limit since we are letting the prom handle 169 * level 14 timer limit since we are letting the prom handle
151 * them until we have a real console driver so L1-A works. 170 * them until we have a real console driver so L1-A works.
152 */ 171 */
153 sun4c_timers->timer_limit10 = (((1000000/HZ) + 1) << 10); 172 sbus_writel((((1000000/HZ) + 1) << 10), &sun4c_timers->l10_limit);
154 master_l10_counter = &sun4c_timers->cur_count10; 173
155 master_l10_limit = &sun4c_timers->timer_limit10; 174 master_l10_counter = &sun4c_timers->l10_count;
175 master_l10_limit = &sun4c_timers->l10_limit;
156 176
157 irq = request_irq(TIMER_IRQ, 177 err = request_irq(irq[0].pri, counter_fn,
158 counter_fn,
159 (IRQF_DISABLED | SA_STATIC_ALLOC), 178 (IRQF_DISABLED | SA_STATIC_ALLOC),
160 "timer", NULL); 179 "timer", NULL);
161 if (irq) { 180 if (err) {
162 prom_printf("time_init: unable to attach IRQ%d\n",TIMER_IRQ); 181 prom_printf("sun4c_init_timers: request_irq() fails with %d\n", err);
163 prom_halt(); 182 prom_halt();
164 } 183 }
165 184
166 sun4c_disable_irq(PROFILE_IRQ); 185 sun4c_disable_irq(irq[1].pri);
167} 186}
168 187
169#ifdef CONFIG_SMP 188#ifdef CONFIG_SMP