Subject: Re: R: Installation on a MPC5200 based custom board

From: Angelo <[email-masked]>
Date: Fri, 5 Dec 2008 20:29:57 +0000 (GMT)

Ok .
=============================================
Case arch = powerpc

I saw that cdm is modified in two fields.

arch/powerpc/platforms/mpc52xx_common.c file, in function: mpc52xx_setup_cpu(void)
.....
    /* Use internal 48 Mhz */
    out_8(&cdm->ext_48mhz_en, 0x00);
    out_8(&cdm->fd_enable, 0x01);
    if (in_be32(&cdm->rstcfg) & 0x40)    /* Assumes 33Mhz clock */
        out_be16(&cdm->fd_counters, 0x0001);
    else
        out_be16(&cdm->fd_counters, 0x5555);
.....

and in file arch/powerpc/platforms/52xx/lite5200.c , function:
void __init lite5200_calibrate_decr(void)
{
    ppc_tb_freq = 0x1F78A40;        /* hardcoded default */
    /* CPU FREQUENCY FORCED TO 396 MHz VALUE */
    ppc_proc_freq = 0x179A7B00;    /* hardcoded default */
..........

=============================================
Case arch = ppc

The code is equal but obviously the path change (arch/ppc/syslib/mpc52xx_setup.c). Funtion: mpc52xx_setup_cpu(void)
.....
    /* Use internal 48 Mhz */
    out_8(&cdm->ext_48mhz_en, 0x00);
    out_8(&cdm->fd_enable, 0x01);
    if (in_be32(&cdm->rstcfg) & 0x40)    /* Assumes 33Mhz clock */
        out_be16(&cdm->fd_counters, 0x0001);
    else
        out_be16(&cdm->fd_counters, 0x5555);
.....
And in function: mpc52xx_calibrate_decr(void)

.....
    xlbfreq = __res.bi_busfreq;
    /* if bootloader didn't pass bus frequencies, calculate them */
    if (xlbfreq == 0) {
    ...........
        /* Compute all frequency from that & CDM settings */
        xlbfreq = (tbl_end - tbl_start) << 8;
        cpufreq = (xlbfreq * core_mult[in_be32(&cdm->rstcfg)&0x1f])/10;
        ipbfreq = (in_8(&cdm->ipb_clk_sel) & 1) ?
                    xlbfreq / 2 : xlbfreq;
        switch (in_8(&cdm->pci_clk_sel) & 3) {
        case 0:
            pcifreq = ipbfreq;
            break;
        case 1:
            pcifreq = ipbfreq / 2;
            break;
        default:
            pcifreq = xlbfreq / 4;
            break;
        }
    .....
=============================================

What do you think about this?

Thanks in advance,
@ngel
--- Ven 5/12/08, Jon Smirl <[email-masked]> ha scritto:
Da: Jon Smirl <[email-masked]>
Oggetto: Re: R: Installation on a MPC5200 based custom board
A: "Juergen Beisert" <[email-masked]>
Cc: [email-masked], [email-masked], "Gary Thomas" <[email-masked]>, [email-masked]
Data: Venerdì 5 dicembre 2008, 20:33

The attachment is from Freescale and shows how the divider works.

-- 
Jon Smirl
[email-masked]