Release 4.14 arch/mips/pmcs-msp71xx/msp_irq_per.c
/*
* Copyright 2010 PMC-Sierra, Inc, derived from irq_cpu.c
*
* This file define the irq handler for MSP PER subsystem interrupts.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/spinlock.h>
#include <linux/bitops.h>
#include <asm/mipsregs.h>
#include <msp_cic_int.h>
#include <msp_regs.h>
/*
* Convenience Macro. Should be somewhere generic.
*/
#define get_current_vpe() \
((read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE)
#ifdef CONFIG_SMP
/*
* The PER registers must be protected from concurrent access.
*/
static DEFINE_SPINLOCK(per_lock);
#endif
/* ensure writes to per are completed */
static inline void per_wmb(void)
{
const volatile void __iomem *per_mem = PER_INT_MSK_REG;
volatile u32 dummy_read;
wmb();
dummy_read = __raw_readl(per_mem);
dummy_read++;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 35 | 100.00% | 1 | 100.00% |
Total | 35 | 100.00% | 1 | 100.00% |
static inline void unmask_per_irq(struct irq_data *d)
{
#ifdef CONFIG_SMP
unsigned long flags;
spin_lock_irqsave(&per_lock, flags);
*PER_INT_MSK_REG |= (1 << (d->irq - MSP_PER_INTBASE));
spin_unlock_irqrestore(&per_lock, flags);
#else
*PER_INT_MSK_REG |= (1 << (d->irq - MSP_PER_INTBASE));
#endif
per_wmb();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 64 | 88.89% | 1 | 50.00% |
Thomas Gleixner | 8 | 11.11% | 1 | 50.00% |
Total | 72 | 100.00% | 2 | 100.00% |
static inline void mask_per_irq(struct irq_data *d)
{
#ifdef CONFIG_SMP
unsigned long flags;
spin_lock_irqsave(&per_lock, flags);
*PER_INT_MSK_REG &= ~(1 << (d->irq - MSP_PER_INTBASE));
spin_unlock_irqrestore(&per_lock, flags);
#else
*PER_INT_MSK_REG &= ~(1 << (d->irq - MSP_PER_INTBASE));
#endif
per_wmb();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 66 | 89.19% | 1 | 50.00% |
Thomas Gleixner | 8 | 10.81% | 1 | 50.00% |
Total | 74 | 100.00% | 2 | 100.00% |
static inline void msp_per_irq_ack(struct irq_data *d)
{
mask_per_irq(d);
/*
* In the PER interrupt controller, only bits 11 and 10
* are write-to-clear, (SPI TX complete, SPI RX complete).
* It does nothing for any others.
*/
*PER_INT_STS_REG = (1 << (d->irq - MSP_PER_INTBASE));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 26 | 78.79% | 1 | 50.00% |
Thomas Gleixner | 7 | 21.21% | 1 | 50.00% |
Total | 33 | 100.00% | 2 | 100.00% |
#ifdef CONFIG_SMP
static int msp_per_irq_set_affinity(struct irq_data *d,
const struct cpumask *affinity, bool force)
{
/* WTF is this doing ????? */
unmask_per_irq(d);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 19 | 65.52% | 1 | 50.00% |
Thomas Gleixner | 10 | 34.48% | 1 | 50.00% |
Total | 29 | 100.00% | 2 | 100.00% |
#endif
static struct irq_chip msp_per_irq_controller = {
.name = "MSP_PER",
.irq_enable = unmask_per_irq,
.irq_disable = mask_per_irq,
.irq_ack = msp_per_irq_ack,
#ifdef CONFIG_SMP
.irq_set_affinity = msp_per_irq_set_affinity,
#endif
};
void __init msp_per_irq_init(void)
{
int i;
/* Mask/clear interrupts. */
*PER_INT_MSK_REG = 0x00000000;
*PER_INT_STS_REG = 0xFFFFFFFF;
/* initialize all the IRQ descriptors */
for (i = MSP_PER_INTBASE; i < MSP_PER_INTBASE + 32; i++) {
irq_set_chip(i, &msp_per_irq_controller);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 44 | 91.67% | 1 | 50.00% |
Thomas Gleixner | 4 | 8.33% | 1 | 50.00% |
Total | 48 | 100.00% | 2 | 100.00% |
void msp_per_irq_dispatch(void)
{
u32 per_mask = *PER_INT_MSK_REG;
u32 per_status = *PER_INT_STS_REG;
u32 pending;
pending = per_status & per_mask;
if (pending) {
do_IRQ(ffs(pending) + MSP_PER_INTBASE - 1);
} else {
spurious_interrupt();
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 52 | 100.00% | 1 | 100.00% |
Total | 52 | 100.00% | 1 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Anoop P A | 384 | 89.10% | 1 | 25.00% |
Thomas Gleixner | 45 | 10.44% | 1 | 25.00% |
Yoichi Yuasa | 1 | 0.23% | 1 | 25.00% |
Ralf Bächle | 1 | 0.23% | 1 | 25.00% |
Total | 431 | 100.00% | 4 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.