Changeset 663e529 in rtems


Ignore:
Timestamp:
Sep 8, 2008, 9:54:22 AM (11 years ago)
Author:
Thomas Doerfler <Thomas.Doerfler@…>
Branches:
4.10, 4.11, 4.9, master
Children:
63de714c
Parents:
95c274e
Message:

added support for flexible PLL in MPC866 and friends

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/powerpc/mpc8xx/clock/clock.c

    r95c274e r663e529  
    7373  unsigned desiredLevel;
    7474  uint32_t   pit_value;
    75   uint32_t mf_value;
     75  uint32_t   extclk;
    7676  bool force_prescaler = false;
    7777  extern uint32_t bsp_clicks_per_usec;
    7878  extern uint32_t bsp_clock_speed;
     79  uint32_t immr_val;
    7980
    8081  if (bsp_clicks_per_usec == 0) {
     
    8283     * oscclk is too low for PIT, compute extclk and derive PIT from there
    8384     */
    84     mf_value  = m8xx.plprcr >> 20;   
    85     pit_value = (bsp_clock_speed
    86                  / (mf_value+1)
     85    /*
     86     * determine external input clock by examining the PLL settings
     87     * this must be done differently depending on type of PLL
     88     */
     89    _mfspr(immr_val,M8xx_IMMR);
     90    if (8 == ((immr_val & 0x0000FF00) >> 8)) {
     91      /*
     92       * for MPC866: complex PLL
     93       */
     94      uint32_t plprcr_val;
     95      uint32_t mfn_value;
     96      uint32_t mfd_value;
     97      uint32_t mfi_value;
     98      uint32_t pdf_value;
     99      uint32_t s_value;
     100
     101      plprcr_val = m8xx.plprcr;
     102      mfn_value  = (plprcr_val & (0xf8000000)) >> (31- 4);
     103      mfd_value  = (plprcr_val & (0x07c00000)) >> (31- 9);
     104      s_value    = (plprcr_val & (0x00300000)) >> (31-11);
     105      mfi_value  = (plprcr_val & (0x000f0000)) >> (31-15);
     106      pdf_value  = (plprcr_val & (0x00000006)) >> (31-30);
     107      extclk = (((uint64_t)bsp_clock_speed)
     108                * ((pdf_value + 1) * (mfd_value + 1))
     109                / (mfi_value * (mfd_value + 1) + mfn_value)
     110                * (1 << s_value));
     111    }
     112    else {
     113      /*
     114       * for MPC860/850 etc: simple PLL
     115       */
     116      uint32_t mf_value;
     117      mf_value  = m8xx.plprcr >> 20;
     118      extclk    = bsp_clock_speed / (mf_value+1);
     119    }
     120    pit_value = (extclk
    87121                 / 1000
    88122                 / 4
Note: See TracChangeset for help on using the changeset viewer.