ppc: Move clock fields to arch_global_data
authorSimon Glass <sjg@chromium.org>
Thu, 13 Dec 2012 20:48:46 +0000 (20:48 +0000)
committerTom Rini <trini@ti.com>
Fri, 1 Feb 2013 20:42:45 +0000 (15:42 -0500)
Move vco_out, cpm_clk, scc_clk, brg_clk into arch_global_data and tidy
up. Leave pci_clk on its own since this should really depend only on
CONFIG_PCI and not any particular chip type.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/powerpc/cpu/mpc8260/speed.c
arch/powerpc/cpu/mpc85xx/speed.c
arch/powerpc/include/asm/global_data.h
arch/powerpc/lib/board.c

index 4ad1ec24c3b4a8fd8a99963d68d834c00cd7ec41..7841e8a898c8e64229aada14afd9c8b682230f74 100644 (file)
@@ -135,17 +135,17 @@ int get_clocks (void)
            (get_pvr () == PVR_8260_HIP7R1) ||
            (get_pvr () == PVR_8260_HIP7RA)) {
                pllmf = (scmr & SCMR_PLLMF_MSKH7) >> SCMR_PLLMF_SHIFT;
-               gd->vco_out = clkin * (pllmf + 1);
+               gd->arch.vco_out = clkin * (pllmf + 1);
        } else {                        /* HiP3, HiP4 */
                pllmf = (scmr & SCMR_PLLMF_MSK) >> SCMR_PLLMF_SHIFT;
                plldf = (scmr & SCMR_PLLDF) ? 1 : 0;
-               gd->vco_out = (clkin * 2 * (pllmf + 1)) / (plldf + 1);
+               gd->arch.vco_out = (clkin * 2 * (pllmf + 1)) / (plldf + 1);
        }
 
-       gd->cpm_clk = gd->vco_out / 2;
+       gd->arch.cpm_clk = gd->arch.vco_out / 2;
        gd->bus_clk = clkin;
-       gd->scc_clk = gd->vco_out / 4;
-       gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+       gd->arch.scc_clk = gd->arch.vco_out / 4;
+       gd->arch.brg_clk = gd->arch.vco_out / (1 << (2 * (dfbrg + 1)));
 
        if (cp->b2c_mult > 0) {
                gd->cpu_clk = (clkin * cp->b2c_mult) / 2;
@@ -173,7 +173,7 @@ int get_clocks (void)
                        pci_div = pcidf + 1;
                }
 
-               gd->pci_clk = (gd->cpm_clk * 2) / pci_div;
+               gd->pci_clk = (gd->arch.cpm_clk * 2) / pci_div;
        }
 #endif
 
@@ -231,10 +231,10 @@ int prt_8260_clks (void)
                        plldf, pllmf, pcidf);
 
        printf (" - vco_out %10ld, scc_clk %10ld, brg_clk %10ld\n",
-                       gd->vco_out, gd->scc_clk, gd->arch.brg_clk);
+                       gd->arch.vco_out, gd->arch.scc_clk, gd->arch.brg_clk);
 
        printf (" - cpu_clk %10ld, cpm_clk %10ld, bus_clk %10ld\n",
-                       gd->cpu_clk, gd->cpm_clk, gd->bus_clk);
+                       gd->cpu_clk, gd->arch.cpm_clk, gd->bus_clk);
 #ifdef CONFIG_PCI
        printf (" - pci_clk %10ld\n", gd->pci_clk);
 #endif
index 8a581ef76b25592310f8e2559aa88e4ffc579137..c4ca481059b75004fea1f8ce88e65d7c423f1e10 100644 (file)
@@ -435,10 +435,10 @@ int get_clocks (void)
 #endif /* defined(CONFIG_FSL_ESDHC) */
 
 #if defined(CONFIG_CPM2)
-       gd->vco_out = 2*sys_info.freqSystemBus;
-       gd->cpm_clk = gd->vco_out / 2;
-       gd->scc_clk = gd->vco_out / 4;
-       gd->arch.brg_clk = gd->vco_out / (1 << (2 * (dfbrg + 1)));
+       gd->arch.vco_out = 2*sys_info.freqSystemBus;
+       gd->arch.cpm_clk = gd->arch.vco_out / 2;
+       gd->arch.scc_clk = gd->arch.vco_out / 4;
+       gd->arch.brg_clk = gd->arch.vco_out / (1 << (2 * (dfbrg + 1)));
 #endif
 
        if(gd->cpu_clk != 0) return (0);
index 8e3a7261201fc71e069612d848550ed229e01593..7d0115d2894d70bda6fa9c3db445f4b2482352b4 100644 (file)
@@ -33,6 +33,10 @@ struct arch_global_data {
        unsigned long brg_clk;
 #endif
 #if defined(CONFIG_CPM2)
+       /* There are many clocks on the MPC8260 - see page 9-5 */
+       unsigned long vco_out;
+       unsigned long cpm_clk;
+       unsigned long scc_clk;
        unsigned long brg_clk;
 #endif
 #if defined(CONFIG_QE)
index b1069a6c0e0322469ac1fff0336f9d91c991caf3..988039f33726182370fdddea051588228667d22d 100644 (file)
@@ -580,10 +580,10 @@ void board_init_f(ulong bootflag)
        bd->bi_intfreq = gd->cpu_clk;   /* Internal Freq, in Hz */
        bd->bi_busfreq = gd->bus_clk;   /* Bus Freq,      in Hz */
 #if defined(CONFIG_CPM2)
-       bd->bi_cpmfreq = gd->cpm_clk;
+       bd->bi_cpmfreq = gd->arch.cpm_clk;
        bd->bi_brgfreq = gd->arch.brg_clk;
-       bd->bi_sccfreq = gd->scc_clk;
-       bd->bi_vco = gd->vco_out;
+       bd->bi_sccfreq = gd->arch.scc_clk;
+       bd->bi_vco = gd->arch.vco_out;
 #endif /* CONFIG_CPM2 */
 #if defined(CONFIG_MPC512X)
        bd->bi_ipsfreq = gd->ips_clk;