summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/mx5
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2018-10-10 10:40:02 +0200
committerStefano Babic <sbabic@denx.de>2018-10-16 10:34:02 +0200
commited85f771902b624891062d3c0fbd6fbf2f4d0982 (patch)
tree23fbc04f023906be4fa9ba3f813e010d2c0d14c0 /arch/arm/mach-imx/mx5
parent0b6b8a3a199ee74e7da0fb8477ac33e7a65f0cb5 (diff)
arm: mx5: Add LDB clock config code
Add code to configure PLL4, from which the LDB clock are directly derived. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch/arm/mach-imx/mx5')
-rw-r--r--arch/arm/mach-imx/mx5/clock.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mx5/clock.c b/arch/arm/mach-imx/mx5/clock.c
index 427cb12415..2fabdd2eae 100644
--- a/arch/arm/mach-imx/mx5/clock.c
+++ b/arch/arm/mach-imx/mx5/clock.c
@@ -838,6 +838,31 @@ static int config_ddr_clk(u32 emi_clk)
return 0;
}
+#ifdef CONFIG_MX53
+static int config_ldb_clk(u32 ref, u32 freq)
+{
+ int ret = 0;
+ struct pll_param pll_param;
+
+ memset(&pll_param, 0, sizeof(struct pll_param));
+
+ ret = calc_pll_params(ref, freq, &pll_param);
+ if (ret != 0) {
+ printf("Error:Can't find pll parameters: %d\n",
+ ret);
+ return ret;
+ }
+
+ return config_pll_clk(PLL4_CLOCK, &pll_param);
+}
+#else
+static int config_ldb_clk(u32 ref, u32 freq)
+{
+ /* Platform not supported */
+ return -EINVAL;
+}
+#endif
+
/*
* This function assumes the expected core clock has to be changed by
* modifying the PLL. This is NOT true always but for most of the times,
@@ -879,6 +904,10 @@ int mxc_set_clock(u32 ref, u32 freq, enum mxc_clock clk)
if (config_nfc_clk(freq))
return -EINVAL;
break;
+ case MXC_LDB_CLK:
+ if (config_ldb_clk(ref, freq))
+ return -EINVAL;
+ break;
default:
printf("Warning:Unsupported or invalid clock type\n");
}