[U-Boot-Users] Fixed CD in serial.c, AT91RM9200

Kögler Peter p.koegler at el-me.de
Tue Jul 13 09:13:22 CEST 2004

Hello all,
is there a reason why the clock divisor in the baudrate generator register
(us->US_BRGR) is set to a fixed value in serial_setbrg(void):


I changed the implementation of serial_setbrg(void) and i can now opperate
at higher baudrates. (change baudrate with loadb).

Here is my version:

void serial_setbrg (void)
  int baudrate, baudRateGenDiv,i;
  unsigned long baudrate_table[] = CFG_BAUDRATE_TABLE;
  int n_baudrates = (sizeof(baudrate_table) / sizeof(baudrate_table[0]));

  baudrate = gd->baudrate;
  //check if value is supported
  for (i=0; i<n_baudrates; ++i) 
    if (baudrate == baudrate_table[i])
      baudRateGenDiv = AT91C_MASTER_CLOCK / baudrate / 16;
      //printf ("## Switched baudrate to %dbps.\n", baudrate);
  if (baudRateGenDiv==0)
    //using default value
    baudRateGenDiv = CFG_AT91C_BRGR_DIVISOR;
    printf ("## Baudrate %dbps not supported using default baudrate
%dbps.\n", baudrate, CONFIG_BAUDRATE);
  us->US_BRGR = baudRateGenDiv;

If you agree with my changes i can provide a patch.



More information about the U-Boot mailing list