Skip to contentSkip to conversation

serial: samsung.c: Add FRACVAL support for newer UART

PATCH Superseded Kukjin Kim 2 participants 3 messages Jun 25, 2010 – Jul 21, 2010 Arm Samsung Exynos

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 1/1 serial: samsung.c: Add FRACVAL support for newer UART

From: Changhwan Youn <[email protected]>

FRACVAL register provides the same function as UDIVSLOT register which is the 1/16ths adjustment to the baud rate but the implementaiton is easier. To support UDIVSLOT register, UDIVSLOT table search is necessary though supporting FRACVAL only needs the index value of UDIVSLOT table.

This patch implements the FRACVAL supports for the newer Samsung SoC UARTs.

---
 drivers/serial/samsung.c |    7 +++++--
 drivers/serial/samsung.h |    1 +
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/serial/samsung.c +5 -2
index a9d6c56..09805c7 100644
@@ -530,7 +530,7 @@ static int s3c24xx_serial_calcbaud(struct baud_calc *calc,
 
 	calc->clksrc = clksrc;
 
-	if (ourport->info->has_divslot) {
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval)) {
 		unsigned long div = rate / baud;
 
 		/* The UDIVSLOT register on the newer UARTs allows us to
@@ -707,6 +707,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 
 		udivslot = udivslot_table[div & 15];
 		dbg("udivslot = %04x (div %d)\n", udivslot, div & 15);
+	} else if (ourport->info->has_fracval) {
+		udivslot = (ourport->baudclk_rate / baud) & 15;
+		dbg("fracval = %04x\n", udivslot);
 	}
 
 	switch (termios->c_cflag & CSIZE) {
@@ -755,7 +758,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	wr_regl(port, S3C2410_UBRDIV, quot);
 	wr_regl(port, S3C2410_UMCON, umcon);
 
-	if (ourport->info->has_divslot)
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval))
 		wr_regl(port, S3C2443_DIVSLOT, udivslot);
 
 	dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
drivers/serial/samsung.h +1 -0
index 0ac06a0..124f476 100644
@@ -24,6 +24,7 @@ struct s3c24xx_uart_info {
 	/* uart port features */
 
 	unsigned int		has_divslot:1;
+	unsigned int		has_fracval:1;
 
 	/* clock source control */
 
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 1/1 serial: samsung.c: Add FRACVAL support for newer UART

Hello.

Quoted 11 lines · Kukjin Kim

From: Changhwan Youn <[email protected]>

FRACVAL register provides the same function as UDIVSLOT register which is the 1/16ths adjustment to the baud rate but the implementaiton is easier. To support UDIVSLOT register, UDIVSLOT table search is necessary though supporting FRACVAL only needs the index value of UDIVSLOT table.

This patch implements the FRACVAL supports for the newer Samsung SoC UARTs.

[...]

drivers/serial/samsung.c static int s3c24xx_serial_calcbaud(struct baud_calc *calc, · line 533

Quoted 10 lines
drivers/serial/samsung.c +1 -1
index a9d6c56..09805c7 100644
@@ -530,7 +530,7 @@ static int s3c24xx_serial_calcbaud(struct baud_calc *calc,
 
 	calc->clksrc = clksrc;
 
-	if (ourport->info->has_divslot) {
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval)) {

Parens around variables are not needed.

drivers/serial/samsung.c static void s3c24xx_serial_set_termios(struct uart_port *port, · line 761

Quoted 6 lines
drivers/serial/samsung.c +1 -1
@@ -755,7 +758,7 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	wr_regl(port, S3C2410_UBRDIV, quot);
 	wr_regl(port, S3C2410_UMCON, umcon);
 
-	if (ourport->info->has_divslot)
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval))

Here as well...

WBR, Sergei

author
#2 lore raw

PATCH 1/1 serial: samsung.c: Add FRACVAL support for newer UART

Quoted 3 lines · Sergei Shtylyov

Hello.

Hi ;-)

Quoted 5 lines
Quoted 3 lines · Kukjin Kim

From: Changhwan Youn <[email protected]>

FRACVAL register provides the same function as UDIVSLOT register which

is

Quoted 1 line
Quoted 1 line

the 1/16ths adjustment to the baud rate but the implementaiton is

easier.

Quoted 6 lines
Quoted 4 lines

To support UDIVSLOT register, UDIVSLOT table search is necessary though supporting FRACVAL only needs the index value of UDIVSLOT table.

This patch implements the FRACVAL supports for the newer Samsung SoC

UARTs.

Quoted 8 lines
Quoted 2 lines

[...]

drivers/serial/samsung.c static int s3c24xx_serial_calcbaud(struct baud_calc

Quoted 5 lines
drivers/serial/samsung.c +0 -0
index a9d6c56..09805c7 100644
@@ -530,7 +530,7 @@ static int s3c24xx_serial_calcbaud(struct baud_calc

*calc,

Quoted 8 lines

drivers/serial/samsung.c static int s3c24xx_serial_calcbaud(struct baud_calc *calc, · line 533

Quoted 5 lines
drivers/serial/samsung.c +1 -1
 	calc->clksrc = clksrc;
 
-	if (ourport->info->has_divslot) {
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval)) {

Parens around variables are not needed.

Yeah.

Quoted 2 lines

drivers/serial/samsung.c static void s3c24xx_serial_set_termios(struct

Quoted 2 lines
drivers/serial/samsung.c +0 -0
@@ -755,7 +758,7 @@ static void s3c24xx_serial_set_termios(struct

uart_port

Quoted 9 lines

*port,

drivers/serial/samsung.c static void s3c24xx_serial_set_termios(struct uart_port *port, · line 761

Quoted 5 lines
drivers/serial/samsung.c +1 -1
 	wr_regl(port, S3C2410_UBRDIV, quot);
 	wr_regl(port, S3C2410_UMCON, umcon);
 
-	if (ourport->info->has_divslot)
+	if ((ourport->info->has_divslot) || (ourport->info->has_fracval))

Here as well...

Yeah.

You're right.
But already re-submitted updated.

Please kindly find following URL.
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-July/020713.html

Thanks.

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