From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Fri, 11 Jul 2008 11:13:21 -0400 Subject: [U-Boot-Users] [PATCH] Round the serial port clock divisor valuereturned by calc_divisor() In-Reply-To: <42848A5C5A0D1E47B026E644DD49B08E0284BE71@mail> References: <20080711012540.GA29444@cideas.com> <42848A5C5A0D1E47B026E644DD49B08E0284BE71@mail> Message-ID: <48777891.9000709@ge.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hugo Villeneuve wrote: > u-boot-users-bounces at lists.sourceforge.net wrote: >> This formula is better at avoiding integer overflow. > > This patch doesn?t round the value correctly. > > Wolfgang, I will resubmit a new patch shortly today to fix the problem. > > Hugo V. Arrgh, you are right. I know you solved it already, but for the record I oversimplified: (gd->baudrate / 2) should have been: (gd->baudrate * (MODE_X_DIV / 2)) WRONG: + return (CFG_NS16550_CLK + (gd->baudrate / 2)) / + (MODE_X_DIV * gd->baudrate); should have been + return (CFG_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) / + (MODE_X_DIV * gd->baudrate); Sorry, gvb