mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM i.MX31 clk: add pll_ref_clk and MCU PLL bypass select
@ 2017-01-16 14:04 Alexander Kurz
  2017-01-17  7:06 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kurz @ 2017-01-16 14:04 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Kurz

The three MX31 PLL may be clocked from either CKIH or a frequency-multiplied
derivate of CKIL generated by the Frequency Pre Multiplier FPM.

Add the pll_ref_clk selection infrastructure and support for MCU PLL bypass
to support clock switching and boards not clocked CKIH.

Signed-off-by: Alexander Kurz <akurz@blala.de>
---
 arch/arm/mach-imx/clk-imx31.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index 8d135c9..dbb5c15 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -63,14 +63,27 @@ enum mx31_clks {
 	mstick1_gate, mstick2_gate, csi_gate, rtc_gate, wdog_gate, pwm_gate,
 	sim_gate, ect_gate, usb_gate, kpp_gate, ipu_gate, uart3_gate,
 	uart4_gate, uart5_gate, owire_gate, ssi2_gate, cspi1_gate, cspi2_gate,
-	gacc_gate, emi_gate, rtic_gate, firi_gate, clk_max
+	gacc_gate, emi_gate, rtic_gate, firi_gate, fpm, pll_ref, mpll_byp,
+	clk_max
 };
 
 static struct clk *clks[clk_max];
 
+static const char *pll_ref_sel[] = {
+	"dummy",
+	"fpm",
+	"ckih",
+	"dummy",
+};
+
+static const char *mpll_byp_sel[] = {
+	"mpll",
+	"pll_ref",
+};
+
 static const char *mcu_main_sel[] = {
 	"spll",
-	"mpll",
+	"mpll_byp",
 };
 
 static const char *per_sel[] = {
@@ -94,9 +107,14 @@ static int imx31_ccm_probe(struct device_d *dev)
 
 	clks[ckih] = clk_fixed("ckih", 26000000);
 	clks[ckil] = clk_fixed("ckil", 32768);
-	clks[mpll] = imx_clk_pllv1("mpll", "ckih", base + CCM_MPCTL);
-	clks[spll] = imx_clk_pllv1("spll", "ckih", base + CCM_SRPCTL);
-	clks[upll] = imx_clk_pllv1("upll", "ckih", base + CCM_UPCTL);
+	clks[fpm] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
+	clks[pll_ref] = imx_clk_mux("pll_ref", base + CCM_CCMR, 1, 2,
+		pll_ref_sel,  ARRAY_SIZE(pll_ref_sel));
+	clks[mpll] = imx_clk_pllv1("mpll", "pll_ref", base + CCM_MPCTL);
+	clks[spll] = imx_clk_pllv1("spll", "pll_ref", base + CCM_SRPCTL);
+	clks[upll] = imx_clk_pllv1("upll", "pll_ref", base + CCM_UPCTL);
+	clks[mpll_byp] = imx_clk_mux("mpll_byp", base + CCM_CCMR, 7, 1,
+			mpll_byp_sel, ARRAY_SIZE(mpll_byp_sel));
 	clks[mcu_main] = imx_clk_mux("mcu_main", base + CCM_PMCR0, 31, 1,
 			mcu_main_sel, ARRAY_SIZE(mcu_main_sel));
 	clks[hsp] = imx_clk_divider("hsp", "mcu_main", base + CCM_PDR0, 11, 3);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM i.MX31 clk: add pll_ref_clk and MCU PLL bypass select
  2017-01-16 14:04 [PATCH] ARM i.MX31 clk: add pll_ref_clk and MCU PLL bypass select Alexander Kurz
@ 2017-01-17  7:06 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2017-01-17  7:06 UTC (permalink / raw)
  To: Alexander Kurz; +Cc: barebox

Hi Alexander,

On Mon, Jan 16, 2017 at 03:04:57PM +0100, Alexander Kurz wrote:
> The three MX31 PLL may be clocked from either CKIH or a frequency-multiplied
> derivate of CKIL generated by the Frequency Pre Multiplier FPM.
> 
> Add the pll_ref_clk selection infrastructure and support for MCU PLL bypass
> to support clock switching and boards not clocked CKIH.
> 
> Signed-off-by: Alexander Kurz <akurz@blala.de>
> ---
>  arch/arm/mach-imx/clk-imx31.c | 28 +++++++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c

The clock support is now under drivers/clk/imx/clk-imx31.c. Could you
send an updated patch?

Sascha

> index 8d135c9..dbb5c15 100644
> --- a/arch/arm/mach-imx/clk-imx31.c
> +++ b/arch/arm/mach-imx/clk-imx31.c
> @@ -63,14 +63,27 @@ enum mx31_clks {
>  	mstick1_gate, mstick2_gate, csi_gate, rtc_gate, wdog_gate, pwm_gate,
>  	sim_gate, ect_gate, usb_gate, kpp_gate, ipu_gate, uart3_gate,
>  	uart4_gate, uart5_gate, owire_gate, ssi2_gate, cspi1_gate, cspi2_gate,
> -	gacc_gate, emi_gate, rtic_gate, firi_gate, clk_max
> +	gacc_gate, emi_gate, rtic_gate, firi_gate, fpm, pll_ref, mpll_byp,
> +	clk_max
>  };
>  
>  static struct clk *clks[clk_max];
>  
> +static const char *pll_ref_sel[] = {
> +	"dummy",
> +	"fpm",
> +	"ckih",
> +	"dummy",
> +};
> +
> +static const char *mpll_byp_sel[] = {
> +	"mpll",
> +	"pll_ref",
> +};
> +
>  static const char *mcu_main_sel[] = {
>  	"spll",
> -	"mpll",
> +	"mpll_byp",
>  };
>  
>  static const char *per_sel[] = {
> @@ -94,9 +107,14 @@ static int imx31_ccm_probe(struct device_d *dev)
>  
>  	clks[ckih] = clk_fixed("ckih", 26000000);
>  	clks[ckil] = clk_fixed("ckil", 32768);
> -	clks[mpll] = imx_clk_pllv1("mpll", "ckih", base + CCM_MPCTL);
> -	clks[spll] = imx_clk_pllv1("spll", "ckih", base + CCM_SRPCTL);
> -	clks[upll] = imx_clk_pllv1("upll", "ckih", base + CCM_UPCTL);
> +	clks[fpm] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
> +	clks[pll_ref] = imx_clk_mux("pll_ref", base + CCM_CCMR, 1, 2,
> +		pll_ref_sel,  ARRAY_SIZE(pll_ref_sel));
> +	clks[mpll] = imx_clk_pllv1("mpll", "pll_ref", base + CCM_MPCTL);
> +	clks[spll] = imx_clk_pllv1("spll", "pll_ref", base + CCM_SRPCTL);
> +	clks[upll] = imx_clk_pllv1("upll", "pll_ref", base + CCM_UPCTL);
> +	clks[mpll_byp] = imx_clk_mux("mpll_byp", base + CCM_CCMR, 7, 1,
> +			mpll_byp_sel, ARRAY_SIZE(mpll_byp_sel));
>  	clks[mcu_main] = imx_clk_mux("mcu_main", base + CCM_PMCR0, 31, 1,
>  			mcu_main_sel, ARRAY_SIZE(mcu_main_sel));
>  	clks[hsp] = imx_clk_divider("hsp", "mcu_main", base + CCM_PDR0, 11, 3);
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-17  7:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 14:04 [PATCH] ARM i.MX31 clk: add pll_ref_clk and MCU PLL bypass select Alexander Kurz
2017-01-17  7:06 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox