Skip to contentSkip to conversation

serial: samsung: Use single interrupt handler for s3c64xx and higher SoC's

RFC PATCH In review Thomas Abraham 2 participants 3 messages Aug 7, 2011 – Aug 12, 2011

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

RFC PATCH 1/1 serial: samsung: Use single interrupt handler for s3c64xx and higher SoC's

s3c64xx and higher SoC's include the interrupt mask and pending registers in the uart controller, unlike the s3c24xx SoC's which have these registers in the interrupt controller. When the mask and pending registers are part of the uart controller, it is easier to manage interrupts with a single interrupt rather than having to create 3 seperate tx/rx/err interrupts.

This patch modifies the tx/rx/err uart interrupt handling for s3c64xx SoC's and higher by registering a single interrupt handler. This makes it easier to add device tree support as well.

---
Tested on Exynos4 smdkv310 only. If this approach is acceptable, it will be tested it on s3c64xx and all s5p SoC's (should work on all as the changes are generic). This is a bulky patch but it will split into smaller patches if the approach is acceptable.

 arch/arm/Kconfig                                 |    1 -
 arch/arm/plat-s5p/Kconfig                        |    1 -
 arch/arm/plat-s5p/dev-uart.c                     |   84 +++---------------
 arch/arm/plat-s5p/irq.c                          |   34 -------
 arch/arm/plat-samsung/Kconfig                    |    5 -
 arch/arm/plat-samsung/Makefile                   |    1 -
 arch/arm/plat-samsung/include/plat/regs-serial.h |    5 +
 arch/arm/plat-samsung/irq-uart.c                 |   89 ------------------
 drivers/tty/serial/samsung.c                     |  104 ++++++++++++++++++++--
 drivers/tty/serial/samsung.h                     |    1 +
 10 files changed, 113 insertions(+), 212 deletions(-)
 delete mode 100644 arch/arm/plat-samsung/irq-uart.c
arch/arm/Kconfig +0 -1
index 27586c4..5412822 100644
@@ -705,7 +705,6 @@ config ARCH_S3C64XX
 	select ARCH_REQUIRE_GPIOLIB
 	select SAMSUNG_CLKSRC
 	select SAMSUNG_IRQ_VIC_TIMER
-	select SAMSUNG_IRQ_UART
 	select S3C_GPIO_TRACK
 	select S3C_GPIO_PULL_UPDOWN
 	select S3C_GPIO_CFG_S3C24XX
arch/arm/plat-s5p/Kconfig +0 -1
index e98f5c5..5b546a3 100644
@@ -22,7 +22,6 @@ config PLAT_S5P
 	select PLAT_SAMSUNG
 	select SAMSUNG_CLKSRC
 	select SAMSUNG_IRQ_VIC_TIMER
-	select SAMSUNG_IRQ_UART
 	help
 	  Base platform code for Samsung's S5P series SoC.
 
arch/arm/plat-s5p/dev-uart.c +12 -72

122 lines not on this page · raw message

arch/arm/plat-s5p/irq.c +0 -34
index a97c089..afdaa10 100644
@@ -17,42 +17,10 @@
 
 #include <asm/hardware/vic.h>
 
-#include <linux/serial_core.h>
 #include <mach/map.h>
 #include <plat/regs-timer.h>
-#include <plat/regs-serial.h>
 #include <plat/cpu.h>
 #include <plat/irq-vic-timer.h>
-#include <plat/irq-uart.h>
-
-/*
- * Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
- * are consecutive when looking up the interrupt in the demux routines.
- */
-static struct s3c_uart_irq uart_irqs[] = {
-	[0] = {
-		.regs		= S5P_VA_UART0,
-		.base_irq	= IRQ_S5P_UART_BASE0,
-		.parent_irq	= IRQ_UART0,
-	},
-	[1] = {
-		.regs		= S5P_VA_UART1,
-		.base_irq	= IRQ_S5P_UART_BASE1,
-		.parent_irq	= IRQ_UART1,
-	},
-	[2] = {
-		.regs		= S5P_VA_UART2,
-		.base_irq	= IRQ_S5P_UART_BASE2,
-		.parent_irq	= IRQ_UART2,
-	},
-#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
-	[3] = {
-		.regs		= S5P_VA_UART3,
-		.base_irq	= IRQ_S5P_UART_BASE3,
-		.parent_irq	= IRQ_UART3,
-	},
-#endif
-};
 
 void __init s5p_init_irq(u32 *vic, u32 num_vic)
 {
@@ -65,6 +33,4 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
 #endif
 
 	s3c_init_vic_timer_irq(5, IRQ_TIMER0);
-
-	s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
 }
arch/arm/plat-samsung/Kconfig +0 -5
index 4d79519..38c5152 100644
@@ -65,11 +65,6 @@ config SAMSUNG_IRQ_VIC_TIMER
        help
          Internal configuration to build the VIC timer interrupt code.
 
-config SAMSUNG_IRQ_UART
-       bool
-       help
-         Internal configuration to build the IRQ UART demux code.
-
 # options for gpio configuration support
 
 config SAMSUNG_GPIOLIB_4BIT
arch/arm/plat-samsung/Makefile +0 -1
index 53eb15b..6a1b423 100644
@@ -21,7 +21,6 @@ obj-y				+= dev-asocdma.o
 
 obj-$(CONFIG_SAMSUNG_CLKSRC)	+= clock-clksrc.o
 
-obj-$(CONFIG_SAMSUNG_IRQ_UART)	+= irq-uart.o
 obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o
 
 # ADC
arch/arm/plat-samsung/include/plat/regs-serial.h +5 -0
index 116edfe..baa59b7 100644
@@ -194,6 +194,11 @@
 #define S3C64XX_UINTSP		0x34
 #define S3C64XX_UINTM		0x38
 
+#define S3C64XX_UINTM_RXD	(0)
+#define S3C64XX_UINTM_TXD	(2)
+#define S3C64XX_UINTM_RXD_MSK	(1 << S3C64XX_UINTM_RXD)
+#define S3C64XX_UINTM_TXD_MSK	(1 << S3C64XX_UINTM_TXD)
+
 /* Following are specific to S5PV210 */
 #define S5PV210_UCON_CLKMASK	(1<<10)
 #define S5PV210_UCON_PCLK	(0<<10)
arch/arm/plat-samsung/irq-uart.c deleted +0 -89

89 lines not on this page · raw message

drivers/tty/serial/samsung.c +95 -9

183 lines not on this page · raw message

drivers/tty/serial/samsung.h +1 -0
index a69d9a5..8e87b78 100644
@@ -61,6 +61,7 @@ struct s3c24xx_uart_port {
 /* register access controls */
 
 #define portaddr(port, reg) ((port)->membase + (reg))
+#define portaddrl(port, reg) ((unsigned long *)((port)->membase + (reg)))
 
 #define rd_regb(port, reg) (__raw_readb(portaddr(port, reg)))
 #define rd_regl(port, reg) (__raw_readl(portaddr(port, reg)))
Signature · 1 line
1.6.6.rc2
#1 lore raw
Quoted 3 lines · Thomas Abraham

s3c64xx and higher SoC's include the interrupt mask and pending registers in the uart controller, unlike the s3c24xx SoC's which have these

registers

Quoted 8 lines

in the interrupt controller. When the mask and pending registers are part of the uart controller, it is easier to manage interrupts with a single interrupt rather than having to create 3 seperate tx/rx/err interrupts.

This patch modifies the tx/rx/err uart interrupt handling for s3c64xx SoC's and higher by registering a single interrupt handler. This makes it easier to add device tree support as well.

Quoted 5 lines

---
Tested on Exynos4 smdkv310 only. If this approach is acceptable, it will

be

Quoted 4 lines

tested it on s3c64xx and all s5p SoC's (should work on all as the changes are generic). This is a bulky patch but it will split into smaller patches if the approach is acceptable.

Hi Thomas,

Hmm, could you please test this on other boards before split? And I need to check whether this is available on s3c24xx SoCs or not...

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#2 lore raw

Hi Mr. Kim,

Quoted 19 lines · Kukjin Kim
Quoted 3 lines · Thomas Abraham

s3c64xx and higher SoC's include the interrupt mask and pending registers in the uart controller, unlike the s3c24xx SoC's which have these

registers

Quoted 8 lines

in the interrupt controller. When the mask and pending registers are part of the uart controller, it is easier to manage interrupts with a single interrupt rather than having to create 3 seperate tx/rx/err interrupts.

This patch modifies the tx/rx/err uart interrupt handling for s3c64xx SoC's and higher by registering a single interrupt handler. This makes it easier to add device tree support as well.

Quoted 5 lines

---
Tested on Exynos4 smdkv310 only. If this approach is acceptable, it will

be

Quoted 8 lines
Quoted 4 lines

tested it on s3c64xx and all s5p SoC's (should work on all as the changes are generic). This is a bulky patch but it will split into smaller patches if the approach is acceptable.

Hi Thomas,

Hmm, could you please test this on other boards before split? And I need to check whether this is available on s3c24xx SoCs or not...

This patchset has been tested on most if the smdk boards. It has been tested for

SMDK2440, SMDK2416, SMDK6410, SMDK6440, SMDK6450, SMDKC100, SMDKV210, SMDKV310.

Thanks,
Thomas.

Quoted 10 lines

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.