[U-Boot-Users] [PATCH] IXP: Add full baud-rate support for ixp42x, ixp45x and ixp46x

Stefan Roese sr at denx.de
Sat Dec 8 17:13:23 CET 2007


On Saturday 08 December 2007, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
>
> diff --git a/cpu/ixp/serial.c b/cpu/ixp/serial.c
> index 2015958..1f13077 100644
> --- a/cpu/ixp/serial.c
> +++ b/cpu/ixp/serial.c
> @@ -31,25 +31,22 @@
>  #include <common.h>
>  #include <asm/arch/ixp425.h>
>
> +/*
> + *               14.7456 MHz
> + * Baud Rate = --------------
> + *              16 x Divisor
> + */
> +#define SERIAL_CLOCK 921600
> +
>  DECLARE_GLOBAL_DATA_PTR;
>
>  void serial_setbrg (void)
>  {
>  	unsigned int quot = 0;
>  	int uart = CFG_IXP425_CONSOLE;
> -
> -	if (gd->baudrate == 1200)
> -		quot = 192;
> -	else if (gd->baudrate == 9600)
> -		quot = 96;
> -	else if (gd->baudrate == 19200)
> -		quot = 48;
> -	else if (gd->baudrate == 38400)
> -		quot = 24;
> -	else if (gd->baudrate == 57600)
> -		quot = 16;
> -	else if (gd->baudrate == 115200)
> -		quot = 8;
> +
> +	if(gd->baudrate < SERIAL_CLOCK && SERIAL_CLOCK % gd->baudrate == 0)

Space after "if" please. And some braces would make this line more readable.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================




More information about the U-Boot mailing list