Patch from Gunter Magin <magin@skil.camelot.de>.

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.
CVS: ----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS:  Tag: rtems-4-5-branch
CVS: 	console-generic.c
CVS: ----------------------------------------------------------------------
This commit is contained in:
Joel Sherrill
2000-03-21 15:06:04 +00:00
parent 218103dd35
commit d6b047703d

View File

@@ -370,8 +370,8 @@ m821_smc_initialize (int port) /* port is the SMC number (i.e. 1 or 2) */
/*
* Put SMC in NMSI mode, connect SMC to BRG
*/
m821.simode &= ~0x7000 << ((port-1) * 8);
m821.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