Merge branch 'mpc86xx'
[oweals/u-boot.git] / cpu / mpc8xx / speed.c
index f03831617c1f24e316e49e182498e9c0c466e0ec..101d5f9cb35a2fa9909cd9d3df1db8ffa8c0947d 100644 (file)
@@ -25,6 +25,8 @@
 #include <mpc8xx.h>
 #include <asm/processor.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 #if !defined(CONFIG_8xx_CPUCLK_DEFAULT) || defined(CFG_MEASURE_CPUCLK) || defined(DEBUG)
 
 #define PITC_SHIFT 16
@@ -181,8 +183,6 @@ unsigned long measure_gclk(void)
  */
 int get_clocks (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        uint immr = get_immr (0);       /* Return full IMMR contents */
        volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
        uint sccr = immap->im_clkrst.car_sccr;
@@ -238,8 +238,6 @@ static long init_pll_866 (long clk);
  */
 int get_clocks_866 (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        volatile immap_t *immr = (immap_t *) CFG_IMMR;
        char              tmp[64];
        long              cpuclk = 0;
@@ -261,7 +259,11 @@ int get_clocks_866 (void)
         */
        sccr_reg = immr->im_clkrst.car_sccr;
        sccr_reg &= ~SCCR_EBDF11;
+#if defined(CONFIG_TQM885D)
+       if (gd->cpu_clk <= 80000000) {
+#else
        if (gd->cpu_clk <= 66000000) {
+#endif
                sccr_reg |= SCCR_EBDF00;        /* bus division factor = 1 */
                gd->bus_clk = gd->cpu_clk;
        } else {
@@ -277,8 +279,6 @@ int get_clocks_866 (void)
  */
 int sdram_adjust_866 (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        volatile immap_t *immr = (immap_t *) CFG_IMMR;
        long              mamr;
 
@@ -364,15 +364,14 @@ static long init_pll_866 (long clk)
 
 #endif /* CONFIG_8xx_CPUCLK_DEFAULT */
 
-#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M)
+#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_TQM866M) \
+    && !defined(CONFIG_TQM885D)
 /*
  * Adjust sdram refresh rate to actual CPU clock
  * and set timebase source according to actual CPU clock
  */
 int adjust_sdram_tbs_8xx (void)
 {
-       DECLARE_GLOBAL_DATA_PTR;
-
        volatile immap_t *immr = (immap_t *) CFG_IMMR;
        long              mamr;
        long              sccr;
@@ -390,6 +389,6 @@ int adjust_sdram_tbs_8xx (void)
 
        return (0);
 }
-#endif /* CONFIG_TQM8xxL/M, !TQM866M */
+#endif /* CONFIG_TQM8xxL/M, !TQM866M, !TQM885D */
 
 /* ------------------------------------------------------------------------- */