Commit 8bd8deea authored by David S. Miller's avatar David S. Miller

sparc32: Use PROM device probing for sun4c timers.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45bb5a7c
...@@ -11,30 +11,6 @@ ...@@ -11,30 +11,6 @@
#include <asm/system.h> /* For SUN4M_NCPUS */ #include <asm/system.h> /* For SUN4M_NCPUS */
#include <asm/btfixup.h> #include <asm/btfixup.h>
/* Timer structures. The interrupt timer has two properties which
* are the counter (which is handled in do_timer in sched.c) and the limit.
* This limit is where the timer's counter 'wraps' around. Oddly enough,
* the sun4c timer when it hits the limit wraps back to 1 and not zero
* thus when calculating the value at which it will fire a microsecond you
* must adjust by one. Thanks SUN for designing such great hardware ;(
*/
/* Note that I am only going to use the timer that interrupts at
* Sparc IRQ 10. There is another one available that can fire at
* IRQ 14. Currently it is left untouched, we keep the PROM's limit
* register value and let the prom take these interrupts. This allows
* L1-A to work.
*/
struct sun4c_timer_info {
__volatile__ unsigned int cur_count10;
__volatile__ unsigned int timer_limit10;
__volatile__ unsigned int cur_count14;
__volatile__ unsigned int timer_limit14;
};
#define SUN_TIMER_PHYSADDR 0xf3000000
extern __volatile__ unsigned int *master_l10_counter; extern __volatile__ unsigned int *master_l10_counter;
extern __volatile__ unsigned int *master_l10_limit; extern __volatile__ unsigned int *master_l10_limit;
......
...@@ -119,16 +119,18 @@ static void sun4c_enable_irq(unsigned int irq_nr) ...@@ -119,16 +119,18 @@ static void sun4c_enable_irq(unsigned int irq_nr)
local_irq_restore(flags); local_irq_restore(flags);
} }
#define TIMER_IRQ 10 /* Also at level 14, but we ignore that one. */ struct sun4c_timer_info {
#define PROFILE_IRQ 14 /* Level14 ticker.. used by OBP for polling */ u32 l10_count;
u32 l10_limit;
u32 l14_count;
u32 l14_limit;
};
volatile struct sun4c_timer_info *sun4c_timers; static struct sun4c_timer_info __iomem *sun4c_timers;
static void sun4c_clear_clock_irq(void) static void sun4c_clear_clock_irq(void)
{ {
volatile unsigned int clear_intr; sbus_readl(&sun4c_timers->l10_limit);
clear_intr = sun4c_timers->timer_limit10;
} }
static void sun4c_load_profile_irq(int cpu, unsigned int limit) static 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,32 +140,49 @@ static void sun4c_load_profile_irq(int cpu, unsigned int limit)
static void __init sun4c_init_timers(irq_handler_t counter_fn) static void __init sun4c_init_timers(irq_handler_t counter_fn)
{ {
int irq; const struct linux_prom_irqs *irq;
struct device_node *dp;
const u32 *addr;
int err;
/* Map the Timer chip, this is implemented in hardware inside dp = of_find_node_by_name(NULL, "counter-timer");
* the cache chip on the sun4c. if (!dp) {
*/ prom_printf("sun4c_init_timers: Unable to find counter-timer\n");
sun4c_timers = ioremap(SUN_TIMER_PHYSADDR, prom_halt();
sizeof(struct sun4c_timer_info)); }
addr = of_get_property(dp, "address", NULL);
if (!addr) {
prom_printf("sun4c_init_timers: No address property\n");
prom_halt();
}
sun4c_timers = (void __iomem *) (unsigned long) addr[0];
irq = of_get_property(dp, "intr", NULL);
if (!irq) {
prom_printf("sun4c_init_timers: No intr property\n");
prom_halt();
}
/* Have the level 10 timer tick at 100HZ. We don't touch the /* Have the level 10 timer tick at 100HZ. We don't touch the
* level 14 timer limit since we are letting the prom handle * level 14 timer limit since we are letting the prom handle
* them until we have a real console driver so L1-A works. * them until we have a real console driver so L1-A works.
*/ */
sun4c_timers->timer_limit10 = (((1000000/HZ) + 1) << 10); sbus_writel((((1000000/HZ) + 1) << 10), &sun4c_timers->l10_limit);
master_l10_counter = &sun4c_timers->cur_count10;
master_l10_limit = &sun4c_timers->timer_limit10; master_l10_counter = &sun4c_timers->l10_count;
master_l10_limit = &sun4c_timers->l10_limit;
irq = request_irq(TIMER_IRQ, err = request_irq(irq[0].pri, counter_fn,
counter_fn,
(IRQF_DISABLED | SA_STATIC_ALLOC), (IRQF_DISABLED | SA_STATIC_ALLOC),
"timer", NULL); "timer", NULL);
if (irq) { if (err) {
prom_printf("time_init: unable to attach IRQ%d\n",TIMER_IRQ); prom_printf("sun4c_init_timers: request_irq() fails with %d\n", err);
prom_halt(); prom_halt();
} }
sun4c_disable_irq(PROFILE_IRQ); sun4c_disable_irq(irq[1].pri);
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment