aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches-5.10/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch
blob: 92c4b564930b1fabf97eef6f575650740abee054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- a/arch/mips/lantiq/xway/sysctrl.c
+++ b/arch/mips/lantiq/xway/sysctrl.c
@@ -440,6 +440,20 @@ static void clkdev_add_clkout(void)
 	}
 }
 
+static void set_phy_clock_source(struct device_node *np_cgu)
+{
+	u32 phy_clk_src, ifcc;
+
+	if (!np_cgu)
+		return;
+
+	if (of_property_read_u32(np_cgu, "lantiq,phy-clk-src", &phy_clk_src))
+		return;
+
+	ifcc = ltq_cgu_r32(ifccr) & ~(0x1c);
+	ltq_cgu_w32(ifcc | (phy_clk_src << 2), ifccr);
+}
+
 /* bring up all register ranges that we need for basic system control */
 void __init ltq_soc_init(void)
 {
@@ -605,4 +619,6 @@ void __init ltq_soc_init(void)
 		clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
 	}
 	usb_set_clock();
+
+	set_phy_clock_source(np_cgu);
 }