forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/arm/mach-imx/mach-vf610.c
....@@ -1,16 +1,58 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright 2012-2013 Freescale Semiconductor, Inc.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
84 */
95
6
+#include <linux/of_address.h>
107 #include <linux/of_platform.h>
8
+#include <linux/io.h>
9
+
1110 #include <linux/irqchip.h>
1211 #include <asm/mach/arch.h>
1312 #include <asm/hardware/cache-l2x0.h>
13
+
14
+#include "common.h"
15
+#include "hardware.h"
16
+
17
+#define MSCM_CPxCOUNT 0x00c
18
+#define MSCM_CPxCFG1 0x014
19
+
20
+static 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
+
50
+static void __init vf610_init_machine(void)
51
+{
52
+ vf610_detect_cpu();
53
+
54
+ of_platform_default_populate(NULL, NULL, NULL);
55
+}
1456
1557 static const char * const vf610_dt_compat[] __initconst = {
1658 "fsl,vf500",
....@@ -24,5 +66,6 @@
2466 DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF5xx/VF6xx (Device Tree)")
2567 .l2c_aux_val = 0,
2668 .l2c_aux_mask = ~0,
69
+ .init_machine = vf610_init_machine,
2770 .dt_compat = vf610_dt_compat,
2871 MACHINE_END