diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-06 05:11:46 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2017-11-29 05:57:41 -0500 |
commit | be2bedb08fe889f7621c1f3f400900ad2394f65b (patch) | |
tree | e44760aad5d136dae0846b908bfd28e723bca033 | |
parent | 4c9f6d31ddced23d4c149bc6af6a2bb93d97863f (diff) |
ARM: sa1111: map interrupt numbers through irqdomain
Map the interrupt numbers for SA1111 through the SA1111 IRQ domain
rather than doing our own translation. This allows us to eliminate
the irq_base sachip member.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/common/sa1111.c | 40 | ||||
-rw-r--r-- | arch/arm/include/asm/hardware/sa1111.h | 2 |
2 files changed, 27 insertions, 15 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c index d6a0ce7b51cf..a2c878769eaf 100644 --- a/arch/arm/common/sa1111.c +++ b/arch/arm/common/sa1111.c | |||
@@ -126,7 +126,7 @@ struct sa1111_dev_info { | |||
126 | unsigned long skpcr_mask; | 126 | unsigned long skpcr_mask; |
127 | bool dma; | 127 | bool dma; |
128 | unsigned int devid; | 128 | unsigned int devid; |
129 | unsigned int irq[6]; | 129 | unsigned int hwirq[6]; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct sa1111_dev_info sa1111_devices[] = { | 132 | static struct sa1111_dev_info sa1111_devices[] = { |
@@ -135,7 +135,7 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
135 | .skpcr_mask = SKPCR_UCLKEN, | 135 | .skpcr_mask = SKPCR_UCLKEN, |
136 | .dma = true, | 136 | .dma = true, |
137 | .devid = SA1111_DEVID_USB, | 137 | .devid = SA1111_DEVID_USB, |
138 | .irq = { | 138 | .hwirq = { |
139 | IRQ_USBPWR, | 139 | IRQ_USBPWR, |
140 | IRQ_HCIM, | 140 | IRQ_HCIM, |
141 | IRQ_HCIBUFFACC, | 141 | IRQ_HCIBUFFACC, |
@@ -149,7 +149,7 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
149 | .skpcr_mask = SKPCR_I2SCLKEN | SKPCR_L3CLKEN, | 149 | .skpcr_mask = SKPCR_I2SCLKEN | SKPCR_L3CLKEN, |
150 | .dma = true, | 150 | .dma = true, |
151 | .devid = SA1111_DEVID_SAC, | 151 | .devid = SA1111_DEVID_SAC, |
152 | .irq = { | 152 | .hwirq = { |
153 | AUDXMTDMADONEA, | 153 | AUDXMTDMADONEA, |
154 | AUDXMTDMADONEB, | 154 | AUDXMTDMADONEB, |
155 | AUDRCVDMADONEA, | 155 | AUDRCVDMADONEA, |
@@ -165,7 +165,7 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
165 | .offset = SA1111_KBD, | 165 | .offset = SA1111_KBD, |
166 | .skpcr_mask = SKPCR_PTCLKEN, | 166 | .skpcr_mask = SKPCR_PTCLKEN, |
167 | .devid = SA1111_DEVID_PS2_KBD, | 167 | .devid = SA1111_DEVID_PS2_KBD, |
168 | .irq = { | 168 | .hwirq = { |
169 | IRQ_TPRXINT, | 169 | IRQ_TPRXINT, |
170 | IRQ_TPTXINT | 170 | IRQ_TPTXINT |
171 | }, | 171 | }, |
@@ -174,7 +174,7 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
174 | .offset = SA1111_MSE, | 174 | .offset = SA1111_MSE, |
175 | .skpcr_mask = SKPCR_PMCLKEN, | 175 | .skpcr_mask = SKPCR_PMCLKEN, |
176 | .devid = SA1111_DEVID_PS2_MSE, | 176 | .devid = SA1111_DEVID_PS2_MSE, |
177 | .irq = { | 177 | .hwirq = { |
178 | IRQ_MSRXINT, | 178 | IRQ_MSRXINT, |
179 | IRQ_MSTXINT | 179 | IRQ_MSTXINT |
180 | }, | 180 | }, |
@@ -183,7 +183,7 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
183 | .offset = 0x1800, | 183 | .offset = 0x1800, |
184 | .skpcr_mask = 0, | 184 | .skpcr_mask = 0, |
185 | .devid = SA1111_DEVID_PCMCIA, | 185 | .devid = SA1111_DEVID_PCMCIA, |
186 | .irq = { | 186 | .hwirq = { |
187 | IRQ_S0_READY_NINT, | 187 | IRQ_S0_READY_NINT, |
188 | IRQ_S0_CD_VALID, | 188 | IRQ_S0_CD_VALID, |
189 | IRQ_S0_BVD1_STSCHG, | 189 | IRQ_S0_BVD1_STSCHG, |
@@ -194,6 +194,11 @@ static struct sa1111_dev_info sa1111_devices[] = { | |||
194 | }, | 194 | }, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | static int sa1111_map_irq(struct sa1111 *sachip, irq_hw_number_t hwirq) | ||
198 | { | ||
199 | return irq_create_mapping(sachip->irqdomain, hwirq); | ||
200 | } | ||
201 | |||
197 | static void sa1111_handle_irqdomain(struct irq_domain *irqdomain, int irq) | 202 | static void sa1111_handle_irqdomain(struct irq_domain *irqdomain, int irq) |
198 | { | 203 | { |
199 | struct irq_desc *d = irq_to_desc(irq_linear_revmap(irqdomain, irq)); | 204 | struct irq_desc *d = irq_to_desc(irq_linear_revmap(irqdomain, irq)); |
@@ -360,6 +365,10 @@ static int sa1111_irqdomain_map(struct irq_domain *d, unsigned int irq, | |||
360 | { | 365 | { |
361 | struct sa1111 *sachip = d->host_data; | 366 | struct sa1111 *sachip = d->host_data; |
362 | 367 | ||
368 | /* Disallow unavailable interrupts */ | ||
369 | if (hwirq > SSPROR && hwirq < AUDXMTDMADONEA) | ||
370 | return -EINVAL; | ||
371 | |||
363 | irq_set_chip_data(irq, sachip); | 372 | irq_set_chip_data(irq, sachip); |
364 | irq_set_chip_and_handler(irq, &sa1111_irq_chip, handle_edge_irq); | 373 | irq_set_chip_and_handler(irq, &sa1111_irq_chip, handle_edge_irq); |
365 | irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); | 374 | irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE); |
@@ -443,7 +452,9 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) | |||
443 | 452 | ||
444 | static void sa1111_remove_irq(struct sa1111 *sachip) | 453 | static void sa1111_remove_irq(struct sa1111 *sachip) |
445 | { | 454 | { |
455 | struct irq_domain *domain = sachip->irqdomain; | ||
446 | void __iomem *irqbase = sachip->base + SA1111_INTC; | 456 | void __iomem *irqbase = sachip->base + SA1111_INTC; |
457 | int i; | ||
447 | 458 | ||
448 | /* disable all IRQs */ | 459 | /* disable all IRQs */ |
449 | writel_relaxed(0, irqbase + SA1111_INTEN0); | 460 | writel_relaxed(0, irqbase + SA1111_INTEN0); |
@@ -451,10 +462,10 @@ static void sa1111_remove_irq(struct sa1111 *sachip) | |||
451 | writel_relaxed(0, irqbase + SA1111_WAKEEN0); | 462 | writel_relaxed(0, irqbase + SA1111_WAKEEN0); |
452 | writel_relaxed(0, irqbase + SA1111_WAKEEN1); | 463 | writel_relaxed(0, irqbase + SA1111_WAKEEN1); |
453 | 464 | ||
454 | irq_domain_remove(sachip->irqdomain); | ||
455 | |||
456 | irq_set_chained_handler_and_data(sachip->irq, NULL, NULL); | 465 | irq_set_chained_handler_and_data(sachip->irq, NULL, NULL); |
457 | irq_free_descs(sachip->irq_base, SA1111_IRQ_NR); | 466 | for (i = 0; i < SA1111_IRQ_NR; i++) |
467 | irq_dispose_mapping(irq_find_mapping(domain, i)); | ||
468 | irq_domain_remove(domain); | ||
458 | 469 | ||
459 | release_mem_region(sachip->phys + SA1111_INTC, 512); | 470 | release_mem_region(sachip->phys + SA1111_INTC, 512); |
460 | } | 471 | } |
@@ -595,7 +606,7 @@ static int sa1111_gpio_to_irq(struct gpio_chip *gc, unsigned offset) | |||
595 | { | 606 | { |
596 | struct sa1111 *sachip = gc_to_sa1111(gc); | 607 | struct sa1111 *sachip = gc_to_sa1111(gc); |
597 | 608 | ||
598 | return sachip->irq_base + offset; | 609 | return sa1111_map_irq(sachip, offset); |
599 | } | 610 | } |
600 | 611 | ||
601 | static int sa1111_setup_gpios(struct sa1111 *sachip) | 612 | static int sa1111_setup_gpios(struct sa1111 *sachip) |
@@ -746,8 +757,8 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, | |||
746 | dev->mapbase = sachip->base + info->offset; | 757 | dev->mapbase = sachip->base + info->offset; |
747 | dev->skpcr_mask = info->skpcr_mask; | 758 | dev->skpcr_mask = info->skpcr_mask; |
748 | 759 | ||
749 | for (i = 0; i < ARRAY_SIZE(info->irq); i++) | 760 | for (i = 0; i < ARRAY_SIZE(info->hwirq); i++) |
750 | dev->irq[i] = sachip->irq_base + info->irq[i]; | 761 | dev->hwirq[i] = info->hwirq[i]; |
751 | 762 | ||
752 | /* | 763 | /* |
753 | * If the parent device has a DMA mask associated with it, and | 764 | * If the parent device has a DMA mask associated with it, and |
@@ -1380,9 +1391,10 @@ EXPORT_SYMBOL(sa1111_disable_device); | |||
1380 | 1391 | ||
1381 | int sa1111_get_irq(struct sa1111_dev *sadev, unsigned num) | 1392 | int sa1111_get_irq(struct sa1111_dev *sadev, unsigned num) |
1382 | { | 1393 | { |
1383 | if (num >= ARRAY_SIZE(sadev->irq)) | 1394 | struct sa1111 *sachip = sa1111_chip_driver(sadev); |
1395 | if (num >= ARRAY_SIZE(sadev->hwirq)) | ||
1384 | return -EINVAL; | 1396 | return -EINVAL; |
1385 | return sadev->irq[num]; | 1397 | return sa1111_map_irq(sachip, sadev->hwirq[num]); |
1386 | } | 1398 | } |
1387 | EXPORT_SYMBOL_GPL(sa1111_get_irq); | 1399 | EXPORT_SYMBOL_GPL(sa1111_get_irq); |
1388 | 1400 | ||
diff --git a/arch/arm/include/asm/hardware/sa1111.h b/arch/arm/include/asm/hardware/sa1111.h index 709980647dd1..798e520e8a49 100644 --- a/arch/arm/include/asm/hardware/sa1111.h +++ b/arch/arm/include/asm/hardware/sa1111.h | |||
@@ -390,7 +390,7 @@ struct sa1111_dev { | |||
390 | struct resource res; | 390 | struct resource res; |
391 | void __iomem *mapbase; | 391 | void __iomem *mapbase; |
392 | unsigned int skpcr_mask; | 392 | unsigned int skpcr_mask; |
393 | unsigned int irq[6]; | 393 | unsigned int hwirq[6]; |
394 | u64 dma_mask; | 394 | u64 dma_mask; |
395 | }; | 395 | }; |
396 | 396 | ||