Skip to contentSkip to conversation

uart_get_divisor picks better quot

PATCH In review roger blofeld 2 participants 2 messages Sep 16, 2004 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uart_get_divisor picks better quot

I have a case where uartclk is 33000000 and baud is 115200. The quotient is about 17.9, but the current code selects 17 as the quot. With 17 I'm getting corrupted characters transmitted. Using 18 fixes the problem. Perhaps rounding would be a better choice than truncation. -roger

===== drivers/serial/serial_core.c 1.87 vs edited =====

drivers/serial/serial_core.c 2004-09-15 14:04:34 -05:00 renamed from drivers/serial/serial_core.c 2004-06-29 09:43:58 -05:00 +0 -0
@@ -403,7 +403,7 @@
        if (baud == 38400 && (port->flags & UPF_SPD_MASK) ==

UPF_SPD_CUST)

                quot = port->custom_divisor;
        else

- quot = port->uartclk / (16 * baud);
+ quot = (port->uartclk + (8 * baud)) / (16 * baud);

        return quot;

}

__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

#1 lore raw

autobaud rate support and dce mode

does linux kernel have a framework for autobaud rate and uart as dce mode.
If yes then pls tell me the interface

Manish

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of roger blofeld
Sent: Thursday, September 16, 2004 5:53 AM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] uart_get_divisor picks better quot

I have a case where uartclk is 33000000 and baud is 115200. The quotient is about 17.9, but the current code selects 17 as the quot. With 17 I'm getting corrupted characters transmitted. Using 18 fixes the problem. Perhaps rounding would be a better choice than truncation. -roger

===== drivers/serial/serial_core.c 1.87 vs edited =====

drivers/serial/serial_core.c 2004-09-15 14:04:34 -05:00 renamed from drivers/serial/serial_core.c 2004-06-29 09:43:58 -05:00 +0 -0
@@ -403,7 +403,7 @@
        if (baud == 38400 && (port->flags & UPF_SPD_MASK) ==

UPF_SPD_CUST)

                quot = port->custom_divisor;
        else

- quot = port->uartclk / (16 * baud);
+ quot = (port->uartclk + (8 * baud)) / (16 * baud);

        return quot;

}

__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html