Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright 2012-2013 Freescale Semiconductor, Inc.
0004  */
0005 
0006 #include <linux/of_address.h>
0007 #include <linux/of_platform.h>
0008 #include <linux/io.h>
0009 
0010 #include <linux/irqchip.h>
0011 #include <asm/mach/arch.h>
0012 #include <asm/hardware/cache-l2x0.h>
0013 
0014 #include "common.h"
0015 #include "hardware.h"
0016 
0017 #define MSCM_CPxCOUNT       0x00c
0018 #define MSCM_CPxCFG1        0x014
0019 
0020 static void __init vf610_detect_cpu(void)
0021 {
0022     struct device_node *np;
0023     u32 cpxcount, cpxcfg1;
0024     unsigned int cpu_type;
0025     void __iomem *mscm;
0026 
0027     np = of_find_compatible_node(NULL, NULL, "fsl,vf610-mscm-cpucfg");
0028     if (WARN_ON(!np))
0029         return;
0030 
0031     mscm = of_iomap(np, 0);
0032     of_node_put(np);
0033 
0034     if (WARN_ON(!mscm))
0035         return;
0036 
0037     cpxcount = readl_relaxed(mscm + MSCM_CPxCOUNT);
0038     cpxcfg1  = readl_relaxed(mscm + MSCM_CPxCFG1);
0039 
0040     iounmap(mscm);
0041 
0042     cpu_type = cpxcount ? MXC_CPU_VF600 : MXC_CPU_VF500;
0043 
0044     if (cpxcfg1)
0045         cpu_type |= MXC_CPU_VFx10;
0046 
0047     mxc_set_cpu_type(cpu_type);
0048 }
0049 
0050 static void __init vf610_init_machine(void)
0051 {
0052     vf610_detect_cpu();
0053 
0054     of_platform_default_populate(NULL, NULL, NULL);
0055 }
0056 
0057 static const char * const vf610_dt_compat[] __initconst = {
0058     "fsl,vf500",
0059     "fsl,vf510",
0060     "fsl,vf600",
0061     "fsl,vf610",
0062     "fsl,vf610m4",
0063     NULL,
0064 };
0065 
0066 DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)")
0067     .l2c_aux_val    = 0,
0068     .l2c_aux_mask   = ~0,
0069     .init_machine   = vf610_init_machine,
0070     .dt_compat  = vf610_dt_compat,
0071 MACHINE_END