]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
serial: zynq: Add support for slow emulation platform
authorMichal Simek <michal.simek@xilinx.com>
Wed, 15 Apr 2015 11:05:06 +0000 (13:05 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 29 Apr 2015 09:19:01 +0000 (11:19 +0200)
On slow platforms not all baudrate setting is valid.
Check it directly in the driver and setup maximum possible
frequency.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/serial/serial_zynq.c

index 3e2b8dc183e467c6562d3a868a6a8147bcf48179..9278763164fae607791d5d4dabd0fe35a9d7e920 100644 (file)
@@ -48,10 +48,16 @@ static void uart_zynq_serial_setbrg(const int port)
        /* Calculation results. */
        unsigned int calc_bauderror, bdiv, bgen;
        unsigned long calc_baud = 0;
-       unsigned long baud = gd->baudrate;
+       unsigned long baud;
        unsigned long clock = get_uart_clk(port);
        struct uart_zynq *regs = uart_zynq_ports[port];
 
+       /* Covering case where input clock is so slow */
+       if (clock < 1000000 && gd->baudrate > 4800)
+               gd->baudrate = 4800;
+
+       baud = gd->baudrate;
+
        /*                master clock
         * Baud rate = ------------------
         *              bgen * (bdiv + 1)