summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ns16550.c7
-rw-r--r--drivers/serial.c21
2 files changed, 22 insertions, 6 deletions
diff --git a/drivers/ns16550.c b/drivers/ns16550.c
index 6f818d7..9344a0a 100644
--- a/drivers/ns16550.c
+++ b/drivers/ns16550.c
@@ -17,12 +17,19 @@
void NS16550_init (NS16550_t com_port, int baud_divisor)
{
com_port->ier = 0x00;
+#ifdef CONFIG_OMAP1510
+ com_port->mdr1 = 0x7; /* mode select reset TL16C750*/
+#endif
com_port->lcr = LCR_BKSE | LCRVAL;
com_port->dll = baud_divisor & 0xff;
com_port->dlm = (baud_divisor >> 8) & 0xff;
com_port->lcr = LCRVAL;
com_port->mcr = MCRVAL;
com_port->fcr = FCRVAL;
+#ifdef CONFIG_OMAP1510
+ com_port->mdr1 = 0; /* select uart mode */
+#endif
+
}
void NS16550_reinit (NS16550_t com_port, int baud_divisor)
diff --git a/drivers/serial.c b/drivers/serial.c
index 36d0e6e..f28ad80 100644
--- a/drivers/serial.c
+++ b/drivers/serial.c
@@ -42,12 +42,22 @@ static NS16550_t console = (NS16550_t) CFG_NS16550_COM4;
#error no valid console defined
#endif
-int serial_init (void)
+static int calc_divisor (void)
{
DECLARE_GLOBAL_DATA_PTR;
+#ifdef CONFIG_OMAP1510
+ /* If can't cleanly clock 115200 set div to 1 */
+ if ((CFG_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
+ console->osc_12m_sel = OSC_12M_SEL; /* enable 6.5 * divisor */
+ return (1); /* return 1 for base divisor */
+ }
+#endif
+ return (CFG_NS16550_CLK / 16 / gd->baudrate);
+}
- int clock_divisor = (CFG_NS16550_CLK + gd->baudrate * 8 )
- / (gd->baudrate * 16);
+int serial_init (void)
+{
+ int clock_divisor = calc_divisor();
#ifdef CFG_NS87308
initialise_ns87308();
@@ -91,10 +101,9 @@ serial_tstc(void)
void
serial_setbrg (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
- int clock_divisor = CFG_NS16550_CLK / 16 / gd->baudrate;
+ int clock_divisor;
+ clock_divisor = calc_divisor();
NS16550_reinit(console, clock_divisor);
}