Merge tag 'u-boot-atmel-fixes-2020.07-a' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / arch / powerpc / cpu / mpc86xx / cpu.c
index 4e90fd2203725e2c1bb60ce96ae209dd0fd0bbb0..9f5bce3992b8c22c5dfd3bda58a942d97187a01a 100644 (file)
@@ -1,34 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2006,2009-2010 Freescale Semiconductor, Inc.
  * Jeff Brown
  * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
  */
 
 #include <common.h>
+#include <cpu_func.h>
+#include <log.h>
+#include <time.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <asm/cache.h>
 #include <asm/mmu.h>
 #include <mpc86xx.h>
 #include <asm/fsl_law.h>
+#include <asm/ppc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -48,7 +36,6 @@ checkcpu(void)
 {
        sys_info_t sysinfo;
        uint pvr, svr;
-       uint ver;
        uint major, minor;
        char buf1[32], buf2[32];
        volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
@@ -57,7 +44,6 @@ checkcpu(void)
        uint msscr0 = mfspr(MSSCR0);
 
        svr = get_svr();
-       ver = SVR_SOC_VER(svr);
        major = SVR_MAJ(svr);
        minor = SVR_MIN(svr);
 
@@ -69,7 +55,7 @@ checkcpu(void)
        }
        puts("CPU:   ");
 
-       cpu = gd->cpu;
+       cpu = gd->arch.cpu;
 
        puts(cpu->name);
 
@@ -77,11 +63,10 @@ checkcpu(void)
        puts("Core:  ");
 
        pvr = get_pvr();
-       ver = PVR_E600_VER(pvr);
        major = PVR_E600_MAJ(pvr);
        minor = PVR_E600_MIN(pvr);
 
-       printf("E600 Core %d", (msscr0 & 0x20) ? 1 : 0 );
+       printf("e600 Core %d", (msscr0 & 0x20) ? 1 : 0);
        if (gur->pordevsr & MPC86xx_PORDEVSR_CORE1TE)
                puts("\n    Core1Translation Enabled");
        debug(" (MSSCR0=%x, PORDEVSR=%x)", msscr0, gur->pordevsr);
@@ -91,30 +76,30 @@ checkcpu(void)
        get_sys_info(&sysinfo);
 
        puts("Clock Configuration:\n");
-       printf("       CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freqProcessor));
-       printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freqSystemBus));
+       printf("       CPU:%-4s MHz, ", strmhz(buf1, sysinfo.freq_processor));
+       printf("MPX:%-4s MHz\n", strmhz(buf1, sysinfo.freq_systembus));
        printf("       DDR:%-4s MHz (%s MT/s data rate), ",
-               strmhz(buf1, sysinfo.freqSystemBus / 2),
-               strmhz(buf2, sysinfo.freqSystemBus));
+               strmhz(buf1, sysinfo.freq_systembus / 2),
+               strmhz(buf2, sysinfo.freq_systembus));
 
-       if (sysinfo.freqLocalBus > LCRR_CLKDIV) {
-               printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freqLocalBus));
+       if (sysinfo.freq_localbus > LCRR_CLKDIV) {
+               printf("LBC:%-4s MHz\n", strmhz(buf1, sysinfo.freq_localbus));
        } else {
                printf("LBC: unknown (LCRR[CLKDIV] = 0x%02lx)\n",
-                      sysinfo.freqLocalBus);
+                      sysinfo.freq_localbus);
        }
 
-       puts("L1:    D-cache 32 KB enabled\n");
-       puts("       I-cache 32 KB enabled\n");
+       puts("L1:    D-cache 32 KiB enabled\n");
+       puts("       I-cache 32 KiB enabled\n");
 
        puts("L2:    ");
        if (get_l2cr() & 0x80000000) {
-#if defined(CONFIG_MPC8610)
+#if defined(CONFIG_ARCH_MPC8610)
                puts("256");
-#elif defined(CONFIG_MPC8641)
+#elif defined(CONFIG_ARCH_MPC8641)
                puts("512");
 #endif
-               puts(" KB enabled\n");
+               puts(" KiB enabled\n");
        } else {
                puts("Disabled\n");
        }
@@ -123,8 +108,7 @@ checkcpu(void)
 }
 
 
-void
-do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
        volatile ccsr_gur_t *gur = &immap->im_gur;
@@ -137,6 +121,8 @@ do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
        while (1)
                ;
+
+       return 1;
 }
 
 
@@ -149,7 +135,7 @@ get_tbclk(void)
        sys_info_t sys_info;
 
        get_sys_info(&sys_info);
-       return (sys_info.freqSystemBus + 3L) / 4L;
+       return (sys_info.freq_systembus + 3L) / 4L;
 }
 
 
@@ -157,7 +143,7 @@ get_tbclk(void)
 void
 watchdog_reset(void)
 {
-#if defined(CONFIG_MPC8610)
+#if defined(CONFIG_ARCH_MPC8610)
        /*
         * This actually feed the hard enabled watchdog.
         */
@@ -178,7 +164,7 @@ watchdog_reset(void)
  * Print out the state of various machine registers.
  * Currently prints out LAWs, BR0/OR0, and BATs
  */
-void mpc86xx_reginfo(void)
+void print_reginfo(void)
 {
        print_bats();
        print_laws();