2012-10-08 03:38:03 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <machine/cpu.h>
|
2013-05-23 14:25:14 +02:00
|
|
|
#include <minix/type.h>
|
2013-12-13 14:12:50 +01:00
|
|
|
#include <minix/board.h>
|
2012-10-08 03:38:03 +02:00
|
|
|
#include <io.h>
|
|
|
|
|
2013-06-11 16:07:43 +02:00
|
|
|
#include "kernel/kernel.h"
|
|
|
|
#include "kernel/proc.h"
|
|
|
|
#include "kernel/vm.h"
|
|
|
|
#include "kernel/proto.h"
|
|
|
|
#include "arch_proto.h"
|
2013-08-26 18:43:05 +02:00
|
|
|
#include "hw_intr.h"
|
2013-06-11 16:07:43 +02:00
|
|
|
|
2014-02-07 08:46:29 +01:00
|
|
|
#include "omap_intr_registers.h"
|
2014-02-24 09:40:30 +01:00
|
|
|
static struct omap_intr
|
|
|
|
{
|
2013-05-23 14:25:14 +02:00
|
|
|
vir_bytes base;
|
2013-06-11 16:07:43 +02:00
|
|
|
int size;
|
2013-05-23 14:25:14 +02:00
|
|
|
} omap_intr;
|
|
|
|
|
2013-06-11 16:07:43 +02:00
|
|
|
static kern_phys_map intr_phys_map;
|
|
|
|
|
2014-02-24 09:40:30 +01:00
|
|
|
int
|
|
|
|
intr_init(const int auto_eoi)
|
2012-10-08 03:38:03 +02:00
|
|
|
{
|
2013-12-17 16:20:37 +01:00
|
|
|
if (BOARD_IS_BBXM(machine.board_id)) {
|
|
|
|
omap_intr.base = OMAP3_DM37XX_INTR_BASE;
|
|
|
|
} else if (BOARD_IS_BB(machine.board_id)) {
|
|
|
|
omap_intr.base = OMAP3_AM335X_INTR_BASE;
|
|
|
|
} else {
|
2014-02-24 09:40:30 +01:00
|
|
|
panic
|
|
|
|
("Can not do the interrupt setup. machine (0x%08x) is unknown\n",
|
|
|
|
machine.board_id);
|
2013-12-17 16:20:37 +01:00
|
|
|
};
|
2014-02-24 09:40:30 +01:00
|
|
|
omap_intr.size = 0x1000; /* 4K */
|
2013-12-17 16:20:37 +01:00
|
|
|
|
2014-02-24 09:40:30 +01:00
|
|
|
kern_phys_map_ptr(omap_intr.base, omap_intr.size,
|
|
|
|
&intr_phys_map, (vir_bytes) & omap_intr.base);
|
2013-12-17 16:20:37 +01:00
|
|
|
return 0;
|
2012-10-08 03:38:03 +02:00
|
|
|
}
|
|
|
|
|
2014-02-24 09:40:30 +01:00
|
|
|
void
|
|
|
|
bsp_irq_handle(void)
|
|
|
|
{
|
2013-05-23 14:25:14 +02:00
|
|
|
/* Function called from assembly to handle interrupts */
|
|
|
|
|
|
|
|
/* get irq */
|
2014-02-24 09:40:30 +01:00
|
|
|
int irq =
|
|
|
|
mmio_read(omap_intr.base +
|
|
|
|
OMAP3_INTCPS_SIR_IRQ) & OMAP3_INTR_ACTIVEIRQ_MASK;
|
2013-05-23 14:25:14 +02:00
|
|
|
/* handle irq */
|
|
|
|
irq_handle(irq);
|
2014-02-24 09:40:30 +01:00
|
|
|
/* re-enable. this should not trigger interrupts due to current cpsr
|
|
|
|
* state */
|
|
|
|
mmio_write(omap_intr.base + OMAP3_INTCPS_CONTROL,
|
|
|
|
OMAP3_INTR_NEWIRQAGR);
|
2013-05-23 14:25:14 +02:00
|
|
|
}
|
|
|
|
|
2014-02-24 09:40:30 +01:00
|
|
|
void
|
|
|
|
bsp_irq_unmask(int irq)
|
2012-10-08 03:38:03 +02:00
|
|
|
{
|
2014-02-24 09:40:30 +01:00
|
|
|
mmio_write(OMAP3_INTR_MIR_CLEAR(omap_intr.base, irq >> 5),
|
|
|
|
1 << (irq & 0x1f));
|
2012-10-08 03:38:03 +02:00
|
|
|
}
|
|
|
|
|
2014-02-24 09:40:30 +01:00
|
|
|
void
|
|
|
|
bsp_irq_mask(const int irq)
|
2012-10-08 03:38:03 +02:00
|
|
|
{
|
2014-02-24 09:40:30 +01:00
|
|
|
mmio_write(OMAP3_INTR_MIR_SET(omap_intr.base, irq >> 5),
|
|
|
|
1 << (irq & 0x1f));
|
2012-10-08 03:38:03 +02:00
|
|
|
}
|