Skip to contentSkip to conversation

ARM: S3C24XX: irq rework for S3C2412, S3C2440 and S3C2442

PATCH New Heiko Stübner 2 participants 12 messages Feb 9, 2013 – Feb 12, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: S3C24XX: irq rework for S3C2412, S3C2440 and S3C2442

This series finishes the irq rework by moving the irqs for s3c2412, s3c2440 and s3c2442 into the new structure.

Now the only open point is the different handling of the eint0 to eint3 interrupts on the s3c2412. On this SoC these interrupts are represented in both the main register and the eint register and also need to be handled in both.

As this should be handlable via the new structure, I'm still investigating the right way to do it. Therefore the override of the eint0 to eint3 interrupts will still remain for a bit.

As I lack the relevant hardware, this series is compile tested only, but as the used mechanisms are the same as with the s3c2416, there shouldn't be any complications.

This series applies on top of the moved s3c24XX.h headers into the common.h file in mach-s3c24xx.

changes since v1:
- included the changes for the s3c2412

Heiko Stuebner (10):
ARM: S3C24XX: move s3c244x irq init to common irq code
ARM: S3C24XX: create dedicated irq init functions for s3c2440 and s3c2442
ARM: S3C24XX: move s3c2440 irqs to common irq code
ARM: S3C24XX: integrate s3c2440 irqs into common init
ARM: S3C24XX: transform s3c2442 irqs into new structure
ARM: S3C24XX: transform s3c2440 irqs into new structure
ARM: S3C24XX: use samsung_sync_wakemask in s3c2412 pm
ARM: S3C24XX: move s3c2412 irq init to common code
ARM: S3C24XX: modify s3c2412 irq init to initialize all irqs
ARM: S3C24XX: transform s3c2412 irqs into new structure

 arch/arm/mach-s3c24xx/Kconfig          |    1 +
 arch/arm/mach-s3c24xx/Makefile         |    6 +-
 arch/arm/mach-s3c24xx/common.h         |    3 +
 arch/arm/mach-s3c24xx/irq-s3c2412.c    |  215 -----------------------
 arch/arm/mach-s3c24xx/irq-s3c2440.c    |  128 --------------
 arch/arm/mach-s3c24xx/irq-s3c244x.c    |  142 ---------------
 arch/arm/mach-s3c24xx/irq.c            |  299 ++++++++++++++++++++++++++++++++
 arch/arm/mach-s3c24xx/mach-anubis.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-at2440evb.c |    2 +-
 arch/arm/mach-s3c24xx/mach-gta02.c     |    2 +-
 arch/arm/mach-s3c24xx/mach-jive.c      |    2 +-
 arch/arm/mach-s3c24xx/mach-mini2440.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-nexcoder.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-osiris.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx3715.c    |    7 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c  |    6 +-
 arch/arm/mach-s3c24xx/mach-smdk2440.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-vstms.c     |    2 +-
 arch/arm/mach-s3c24xx/pm-s3c2412.c     |    8 +
 20 files changed, 328 insertions(+), 507 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2412.c
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2440.c
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c244x.c
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH v2 1/10 ARM: S3C24XX: move s3c244x irq init to common irq code

Base for further modifications.

---
 arch/arm/mach-s3c24xx/Makefile      |    2 +-
 arch/arm/mach-s3c24xx/irq-s3c244x.c |  142 -----------------------------------
 arch/arm/mach-s3c24xx/irq.c         |  105 ++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 143 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c244x.c
arch/arm/mach-s3c24xx/Makefile +1 -1
index af53d27..051b8f9 100644
@@ -33,7 +33,7 @@ obj-$(CONFIG_S3C2416_PM)	+= pm-s3c2416.o
 
 obj-$(CONFIG_CPU_S3C2440)	+= s3c2440.o irq-s3c2440.o clock-s3c2440.o
 obj-$(CONFIG_CPU_S3C2442)	+= s3c2442.o
-obj-$(CONFIG_CPU_S3C244X)	+= s3c244x.o irq-s3c244x.o clock-s3c244x.o
+obj-$(CONFIG_CPU_S3C244X)	+= s3c244x.o clock-s3c244x.o
 obj-$(CONFIG_S3C2440_CPUFREQ)	+= cpufreq-s3c2440.o
 obj-$(CONFIG_S3C2440_DMA)	+= dma-s3c2440.o
 obj-$(CONFIG_S3C2440_PLL_12000000) += pll-s3c2440-12000000.o
arch/arm/mach-s3c24xx/irq-s3c244x.c deleted +0 -142

142 lines not on this page · raw message

arch/arm/mach-s3c24xx/irq.c +105 -0

111 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

PATCH v2 2/10 ARM: S3C24XX: create dedicated irq init functions for s3c2440 and s3c2442

In reply to Heiko Stübner

s3c2440 and s3c2442 need separate init functions, as the s3c2440 contains even more differing irqs that will be moved in the following patch.

---
 arch/arm/mach-s3c24xx/common.h         |    2 +
 arch/arm/mach-s3c24xx/irq.c            |   45 ++++++++++++++++---------------
 arch/arm/mach-s3c24xx/mach-anubis.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-at2440evb.c |    2 +-
 arch/arm/mach-s3c24xx/mach-gta02.c     |    2 +-
 arch/arm/mach-s3c24xx/mach-mini2440.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-nexcoder.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-osiris.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx3715.c    |    7 +----
 arch/arm/mach-s3c24xx/mach-smdk2440.c  |    2 +-
 11 files changed, 34 insertions(+), 36 deletions(-)
arch/arm/mach-s3c24xx/common.h +2 -0
index 8a2b413..362a8cd 100644
@@ -73,6 +73,7 @@ extern void s3c244x_restart(char mode, const char *cmd);
 #ifdef CONFIG_CPU_S3C2440
 extern  int s3c2440_init(void);
 extern void s3c2440_map_io(void);
+extern void s3c2440_init_irq(void);
 #else
 #define s3c2440_init NULL
 #define s3c2440_map_io NULL
@@ -81,6 +82,7 @@ extern void s3c2440_map_io(void);
 #ifdef CONFIG_CPU_S3C2442
 extern  int s3c2442_init(void);
 extern void s3c2442_map_io(void);
+extern void s3c2442_init_irq(void);
 #else
 #define s3c2442_init NULL
 #define s3c2442_map_io NULL
arch/arm/mach-s3c24xx/irq.c +23 -22

69 lines not on this page · raw message

arch/arm/mach-s3c24xx/mach-anubis.c +1 -1
index 24f1a04..c1fb6c3 100644
@@ -445,7 +445,7 @@ MACHINE_START(ANUBIS, "Simtec-Anubis")
 	.atag_offset	= 0x100,
 	.map_io		= anubis_map_io,
 	.init_machine	= anubis_init,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-at2440evb.c +1 -1
index 2bf6c8c..6dfeeb7 100644
@@ -211,7 +211,7 @@ MACHINE_START(AT2440EVB, "AT2440EVB")
 	.atag_offset	= 0x100,
 	.map_io		= at2440evb_map_io,
 	.init_machine	= at2440evb_init,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-gta02.c +1 -1
index 84a750d..13d8d07 100644
@@ -589,7 +589,7 @@ MACHINE_START(NEO1973_GTA02, "GTA02")
 	/* Maintainer: Nelson Castillo <[email protected]> */
 	.atag_offset	= 0x100,
 	.map_io		= gta02_map_io,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2442_init_irq,
 	.init_machine	= gta02_machine_init,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
arch/arm/mach-s3c24xx/mach-mini2440.c +1 -1
index 29f106c..a83db46 100644
@@ -688,7 +688,7 @@ MACHINE_START(MINI2440, "MINI2440")
 	.atag_offset	= 0x100,
 	.map_io		= mini2440_map_io,
 	.init_machine	= mini2440_init,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-nexcoder.c +1 -1
index 5c826d1..01f4354 100644
@@ -152,7 +152,7 @@ MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
 	.atag_offset	= 0x100,
 	.map_io		= nexcoder_map_io,
 	.init_machine	= nexcoder_init,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
 MACHINE_END
arch/arm/mach-s3c24xx/mach-osiris.c +1 -1
index ef3a7b0..de78fbb 100644
@@ -425,7 +425,7 @@ MACHINE_START(OSIRIS, "Simtec-OSIRIS")
 	/* Maintainer: Ben Dooks <[email protected]> */
 	.atag_offset	= 0x100,
 	.map_io		= osiris_map_io,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_machine	= osiris_init,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
arch/arm/mach-s3c24xx/mach-rx1950.c +1 -1
index 64b52a9..44ca018 100644
@@ -812,7 +812,7 @@ MACHINE_START(RX1950, "HP iPAQ RX1950")
 	.atag_offset = 0x100,
 	.map_io = rx1950_map_io,
 	.reserve	= rx1950_reserve,
-	.init_irq = s3c24xx_init_irq,
+	.init_irq	= s3c2442_init_irq,
 	.init_machine = rx1950_init_machine,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
arch/arm/mach-s3c24xx/mach-rx3715.c +1 -6
index 0a3c964..3bc6231 100644
@@ -190,11 +190,6 @@ static void __init rx3715_reserve(void)
 	memblock_reserve(0x30081000, 0x1000);
 }
 
-static void __init rx3715_init_irq(void)
-{
-	s3c24xx_init_irq();
-}
-
 static void __init rx3715_init_machine(void)
 {
 #ifdef CONFIG_PM_H1940
@@ -212,7 +207,7 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
 	.atag_offset	= 0x100,
 	.map_io		= rx3715_map_io,
 	.reserve	= rx3715_reserve,
-	.init_irq	= rx3715_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.init_machine	= rx3715_init_machine,
 	.init_time	= samsung_timer_init,
 	.restart	= s3c244x_restart,
arch/arm/mach-s3c24xx/mach-smdk2440.c +1 -1
index 3f13e85..90be6d0 100644
@@ -178,7 +178,7 @@ MACHINE_START(S3C2440, "SMDK2440")
 	/* Maintainer: Ben Dooks <[email protected]> */
 	.atag_offset	= 0x100,
 
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2440_init_irq,
 	.map_io		= smdk2440_map_io,
 	.init_machine	= smdk2440_machine_init,
 	.init_time	= samsung_timer_init,
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH v2 3/10 ARM: S3C24XX: move s3c2440 irqs to common irq code

In reply to Heiko Stübner

Will be integrated in the following patch.

---
 arch/arm/mach-s3c24xx/Makefile      |    2 +-
 arch/arm/mach-s3c24xx/irq-s3c2440.c |  128 -----------------------------------
 arch/arm/mach-s3c24xx/irq.c         |   88 ++++++++++++++++++++++++
 3 files changed, 89 insertions(+), 129 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2440.c
arch/arm/mach-s3c24xx/Makefile +1 -1
index 051b8f9..9041260 100644
@@ -31,7 +31,7 @@ obj-$(CONFIG_S3C2412_PM_SLEEP)	+= sleep-s3c2412.o
 obj-$(CONFIG_CPU_S3C2416)	+= s3c2416.o clock-s3c2416.o
 obj-$(CONFIG_S3C2416_PM)	+= pm-s3c2416.o
 
-obj-$(CONFIG_CPU_S3C2440)	+= s3c2440.o irq-s3c2440.o clock-s3c2440.o
+obj-$(CONFIG_CPU_S3C2440)	+= s3c2440.o clock-s3c2440.o
 obj-$(CONFIG_CPU_S3C2442)	+= s3c2442.o
 obj-$(CONFIG_CPU_S3C244X)	+= s3c244x.o clock-s3c244x.o
 obj-$(CONFIG_S3C2440_CPUFREQ)	+= cpufreq-s3c2440.o
arch/arm/mach-s3c24xx/irq-s3c2440.c deleted +0 -128

128 lines not on this page · raw message

arch/arm/mach-s3c24xx/irq.c +88 -0

94 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#4 lore raw

PATCH v2 4/10 ARM: S3C24XX: integrate s3c2440 irqs into common init

In reply to Heiko Stübner

Now all the arch_initcalls for s3c244x irqs are gone.

---
 arch/arm/mach-s3c24xx/irq.c |   46 ++++++++++++------------------------------
 1 files changed, 13 insertions(+), 33 deletions(-)
arch/arm/mach-s3c24xx/irq.c +13 -33
index 592072b..998e6a8 100644
@@ -840,44 +840,12 @@ static struct irq_chip s3c_irq_wdtac97 = {
 	.irq_ack	= s3c_irq_wdtac97_ack,
 };
 
-static int s3c2440_irq_add(struct device *dev, struct subsys_interface *sif)
+void __init s3c2440_init_irq(void)
 {
 	unsigned int irqno;
 
 	printk("S3C2440: IRQ Support\n");
 
-	/* add new chained handler for wdt, ac7 */
-
-	irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip,
-				 handle_level_irq);
-	irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
-
-	for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
-		irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97,
-					 handle_level_irq);
-		set_irq_flags(irqno, IRQF_VALID);
-	}
-
-	return 0;
-}
-
-static struct subsys_interface s3c2440_irq_interface = {
-	.name		= "s3c2440_irq",
-	.subsys		= &s3c2440_subsys,
-	.add_dev	= s3c2440_irq_add,
-};
-
-static int s3c2440_irq_init(void)
-{
-	return subsys_interface_register(&s3c2440_irq_interface);
-}
-
-arch_initcall(s3c2440_irq_init);
-
-void __init s3c2440_init_irq(void)
-{
-	unsigned int irqno;
-
 	s3c24xx_init_irq();
 
 	irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
@@ -895,6 +863,18 @@ void __init s3c2440_init_irq(void)
 					 handle_level_irq);
 		set_irq_flags(irqno, IRQF_VALID);
 	}
+
+	/* add new chained handler for wdt, ac7 */
+
+	irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip,
+				 handle_level_irq);
+	irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
+
+	for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
+		irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97,
+					 handle_level_irq);
+		set_irq_flags(irqno, IRQF_VALID);
+	}
 }
 #endif
 
Signature · 1 line
1.7.2.3
#5 lore raw

PATCH v2 5/10 ARM: S3C24XX: transform s3c2442 irqs into new structure

In reply to Heiko Stübner

Simply declare a correct mapping structure to use the common irq code.

---
 arch/arm/mach-s3c24xx/irq.c |   78 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 63 insertions(+), 15 deletions(-)
arch/arm/mach-s3c24xx/irq.c +63 -15
index 998e6a8..01358a5 100644
@@ -879,27 +879,75 @@ void __init s3c2440_init_irq(void)
 #endif
 
 #ifdef CONFIG_CPU_S3C2442
-void __init s3c2442_init_irq(void)
-{
-	unsigned int irqno;
+static struct s3c_irq_data init_s3c2442base[32] = {
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* WDT */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SDI */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
 
-	s3c24xx_init_irq();
+static struct s3c_irq_data init_s3c2442subint[32] = {
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */
+};
 
-	irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
-				 handle_level_irq);
-	set_irq_flags(IRQ_NFCON, IRQF_VALID);
+void __init s3c2442_init_irq(void)
+{
+	struct s3c_irq_intc *main_intc;
 
-	/* add chained handler for camera */
+	pr_info("S3C2442: IRQ Support\n");
 
-	irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip,
-				 handle_level_irq);
-	irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
+#ifdef CONFIG_FIQ
+	init_FIQ(FIQ_START);
+#endif
 
-	for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
-		irq_set_chip_and_handler(irqno, &s3c_irq_cam,
-					 handle_level_irq);
-		set_irq_flags(irqno, IRQF_VALID);
+	main_intc = s3c24xx_init_intc(NULL, &init_s3c2442base[0], NULL, 0x4a000000);
+	if (IS_ERR(main_intc)) {
+		pr_err("irq: could not create main interrupt controller\n");
+		return;
 	}
+
+	s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
+	s3c24xx_init_intc(NULL, &init_s3c2442subint[0], main_intc, 0x4a000018);
 }
 #endif
 
Signature · 1 line
1.7.2.3
#6 lore raw

PATCH v2 6/10 ARM: S3C24XX: transform s3c2440 irqs into new structure

In reply to Heiko Stübner

As always a mapping structure is everything needed.

---
 arch/arm/mach-s3c24xx/irq.c |  196 +++++++++++++-----------------------------
 1 files changed, 61 insertions(+), 135 deletions(-)
arch/arm/mach-s3c24xx/irq.c +61 -135
index 01358a5..26b17a1 100644
@@ -731,150 +731,78 @@ void __init s3c2416_init_irq(void)
 
 #endif
 
-#ifdef CONFIG_CPU_S3C244X
-/* camera irq */
-
-static void s3c_irq_demux_cam(unsigned int irq,
-			      struct irq_desc *desc)
-{
-	unsigned int subsrc, submsk;
-
-	/* read the current pending interrupts, and the mask
-	 * for what it is available */
-
-	subsrc = __raw_readl(S3C2410_SUBSRCPND);
-	submsk = __raw_readl(S3C2410_INTSUBMSK);
-
-	subsrc &= ~submsk;
-	subsrc >>= 11;
-	subsrc &= 3;
-
-	if (subsrc != 0) {
-		if (subsrc & 1) {
-			generic_handle_irq(IRQ_S3C2440_CAM_C);
-		}
-		if (subsrc & 2) {
-			generic_handle_irq(IRQ_S3C2440_CAM_P);
-		}
-	}
-}
-
-#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
-
-static void
-s3c_irq_cam_mask(struct irq_data *data)
-{
-	s3c_irqsub_mask(data->irq, INTMSK_CAM, 3 << 11);
-}
-
-static void
-s3c_irq_cam_unmask(struct irq_data *data)
-{
-	s3c_irqsub_unmask(data->irq, INTMSK_CAM);
-}
-
-static void
-s3c_irq_cam_ack(struct irq_data *data)
-{
-	s3c_irqsub_maskack(data->irq, INTMSK_CAM, 3 << 11);
-}
-
-static struct irq_chip s3c_irq_cam = {
-	.irq_mask	= s3c_irq_cam_mask,
-	.irq_unmask	= s3c_irq_cam_unmask,
-	.irq_ack	= s3c_irq_cam_ack,
-};
-
 #ifdef CONFIG_CPU_S3C2440
-/* WDT/AC97 */
-
-static void s3c_irq_demux_wdtac97(unsigned int irq,
-				  struct irq_desc *desc)
-{
-	unsigned int subsrc, submsk;
-
-	/* read the current pending interrupts, and the mask
-	 * for what it is available */
-
-	subsrc = __raw_readl(S3C2410_SUBSRCPND);
-	submsk = __raw_readl(S3C2410_INTSUBMSK);
-
-	subsrc &= ~submsk;
-	subsrc >>= 13;
-	subsrc &= 3;
-
-	if (subsrc != 0) {
-		if (subsrc & 1) {
-			generic_handle_irq(IRQ_S3C2440_WDT);
-		}
-		if (subsrc & 2) {
-			generic_handle_irq(IRQ_S3C2440_AC97);
-		}
-	}
-}
-
-
-#define INTMSK_WDT	 (1UL << (IRQ_WDT - IRQ_EINT0))
-
-static void
-s3c_irq_wdtac97_mask(struct irq_data *data)
-{
-	s3c_irqsub_mask(data->irq, INTMSK_WDT, 3 << 13);
-}
-
-static void
-s3c_irq_wdtac97_unmask(struct irq_data *data)
-{
-	s3c_irqsub_unmask(data->irq, INTMSK_WDT);
-}
-
-static void
-s3c_irq_wdtac97_ack(struct irq_data *data)
-{
-	s3c_irqsub_maskack(data->irq, INTMSK_WDT, 3 << 13);
-}
+static struct s3c_irq_data init_s3c2440base[32] = {
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* CAM */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* WDT/AC97 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SDI */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* NFCON */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
 
-static struct irq_chip s3c_irq_wdtac97 = {
-	.irq_mask	= s3c_irq_wdtac97_mask,
-	.irq_unmask	= s3c_irq_wdtac97_unmask,
-	.irq_ack	= s3c_irq_wdtac97_ack,
+static struct s3c_irq_data init_s3c2440subint[32] = {
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* TC */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 6 }, /* ADC */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* WDT */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 9 }, /* AC97 */
 };
 
 void __init s3c2440_init_irq(void)
 {
-	unsigned int irqno;
-
-	printk("S3C2440: IRQ Support\n");
-
-	s3c24xx_init_irq();
-
-	irq_set_chip_and_handler(IRQ_NFCON, &s3c_irq_level_chip,
-				 handle_level_irq);
-	set_irq_flags(IRQ_NFCON, IRQF_VALID);
+	struct s3c_irq_intc *main_intc;
 
-	/* add chained handler for camera */
+	pr_info("S3C2440: IRQ Support\n");
 
-	irq_set_chip_and_handler(IRQ_CAM, &s3c_irq_level_chip,
-				 handle_level_irq);
-	irq_set_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
+#ifdef CONFIG_FIQ
+	init_FIQ(FIQ_START);
+#endif
 
-	for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
-		irq_set_chip_and_handler(irqno, &s3c_irq_cam,
-					 handle_level_irq);
-		set_irq_flags(irqno, IRQF_VALID);
+	main_intc = s3c24xx_init_intc(NULL, &init_s3c2440base[0], NULL, 0x4a000000);
+	if (IS_ERR(main_intc)) {
+		pr_err("irq: could not create main interrupt controller\n");
+		return;
 	}
 
-	/* add new chained handler for wdt, ac7 */
-
-	irq_set_chip_and_handler(IRQ_WDT, &s3c_irq_level_chip,
-				 handle_level_irq);
-	irq_set_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
-
-	for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
-		irq_set_chip_and_handler(irqno, &s3c_irq_wdtac97,
-					 handle_level_irq);
-		set_irq_flags(irqno, IRQF_VALID);
-	}
+	s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
+	s3c24xx_init_intc(NULL, &init_s3c2440subint[0], main_intc, 0x4a000018);
 }
 #endif
 
@@ -951,8 +879,6 @@ void __init s3c2442_init_irq(void)
 }
 #endif
 
-#endif
-
 #ifdef CONFIG_CPU_S3C2443
 static struct s3c_irq_data init_s3c2443base[32] = {
 	{ .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
Signature · 1 line
1.7.2.3
#7 lore raw

PATCH v2 7/10 ARM: S3C24XX: use samsung_sync_wakemask in s3c2412 pm

In reply to Heiko Stübner

Originally the s3c2412 used a overidden irq chip to set the rtc wakeup flag. But with using the samsung_sync_wakemask function the same can be achieved without introducing soc specific irq functions.

---
 arch/arm/mach-s3c24xx/Kconfig       |    1 +
 arch/arm/mach-s3c24xx/irq-s3c2412.c |   23 -----------------------
 arch/arm/mach-s3c24xx/pm-s3c2412.c  |    8 ++++++++
 3 files changed, 9 insertions(+), 23 deletions(-)
arch/arm/mach-s3c24xx/Kconfig +1 -0
index 876393e..0dca380 100644
@@ -406,6 +406,7 @@ config S3C2412_DMA
 config S3C2412_PM
 	bool
 	select S3C2412_PM_SLEEP
+	select SAMSUNG_WAKEMASK
 	help
 	  Internal config node to apply S3C2412 power management
 
arch/arm/mach-s3c24xx/irq-s3c2412.c +0 -23
index 67d7631..e6fd954 100644
@@ -155,22 +155,6 @@ static struct irq_chip s3c2412_irq_cfsdi = {
 	.irq_unmask	= s3c2412_irq_cfsdi_unmask,
 };
 
-static int s3c2412_irq_rtc_wake(struct irq_data *data, unsigned int state)
-{
-	unsigned long pwrcfg;
-
-	pwrcfg = __raw_readl(S3C2412_PWRCFG);
-	if (state)
-		pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ;
-	else
-		pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ;
-	__raw_writel(pwrcfg, S3C2412_PWRCFG);
-
-	return s3c_irq_chip.irq_set_wake(data, state);
-}
-
-static struct irq_chip s3c2412_irq_rtc_chip;
-
 static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif)
 {
 	unsigned int irqno;
@@ -191,13 +175,6 @@ static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif)
 		set_irq_flags(irqno, IRQF_VALID);
 	}
 
-	/* change RTC IRQ's set wake method */
-
-	s3c2412_irq_rtc_chip = s3c_irq_chip;
-	s3c2412_irq_rtc_chip.irq_set_wake = s3c2412_irq_rtc_wake;
-
-	irq_set_chip(IRQ_RTC, &s3c2412_irq_rtc_chip);
-
 	return 0;
 }
 
arch/arm/mach-s3c24xx/pm-s3c2412.c +8 -0
index 4c4bc1c..d75f95e 100644
@@ -29,6 +29,7 @@
 
 #include <plat/cpu.h>
 #include <plat/pm.h>
+#include <plat/wakeup-mask.h>
 
 #include "regs-dsc.h"
 #include "s3c2412-power.h"
@@ -51,8 +52,15 @@ static int s3c2412_cpu_suspend(unsigned long arg)
 	return 1; /* Aborting suspend */
 }
 
+/* mapping of interrupts to parts of the wakeup mask */
+static struct samsung_wakeup_mask wake_irqs[] = {
+	{ .irq = IRQ_RTC,	.bit = S3C2412_PWRCFG_RTC_MASKIRQ, },
+};
+
 static void s3c2412_pm_prepare(void)
 {
+	samsung_sync_wakemask(S3C2412_PWRCFG,
+			      wake_irqs, ARRAY_SIZE(wake_irqs));
 }
 
 static int s3c2412_pm_add(struct device *dev, struct subsys_interface *sif)
Signature · 1 line
1.7.2.3
#8 lore raw

PATCH v2 8/10 ARM: S3C24XX: move s3c2412 irq init to common code

In reply to Heiko Stübner

Base for further cleanups

---
 arch/arm/mach-s3c24xx/Makefile      |    2 +-
 arch/arm/mach-s3c24xx/irq-s3c2412.c |  192 -----------------------------------
 arch/arm/mach-s3c24xx/irq.c         |  154 ++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 193 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2412.c
arch/arm/mach-s3c24xx/Makefile +1 -1
index 9041260..be6e4d0 100644
@@ -22,7 +22,7 @@ obj-$(CONFIG_S3C2410_DMA)	+= dma-s3c2410.o
 obj-$(CONFIG_S3C2410_PLL)	+= pll-s3c2410.o
 obj-$(CONFIG_S3C2410_PM)	+= pm-s3c2410.o sleep-s3c2410.o
 
-obj-$(CONFIG_CPU_S3C2412)	+= s3c2412.o irq-s3c2412.o clock-s3c2412.o
+obj-$(CONFIG_CPU_S3C2412)	+= s3c2412.o clock-s3c2412.o
 obj-$(CONFIG_S3C2412_CPUFREQ)	+= cpufreq-s3c2412.o
 obj-$(CONFIG_S3C2412_DMA)	+= dma-s3c2412.o
 obj-$(CONFIG_S3C2412_PM)	+= pm-s3c2412.o
arch/arm/mach-s3c24xx/irq-s3c2412.c deleted +0 -192

192 lines not on this page · raw message

arch/arm/mach-s3c24xx/irq.c +154 -0

160 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#9 lore raw

PATCH v2 9/10 ARM: S3C24XX: modify s3c2412 irq init to initialize all irqs

In reply to Heiko Stübner

Combines the two independent init steps for the irqs into one.

---
 arch/arm/mach-s3c24xx/common.h        |    1 +
 arch/arm/mach-s3c24xx/irq.c           |   19 +++----------------
 arch/arm/mach-s3c24xx/mach-jive.c     |    2 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c |    6 +++---
 arch/arm/mach-s3c24xx/mach-vstms.c    |    2 +-
 5 files changed, 9 insertions(+), 21 deletions(-)
arch/arm/mach-s3c24xx/common.h +1 -0
index 362a8cd..abefeb3 100644
@@ -36,6 +36,7 @@ extern void s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no);
 extern void s3c2412_init_clocks(int xtal);
 extern  int s3c2412_baseclk_add(void);
 extern void s3c2412_restart(char mode, const char *cmd);
+extern void s3c2412_init_irq(void);
 #else
 #define s3c2412_init_clocks NULL
 #define s3c2412_init_uarts NULL
arch/arm/mach-s3c24xx/irq.c +3 -16
index 905cb21..bf1e964 100644
@@ -745,10 +745,12 @@ static struct irq_chip s3c2412_irq_cfsdi = {
 	.irq_unmask	= s3c2412_irq_cfsdi_unmask,
 };
 
-static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif)
+void s3c2412_init_irq(void)
 {
 	unsigned int irqno;
 
+	s3c24xx_init_irq();
+
 	for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) {
 		irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4,
 					 handle_edge_irq);
@@ -764,22 +766,7 @@ static int s3c2412_irq_add(struct device *dev, struct subsys_interface *sif)
 					 handle_level_irq);
 		set_irq_flags(irqno, IRQF_VALID);
 	}
-
-	return 0;
 }
-
-static struct subsys_interface s3c2412_irq_interface = {
-	.name		= "s3c2412_irq",
-	.subsys		= &s3c2412_subsys,
-	.add_dev	= s3c2412_irq_add,
-};
-
-static int s3c2412_irq_init(void)
-{
-	return subsys_interface_register(&s3c2412_irq_interface);
-}
-
-arch_initcall(s3c2412_irq_init);
 #endif
 
 #ifdef CONFIG_CPU_S3C2416
arch/arm/mach-s3c24xx/mach-jive.c +1 -1
index 0c8c733..0d06c53 100644
@@ -660,7 +660,7 @@ MACHINE_START(JIVE, "JIVE")
 	/* Maintainer: Ben Dooks <[email protected]> */
 	.atag_offset	= 0x100,
 
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2412_init_irq,
 	.map_io		= jive_map_io,
 	.init_machine	= jive_machine_init,
 	.init_time	= samsung_timer_init,
arch/arm/mach-s3c24xx/mach-smdk2413.c +3 -3
index d5ef86d..9b3f814 100644
@@ -131,7 +131,7 @@ MACHINE_START(S3C2413, "S3C2413")
 	.atag_offset	= 0x100,
 
 	.fixup		= smdk2413_fixup,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2412_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
 	.init_time	= samsung_timer_init,
@@ -143,7 +143,7 @@ MACHINE_START(SMDK2412, "SMDK2412")
 	.atag_offset	= 0x100,
 
 	.fixup		= smdk2413_fixup,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2412_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
 	.init_time	= samsung_timer_init,
@@ -155,7 +155,7 @@ MACHINE_START(SMDK2413, "SMDK2413")
 	.atag_offset	= 0x100,
 
 	.fixup		= smdk2413_fixup,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2412_init_irq,
 	.map_io		= smdk2413_map_io,
 	.init_machine	= smdk2413_machine_init,
 	.init_time	= samsung_timer_init,
arch/arm/mach-s3c24xx/mach-vstms.c +1 -1
index 622a1ed..b665884 100644
@@ -158,7 +158,7 @@ MACHINE_START(VSTMS, "VSTMS")
 	.atag_offset	= 0x100,
 
 	.fixup		= vstms_fixup,
-	.init_irq	= s3c24xx_init_irq,
+	.init_irq	= s3c2412_init_irq,
 	.init_machine	= vstms_init,
 	.map_io		= vstms_map_io,
 	.init_time	= samsung_timer_init,
Signature · 1 line
1.7.2.3
#10 lore raw

PATCH v2 10/10 ARM: S3C24XX: transform s3c2412 irqs into new structure

In reply to Heiko Stübner

Contains only the new mapping structure. The special handling of the eint0 to eint3 interrupts still needs to be solved.

---
 arch/arm/mach-s3c24xx/irq.c |  122 +++++++++++++++++++++++--------------------
 1 files changed, 66 insertions(+), 56 deletions(-)
arch/arm/mach-s3c24xx/irq.c +66 -56
index bf1e964..1cb1962 100644
@@ -629,9 +629,58 @@ void __init s3c24xx_init_irq(void)
 }
 
 #ifdef CONFIG_CPU_S3C2412
+static struct s3c_irq_data init_s3c2412base[32] = {
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT0 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT1 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT2 */
+	{ .type = S3C_IRQTYPE_EINT, }, /* EINT3 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT4to7 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* EINT8to23 */
+	{ .type = S3C_IRQTYPE_NONE, }, /* reserved */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* nBATT_FLT */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TICK */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* WDT */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER3 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* TIMER4 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* LCD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA2 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* DMA3 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* SDI/CF */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI0 */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART1 */
+	{ .type = S3C_IRQTYPE_NONE, }, /* reserved */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBD */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* USBH */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* IIC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* UART0 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* SPI1 */
+	{ .type = S3C_IRQTYPE_EDGE, }, /* RTC */
+	{ .type = S3C_IRQTYPE_LEVEL, }, /* ADCPARENT */
+};
 
-#define INTMSK(start, end) ((1 << ((end) + 1 - (start))) - 1)
-#define INTMSK_SUB(start, end) (INTMSK(start, end) << ((start - S3C2410_IRQSUB(0))))
+static struct s3c_irq_data init_s3c2412subint[32] = {
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 28 }, /* UART0-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 23 }, /* UART1-ERR */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-RX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-TX */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 15 }, /* UART2-ERR */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* TC */
+	{ .type = S3C_IRQTYPE_EDGE, .parent_irq = 31 }, /* ADC */
+	{ .type = S3C_IRQTYPE_NONE, },
+	{ .type = S3C_IRQTYPE_NONE, },
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* SDI */
+	{ .type = S3C_IRQTYPE_LEVEL, .parent_irq = 21 }, /* CF */
+};
 
 /* the s3c2412 changes the behaviour of IRQ_EINT0 through IRQ_EINT3 by
  * having them turn up in both the INT* and the EINT* registers. Whilst
@@ -700,72 +749,33 @@ static struct irq_chip s3c2412_irq_eint0t4 = {
 	.irq_set_type	= s3c_irqext_type,
 };
 
-#define INTBIT(x)	(1 << ((x) - S3C2410_IRQSUB(0)))
-
-/* CF and SDI sub interrupts */
-
-static void s3c2412_irq_demux_cfsdi(unsigned int irq, struct irq_desc *desc)
-{
-	unsigned int subsrc, submsk;
-
-	subsrc = __raw_readl(S3C2410_SUBSRCPND);
-	submsk = __raw_readl(S3C2410_INTSUBMSK);
-
-	subsrc  &= ~submsk;
-
-	if (subsrc & INTBIT(IRQ_S3C2412_SDI))
-		generic_handle_irq(IRQ_S3C2412_SDI);
-
-	if (subsrc & INTBIT(IRQ_S3C2412_CF))
-		generic_handle_irq(IRQ_S3C2412_CF);
-}
-
-#define INTMSK_CFSDI	(1UL << (IRQ_S3C2412_CFSDI - IRQ_EINT0))
-#define SUBMSK_CFSDI	INTMSK_SUB(IRQ_S3C2412_SDI, IRQ_S3C2412_CF)
-
-static void s3c2412_irq_cfsdi_mask(struct irq_data *data)
+void s3c2412_init_irq(void)
 {
-	s3c_irqsub_mask(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
-}
+	struct s3c_irq_intc *main_intc;
+	unsigned int irqno;
 
-static void s3c2412_irq_cfsdi_unmask(struct irq_data *data)
-{
-	s3c_irqsub_unmask(data->irq, INTMSK_CFSDI);
-}
+	pr_info("S3C2412: IRQ Support\n");
 
-static void s3c2412_irq_cfsdi_ack(struct irq_data *data)
-{
-	s3c_irqsub_maskack(data->irq, INTMSK_CFSDI, SUBMSK_CFSDI);
-}
+#ifdef CONFIG_FIQ
+	init_FIQ(FIQ_START);
+#endif
 
-static struct irq_chip s3c2412_irq_cfsdi = {
-	.name		= "s3c2412-cfsdi",
-	.irq_ack	= s3c2412_irq_cfsdi_ack,
-	.irq_mask	= s3c2412_irq_cfsdi_mask,
-	.irq_unmask	= s3c2412_irq_cfsdi_unmask,
-};
+	main_intc = s3c24xx_init_intc(NULL, &init_s3c2412base[0], NULL, 0x4a000000);
+	if (IS_ERR(main_intc)) {
+		pr_err("irq: could not create main interrupt controller\n");
+		return;
+	}
 
-void s3c2412_init_irq(void)
-{
-	unsigned int irqno;
+	s3c24xx_init_intc(NULL, &init_eint[0], main_intc, 0x560000a4);
+	s3c24xx_init_intc(NULL, &init_s3c2412subint[0], main_intc, 0x4a000018);
 
-	s3c24xx_init_irq();
+	/* special handling for eints 0 to 3 */
 
 	for (irqno = IRQ_EINT0; irqno <= IRQ_EINT3; irqno++) {
 		irq_set_chip_and_handler(irqno, &s3c2412_irq_eint0t4,
 					 handle_edge_irq);
 		set_irq_flags(irqno, IRQF_VALID);
 	}
-
-	/* add demux support for CF/SDI */
-
-	irq_set_chained_handler(IRQ_S3C2412_CFSDI, s3c2412_irq_demux_cfsdi);
-
-	for (irqno = IRQ_S3C2412_SDI; irqno <= IRQ_S3C2412_CF; irqno++) {
-		irq_set_chip_and_handler(irqno, &s3c2412_irq_cfsdi,
-					 handle_level_irq);
-		set_irq_flags(irqno, IRQF_VALID);
-	}
 }
 #endif
 
Signature · 1 line
1.7.2.3
Applied
#11 lore raw

v2 cover ARM: S3C24XX: irq rework for S3C2412, S3C2440 and S3C2442

In reply to Heiko Stübner
Quoted 62 lines · Heiko St?bner

This series finishes the irq rework by moving the irqs for s3c2412, s3c2440 and s3c2442 into the new structure.

Now the only open point is the different handling of the eint0 to eint3 interrupts on the s3c2412. On this SoC these interrupts are represented in both the main register and the eint register and also need to be handled in both.

As this should be handlable via the new structure, I'm still investigating the right way to do it. Therefore the override of the eint0 to eint3 interrupts will still remain for a bit.

As I lack the relevant hardware, this series is compile tested only, but as the used mechanisms are the same as with the s3c2416, there shouldn't be any complications.

This series applies on top of the moved s3c24XX.h headers into the common.h
file in mach-s3c24xx.

changes since v1:
- included the changes for the s3c2412

Heiko Stuebner (10):
ARM: S3C24XX: move s3c244x irq init to common irq code
ARM: S3C24XX: create dedicated irq init functions for s3c2440 and s3c2442
ARM: S3C24XX: move s3c2440 irqs to common irq code
ARM: S3C24XX: integrate s3c2440 irqs into common init
ARM: S3C24XX: transform s3c2442 irqs into new structure
ARM: S3C24XX: transform s3c2440 irqs into new structure
ARM: S3C24XX: use samsung_sync_wakemask in s3c2412 pm
ARM: S3C24XX: move s3c2412 irq init to common code
ARM: S3C24XX: modify s3c2412 irq init to initialize all irqs
ARM: S3C24XX: transform s3c2412 irqs into new structure

 arch/arm/mach-s3c24xx/Kconfig          |    1 +
 arch/arm/mach-s3c24xx/Makefile         |    6 +-
 arch/arm/mach-s3c24xx/common.h         |    3 +
 arch/arm/mach-s3c24xx/irq-s3c2412.c    |  215 -----------------------
 arch/arm/mach-s3c24xx/irq-s3c2440.c    |  128 --------------
 arch/arm/mach-s3c24xx/irq-s3c244x.c    |  142 ---------------
 arch/arm/mach-s3c24xx/irq.c            |  299
++++++++++++++++++++++++++++++++
 arch/arm/mach-s3c24xx/mach-anubis.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-at2440evb.c |    2 +-
 arch/arm/mach-s3c24xx/mach-gta02.c     |    2 +-
 arch/arm/mach-s3c24xx/mach-jive.c      |    2 +-
 arch/arm/mach-s3c24xx/mach-mini2440.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-nexcoder.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-osiris.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx1950.c    |    2 +-
 arch/arm/mach-s3c24xx/mach-rx3715.c    |    7 +-
 arch/arm/mach-s3c24xx/mach-smdk2413.c  |    6 +-
 arch/arm/mach-s3c24xx/mach-smdk2440.c  |    2 +-
 arch/arm/mach-s3c24xx/mach-vstms.c     |    2 +-
 arch/arm/mach-s3c24xx/pm-s3c2412.c     |    8 +
 20 files changed, 328 insertions(+), 507 deletions(-)
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2412.c
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c2440.c
 delete mode 100644 arch/arm/mach-s3c24xx/irq-s3c244x.c
Quoted 2 lines

--
1.7.2.3

Applied, this whole series and integration 2412 eint handling.

Thanks for your time and support.

- Kukjin