diff options
author | Heiko Stuebner <heiko@sntech.de> | 2013-02-12 13:09:13 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2013-03-05 06:21:04 -0500 |
commit | d3d5a2c9e6cf9723fe7ba9ad918540ad53ae381c (patch) | |
tree | 2b8dbc05126bde2aa9fd6d2e314c72022e6800e4 /arch/arm/mach-s3c24xx | |
parent | 592957085e3763b9339a6a281f1aeb1247cdd245 (diff) |
ARM: S3C24XX: move s3c2412 irq init to common code
Base for further cleanups
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c24xx')
-rw-r--r-- | arch/arm/mach-s3c24xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c24xx/irq-s3c2412.c | 192 | ||||
-rw-r--r-- | arch/arm/mach-s3c24xx/irq.c | 154 |
3 files changed, 155 insertions, 193 deletions
diff --git a/arch/arm/mach-s3c24xx/Makefile b/arch/arm/mach-s3c24xx/Makefile index 90412607fb47..be6e4d0e6f1a 100644 --- a/arch/arm/mach-s3c24xx/Makefile +++ b/arch/arm/mach-s3c24xx/Makefile | |||
@@ -22,7 +22,7 @@ obj-$(CONFIG_S3C2410_DMA) += dma-s3c2410.o | |||
22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o | 22 | obj-$(CONFIG_S3C2410_PLL) += pll-s3c2410.o |
23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o | 23 | obj-$(CONFIG_S3C2410_PM) += pm-s3c2410.o sleep-s3c2410.o |
24 | 24 | ||
25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o irq-s3c2412.o clock-s3c2412.o | 25 | obj-$(CONFIG_CPU_S3C2412) += s3c2412.o clock-s3c2412.o |
26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o | 26 | obj-$(CONFIG_S3C2412_CPUFREQ) += cpufreq-s3c2412.o |
27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o | 27 | obj-$(CONFIG_S3C2412_DMA) += dma-s3c2412.o |
28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o | 28 | obj-$(CONFIG_S3C2412_PM) += pm-s3c2412.o |
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2412.c b/arch/arm/mach-s3c24xx/irq-s3c2412.c deleted file mode 100644 index e6fd954c5fd4..000000000000 --- a/arch/arm/mach-s3c24xx/irq-s3c2412.c +++ /dev/null | |||
@@ -1,192 +0,0 @@ | |||
1 | /* linux/arch/arm/mach-s3c2412/irq.c | ||
2 | * | ||
3 | * Copyright (c) 2006 Simtec Electronics | ||
4 | * Ben Dooks <ben@simtec.co.uk> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/init.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/interrupt.h> | ||
25 | #include <linux/ioport.h> | ||
26 | #include <linux/device.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/regs-irq.h> | ||
35 | #include <mach/regs-gpio.h> | ||
36 | |||
37 | #include <plat/cpu.h> | ||
38 | #include <plat/irq.h> | ||
39 | #include <plat/pm.h> | ||
40 | |||
41 | #include "s3c2412-power.h" | ||
42 | |||
43 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
44 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | ||
45 | |||
46 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
47 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
48 | * both show the status, they both now need to be acked when the IRQs | ||
49 | * go off. | ||
50 | */ | ||
51 | |||
52 | static void | ||
53 | s3c2412_irq_mask(struct irq_data *data) | ||
54 | { | ||
55 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
56 | unsigned long mask; | ||
57 | |||
58 | mask = __raw_readl(S3C2410_INTMSK); | ||
59 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
60 | |||
61 | mask = __raw_readl(S3C2412_EINTMASK); | ||
62 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
63 | } | ||
64 | |||
65 | static inline void | ||
66 | s3c2412_irq_ack(struct irq_data *data) | ||
67 | { | ||
68 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
69 | |||
70 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
71 | __raw_writel(bitval, S3C2410_SRCPND); | ||
72 | __raw_writel(bitval, S3C2410_INTPND); | ||
73 | } | ||
74 | |||
75 | static inline void | ||
76 | s3c2412_irq_maskack(struct irq_data *data) | ||
77 | { | ||
78 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
79 | unsigned long mask; | ||
80 | |||
81 | mask = __raw_readl(S3C2410_INTMSK); | ||
82 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
83 | |||
84 | mask = __raw_readl(S3C2412_EINTMASK); | ||
85 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
86 | |||
87 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
88 | __raw_writel(bitval, S3C2410_SRCPND); | ||
89 | __raw_writel(bitval, S3C2410_INTPND); | ||
90 | } | ||
91 | |||
92 | static void | ||
93 | s3c2412_irq_unmask(struct irq_data *data) | ||
94 | { | ||
95 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
96 | unsigned long mask; | ||
97 | |||
98 | mask = __raw_readl(S3C2412_EINTMASK); | ||
99 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
100 | |||
101 | mask = __raw_readl(S3C2410_INTMSK); | ||
102 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
103 | } | ||
104 | |||
105 | static struct irq_chip s3c2412_irq_eint0t4 = { | ||
106 | .irq_ack = s3c2412_irq_ack, | ||
107 | .irq_mask = s3c2412_irq_mask, | ||
108 | .irq_unmask = s3c2412_irq_unmask, | ||
109 | .irq_set_wake = s3c_irq_wake, | ||
110 | .irq_set_type = s3c_irqext_type, | ||
111 | }; | ||
112 | |||
113 | #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) | ||
114 | |||
115 | /* CF and SDI sub interrupts */ | ||
116 | |||
117 | static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) | ||
118 | { | ||
119 | unsigned int subsrc, submsk; | ||
120 | |||
121 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
122 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
123 | |||
124 | subsrc &= ~submsk; | ||
125 | |||
126 | if (subsrc & INTBIT(IRQ_S3C2412_SDI)) | ||
127 | generic_handle_irq(IRQ_S3C2412_SDI); | ||
128 | |||
129 | if (subsrc & INTBIT(IRQ_S3C2412_CF)) | ||
130 | generic_handle_irq(IRQ_S3C2412_CF); | ||
131 | } | ||
132 | |||
133 | #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) | ||
134 | #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) | ||
135 | |||
136 | static void s3c2412_irq_cfsdi_mask(struct irq_data *data) | ||
137 | { | ||
138 | s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
139 | } | ||
140 | |||
141 | static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) | ||
142 | { | ||
143 | s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); | ||
144 | } | ||
145 | |||
146 | static void s3c2412_irq_cfsdi_ack(struct irq_data *data) | ||
147 | { | ||
148 | s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
149 | } | ||
150 | |||
151 | static struct irq_chip s3c2412_irq_cfsdi = { | ||
152 | .name = "s3c2412-cfsdi", | ||
153 | .irq_ack = s3c2412_irq_cfsdi_ack, | ||
154 | .irq_mask = s3c2412_irq_cfsdi_mask, | ||
155 | .irq_unmask = s3c2412_irq_cfsdi_unmask, | ||
156 | }; | ||
157 | |||
158 | static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | ||
159 | { | ||
160 | unsigned int irqno; | ||
161 | |||
162 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
163 | irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, | ||
164 | handle_edge_irq); | ||
165 | set_irq_flags(irqno, IRQF_VALID); | ||
166 | } | ||
167 | |||
168 | /* add demux support for CF/SDI */ | ||
169 | |||
170 | irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); | ||
171 | |||
172 | for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { | ||
173 | irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, | ||
174 | handle_level_irq); | ||
175 | set_irq_flags(irqno, IRQF_VALID); | ||
176 | } | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
181 | static struct subsys_interface s3c2412_irq_interface = { | ||
182 | .name = "s3c2412_irq", | ||
183 | .subsys = &s3c2412_subsys, | ||
184 | .add_dev = s3c2412_irq_add, | ||
185 | }; | ||
186 | |||
187 | static int s3c2412_irq_init(void) | ||
188 | { | ||
189 | return subsys_interface_register(&s3c2412_irq_interface); | ||
190 | } | ||
191 | |||
192 | arch_initcall(s3c2412_irq_init); | ||
diff --git a/arch/arm/mach-s3c24xx/irq.c b/arch/arm/mach-s3c24xx/irq.c index ddb6752e5948..2bb4a97e527e 100644 --- a/arch/arm/mach-s3c24xx/irq.c +++ b/arch/arm/mach-s3c24xx/irq.c | |||
@@ -626,6 +626,160 @@ void __init s3c24xx_init_irq(void) | |||
626 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); | 626 | s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4); |
627 | } | 627 | } |
628 | 628 | ||
629 | #ifdef CONFIG_CPU_S3C2412 | ||
630 | |||
631 | #define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1) | ||
632 | #define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0)))) | ||
633 | |||
634 | /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by | ||
635 | * having them turn up in both the INT* and the EINT* registers. Whilst | ||
636 | * both show the status, they both now need to be acked when the IRQs | ||
637 | * go off. | ||
638 | */ | ||
639 | |||
640 | static void | ||
641 | s3c2412_irq_mask(struct irq_data *data) | ||
642 | { | ||
643 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
644 | unsigned long mask; | ||
645 | |||
646 | mask = __raw_readl(S3C2410_INTMSK); | ||
647 | __raw_writel(mask | bitval, S3C2410_INTMSK); | ||
648 | |||
649 | mask = __raw_readl(S3C2412_EINTMASK); | ||
650 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
651 | } | ||
652 | |||
653 | static inline void | ||
654 | s3c2412_irq_ack(struct irq_data *data) | ||
655 | { | ||
656 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
657 | |||
658 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
659 | __raw_writel(bitval, S3C2410_SRCPND); | ||
660 | __raw_writel(bitval, S3C2410_INTPND); | ||
661 | } | ||
662 | |||
663 | static inline void | ||
664 | s3c2412_irq_maskack(struct irq_data *data) | ||
665 | { | ||
666 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
667 | unsigned long mask; | ||
668 | |||
669 | mask = __raw_readl(S3C2410_INTMSK); | ||
670 | __raw_writel(mask|bitval, S3C2410_INTMSK); | ||
671 | |||
672 | mask = __raw_readl(S3C2412_EINTMASK); | ||
673 | __raw_writel(mask | bitval, S3C2412_EINTMASK); | ||
674 | |||
675 | __raw_writel(bitval, S3C2412_EINTPEND); | ||
676 | __raw_writel(bitval, S3C2410_SRCPND); | ||
677 | __raw_writel(bitval, S3C2410_INTPND); | ||
678 | } | ||
679 | |||
680 | static void | ||
681 | s3c2412_irq_unmask(struct irq_data *data) | ||
682 | { | ||
683 | unsigned long bitval = 1UL << (data->irq - IRQ_EINT0); | ||
684 | unsigned long mask; | ||
685 | |||
686 | mask = __raw_readl(S3C2412_EINTMASK); | ||
687 | __raw_writel(mask & ~bitval, S3C2412_EINTMASK); | ||
688 | |||
689 | mask = __raw_readl(S3C2410_INTMSK); | ||
690 | __raw_writel(mask & ~bitval, S3C2410_INTMSK); | ||
691 | } | ||
692 | |||
693 | static struct irq_chip s3c2412_irq_eint0t4 = { | ||
694 | .irq_ack = s3c2412_irq_ack, | ||
695 | .irq_mask = s3c2412_irq_mask, | ||
696 | .irq_unmask = s3c2412_irq_unmask, | ||
697 | .irq_set_wake = s3c_irq_wake, | ||
698 | .irq_set_type = s3c_irqext_type, | ||
699 | }; | ||
700 | |||
701 | #define INTBIT(x) (1 << ((x) - S3C2410_IRQSUB(0))) | ||
702 | |||
703 | /* CF and SDI sub interrupts */ | ||
704 | |||
705 | static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc) | ||
706 | { | ||
707 | unsigned int subsrc, submsk; | ||
708 | |||
709 | subsrc = __raw_readl(S3C2410_SUBSRCPND); | ||
710 | submsk = __raw_readl(S3C2410_INTSUBMSK); | ||
711 | |||
712 | subsrc &= ~submsk; | ||
713 | |||
714 | if (subsrc & INTBIT(IRQ_S3C2412_SDI)) | ||
715 | generic_handle_irq(IRQ_S3C2412_SDI); | ||
716 | |||
717 | if (subsrc & INTBIT(IRQ_S3C2412_CF)) | ||
718 | generic_handle_irq(IRQ_S3C2412_CF); | ||
719 | } | ||
720 | |||
721 | #define INTMSK_CFSDI (1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0)) | ||
722 | #define SUBMSK_CFSDI INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF) | ||
723 | |||
724 | static void s3c2412_irq_cfsdi_mask(struct irq_data *data) | ||
725 | { | ||
726 | s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
727 | } | ||
728 | |||
729 | static void s3c2412_irq_cfsdi_unmask(struct irq_data *data) | ||
730 | { | ||
731 | s3c_irqsub_unmask(data->irq, INTMSK_CFSDI); | ||
732 | } | ||
733 | |||
734 | static void s3c2412_irq_cfsdi_ack(struct irq_data *data) | ||
735 | { | ||
736 | s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI); | ||
737 | } | ||
738 | |||
739 | static struct irq_chip s3c2412_irq_cfsdi = { | ||
740 | .name = "s3c2412-cfsdi", | ||
741 | .irq_ack = s3c2412_irq_cfsdi_ack, | ||
742 | .irq_mask = s3c2412_irq_cfsdi_mask, | ||
743 | .irq_unmask = s3c2412_irq_cfsdi_unmask, | ||
744 | }; | ||
745 | |||
746 | static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif) | ||
747 | { | ||
748 | unsigned int irqno; | ||
749 | |||
750 | for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) { | ||
751 | irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4, | ||
752 | handle_edge_irq); | ||
753 | set_irq_flags(irqno, IRQF_VALID); | ||
754 | } | ||
755 | |||
756 | /* add demux support for CF/SDI */ | ||
757 | |||
758 | irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi); | ||
759 | |||
760 | for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) { | ||
761 | irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi, | ||
762 | handle_level_irq); | ||
763 | set_irq_flags(irqno, IRQF_VALID); | ||
764 | } | ||
765 | |||
766 | return 0; | ||
767 | } | ||
768 | |||
769 | static struct subsys_interface s3c2412_irq_interface = { | ||
770 | .name = "s3c2412_irq", | ||
771 | .subsys = &s3c2412_subsys, | ||
772 | .add_dev = s3c2412_irq_add, | ||
773 | }; | ||
774 | |||
775 | static int s3c2412_irq_init(void) | ||
776 | { | ||
777 | return subsys_interface_register(&s3c2412_irq_interface); | ||
778 | } | ||
779 | |||
780 | arch_initcall(s3c2412_irq_init); | ||
781 | #endif | ||
782 | |||
629 | #ifdef CONFIG_CPU_S3C2416 | 783 | #ifdef CONFIG_CPU_S3C2416 |
630 | static struct s3c_irq_data init_s3c2416base[32] = { | 784 | static struct s3c_irq_data init_s3c2416base[32] = { |
631 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ | 785 | { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ |