]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - cpu/mpc512x/speed.c
General help message cleanup
[karo-tx-uboot.git] / cpu / mpc512x / speed.c
index a609827387b9881ad8dbfb6beda6d6756daa335a..1f908624249834c82b48fc27d1cb5772a606e60a 100644 (file)
@@ -62,17 +62,19 @@ static int sys_dividors[][2] = {
 
 int get_clocks (void)
 {
-       volatile immap_t *im = (immap_t *) CFG_IMMR;
+       volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
        u8 spmf;
        u8 cpmf;
        u8 sys_div;
        u8 ips_div;
-       u32 ref_clk = CFG_MPC512X_CLKIN;
+       u8 pci_div;
+       u32 ref_clk = CONFIG_SYS_MPC512X_CLKIN;
        u32 spll;
        u32 sys_clk;
        u32 core_clk;
        u32 csb_clk;
        u32 ips_clk;
+       u32 pci_clk;
 
        if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im)
                return -1;
@@ -95,8 +97,16 @@ int get_clocks (void)
                /* in case we cannot get a sane IPS divisor, fail gracefully */
                ips_clk = 0;
        }
+       pci_div = (im->clk.scfr[0] & SCFR1_PCI_DIV_MASK) >> SCFR1_PCI_DIV_SHIFT;
+       if (pci_div != 0) {
+               pci_clk = csb_clk / pci_div;
+       } else {
+               /* in case we cannot get a sane IPS divisor, fail gracefully */
+               pci_clk = 333333;
+       }
 
-       gd->ipb_clk = ips_clk;
+       gd->ips_clk = ips_clk;
+       gd->pci_clk = pci_clk;
        gd->csb_clk = csb_clk;
        gd->cpu_clk = core_clk;
        gd->bus_clk = csb_clk;
@@ -115,17 +125,20 @@ ulong get_bus_freq (ulong dummy)
 
 int do_clocks (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
-       printf ("Clock configuration:\n");
-       printf ("  CPU:                 %4d MHz\n", gd->cpu_clk / 1000000);
-       printf ("  Coherent System Bus: %4d MHz\n", gd->csb_clk / 1000000);
-       printf ("  IPS Bus:             %4d MHz\n", gd->ipb_clk / 1000000);
-       printf ("  DDR:                 %4d MHz\n", 2 * gd->csb_clk / 1000000);
+       char buf[32];
+
+       printf("Clock configuration:\n");
+       printf("  CPU:                 %-4s MHz\n", strmhz(buf, gd->cpu_clk));
+       printf("  Coherent System Bus: %-4s MHz\n", strmhz(buf, gd->csb_clk));
+       printf("  IPS Bus:             %-4s MHz\n", strmhz(buf, gd->ips_clk));
+       printf("  PCI:                 %-4s MHz\n", strmhz(buf, gd->pci_clk));
+       printf("  DDR:                 %-4s MHz\n", strmhz(buf, 2*gd->csb_clk));
        return 0;
 }
 
 U_BOOT_CMD(clocks, 1, 0, do_clocks,
-       "clocks  - print clock configuration\n",
-       "    clocks\n"
+       "print clock configuration",
+       "    clocks"
 );
 
 int prt_mpc512x_clks (void)