aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/8250/8250_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/8250/8250_pci.c')
-rw-r--r--drivers/tty/serial/8250/8250_pci.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 0ff3e3624d4c..a3dbc4d97fa2 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1366,22 +1366,43 @@ byt_set_termios(struct uart_port *p, struct ktermios *termios,
1366 struct ktermios *old) 1366 struct ktermios *old)
1367{ 1367{
1368 unsigned int baud = tty_termios_baud_rate(termios); 1368 unsigned int baud = tty_termios_baud_rate(termios);
1369 unsigned int m = 6912; 1369 unsigned int m, n;
1370 unsigned int n = 15625;
1371 u32 reg; 1370 u32 reg;
1372 1371
1373 /* For baud rates 1M, 2M, 3M and 4M the dividers must be adjusted. */ 1372 /*
1374 if (baud == 1000000 || baud == 2000000 || baud == 4000000) { 1373 * For baud rates 0.5M, 1M, 1.5M, 2M, 2.5M, 3M, 3.5M and 4M the
1374 * dividers must be adjusted.
1375 *
1376 * uartclk = (m / n) * 100 MHz, where m <= n
1377 */
1378 switch (baud) {
1379 case 500000:
1380 case 1000000:
1381 case 2000000:
1382 case 4000000:
1375 m = 64; 1383 m = 64;
1376 n = 100; 1384 n = 100;
1377
1378 p->uartclk = 64000000; 1385 p->uartclk = 64000000;
1379 } else if (baud == 3000000) { 1386 break;
1387 case 3500000:
1388 m = 56;
1389 n = 100;
1390 p->uartclk = 56000000;
1391 break;
1392 case 1500000:
1393 case 3000000:
1380 m = 48; 1394 m = 48;
1381 n = 100; 1395 n = 100;
1382
1383 p->uartclk = 48000000; 1396 p->uartclk = 48000000;
1384 } else { 1397 break;
1398 case 2500000:
1399 m = 40;
1400 n = 100;
1401 p->uartclk = 40000000;
1402 break;
1403 default:
1404 m = 6912;
1405 n = 15625;
1385 p->uartclk = 44236800; 1406 p->uartclk = 44236800;
1386 } 1407 }
1387 1408