|
@@ -29,17 +29,29 @@
|
|
|
#include "common.h"
|
|
|
#include "rcar-gen2.h"
|
|
|
|
|
|
+static const struct of_device_id cpg_matches[] __initconst = {
|
|
|
+ { .compatible = "renesas,rcar-gen2-cpg-clocks", },
|
|
|
+ { .compatible = "renesas,r8a7743-cpg-mssr", .data = "extal" },
|
|
|
+ { .compatible = "renesas,r8a7790-cpg-mssr", .data = "extal" },
|
|
|
+ { .compatible = "renesas,r8a7791-cpg-mssr", .data = "extal" },
|
|
|
+ { .compatible = "renesas,r8a7793-cpg-mssr", .data = "extal" },
|
|
|
+ { /* sentinel */ }
|
|
|
+};
|
|
|
+
|
|
|
static unsigned int __init get_extal_freq(void)
|
|
|
{
|
|
|
+ const struct of_device_id *match;
|
|
|
struct device_node *cpg, *extal;
|
|
|
u32 freq = 20000000;
|
|
|
+ int idx = 0;
|
|
|
|
|
|
- cpg = of_find_compatible_node(NULL, NULL,
|
|
|
- "renesas,rcar-gen2-cpg-clocks");
|
|
|
+ cpg = of_find_matching_node_and_match(NULL, cpg_matches, &match);
|
|
|
if (!cpg)
|
|
|
return freq;
|
|
|
|
|
|
- extal = of_parse_phandle(cpg, "clocks", 0);
|
|
|
+ if (match->data)
|
|
|
+ idx = of_property_match_string(cpg, "clock-names", match->data);
|
|
|
+ extal = of_parse_phandle(cpg, "clocks", idx);
|
|
|
of_node_put(cpg);
|
|
|
if (!extal)
|
|
|
return freq;
|
|
@@ -58,7 +70,8 @@ void __init rcar_gen2_timer_init(void)
|
|
|
void __iomem *base;
|
|
|
u32 freq;
|
|
|
|
|
|
- if (of_machine_is_compatible("renesas,r8a7792") ||
|
|
|
+ if (of_machine_is_compatible("renesas,r8a7745") ||
|
|
|
+ of_machine_is_compatible("renesas,r8a7792") ||
|
|
|
of_machine_is_compatible("renesas,r8a7794")) {
|
|
|
freq = 260000000 / 8; /* ZS / 8 */
|
|
|
/* CNTVOFF has to be initialized either from non-secure
|