From 218103dd3566aa9ae55f202b9b69fc810ea4f42a Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 21 Mar 2000 15:05:19 +0000 Subject: [PATCH] Patch from Gunter Magin . It seems to me I have found a bug in m860_smc_initialize(). This function lives in c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c. The following lines are supposed to set the simode register with the baud rate generator index, which has been returned from m860_get_brg_clk(). (line 386 of console-generic.c) /* * Put SMC in NMSI mode, connect SMC to BRG */ m860.simode &= ~0x7000 << ((port-1) * 8); m860.simode |= brg << (12 + ((port-1) * 8)); This works well for port == 1 (SMC1), however for SMC2 (port == 2) it fails. First, the simode register consists of 2 16bit parts (one for SMC1 and SMC2 respectively), hence the shift count is wrong. Second ~0x7000 (which is 0xffff8fff is shifted left and pulls 0 from the right, which kills the SMC1 entries, when written back to the simode register. Substitute those lines by: m860.simode &= ~(0x7000 << ((port-1) * 16)); m860.simode |= brg << (12 + ((port-1) * 16)); I have checked snapshot 20000218a which still contains the bug. Also affected is libcpu/powerpc/mpc821/console_generic.c, which is a cut&paste&substitue decendant of the mpc860 console-generic.c. --- .../libcpu/powerpc/mpc860/console-generic/console-generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c index e611b3bda8..3ace5ce9b6 100644 --- a/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c +++ b/c/src/lib/libcpu/powerpc/mpc860/console-generic/console-generic.c @@ -385,8 +385,8 @@ m860_smc_initialize (int port) /* port is the SMC number (i.e. 1 or 2) */ /* * Put SMC in NMSI mode, connect SMC to BRG */ - m860.simode &= ~0x7000 << ((port-1) * 8); - m860.simode |= brg << (12 + ((port-1) * 8)); + m860.simode &= ~(0x7000 << ((port-1) * 16)); + m860.simode |= brg << (12 + ((port-1) * 16)); /* * Set up SMC1 parameter RAM common to all protocols