blob: 208ff640698dbef33597d3ce5097262741fd0a7d [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-or-later
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright 2012-2013 Freescale Semiconductor, Inc.
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00004 */
5
Olivier Deprez157378f2022-04-04 15:47:50 +02006#include <linux/of_address.h>
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00007#include <linux/of_platform.h>
Olivier Deprez157378f2022-04-04 15:47:50 +02008#include <linux/io.h>
9
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000010#include <linux/irqchip.h>
11#include <asm/mach/arch.h>
12#include <asm/hardware/cache-l2x0.h>
13
Olivier Deprez157378f2022-04-04 15:47:50 +020014#include "common.h"
15#include "hardware.h"
16
17#define MSCM_CPxCOUNT 0x00c
18#define MSCM_CPxCFG1 0x014
19
20static void __init vf610_detect_cpu(void)
21{
22 struct device_node *np;
23 u32 cpxcount, cpxcfg1;
24 unsigned int cpu_type;
25 void __iomem *mscm;
26
27 np = of_find_compatible_node(NULL, NULL, "fsl,vf610-mscm-cpucfg");
28 if (WARN_ON(!np))
29 return;
30
31 mscm = of_iomap(np, 0);
32 of_node_put(np);
33
34 if (WARN_ON(!mscm))
35 return;
36
37 cpxcount = readl_relaxed(mscm + MSCM_CPxCOUNT);
38 cpxcfg1 = readl_relaxed(mscm + MSCM_CPxCFG1);
39
40 iounmap(mscm);
41
42 cpu_type = cpxcount ? MXC_CPU_VF600 : MXC_CPU_VF500;
43
44 if (cpxcfg1)
45 cpu_type |= MXC_CPU_VFx10;
46
47 mxc_set_cpu_type(cpu_type);
48}
49
50static void __init vf610_init_machine(void)
51{
52 vf610_detect_cpu();
53
54 of_platform_default_populate(NULL, NULL, NULL);
55}
56
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000057static const char * const vf610_dt_compat[] __initconst = {
58 "fsl,vf500",
59 "fsl,vf510",
60 "fsl,vf600",
61 "fsl,vf610",
62 "fsl,vf610m4",
63 NULL,
64};
65
66DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)")
67 .l2c_aux_val = 0,
68 .l2c_aux_mask = ~0,
Olivier Deprez157378f2022-04-04 15:47:50 +020069 .init_machine = vf610_init_machine,
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000070 .dt_compat = vf610_dt_compat,
71MACHINE_END