serial: zynq: Use global baudrate instead of hardcoded one
This change enables to change baudrate on command line. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
parent
c4fa511425
commit
12c9e7d622
1 changed files with 1 additions and 17 deletions
|
@ -42,29 +42,13 @@ static struct uart_zynq *uart_zynq_ports[2] = {
|
||||||
[1] = (struct uart_zynq *)ZYNQ_SERIAL_BASEADDR1,
|
[1] = (struct uart_zynq *)ZYNQ_SERIAL_BASEADDR1,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(CONFIG_ZYNQ_SERIAL_BAUDRATE0)
|
|
||||||
# define CONFIG_ZYNQ_SERIAL_BAUDRATE0 CONFIG_BAUDRATE
|
|
||||||
#endif
|
|
||||||
#if !defined(CONFIG_ZYNQ_SERIAL_BAUDRATE1)
|
|
||||||
# define CONFIG_ZYNQ_SERIAL_BAUDRATE1 CONFIG_BAUDRATE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct uart_zynq_params {
|
|
||||||
u32 baudrate;
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct uart_zynq_params uart_zynq_ports_param[2] = {
|
|
||||||
[0].baudrate = CONFIG_ZYNQ_SERIAL_BAUDRATE0,
|
|
||||||
[1].baudrate = CONFIG_ZYNQ_SERIAL_BAUDRATE1,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Set up the baud rate in gd struct */
|
/* Set up the baud rate in gd struct */
|
||||||
static void uart_zynq_serial_setbrg(const int port)
|
static void uart_zynq_serial_setbrg(const int port)
|
||||||
{
|
{
|
||||||
/* Calculation results. */
|
/* Calculation results. */
|
||||||
unsigned int calc_bauderror, bdiv, bgen;
|
unsigned int calc_bauderror, bdiv, bgen;
|
||||||
unsigned long calc_baud = 0;
|
unsigned long calc_baud = 0;
|
||||||
unsigned long baud = uart_zynq_ports_param[port].baudrate;
|
unsigned long baud = gd->baudrate;
|
||||||
unsigned long clock = get_uart_clk(port);
|
unsigned long clock = get_uart_clk(port);
|
||||||
struct uart_zynq *regs = uart_zynq_ports[port];
|
struct uart_zynq *regs = uart_zynq_ports[port];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue