* Patch by Rahul Shanbhag, 28 Jan 2004:
  Fix flash protection/locking handling for OMAP1610 innovator board.

* Patch by Rolf Peukert, 28 Jan 2004:
  fix flash write problems on CSB226 board (write with 32 bit bus width)

* Patches by Mark Jonas, 16 Jan 2004:
  - fix rounding error when calculating baudrates for MPC5200 PSCs
  - make sure CFG_RAMBOOT and CFG_LOWBOOT are not enabled at the same
    time which is not supported
diff --git a/cpu/mpc5xxx/serial.c b/cpu/mpc5xxx/serial.c
index 54ecf5b..f463d2c 100644
--- a/cpu/mpc5xxx/serial.c
+++ b/cpu/mpc5xxx/serial.c
@@ -67,10 +67,10 @@
 	/* select clock sources */
 #if defined(CONFIG_MGT5100)
 	psc->psc_clock_select = 0xdd00;
-	baseclk = CFG_MPC5XXX_CLKIN / 32;
+	baseclk = (CFG_MPC5XXX_CLKIN + 16) / 32;
 #elif defined(CONFIG_MPC5200)
 	psc->psc_clock_select = 0;
-	baseclk = gd->ipb_clk / 32;
+	baseclk = (gd->ipb_clk + 16) / 32;
 #endif
 
 	/* switch to UART mode */
@@ -85,8 +85,8 @@
 	psc->mode = PSC_MODE_ONE_STOP;
 
 	/* set up UART divisor */
-	div = baseclk / gd->baudrate;
-	psc->ctur = div >> 8;
+	div = (baseclk + (gd->baudrate/2)) / gd->baudrate;
+	psc->ctur = (div >> 8) & 0xff;
 	psc->ctlr = div & 0xff;
 
 	/* disable all interrupts */