aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c24xx
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2013-02-12 12:59:35 -0500
committerKukjin Kim <kgene.kim@samsung.com>2013-03-05 06:20:54 -0500
commitf0301673ff7ad8aae45c4a95613771d34b1cf052 (patch)
treef0eacb50fef5736314a1ea3ca0e7ba671fe7614b /arch/arm/mach-s3c24xx
parent70644ade48ae88f88f4935c4d2f3331c3ef177a1 (diff)
ARM: S3C24XX: transform s3c2440 irqs into new structure
As always a mapping structure is everything needed. 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/irq.c196
1 files changed, 61 insertions, 135 deletions
diff --git a/arch/arm/mach-s3c24xx/irq.c b/arch/arm/mach-s3c24xx/irq.c
index 7d4061980bb2..ddb6752e5948 100644
--- a/arch/arm/mach-s3c24xx/irq.c
+++ b/arch/arm/mach-s3c24xx/irq.c
@@ -729,150 +729,78 @@ void __init s3c2416_init_irq(void)
729 729
730#endif 730#endif
731 731
732#ifdef CONFIG_CPU_S3C244X
733/* camera irq */
734
735static void s3c_irq_demux_cam(unsigned int irq,
736 struct irq_desc *desc)
737{
738 unsigned int subsrc, submsk;
739
740 /* read the current pending interrupts, and the mask
741 * for what it is available */
742
743 subsrc = __raw_readl(S3C2410_SUBSRCPND);
744 submsk = __raw_readl(S3C2410_INTSUBMSK);
745
746 subsrc &= ~submsk;
747 subsrc >>= 11;
748 subsrc &= 3;
749
750 if (subsrc != 0) {
751 if (subsrc & 1) {
752 generic_handle_irq(IRQ_S3C2440_CAM_C);
753 }
754 if (subsrc & 2) {
755 generic_handle_irq(IRQ_S3C2440_CAM_P);
756 }
757 }
758}
759
760#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
761
762static void
763s3c_irq_cam_mask(struct irq_data *data)
764{
765 s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
766}
767
768static void
769s3c_irq_cam_unmask(struct irq_data *data)
770{
771 s3c_irqsub_unmask(data->irq, INTMSK_CAM);
772}
773
774static void
775s3c_irq_cam_ack(struct irq_data *data)
776{
777 s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
778}
779
780static struct irq_chip s3c_irq_cam = {
781 .irq_mask = s3c_irq_cam_mask,
782 .irq_unmask = s3c_irq_cam_unmask,
783 .irq_ack = s3c_irq_cam_ack,
784};
785
786#ifdef CONFIG_CPU_S3C2440 732#ifdef CONFIG_CPU_S3C2440
787/* WDT/AC97 */ 733static struct s3c_irq_data init_s3c2440base[32] = {
788 734 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
789static void s3c_irq_demux_wdtac97(unsigned int irq, 735 { .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
790 struct irq_desc *desc) 736 { .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
791{ 737 { .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
792 unsigned int subsrc, submsk; 738 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
793 739 { .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
794 /* read the current pending interrupts, and the mask 740 { .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
795 * for what it is available */ 741 { .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
796 742 { .type = S3C_IRQTYPE_EDGE, }, /* TICK */
797 subsrc = __raw_readl(S3C2410_SUBSRCPND); 743 { .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
798 submsk = __raw_readl(S3C2410_INTSUBMSK); 744 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
799 745 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
800 subsrc &= ~submsk; 746 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
801 subsrc >>= 13; 747 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
802 subsrc &= 3; 748 { .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
803 749 { .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
804 if (subsrc != 0) { 750 { .type = S3C_IRQTYPE_EDGE, }, /* LCD */
805 if (subsrc & 1) { 751 { .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
806 generic_handle_irq(IRQ_S3C2440_WDT); 752 { .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
807 } 753 { .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
808 if (subsrc & 2) { 754 { .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
809 generic_handle_irq(IRQ_S3C2440_AC97); 755 { .type = S3C_IRQTYPE_EDGE, }, /* SDI */
810 } 756 { .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
811 } 757 { .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
812} 758 { .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
813 759 { .type = S3C_IRQTYPE_EDGE, }, /* USBD */
814 760 { .type = S3C_IRQTYPE_EDGE, }, /* USBH */
815#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0)) 761 { .type = S3C_IRQTYPE_EDGE, }, /* IIC */
816 762 { .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
817static void 763 { .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
818s3c_irq_wdtac97_mask(struct irq_data *data) 764 { .type = S3C_IRQTYPE_EDGE, }, /* RTC */
819{ 765 { .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
820 s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13); 766};
821}
822
823static void
824s3c_irq_wdtac97_unmask(struct irq_data *data)
825{
826 s3c_irqsub_unmask(data->irq, INTMSK_WDT);
827}
828
829static void
830s3c_irq_wdtac97_ack(struct irq_data *data)
831{
832 s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13);
833}
834 767
835static struct irq_chip s3c_irq_wdtac97 = { 768static struct s3c_irq_data init_s3c2440subint[32] = {
836 .irq_mask = s3c_irq_wdtac97_mask, 769 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
837 .irq_unmask = s3c_irq_wdtac97_unmask, 770 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
838 .irq_ack = s3c_irq_wdtac97_ack, 771 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
772 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
773 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
774 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
775 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
776 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
777 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
778 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
779 { .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
780 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */
781 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */
782 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
783 { .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
839}; 784};
840 785
841void __init s3c2440_init_irq(void) 786void __init s3c2440_init_irq(void)
842{ 787{
843 unsigned int irqno; 788 struct s3c_irq_intc *main_intc;
844
845 printk("S3C2440: IRQ Support\n");
846
847 s3c24xx_init_irq();
848
849 irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
850 handle_level_irq);
851 set_irq_flags(IRQ_NFCON, IRQF_VALID);
852 789
853 /* add chained handler for camera */ 790 pr_info("S3C2440: IRQ Support\n");
854 791
855 irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip, 792#ifdef CONFIG_FIQ
856 handle_level_irq); 793 init_FIQ(FIQ_START);
857 irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam); 794#endif
858 795
859 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) { 796 main_intc = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, 0x4a000000);
860 irq_set_chip_and_handler(irqno, &s3c_irq_cam, 797 if (IS_ERR(main_intc)) {
861 handle_level_irq); 798 pr_err("irq: could not create main interrupt controller\n");
862 set_irq_flags(irqno, IRQF_VALID); 799 return;
863 } 800 }
864 801
865 /* add new chained handler for wdt, ac7 */ 802 s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
866 803 s3c24xx_init_intc(NULL, &init_s3c2440subint[0], main_intc, 0x4a000018);
867 irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip,
868 handle_level_irq);
869 irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
870
871 for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
872 irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97,
873 handle_level_irq);
874 set_irq_flags(irqno, IRQF_VALID);
875 }
876} 804}
877#endif 805#endif
878 806
@@ -949,8 +877,6 @@ void __init s3c2442_init_irq(void)
949} 877}
950#endif 878#endif
951 879
952#endif
953
954#ifdef CONFIG_CPU_S3C2443 880#ifdef CONFIG_CPU_S3C2443
955static struct s3c_irq_data init_s3c2443base[32] = { 881static struct s3c_irq_data init_s3c2443base[32] = {
956 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */ 882 { .type = S3C_IRQTYPE_EINT, }, /* EINT0 */