mpc83xx: Introduce ARCH_MPC834*
[platform/kernel/u-boot.git] / arch / powerpc / cpu / mpc83xx / cpu_init.c
index 5153351..7c37867 100644 (file)
@@ -1,31 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
- *
- * 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 <mpc83xx.h>
 #include <ioports.h>
 #include <asm/io.h>
+#include <asm/processor.h>
 #ifdef CONFIG_USB_EHCI_FSL
-#include <usb/ehci-fsl.h>
+#include <usb/ehci-ci.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -221,8 +205,7 @@ void cpu_init_f (volatile immap_t * im)
        /* Pointer is writable since we allocated a register for it */
        gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
 
-       /* Clear initial global data */
-       memset ((void *) gd, 0, sizeof (gd_t));
+       /* global data region was cleared in start.S */
 
        /* system performance tweaking */
        clrsetbits_be32(&im->arbiter.acr, acr_mask, acr_val);
@@ -257,7 +240,7 @@ void cpu_init_f (volatile immap_t * im)
 
        /* System General Purpose Register */
 #ifdef CONFIG_SYS_SICRH
-#if defined(CONFIG_MPC834x) || defined(CONFIG_MPC8313)
+#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC8313)
        /* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
        __raw_writel((im->sysconf.sicrh & 0x0000000C) | CONFIG_SYS_SICRH,
                     &im->sysconf.sicrh);
@@ -329,9 +312,9 @@ void cpu_init_f (volatile immap_t * im)
        im->gpio[1].dat = CONFIG_SYS_GPIO2_DAT;
        im->gpio[1].dir = CONFIG_SYS_GPIO2_DIR;
 #endif
-#if defined(CONFIG_USB_EHCI_FSL) && defined(CONFIG_MPC831x)
+#if defined(CONFIG_USB_EHCI_FSL) && defined(CONFIG_ARCH_MPC831X)
        uint32_t temp;
-       struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR;
+       struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB1_ADDR;
 
        /* Configure interface. */
        setbits_be32(&ehci->control, REFSEL_16MHZ | UTMI_PHY_EN);
@@ -441,15 +424,15 @@ static int print_83xx_arb_event(int force)
        };
 
        int etype = (gd->arch.arbiter_event_attributes & AEATR_EVENT)
-                   >> AEATR_EVENT_SHIFT;
+                   >> AEATR_EVENT_SHIFT;
        int mstr_id = (gd->arch.arbiter_event_attributes & AEATR_MSTR_ID)
-                     >> AEATR_MSTR_ID_SHIFT;
+                     >> AEATR_MSTR_ID_SHIFT;
        int tbst = (gd->arch.arbiter_event_attributes & AEATR_TBST)
-                  >> AEATR_TBST_SHIFT;
+                  >> AEATR_TBST_SHIFT;
        int tsize = (gd->arch.arbiter_event_attributes & AEATR_TSIZE)
-                   >> AEATR_TSIZE_SHIFT;
+                   >> AEATR_TSIZE_SHIFT;
        int ttype = (gd->arch.arbiter_event_attributes & AEATR_TTYPE)
-                   >> AEATR_TTYPE_SHIFT;
+                   >> AEATR_TTYPE_SHIFT;
 
        if (!force && !gd->arch.arbiter_event_address)
                return 0;
@@ -481,6 +464,7 @@ static int print_83xx_arb_event(int force)
 }
 #endif /* CONFIG_DISPLAY_AER_xxxx */
 
+#ifndef CONFIG_CPU_MPC83XX
 /*
  * Figure out the cause of the reset
  */
@@ -500,7 +484,7 @@ int prt_83xx_rsr(void)
                RSR_SRS,  "External/Internal Soft"}, {
                RSR_HRS,  "External/Internal Hard"}
        };
-       static int n = sizeof bits / sizeof bits[0];
+       static int n = ARRAY_SIZE(bits);
        ulong rsr = gd->arch.reset_status;
        int i;
        char *sep;
@@ -522,3 +506,4 @@ int prt_83xx_rsr(void)
 
        return 0;
 }
+#endif