[U-Boot-Users] at91rm9200 serial frequency fix

Michael Trimarchi trimarchi at gandalf.sssup.it
Sun Aug 19 19:42:02 CEST 2007


>  
> +#define BAUDRATE(mck, baud) \
> +	((((mck) * 10) % ((baud) * 16)) >= 5) ? \
> +	(mck / (baud * 16) + 1) : ((mck) / (baud * 16))
> +
>  void serial_setbrg (void)
>  {
>  	int baudrate;
>  
>  	if ((baudrate = gd->baudrate) <= 0)
>  		baudrate = CONFIG_BAUDRATE;
> -	/* MASTER_CLOCK/(16 * baudrate) */
> -	us->US_BRGR = (AT91C_MASTER_CLOCK >> 4) / (unsigned)baudrate;
> +
> +	us->US_BRGR = BOUDRATE(AT91C_MASTER_CLOCK, (unsigned)baudrate);
>  }
>  
>  int serial_init (void)
>
>   
Excuse me I take the wrong diff file, containg and error on macro name. 
I will send the right one soon.

Regards Michael





More information about the U-Boot mailing list