Release 4.7 drivers/irqchip/exynos-combiner.c
/*
* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
* http://www.samsung.com
*
* Combiner irqchip for EXYNOS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/err.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/syscore_ops.h>
#include <linux/irqdomain.h>
#include <linux/irqchip.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/interrupt.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#define COMBINER_ENABLE_SET 0x0
#define COMBINER_ENABLE_CLEAR 0x4
#define COMBINER_INT_STATUS 0xC
#define IRQ_IN_COMBINER 8
static DEFINE_SPINLOCK(irq_controller_lock);
struct combiner_chip_data {
unsigned int hwirq_offset;
unsigned int irq_mask;
void __iomem *base;
unsigned int parent_irq;
#ifdef CONFIG_PM
u32 pm_save;
#endif
};
static struct combiner_chip_data *combiner_data;
static struct irq_domain *combiner_irq_domain;
static unsigned int max_nr = 20;
static inline void __iomem *combiner_base(struct irq_data *data)
{
struct combiner_chip_data *combiner_data =
irq_data_get_irq_chip_data(data);
return combiner_data->base;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 29 | 100.00% | 1 | 100.00% |
| Total | 29 | 100.00% | 1 | 100.00% |
static void combiner_mask_irq(struct irq_data *data)
{
u32 mask = 1 << (data->hwirq % 32);
__raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_CLEAR);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 36 | 100.00% | 1 | 100.00% |
| Total | 36 | 100.00% | 1 | 100.00% |
static void combiner_unmask_irq(struct irq_data *data)
{
u32 mask = 1 << (data->hwirq % 32);
__raw_writel(mask, combiner_base(data) + COMBINER_ENABLE_SET);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 36 | 100.00% | 1 | 100.00% |
| Total | 36 | 100.00% | 1 | 100.00% |
static void combiner_handle_cascade_irq(struct irq_desc *desc)
{
struct combiner_chip_data *chip_data = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int cascade_irq, combiner_irq;
unsigned long status;
chained_irq_enter(chip, desc);
spin_lock(&irq_controller_lock);
status = __raw_readl(chip_data->base + COMBINER_INT_STATUS);
spin_unlock(&irq_controller_lock);
status &= chip_data->irq_mask;
if (status == 0)
goto out;
combiner_irq = chip_data->hwirq_offset + __ffs(status);
cascade_irq = irq_find_mapping(combiner_irq_domain, combiner_irq);
if (unlikely(!cascade_irq))
handle_bad_irq(desc);
else
generic_handle_irq(cascade_irq);
out:
chained_irq_exit(chip, desc);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 119 | 88.81% | 1 | 25.00% |
arnd bergmann | arnd bergmann | 10 | 7.46% | 1 | 25.00% |
jiang liu | jiang liu | 4 | 2.99% | 1 | 25.00% |
pankaj dubey | pankaj dubey | 1 | 0.75% | 1 | 25.00% |
| Total | 134 | 100.00% | 4 | 100.00% |
#ifdef CONFIG_SMP
static int combiner_set_affinity(struct irq_data *d,
const struct cpumask *mask_val, bool force)
{
struct combiner_chip_data *chip_data = irq_data_get_irq_chip_data(d);
struct irq_chip *chip = irq_get_chip(chip_data->parent_irq);
struct irq_data *data = irq_get_irq_data(chip_data->parent_irq);
if (chip && chip->irq_set_affinity)
return chip->irq_set_affinity(data, mask_val, force);
else
return -EINVAL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
chanho park | chanho park | 79 | 100.00% | 1 | 100.00% |
| Total | 79 | 100.00% | 1 | 100.00% |
#endif
static struct irq_chip combiner_chip = {
.name = "COMBINER",
.irq_mask = combiner_mask_irq,
.irq_unmask = combiner_unmask_irq,
#ifdef CONFIG_SMP
.irq_set_affinity = combiner_set_affinity,
#endif
};
static void __init combiner_cascade_irq(struct combiner_chip_data *combiner_data,
unsigned int irq)
{
irq_set_chained_handler_and_data(irq, combiner_handle_cascade_irq,
combiner_data);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 18 | 72.00% | 1 | 33.33% |
arnd bergmann | arnd bergmann | 4 | 16.00% | 1 | 33.33% |
thomas gleixner | thomas gleixner | 3 | 12.00% | 1 | 33.33% |
| Total | 25 | 100.00% | 3 | 100.00% |
static void __init combiner_init_one(struct combiner_chip_data *combiner_data,
unsigned int combiner_nr,
void __iomem *base, unsigned int irq)
{
combiner_data->base = base;
combiner_data->hwirq_offset = (combiner_nr & ~3) * IRQ_IN_COMBINER;
combiner_data->irq_mask = 0xff << ((combiner_nr % 4) << 3);
combiner_data->parent_irq = irq;
/* Disable all interrupts */
__raw_writel(combiner_data->irq_mask, base + COMBINER_ENABLE_CLEAR);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 52 | 66.67% | 1 | 20.00% |
arnd bergmann | arnd bergmann | 17 | 21.79% | 3 | 60.00% |
chanho park | chanho park | 9 | 11.54% | 1 | 20.00% |
| Total | 78 | 100.00% | 5 | 100.00% |
static int combiner_irq_domain_xlate(struct irq_domain *d,
struct device_node *controller,
const u32 *intspec, unsigned int intsize,
unsigned long *out_hwirq,
unsigned int *out_type)
{
if (irq_domain_get_of_node(d) != controller)
return -EINVAL;
if (intsize < 2)
return -EINVAL;
*out_hwirq = intspec[0] * IRQ_IN_COMBINER + intspec[1];
*out_type = 0;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 77 | 95.06% | 1 | 33.33% |
marc zyngier | marc zyngier | 3 | 3.70% | 1 | 33.33% |
arnd bergmann | arnd bergmann | 1 | 1.23% | 1 | 33.33% |
| Total | 81 | 100.00% | 3 | 100.00% |
static int combiner_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
struct combiner_chip_data *combiner_data = d->host_data;
irq_set_chip_and_handler(irq, &combiner_chip, handle_level_irq);
irq_set_chip_data(irq, &combiner_data[hw >> 3]);
irq_set_probe(irq);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 49 | 84.48% | 2 | 66.67% |
arnd bergmann | arnd bergmann | 9 | 15.52% | 1 | 33.33% |
| Total | 58 | 100.00% | 3 | 100.00% |
static const struct irq_domain_ops combiner_irq_domain_ops = {
.xlate = combiner_irq_domain_xlate,
.map = combiner_irq_domain_map,
};
static void __init combiner_init(void __iomem *combiner_base,
struct device_node *np)
{
int i, irq;
unsigned int nr_irq;
nr_irq = max_nr * IRQ_IN_COMBINER;
combiner_data = kcalloc(max_nr, sizeof (*combiner_data), GFP_KERNEL);
if (!combiner_data) {
pr_warn("%s: could not allocate combiner data\n", __func__);
return;
}
combiner_irq_domain = irq_domain_add_linear(np, nr_irq,
&combiner_irq_domain_ops, combiner_data);
if (WARN_ON(!combiner_irq_domain)) {
pr_warn("%s: irq domain init failed\n", __func__);
return;
}
for (i = 0; i < max_nr; i++) {
irq = irq_of_parse_and_map(np, i);
combiner_init_one(&combiner_data[i], i,
combiner_base + (i >> 2) * 0x10, irq);
combiner_cascade_irq(&combiner_data[i], irq);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 108 | 71.05% | 1 | 14.29% |
arnd bergmann | arnd bergmann | 23 | 15.13% | 2 | 28.57% |
chanho park | chanho park | 17 | 11.18% | 1 | 14.29% |
wang long | wang long | 2 | 1.32% | 1 | 14.29% |
sachin kamat | sachin kamat | 1 | 0.66% | 1 | 14.29% |
chander kashyap | chander kashyap | 1 | 0.66% | 1 | 14.29% |
| Total | 152 | 100.00% | 7 | 100.00% |
#ifdef CONFIG_PM
/**
* combiner_suspend - save interrupt combiner state before suspend
*
* Save the interrupt enable set register for all combiner groups since
* the state is lost when the system enters into a sleep state.
*
*/
static int combiner_suspend(void)
{
int i;
for (i = 0; i < max_nr; i++)
combiner_data[i].pm_save =
__raw_readl(combiner_data[i].base + COMBINER_ENABLE_SET);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
javier martinez canillas | javier martinez canillas | 46 | 100.00% | 1 | 100.00% |
| Total | 46 | 100.00% | 1 | 100.00% |
/**
* combiner_resume - restore interrupt combiner state after resume
*
* Restore the interrupt enable set register for all combiner groups since
* the state is lost when the system enters into a sleep state on suspend.
*
*/
static void combiner_resume(void)
{
int i;
for (i = 0; i < max_nr; i++) {
__raw_writel(combiner_data[i].irq_mask,
combiner_data[i].base + COMBINER_ENABLE_CLEAR);
__raw_writel(combiner_data[i].pm_save,
combiner_data[i].base + COMBINER_ENABLE_SET);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
javier martinez canillas | javier martinez canillas | 64 | 100.00% | 1 | 100.00% |
| Total | 64 | 100.00% | 1 | 100.00% |
#else
#define combiner_suspend NULL
#define combiner_resume NULL
#endif
static struct syscore_ops combiner_syscore_ops = {
.suspend = combiner_suspend,
.resume = combiner_resume,
};
static int __init combiner_of_init(struct device_node *np,
struct device_node *parent)
{
void __iomem *combiner_base;
combiner_base = of_iomap(np, 0);
if (!combiner_base) {
pr_err("%s: failed to map combiner registers\n", __func__);
return -ENXIO;
}
if (of_property_read_u32(np, "samsung,combiner-nr", &max_nr)) {
pr_info("%s: number of combiners not specified, "
"setting default as %d.\n",
__func__, max_nr);
}
combiner_init(combiner_base, np);
register_syscore_ops(&combiner_syscore_ops);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 59 | 66.29% | 1 | 33.33% |
arnd bergmann | arnd bergmann | 24 | 26.97% | 1 | 33.33% |
javier martinez canillas | javier martinez canillas | 6 | 6.74% | 1 | 33.33% |
| Total | 89 | 100.00% | 3 | 100.00% |
IRQCHIP_DECLARE(exynos4210_combiner, "samsung,exynos4210-combiner",
combiner_of_init);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
rob herring | rob herring | 693 | 62.21% | 2 | 11.11% |
javier martinez canillas | javier martinez canillas | 174 | 15.62% | 1 | 5.56% |
chanho park | chanho park | 126 | 11.31% | 1 | 5.56% |
arnd bergmann | arnd bergmann | 96 | 8.62% | 3 | 16.67% |
joel porquet | joel porquet | 5 | 0.45% | 1 | 5.56% |
jiang liu | jiang liu | 4 | 0.36% | 1 | 5.56% |
thomas gleixner | thomas gleixner | 3 | 0.27% | 1 | 5.56% |
marc zyngier | marc zyngier | 3 | 0.27% | 1 | 5.56% |
catalin marinas | catalin marinas | 2 | 0.18% | 1 | 5.56% |
wang long | wang long | 2 | 0.18% | 1 | 5.56% |
naveen krishna chatradhi | naveen krishna chatradhi | 2 | 0.18% | 1 | 5.56% |
sachin kamat | sachin kamat | 1 | 0.09% | 1 | 5.56% |
krzysztof kozlowski | krzysztof kozlowski | 1 | 0.09% | 1 | 5.56% |
chander kashyap | chander kashyap | 1 | 0.09% | 1 | 5.56% |
pankaj dubey | pankaj dubey | 1 | 0.09% | 1 | 5.56% |
| Total | 1114 | 100.00% | 18 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.