[U-Boot-Users] [Patch] MPC5xxx PSC baudrate calculation

Hi,
attached is a patch, that fixes a bug in MPC5200 PSC Baud rate calculation. The Problem was, that proper rounding was not applied to baudrate calculation in serial_setbrg(). The formula from serial_init() should be used.
Best regards Sebastian Schau
--- serial.c 9 Feb 2004 20:51:26 -0000 1.1.1.1 +++ serial.c 27 Jan 2005 15:21:26 -0000 @@ -152,14 +152,14 @@ unsigned long baseclk, div;
#if defined(CONFIG_MGT5100) - baseclk = CFG_MPC5XXX_CLKIN / 32; + baseclk = (CFG_MPC5XXX_CLKIN + 16) / 32; #elif defined(CONFIG_MPC5200) - baseclk = gd->ipb_clk / 32; + baseclk = (gd->ipb_clk + 16) / 32; #endif
/* 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; } #endif /* CONFIG_PSC_CONSOLE */

In message 41F91530.7010706@MAZeT.de you wrote:
attached is a patch, that fixes a bug in MPC5200 PSC Baud rate calculation. The Problem was, that proper rounding was not applied to baudrate calculation in serial_setbrg(). The formula from serial_init() should be used.
Added (as far as still relevant).
Best regards,
Wolfgang Denk
participants (2)
-
Sebastian Schau
-
Wolfgang Denk