Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 374212
b: refs/heads/master
c: 6761dcf
h: refs/heads/master
v: v3
  • Loading branch information
Arnd Bergmann committed Apr 19, 2013
1 parent 2625888 commit 1201e47
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30269ddff13f417677a27e37086c97a57f1cf2da
refs/heads/master: 6761dcfe8c42b55076753bc8bea7b5dcbfb445c0
15 changes: 14 additions & 1 deletion trunk/arch/arm/mach-exynos/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,19 @@ void __init exynos_init_time(void)
}
}

static unsigned int max_combiner_nr(void)
{
if (soc_is_exynos5250())
return EXYNOS5_MAX_COMBINER_NR;
else if (soc_is_exynos4412())
return EXYNOS4412_MAX_COMBINER_NR;
else if (soc_is_exynos4212())
return EXYNOS4212_MAX_COMBINER_NR;
else
return EXYNOS4210_MAX_COMBINER_NR;
}


void __init exynos4_init_irq(void)
{
unsigned int gic_bank_offset;
Expand All @@ -434,7 +447,7 @@ void __init exynos4_init_irq(void)
#endif

if (!of_have_populated_dt())
combiner_init(S5P_VA_COMBINER_BASE, NULL);
combiner_init(S5P_VA_COMBINER_BASE, NULL, max_combiner_nr());

/*
* The parameters of s5p_init_irq() are for VIC init.
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/arm/mach-exynos/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ void exynos4212_register_clocks(void);
#endif

struct device_node;
void combiner_init(void __iomem *combiner_base, struct device_node *np);
void combiner_init(void __iomem *combiner_base, struct device_node *np,
unsigned int max_nr);

extern struct smp_operations exynos_smp_ops;

Expand Down
46 changes: 16 additions & 30 deletions trunk/drivers/irqchip/exynos-combiner.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#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 {
Expand Down Expand Up @@ -112,23 +114,9 @@ static struct irq_chip combiner_chip = {
#endif
};

static unsigned int max_combiner_nr(void)
{
if (soc_is_exynos5250())
return EXYNOS5_MAX_COMBINER_NR;
else if (soc_is_exynos4412())
return EXYNOS4412_MAX_COMBINER_NR;
else if (soc_is_exynos4212())
return EXYNOS4212_MAX_COMBINER_NR;
else
return EXYNOS4210_MAX_COMBINER_NR;
}

static void __init combiner_cascade_irq(unsigned int combiner_nr,
unsigned int irq)
{
if (combiner_nr >= max_combiner_nr())
BUG();
if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
BUG();
irq_set_chained_handler(irq, combiner_handle_cascade_irq);
Expand All @@ -139,7 +127,7 @@ static void __init combiner_init_one(unsigned int combiner_nr,
{
combiner_data[combiner_nr].base = base;
combiner_data[combiner_nr].irq_offset = irq_find_mapping(
combiner_irq_domain, combiner_nr * MAX_IRQ_IN_COMBINER);
combiner_irq_domain, combiner_nr * IRQ_IN_COMBINER);
combiner_data[combiner_nr].irq_mask = 0xff << ((combiner_nr % 4) << 3);
combiner_data[combiner_nr].parent_irq = irq;

Expand All @@ -161,7 +149,7 @@ static int combiner_irq_domain_xlate(struct irq_domain *d,
if (intsize < 2)
return -EINVAL;

*out_hwirq = intspec[0] * MAX_IRQ_IN_COMBINER + intspec[1];
*out_hwirq = intspec[0] * IRQ_IN_COMBINER + intspec[1];
*out_type = 0;

return 0;
Expand Down Expand Up @@ -209,22 +197,13 @@ static unsigned int exynos4x12_combiner_extra_irq(int group)
}

void __init combiner_init(void __iomem *combiner_base,
struct device_node *np)
struct device_node *np,
unsigned int max_nr)
{
int i, irq, irq_base;
unsigned int max_nr, nr_irq;
unsigned int nr_irq;

max_nr = max_combiner_nr();

if (np) {
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);
}
}

nr_irq = max_nr * MAX_IRQ_IN_COMBINER;
nr_irq = max_nr * IRQ_IN_COMBINER;

irq_base = irq_alloc_descs(COMBINER_IRQ(0, 0), 1, nr_irq, 0);
if (IS_ERR_VALUE(irq_base)) {
Expand Down Expand Up @@ -258,14 +237,21 @@ static int __init combiner_of_init(struct device_node *np,
struct device_node *parent)
{
void __iomem *combiner_base;
unsigned int max_nr = 20;

combiner_base = of_iomap(np, 0);
if (!combiner_base) {
pr_err("%s: failed to map combiner registers\n", __func__);
return -ENXIO;
}

combiner_init(combiner_base, np);
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, max_nr);

return 0;
}
Expand Down

0 comments on commit 1201e47

Please sign in to comment.