#include <linux/kernel.h>
#include <linux/reboot.h>
#include <linux/interrupt.h>
+#include <linux/bitops.h>
#include <asm/bootinfo.h>
#include <asm/irq_cpu.h>
#include <asm/io.h>
-#include "../ar531x.h"
+
+#include <ar531x.h>
+#include <gpio.h>
static u32 gpiointmask = 0, gpiointval = 0;
if (!pend)
return;
- do_IRQ(AR531X_GPIO_IRQ_BASE + 31 - clz(pend));
+ do_IRQ(AR531X_GPIO_IRQ_BASE + fls(pend) - 1);
}
do_IRQ(AR5315_IRQ_WLAN0_INTRS);
else if (pending & CAUSEF_IP4)
do_IRQ(AR5315_IRQ_ENET0_INTRS);
+#ifdef CONFIG_PCI
+ else if (pending & CAUSEF_IP5)
+ ar5315_pci_irq(AR5315_IRQ_LCBUS_PCI);
+#endif
else if (pending & CAUSEF_IP2) {
unsigned int ar531x_misc_intrs = sysRegRead(AR5315_ISR) & sysRegRead(AR5315_IMR);
do_IRQ(AR531X_IRQ_CPU_CLOCK);
}
+#ifdef CONFIG_PCI
+static inline void pci_abort_irq(void)
+{
+ sysRegWrite(AR5315_PCI_INT_STATUS, AR5315_PCI_ABORT_INT);
+ (void)sysRegRead(AR5315_PCI_INT_STATUS); /* flush write to hardware */
+}
+
+static inline void pci_ack_irq(void)
+{
+ sysRegWrite(AR5315_PCI_INT_STATUS, AR5315_PCI_EXT_INT);
+ (void)sysRegRead(AR5315_PCI_INT_STATUS); /* flush write to hardware */
+}
+
+void ar5315_pci_irq(int irq)
+{
+ if (sysRegRead(AR5315_PCI_INT_STATUS) == AR5315_PCI_ABORT_INT)
+ pci_abort_irq();
+ else {
+ do_IRQ(irq);
+ pci_ack_irq();
+ }
+}
+#endif
+
static void ar5315_gpio_intr_enable(unsigned int irq)
{
u32 gpio, mask;
/* reconfigure GPIO line as input */
sysRegMask(AR5315_GPIO_CR, AR5315_GPIO_CR_M(gpio), AR5315_GPIO_CR_I(gpio));
-
+
/* Enable interrupt with edge detection */
sysRegMask(AR5315_GPIO_INT, AR5315_GPIO_INT_M | AR5315_GPIO_INT_LVL_M, gpio | AR5315_GPIO_INT_LVL(3));
}
case AR531X_MISC_IRQ_SPI:
imr &= ~AR5315_ISR_SPI;
break;
-
+
case AR531X_MISC_IRQ_TIMER:
imr &= (~AR5315_ISR_TIMER);
break;