On Wed, Mar 11, 2015 at 10:19:17PM +0200, Andy Shevchenko wrote: > This patch replaces a case switch by a serial8250_get_ps() call that does > necessary calculations for byt_set_termios(). > > Below is a list of the calculations done for all defined baud rates. Each line > in a format: 1) nominator, 2) denominator, 3) prescaler, 4) Fuart, 5) port UART > clock, 6) list of baud rates with DLAB values. > > 4 5 16 80000000 80000000 2500000(2) > 14 25 16 56000000 56000000 3500000(1) > 16 25 16 64000000 64000000 500000(8),1000000(4),2000000(2),4000000(1) > 24 25 16 96000000 96000000 1500000(4),3000000(2) > 2304 3125 16 73728000 73728000 576000(8),1152000(4) > 8192 15625 16 52428800 52428800 50(65536),200(16384) > 9216 15625 16 58982400 58982400 1800(2048),57600(64),115200(32),230400(16),460800(8),921600(4),1843200(2) > 12288 15625 16 78643200 78643200 75(65536),150(32768),300(16384),600(8192),1200(4096),2400(2048),4800(1024),9600(512),19200(256),38400(128) > 11264 19531 16 57672418 57671680 110(32768) > 17152 24414 16 70254771 70254592 134(32768) > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > --- > drivers/tty/serial/8250/8250_pci.c | 36 ++++++------------------------------ > 1 file changed, 6 insertions(+), 30 deletions(-) > > diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c > index 11784e9..544d11b 100644 > --- a/drivers/tty/serial/8250/8250_pci.c > +++ b/drivers/tty/serial/8250/8250_pci.c > @@ -1401,37 +1401,13 @@ byt_set_termios(struct uart_port *p, struct ktermios *termios, > * dividers must be adjusted. > * > * uartclk = (m / n) * 100 MHz, where m <= n > + * > + * For now we ignore a prescaler value since it will be always 16 for > + * standard baud rates. > + * > + * Note, that the formula will not work for rates less than 110 baud. > */ > - switch (baud) { > - case 500000: > - case 1000000: > - case 2000000: > - case 4000000: > - m = 64; > - n = 100; > - p->uartclk = 64000000; > - break; > - case 3500000: > - m = 56; > - n = 100; > - p->uartclk = 56000000; > - break; > - case 1500000: > - case 3000000: > - m = 48; > - n = 100; > - p->uartclk = 48000000; > - break; > - case 2500000: > - m = 40; > - n = 100; > - p->uartclk = 40000000; > - break; > - default: > - m = 2304; > - n = 3125; > - p->uartclk = 73728000; > - } > + serial8250_get_ps(p, baud, 100000000, 15, &m, &n); The UART on BYT does not have prescaler like Intel MID UARTs do. Shouldn't you just calculate the m and n values for the fractional divider in that function, it is the shared part, and leave the calculation of the prescaler value as Intel MID specific thing for now? Thanks, -- heikki -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html