Skip to contentSkip to conversation

ARM: SAMSUNG: serial: Fix on handling of one clock source for UART

PATCH New Kukjin Kim 2 participants 3 messages May 28, 2011 – May 30, 2011

Subsystems (4)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 1/1 ARM: SAMSUNG: serial: Fix on handling of one clock source for UART

From: Boojin Kim <[email protected]>

This patch fixes the way of comparison for handling of two or more clock sources for UART.

For example, if just only one clock source is defined even though there are two clock sources for UART, the serial driver does not set proper clock up. Of course, it is problem.

So this patch changes the condition of comparison to avoid useless setup clock and adds a flag 'NO_NEED_CHECK_CLKSRC' which means selection of source clock is not required.

In addition, since the Exynos4210 has only one clock source for UART this patch adds the flag into its common_init_uarts().

---
 arch/arm/mach-exynos4/init.c                     |    1 +
 arch/arm/plat-samsung/include/plat/regs-serial.h |    2 ++
 drivers/tty/serial/s5pv210.c                     |    4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-exynos4/init.c +1 -0
index cf91f50..a8a83e3 100644
@@ -35,6 +35,7 @@ void __init exynos4_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
 			tcfg->clocks = exynos4_serial_clocks;
 			tcfg->clocks_size = ARRAY_SIZE(exynos4_serial_clocks);
 		}
+		tcfg->flags |= NO_NEED_CHECK_CLKSRC;
 	}
 
 	s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no);
arch/arm/plat-samsung/include/plat/regs-serial.h +2 -0
index 788837e..d2ef07f 100644
@@ -224,6 +224,8 @@
 #define S5PV210_UFSTAT_RXMASK	(255<<0)
 #define S5PV210_UFSTAT_RXSHIFT	(0)
 
+#define NO_NEED_CHECK_CLKSRC	1
+
 #ifndef __ASSEMBLY__
 
 /* struct s3c24xx_uart_clksrc
drivers/tty/serial/s5pv210.c +2 -2
index 6ebccd7..453e5b7 100644
@@ -31,7 +31,7 @@ static int s5pv210_serial_setsource(struct uart_port *port,
 	struct s3c2410_uartcfg *cfg = port->dev->platform_data;
 	unsigned long ucon = rd_regl(port, S3C2410_UCON);
 
-	if ((cfg->clocks_size) == 1)
+	if (cfg->flags & NO_NEED_CHECK_CLKSRC)
 		return 0;
 
 	if (strcmp(clk->name, "pclk") == 0)
@@ -56,7 +56,7 @@ static int s5pv210_serial_getsource(struct uart_port *port,
 
 	clk->divisor = 1;
 
-	if ((cfg->clocks_size) == 1)
+	if (cfg->flags & NO_NEED_CHECK_CLKSRC)
 		return 0;
 
 	switch (ucon & S5PV210_UCON_CLKMASK) {
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 1/1 ARM: SAMSUNG: serial: Fix on handling of one clock source for UART

Quoted 16 lines · Kukjin Kim

From: Boojin Kim <[email protected]>

This patch fixes the way of comparison for handling of two or more clock sources for UART.

For example, if just only one clock source is defined even though there are two clock sources for UART, the serial driver does not set proper clock up. Of course, it is problem.

So this patch changes the condition of comparison to avoid useless setup clock and adds a flag 'NO_NEED_CHECK_CLKSRC' which means selection of source clock is not required.

In addition, since the Exynos4210 has only one clock source for UART this patch adds the flag into its common_init_uarts().

Quoted 8 lines
---
 arch/arm/mach-exynos4/init.c                     |    1 +
 arch/arm/plat-samsung/include/plat/regs-serial.h |    2 ++
 drivers/tty/serial/s5pv210.c                     |    4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)

Is this needed in older kernels as well (like .39)?

thanks,

greg k-h

author
#2 lore raw

PATCH 1/1 ARM: SAMSUNG: serial: Fix on handling of one clock source for UART

Quoted 26 lines · Greg KH
Quoted 16 lines · Kukjin Kim

From: Boojin Kim<[email protected]>

This patch fixes the way of comparison for handling of two or more clock sources for UART.

For example, if just only one clock source is defined even though there are two clock sources for UART, the serial driver does not set proper clock up. Of course, it is problem.

So this patch changes the condition of comparison to avoid useless setup clock and adds a flag 'NO_NEED_CHECK_CLKSRC' which means selection of source clock is not required.

In addition, since the Exynos4210 has only one clock source for UART this patch adds the flag into its common_init_uarts().

Quoted 8 lines
---
  arch/arm/mach-exynos4/init.c                     |    1 +
  arch/arm/plat-samsung/include/plat/regs-serial.h |    2 ++
  drivers/tty/serial/s5pv210.c                     |    4 ++--
  3 files changed, 5 insertions(+), 2 deletions(-)
Quoted 2 lines

Is this needed in older kernels as well (like .39)?

Hi, Greg :)

Yes, we need this on 2.6.39 but don't need on .38 because the comparison codes has been merged during 39 merge window.

Could you please apply this on next .39 stable?

Thanks.

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