On Thu, Apr 17, 2014 at 4:19 AM, Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> wrote: > Well, we are already handling this same refclk in the clk that is > provided to this driver in case of BYT, so we should probable handle > this in that as well. Then we could have a more generic set_termios > where we do something like this.. > > static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, > struct ktermios *old) > { > unsigned int baud = tty_termios_baud_rate(termios); > struct dw8250_data *d = p->private_data; > unsigned int rate; > int ret; > > rate = clk_round_rate(d->clk, baud*16); > ret = clk_set_rate(d->clk, rate); > if (!ret) > p->uartclk = rate; > serial8250_do_set_termios(p, termios, old); > } On Broadcom's mobile SoCs, the external clock that feeds into the DW UART can switch between high and low frequency parents. The above may result in a lower frequency parent being selected in cases where a higher frequency parent could yield better actual baud rate. Consider if 115,200 baud was requested and parents provided 2 MHz and 104 MHz. This would select 2 MHz (for 125,000 baud) instead of 104 MHz (for 116,071 baud). To get the best baud rate accuracy, the capabilities of the internal divider need to be considered together with those of the external clock. -Tim -- 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