xref: /linux/arch/arm/mach-imx/mach-vf610.c (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
25be913c6SJingchang Lu /*
35be913c6SJingchang Lu  * Copyright 2012-2013 Freescale Semiconductor, Inc.
45be913c6SJingchang Lu  */
55be913c6SJingchang Lu 
6dceb213cSAndrey Smirnov #include <linux/of_address.h>
75be913c6SJingchang Lu #include <linux/of_platform.h>
8dceb213cSAndrey Smirnov #include <linux/io.h>
9dceb213cSAndrey Smirnov 
105be913c6SJingchang Lu #include <linux/irqchip.h>
115be913c6SJingchang Lu #include <asm/mach/arch.h>
125be913c6SJingchang Lu #include <asm/hardware/cache-l2x0.h>
135be913c6SJingchang Lu 
14dceb213cSAndrey Smirnov #include "common.h"
15dceb213cSAndrey Smirnov #include "hardware.h"
16dceb213cSAndrey Smirnov 
17dceb213cSAndrey Smirnov #define MSCM_CPxCOUNT		0x00c
18dceb213cSAndrey Smirnov #define MSCM_CPxCFG1		0x014
19dceb213cSAndrey Smirnov 
vf610_detect_cpu(void)20dceb213cSAndrey Smirnov static void __init vf610_detect_cpu(void)
21dceb213cSAndrey Smirnov {
22dceb213cSAndrey Smirnov 	struct device_node *np;
23dceb213cSAndrey Smirnov 	u32 cpxcount, cpxcfg1;
24dceb213cSAndrey Smirnov 	unsigned int cpu_type;
25dceb213cSAndrey Smirnov 	void __iomem *mscm;
26dceb213cSAndrey Smirnov 
27dceb213cSAndrey Smirnov 	np = of_find_compatible_node(NULL, NULL, "fsl,vf610-mscm-cpucfg");
28dceb213cSAndrey Smirnov 	if (WARN_ON(!np))
29dceb213cSAndrey Smirnov 		return;
30dceb213cSAndrey Smirnov 
31dceb213cSAndrey Smirnov 	mscm = of_iomap(np, 0);
32dceb213cSAndrey Smirnov 	of_node_put(np);
33dceb213cSAndrey Smirnov 
34dceb213cSAndrey Smirnov 	if (WARN_ON(!mscm))
35dceb213cSAndrey Smirnov 		return;
36dceb213cSAndrey Smirnov 
37dceb213cSAndrey Smirnov 	cpxcount = readl_relaxed(mscm + MSCM_CPxCOUNT);
38dceb213cSAndrey Smirnov 	cpxcfg1  = readl_relaxed(mscm + MSCM_CPxCFG1);
39dceb213cSAndrey Smirnov 
40dceb213cSAndrey Smirnov 	iounmap(mscm);
41dceb213cSAndrey Smirnov 
42dceb213cSAndrey Smirnov 	cpu_type = cpxcount ? MXC_CPU_VF600 : MXC_CPU_VF500;
43dceb213cSAndrey Smirnov 
44dceb213cSAndrey Smirnov 	if (cpxcfg1)
45dceb213cSAndrey Smirnov 		cpu_type |= MXC_CPU_VFx10;
46dceb213cSAndrey Smirnov 
47dceb213cSAndrey Smirnov 	mxc_set_cpu_type(cpu_type);
48dceb213cSAndrey Smirnov }
49dceb213cSAndrey Smirnov 
vf610_init_machine(void)50dceb213cSAndrey Smirnov static void __init vf610_init_machine(void)
51dceb213cSAndrey Smirnov {
52dceb213cSAndrey Smirnov 	vf610_detect_cpu();
53dceb213cSAndrey Smirnov 
54*d2199b34SPeng Fan 	of_platform_default_populate(NULL, NULL, NULL);
55dceb213cSAndrey Smirnov }
56dceb213cSAndrey Smirnov 
578756dd92SShawn Guo static const char * const vf610_dt_compat[] __initconst = {
58da06aae8SStefan Agner 	"fsl,vf500",
59da06aae8SStefan Agner 	"fsl,vf510",
60da06aae8SStefan Agner 	"fsl,vf600",
615be913c6SJingchang Lu 	"fsl,vf610",
628064887eSStefan Agner 	"fsl,vf610m4",
635be913c6SJingchang Lu 	NULL,
645be913c6SJingchang Lu };
655be913c6SJingchang Lu 
66da06aae8SStefan Agner DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)")
67b9f71aadSRussell King 	.l2c_aux_val	= 0,
68b9f71aadSRussell King 	.l2c_aux_mask	= ~0,
69dceb213cSAndrey Smirnov 	.init_machine   = vf610_init_machine,
705be913c6SJingchang Lu 	.dt_compat	= vf610_dt_compat,
715be913c6SJingchang Lu MACHINE_END
72