static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) { unsigned long tmp; tmp = intc_bank_read_reg(bank, INTC_REVISION) & 0xff; printk(KERN_INFO "IRQ: Found an INTC at 0x%p " "(revision %ld.%ld) with %d interrupts\n", bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs); tmp = intc_bank_read_reg(bank, INTC_SYSCONFIG); tmp |= 1 << 1; /* soft reset */ intc_bank_write_reg(tmp, bank, INTC_SYSCONFIG); while (!(intc_bank_read_reg(bank, INTC_SYSSTATUS) & 0x1)) /* Wait for reset to complete */; /* Enable autoidle */ intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG); /* Enable protection mode */ __raw_writel(1 << 0, bank->base_reg + INTC_PROTECTION); /* Disable all interrupts by masking them off. They will be re-enabled when a handler is registered for them. */ for (tmp = 0; tmp < bank->nr_irqs; tmp += IRQ_BITS_PER_REG) { intc_bank_write_reg(0xffffffff, bank, INTC_MIR_SET0 + tmp); } /* Set the global enable */ omap_global_enable(); }
static void omap_global_enable(void) { unsigned long tmp; tmp = intc_bank_read_reg(&irq_banks[0], INTC_SICR); tmp &= ~(1 << 6); intc_bank_write_reg(tmp, &irq_banks[0], INTC_SICR); }
static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) { unsigned long tmp; tmp = intc_bank_read_reg(bank, INTC_REVISION) & 0xff; printk(KERN_INFO "IRQ: Found an INTC at 0x%p " "(revision %ld.%ld) with %d interrupts\n", bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs); tmp = intc_bank_read_reg(bank, INTC_SYSCONFIG); tmp |= 1 << 1; /* soft reset */ intc_bank_write_reg(tmp, bank, INTC_SYSCONFIG); while (!(intc_bank_read_reg(bank, INTC_SYSSTATUS) & 0x1)) /* Wait for reset to complete */; /* Enable autoidle */ intc_bank_write_reg(1 << 0, bank, INTC_SYSCONFIG); }
void omap3_intc_autoidle(int enable) { u32 read_val; read_val = intc_bank_read_reg(&irq_banks[0], INTC_SYSCONFIG); if (!enable) read_val &= ~0x1; else read_val |= 0x1; intc_bank_write_reg(read_val, &irq_banks[0], INTC_SYSCONFIG); }
/* * On 34xx we can get occasional spurious interrupts if the ack from * an interrupt handler does not get posted before we unmask. Warn about * the interrupt handlers that need to flush posted writes. */ static int omap_check_spurious(unsigned int irq) { u32 sir, spurious; sir = intc_bank_read_reg(&irq_banks[0], INTC_SIR); spurious = sir >> 6; if (spurious > 1) { printk(KERN_WARNING "Spurious irq %i: 0x%08x, please flush " "posted write for irq %i\n", irq, sir, previous_irq); return spurious; } return 0; }
static void omap_ack_irq(unsigned int irq) { unsigned long tmp; tmp = intc_bank_read_reg(&irq_banks[0], (INTC_ILR_REG0 + (irq * 0x04))); if(tmp & 0x01) { /* FIQ ACK*/ intc_bank_write_reg(0x02, &irq_banks[0], INTC_CONTROL); } else { /*IRQ ACK*/ intc_bank_write_reg(0x01, &irq_banks[0], INTC_CONTROL); } }
int omap_irq_pending(void) { int i; for (i = 0; i < ARRAY_SIZE(irq_banks); i++) { struct omap_irq_bank *bank = irq_banks + i; int irq; for (irq = 0; irq < bank->nr_irqs; irq += IRQ_BITS_PER_REG) { int offset = irq & (~(IRQ_BITS_PER_REG - 1)); if (intc_bank_read_reg(bank, (INTC_PENDING_IRQ0 + offset))) return 1; } } return 0; }
void omap3_intc_save_context(void) { int ind = 0, i = 0; for (ind = 0; ind < ARRAY_SIZE(irq_banks); ind++) { struct omap_irq_bank *bank = irq_banks + ind; intc_context[ind].sysconfig = intc_bank_read_reg(bank, INTC_SYSCONFIG); intc_context[ind].protection = intc_bank_read_reg(bank, INTC_PROTECTION); intc_context[ind].idle = intc_bank_read_reg(bank, INTC_IDLE); intc_context[ind].threshold = intc_bank_read_reg(bank, INTC_THRESHOLD); for (i = 0; i < INTCPS_NR_IRQS; i++) intc_context[ind].ilr[i] = intc_bank_read_reg(bank, (0x100 + 0x4*i)); for (i = 0; i < INTCPS_NR_MIR_REGS; i++) intc_context[ind].mir[i] = intc_bank_read_reg(&irq_banks[0], INTC_MIR0 + (0x20 * i)); } }