forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/arch/arm/mach-shmobile/setup-rcar-gen2.c
....@@ -7,24 +7,26 @@
77 * Copyright (C) 2014 Ulrich Hecht
88 */
99
10
-#include <linux/clk-provider.h>
1110 #include <linux/clocksource.h>
1211 #include <linux/device.h>
13
-#include <linux/dma-contiguous.h>
12
+#include <linux/dma-map-ops.h>
1413 #include <linux/io.h>
1514 #include <linux/kernel.h>
1615 #include <linux/memblock.h>
1716 #include <linux/of.h>
17
+#include <linux/of_clk.h>
1818 #include <linux/of_fdt.h>
1919 #include <linux/of_platform.h>
20
+#include <linux/psci.h>
2021 #include <asm/mach/arch.h>
2122 #include <asm/secure_cntvoff.h>
2223 #include "common.h"
2324 #include "rcar-gen2.h"
2425
2526 static const struct of_device_id cpg_matches[] __initconst = {
26
- { .compatible = "renesas,rcar-gen2-cpg-clocks", },
27
+ { .compatible = "renesas,r8a7742-cpg-mssr", .data = "extal" },
2728 { .compatible = "renesas,r8a7743-cpg-mssr", .data = "extal" },
29
+ { .compatible = "renesas,r8a7744-cpg-mssr", .data = "extal" },
2830 { .compatible = "renesas,r8a7790-cpg-mssr", .data = "extal" },
2931 { .compatible = "renesas,r8a7791-cpg-mssr", .data = "extal" },
3032 { .compatible = "renesas,r8a7793-cpg-mssr", .data = "extal" },
....@@ -57,10 +59,25 @@
5759 #define CNTCR 0
5860 #define CNTFID0 0x20
5961
60
-void __init rcar_gen2_timer_init(void)
62
+static void __init rcar_gen2_timer_init(void)
6163 {
64
+ bool need_update = true;
6265 void __iomem *base;
6366 u32 freq;
67
+
68
+ /*
69
+ * If PSCI is available then most likely we are running on PSCI-enabled
70
+ * U-Boot which, we assume, has already taken care of resetting CNTVOFF
71
+ * and updating counter module before switching to non-secure mode
72
+ * and we don't need to.
73
+ */
74
+#ifdef CONFIG_ARM_PSCI_FW
75
+ if (psci_ops.cpu_on)
76
+ need_update = false;
77
+#endif
78
+
79
+ if (need_update == false)
80
+ goto skip_update;
6481
6582 secure_cntvoff_init();
6683
....@@ -101,6 +118,7 @@
101118
102119 iounmap(base);
103120
121
+skip_update:
104122 of_clk_init(NULL);
105123 timer_probe();
106124 }
....@@ -156,7 +174,7 @@
156174 return 0;
157175 }
158176
159
-void __init rcar_gen2_reserve(void)
177
+static void __init rcar_gen2_reserve(void)
160178 {
161179 struct memory_reserve_config mrc;
162180
....@@ -192,7 +210,9 @@
192210 MACHINE_END
193211
194212 static const char * const rz_g1_boards_compat_dt[] __initconst = {
213
+ "renesas,r8a7742",
195214 "renesas,r8a7743",
215
+ "renesas,r8a7744",
196216 "renesas,r8a7745",
197217 "renesas,r8a77470",
198218 NULL,