#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
#include <asm/io.h>
#include <asm/mipsregs.h>
#include <asm/irq_cpu.h>
static irqreturn_t jz4740_cascade(int irq, void *data)
{
uint32_t irq_reg;
- irq_reg = readl(jz_intc_base + JZ_REG_INTC_PENDING);
- if (irq_reg) {
- generic_handle_irq(ffs(irq_reg) - 1 + JZ_IRQ_BASE);
- return IRQ_HANDLED;
- }
+ irq_reg = readl(jz_intc_base + JZ_REG_INTC_PENDING);
+ generic_handle_irq(ffs(irq_reg) - 1 + JZ_IRQ_BASE);
- return 0;
+ return IRQ_HANDLED;
}
static struct irqaction jz4740_cascade_action = {
.handler = jz4740_cascade,
- .name = "JZ4740 cascade interrupt"
+ .name = "JZ4740 cascade interrupt",
+ .flags = IRQF_DISABLED,
};
void __init arch_init_irq(void)
{
unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
if (pending & STATUSF_IP2)
- jz4740_cascade(2, NULL);
+ do_IRQ(2);
else if(pending & STATUSF_IP3)
do_IRQ(3);
else
{
jz_intc_saved = readl(jz_intc_base + JZ_REG_INTC_MASK);
writel(~jz_intc_wakeup, jz_intc_base + JZ_REG_INTC_SET_MASK);
+ writel(jz_intc_wakeup, jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
}
void jz4740_intc_resume(void)
{
writel(~jz_intc_saved, jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
+ writel(jz_intc_saved, jz_intc_base + JZ_REG_INTC_SET_MASK);
+}
+
+#ifdef CONFIG_DEBUG_FS
+
+static int intc_regs_show(struct seq_file *s, void *unused)
+{
+ seq_printf(s, "Status:\t\t%08x\n", readl(jz_intc_base + JZ_REG_INTC_STATUS));
+ seq_printf(s, "Mask\t\t%08x\n", readl(jz_intc_base + JZ_REG_INTC_MASK));
+ seq_printf(s, "Pending:\t%08x\n", readl(jz_intc_base + JZ_REG_INTC_PENDING));
+
+ return 0;
}
+
+static int intc_regs_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, intc_regs_show, NULL);
+}
+
+static const struct file_operations intc_regs_operations = {
+ .open = intc_regs_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static int __init intc_debugfs_init(void)
+{
+ (void) debugfs_create_file("jz_regs_intc", S_IFREG | S_IRUGO,
+ NULL, NULL, &intc_regs_operations);
+ return 0;
+}
+subsys_initcall(intc_debugfs_init);
+
+#endif