#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: c_nec_jazz.c,v 1.14 2013/12/16 15:46:57 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/pio.h>
#include <machine/platform.h>
#include <dev/isa/isavar.h>
#include <arc/arc/timervar.h>
#include <arc/jazz/rd94.h>
#include <arc/jazz/jazziovar.h>
#include <arc/jazz/timer_jazziovar.h>
uint32_t timer_nec_jazz_intr(uint32_t, struct clockframe *);
void timer_nec_jazz_init(int);
struct timer_jazzio_config timer_nec_jazz_conf = {
MIPS_INT_MASK_3,
timer_nec_jazz_intr,
timer_nec_jazz_init,
};
uint32_t
timer_nec_jazz_intr(uint32_t mask, struct clockframe *cf)
{
(void)in32(RD94_SYS_INTSTAT3);
last_cp0_count = mips3_cp0_count_read();
hardclock(cf);
timer_jazzio_ev.ev_count++;
return MIPS_INT_MASK_3;
}
void
timer_nec_jazz_init(int interval)
{
if (interval <= 0)
panic("timer_nec_jazz_init: invalid interval %d", interval);
out32(RD94_SYS_IT_VALUE, interval - 1);
out32(RD94_SYS_EXT_IMASK, cpu_int_mask);
}
struct pica_dev nec_rd94_cpu[] = {
{{ "timer", -1, 0, }, (void *)RD94_SYS_IT_VALUE, },
{{ "dallas_rtc", -1, 0, }, (void *)RD94_SYS_CLOCK, },
{{ "LPT1", 0, 0, }, (void *)RD94_SYS_PAR1, },
{{ "I82077", 1, 0, }, (void *)RD94_SYS_FLOPPY, },
{{ "AD1848", 2, 0, }, (void *)RD94_SYS_SOUND,},
{{ "SONIC", 3, 0, }, (void *)RD94_SYS_SONIC, },
{{ "NCRC700", 4, 0, }, (void *)RD94_SYS_SCSI0, },
{{ "NCRC700", 5, 0, }, (void *)RD94_SYS_SCSI1, },
{{ "I8742", 6, 0, }, (void *)RD94_SYS_KBD, },
{{ "pms", 7, 0, }, (void *)RD94_SYS_KBD, },
{{ "COM1", 8, 0, }, (void *)RD94_SYS_COM1, },
{{ "COM2", 9, 0, }, (void *)RD94_SYS_COM2, },
{{ NULL, -1, 0, }, NULL, },
};
void
c_nec_jazz_set_intr(uint32_t mask,
uint32_t (*int_hand)(uint32_t, struct clockframe *), int prio)
{
arc_set_intr(mask, int_hand, prio);
out32(RD94_SYS_EXT_IMASK, cpu_int_mask & (~MIPS_INT_MASK_3 >> 10));
}
void
c_nec_jazz_init(void)
{
timer_jazzio_conf = &timer_nec_jazz_conf;
jazzio_devconfig = nec_rd94_cpu;
}