aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2013-04-04 01:53:52 -0400
committerKukjin Kim <kgene.kim@samsung.com>2013-04-04 01:56:22 -0400
commitf5a25524508e68ac670b28db9112d3962dca4703 (patch)
tree6c3e56d0f95e6a5a16d13c7a7adc970484c7bc8c
parent658dc8fb9cbc7712b1518ce79211ffadcabd1c9e (diff)
irqchip: s3c24xx: make interrupt handling independent of irq_domain structure
Keep a pointer to the corresponding s3c_irq_data struct as irq_chip_data. This removes the need to fetch the intc struct from the irq_domains host_data, thus making it independent of the underlying irq_domain structure. Also keep the real register offset of the interrupt in the s3c_irq_data struct to make it independent of the hwirq structure in the irq_domain Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--drivers/irqchip/irq-s3c24xx.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/drivers/irqchip/irq-s3c24xx.c b/drivers/irqchip/irq-s3c24xx.c
index 9914abdb8214..02b82db086d8 100644
--- a/drivers/irqchip/irq-s3c24xx.c
+++ b/drivers/irqchip/irq-s3c24xx.c
@@ -43,6 +43,7 @@
43 43
44struct s3c_irq_data { 44struct s3c_irq_data {
45 unsigned int type; 45 unsigned int type;
46 unsigned long offset;
46 unsigned long parent_irq; 47 unsigned long parent_irq;
47 48
48 /* data gets filled during init */ 49 /* data gets filled during init */
@@ -79,15 +80,15 @@ static struct s3c_irq_intc *s3c_intc[3];
79 80
80static void s3c_irq_mask(struct irq_data *data) 81static void s3c_irq_mask(struct irq_data *data)
81{ 82{
82 struct s3c_irq_intc *intc = data->domain->host_data; 83 struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
84 struct s3c_irq_intc *intc = irq_data->intc;
83 struct s3c_irq_intc *parent_intc = intc->parent; 85 struct s3c_irq_intc *parent_intc = intc->parent;
84 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
85 struct s3c_irq_data *parent_data; 86 struct s3c_irq_data *parent_data;
86 unsigned long mask; 87 unsigned long mask;
87 unsigned int irqno; 88 unsigned int irqno;
88 89
89 mask = __raw_readl(intc->reg_mask); 90 mask = __raw_readl(intc->reg_mask);
90 mask |= (1UL << data->hwirq); 91 mask |= (1UL << irq_data->offset);
91 __raw_writel(mask, intc->reg_mask); 92 __raw_writel(mask, intc->reg_mask);
92 93
93 if (parent_intc) { 94 if (parent_intc) {
@@ -104,14 +105,14 @@ static void s3c_irq_mask(struct irq_data *data)
104 105
105static void s3c_irq_unmask(struct irq_data *data) 106static void s3c_irq_unmask(struct irq_data *data)
106{ 107{
107 struct s3c_irq_intc *intc = data->domain->host_data; 108 struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
109 struct s3c_irq_intc *intc = irq_data->intc;
108 struct s3c_irq_intc *parent_intc = intc->parent; 110 struct s3c_irq_intc *parent_intc = intc->parent;
109 struct s3c_irq_data *irq_data = &intc->irqs[data->hwirq];
110 unsigned long mask; 111 unsigned long mask;
111 unsigned int irqno; 112 unsigned int irqno;
112 113
113 mask = __raw_readl(intc->reg_mask); 114 mask = __raw_readl(intc->reg_mask);
114 mask &= ~(1UL << data->hwirq); 115 mask &= ~(1UL << irq_data->offset);
115 __raw_writel(mask, intc->reg_mask); 116 __raw_writel(mask, intc->reg_mask);
116 117
117 if (parent_intc) { 118 if (parent_intc) {
@@ -123,8 +124,9 @@ static void s3c_irq_unmask(struct irq_data *data)
123 124
124static inline void s3c_irq_ack(struct irq_data *data) 125static inline void s3c_irq_ack(struct irq_data *data)
125{ 126{
126 struct s3c_irq_intc *intc = data->domain->host_data; 127 struct s3c_irq_data *irq_data = irq_data_get_irq_chip_data(data);
127 unsigned long bitval = 1UL << data->hwirq; 128 struct s3c_irq_intc *intc = irq_data->intc;
129 unsigned long bitval = 1UL << irq_data->offset;
128 130
129 __raw_writel(bitval, intc->reg_pending); 131 __raw_writel(bitval, intc->reg_pending);
130 if (intc->reg_intpnd) 132 if (intc->reg_intpnd)
@@ -291,8 +293,7 @@ static struct irq_chip s3c_irq_eint0t4 = {
291static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc) 293static void s3c_irq_demux(unsigned int irq, struct irq_desc *desc)
292{ 294{
293 struct irq_chip *chip = irq_desc_get_chip(desc); 295 struct irq_chip *chip = irq_desc_get_chip(desc);
294 struct s3c_irq_intc *intc = desc->irq_data.domain->host_data; 296 struct s3c_irq_data *irq_data = irq_desc_get_chip_data(desc);
295 struct s3c_irq_data *irq_data = &intc->irqs[desc->irq_data.hwirq];
296 struct s3c_irq_intc *sub_intc = irq_data->sub_intc; 297 struct s3c_irq_intc *sub_intc = irq_data->sub_intc;
297 unsigned long src; 298 unsigned long src;
298 unsigned long msk; 299 unsigned long msk;
@@ -406,6 +407,7 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
406 407
407 /* attach controller pointer to irq_data */ 408 /* attach controller pointer to irq_data */
408 irq_data->intc = intc; 409 irq_data->intc = intc;
410 irq_data->offset = hw;
409 411
410 parent_intc = intc->parent; 412 parent_intc = intc->parent;
411 413
@@ -444,6 +446,9 @@ static int s3c24xx_irq_map(struct irq_domain *h, unsigned int virq,
444 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type); 446 pr_err("irq-s3c24xx: unsupported irqtype %d\n", irq_data->type);
445 return -EINVAL; 447 return -EINVAL;
446 } 448 }
449
450 irq_set_chip_data(virq, irq_data);
451
447 set_irq_flags(virq, IRQF_VALID); 452 set_irq_flags(virq, IRQF_VALID);
448 453
449 if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) { 454 if (parent_intc && irq_data->type != S3C_IRQTYPE_NONE) {