[U-Boot-Users] [PATCH] Round the serial port clock divisor valuereturned by calc_divisor()
Jerry Van Baren
gerald.vanbaren at ge.com
Fri Jul 11 17:13:21 CEST 2008
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
More information about the U-Boot
mailing list