
Hi All,
I am working with ARM1176 core, and using standard serial driver NS16550. I found one bug in to this function -
The driver doesn't work with baudrate 57600, I debuged this issue and find that small modification is required in function "calc_divisor" - Below is complete function -
CFG_NS16550_CLK = 10000000 MODE_X_DIV=16 static int calc_divisor (NS16550_t port) { unsigned int baudrate_div; #ifdef CONFIG_OMAP1510 /* If can't cleanly clock 115200 set div to 1 */ if ((CFG_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) { port->osc_12m_sel = OSC_12M_SEL; /* enable 6.5 * divisor */ return (1); /* return 1 for base divisor */ } port->osc_12m_sel = 0; /* clear if previsouly set */ #endif #ifdef CONFIG_OMAP1610 /* If can't cleanly clock 115200 set div to 1 */ if ((CFG_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) { return (26); /* return 26 for base divisor */ } #endif
#ifdef CONFIG_APTIX #define MODE_X_DIV 13 #else #define MODE_X_DIV 16 #endif baudrate_div = (CFG_NS16550_CLK / gd->baudrate); if ((baudrate_div%MODE_X_DIV)>7) baudrate_div+=8; baudrate_div/=MODE_X_DIV;
return baudrate_div;
}
I have tested with baudrates 9600, 19200, 38400 and 57600. it's working perfectly fine.
Am I on correct path? Please let me know if I am missing something.
Thanks,
Vaibhav