aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>2017-03-25 16:57:20 +0530
committerMichal Simek <michal.simek@xilinx.com>2017-03-24 13:33:21 +0100
commite6a2da266cd993bc3028bffea936a9177a85bbed (patch)
tree02c9b41d266768e1d757892e6afe15c48948e69c
parent756de54e02c98beb60314541b7f9323b094a69db (diff)
downloadlinux-e6a2da266cd993bc3028bffea936a9177a85bbed.tar.gz
clk: zynqmp: Warn on vpll multiuser conditionally
Warn on multiuser only when changing rates. This helps remove the warn in cases where the dp driver is not there and vpll is used for other stuff. Expectation is that DP is using VPLL. Checking generic case where DP uses different PLL requires additional fix. But as of now recomendation is to use VPLL for DP. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
-rw-r--r--drivers/clk/zynqmp/clkc.c24
-rw-r--r--drivers/clk/zynqmp/pll.c12
2 files changed, 12 insertions, 24 deletions
diff --git a/drivers/clk/zynqmp/clkc.c b/drivers/clk/zynqmp/clkc.c
index 40b874c6becfc2..8de0e96dd9261e 100644
--- a/drivers/clk/zynqmp/clkc.c
+++ b/drivers/clk/zynqmp/clkc.c
@@ -1126,27 +1126,3 @@ static int __init zynqmp_clock_init(void)
return 0;
}
arch_initcall(zynqmp_clock_init);
-
-static int __init warn_vpll_multiuser(void)
-{
- struct device_node *np;
- unsigned int children;
-
- np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp-clkc");
- if (!np)
- return 0;
- of_node_put(np);
-
- /*
- * We're running on a ZynqMP compatible machine, make sure the
- * VPLL only has one child.
- */
- children = clk_get_children("vpll");
-
- /* Account for vpll_to_lpd and dp_video_ref */
- if (children > 2)
- WARN(1, "Two devices are using vpll which is forbidden\n");
-
- return 0;
-}
-late_initcall_sync(warn_vpll_multiuser);
diff --git a/drivers/clk/zynqmp/pll.c b/drivers/clk/zynqmp/pll.c
index bac0826d75e064..342375333ff947 100644
--- a/drivers/clk/zynqmp/pll.c
+++ b/drivers/clk/zynqmp/pll.c
@@ -177,6 +177,18 @@ static int zynqmp_pll_set_rate(struct clk_hw *hw, unsigned long rate,
long rate_div, frac, m, f;
if (pll_frac_get_mode(hw) == PLL_MODE_FRAC) {
+ unsigned int children;
+
+ /*
+ * We're running on a ZynqMP compatible machine, make sure the
+ * VPLL only has one child.
+ */
+ children = clk_get_children("vpll");
+
+ /* Account for vpll_to_lpd and dp_video_ref */
+ if (children > 2)
+ WARN(1, "Two devices are using vpll which is forbidden\n");
+
rate_div = ((rate * FRAC_DIV) / parent_rate);
m = rate_div / FRAC_DIV;
f = rate_div % FRAC_DIV;