diff mbox

[v4,4/4] ARM: OMAP2+: Add pdata quirk for sys_clkout2 for omap3 DBB056

Message ID 1392387656-15186-5-git-send-email-chf.fritz@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christoph Fritz Feb. 14, 2014, 2:20 p.m. UTC
Full device tree support for clock control, especially to set frequencies,
is not yet accomplished. Until then, configure the 24Mhz of sys_clkout2 to
feed an USB-Hub here.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
 arch/arm/mach-omap2/pdata-quirks.c |   37 ++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Tony Lindgren Feb. 28, 2014, 10:37 p.m. UTC | #1
* Christoph Fritz <chf.fritz@googlemail.com> [140214 06:24]:
> Full device tree support for clock control, especially to set frequencies,
> is not yet accomplished. Until then, configure the 24Mhz of sys_clkout2 to
> feed an USB-Hub here.

Hmm would like to see Tero's comments on this, I wonder if we should
wait on this to avoid extra churn?

Regards,

Tony
 
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
>  arch/arm/mach-omap2/pdata-quirks.c |   37 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
> index 435a823..e36ac3f 100644
> --- a/arch/arm/mach-omap2/pdata-quirks.c
> +++ b/arch/arm/mach-omap2/pdata-quirks.c
> @@ -172,6 +172,43 @@ static void __init am3517_evm_legacy_init(void)
>  
>  static void __init omap3_dbb056_legacy_init(void)
>  {
> +	struct clk *clkout2;
> +	struct clk *cm96fck;
> +
> +	/* Reparent clkout2 to 96M_FCK */
> +	pr_info("%s: Late Reparent clkout2 to 96M_FCK\n", __func__);
> +	clkout2 = clk_get(NULL, "clkout2_src_ck");
> +	if (clkout2 < 0) {
> +		pr_err("a83x-quirk: couldn't get clkout2_src_ck\n");
> +		return;
> +	}
> +	cm96fck = clk_get(NULL, "cm_96m_fck");
> +	if (cm96fck < 0) {
> +		pr_err("a83x-quirk: couldn't get cm_96m_fck\n");
> +		return;
> +	}
> +	if (clk_set_parent(clkout2, cm96fck) < 0) {
> +		pr_err("a83x-quirk: couldn't reparent clkout2_src_ck\n");
> +		return;
> +	}
> +
> +	/* Set clkout2 to 24MHz for internal usb hub*/
> +	pr_info("%s: Set clkout2 to 24MHz for internal usb hub\n", __func__);
> +	clkout2 = clk_get(NULL, "sys_clkout2");
> +	if (clkout2 < 0) {
> +		pr_err("%s: couldn't get sys_clkout2\n", __func__);
> +		return;
> +	}
> +	if (clk_set_rate(clkout2, 24000000) < 0) {
> +		pr_err("%s: couldn't set sys_clkout2 rate\n", __func__);
> +		return;
> +	}
> +	if (clk_prepare_enable(clkout2) < 0) {
> +		pr_err("%s: couldn't enable sys_clkout2\n", __func__);
> +		return;
> +	}
> +
> +	/* Initialize display */
>  	omap3_dbb056_display_init_of();
>  }
>  #endif /* CONFIG_ARCH_OMAP3 */
> -- 
> 1.7.10.4
>
Tero Kristo March 5, 2014, 1:07 p.m. UTC | #2
On 03/01/2014 12:37 AM, Tony Lindgren wrote:
> * Christoph Fritz <chf.fritz@googlemail.com> [140214 06:24]:
>> Full device tree support for clock control, especially to set frequencies,
>> is not yet accomplished. Until then, configure the 24Mhz of sys_clkout2 to
>> feed an USB-Hub here.
>
> Hmm would like to see Tero's comments on this, I wonder if we should
> wait on this to avoid extra churn?

Well, the set I posted that adds default clock parenting / default rate 
support to DT hasn't actually moved forward, so you might want to take 
this in as is now if it should be rushed. The clk-enable part isn't done 
currently by anything anyway. Just wondering though, should you create 
some sort of driver for your usb-hub which would control these clocks?

-Tero


>
> Regards,
>
> Tony
>
>> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
>> ---
>>   arch/arm/mach-omap2/pdata-quirks.c |   37 ++++++++++++++++++++++++++++++++++++
>>   1 file changed, 37 insertions(+)
>>
>> diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
>> index 435a823..e36ac3f 100644
>> --- a/arch/arm/mach-omap2/pdata-quirks.c
>> +++ b/arch/arm/mach-omap2/pdata-quirks.c
>> @@ -172,6 +172,43 @@ static void __init am3517_evm_legacy_init(void)
>>
>>   static void __init omap3_dbb056_legacy_init(void)
>>   {
>> +	struct clk *clkout2;
>> +	struct clk *cm96fck;
>> +
>> +	/* Reparent clkout2 to 96M_FCK */
>> +	pr_info("%s: Late Reparent clkout2 to 96M_FCK\n", __func__);
>> +	clkout2 = clk_get(NULL, "clkout2_src_ck");
>> +	if (clkout2 < 0) {
>> +		pr_err("a83x-quirk: couldn't get clkout2_src_ck\n");
>> +		return;
>> +	}
>> +	cm96fck = clk_get(NULL, "cm_96m_fck");
>> +	if (cm96fck < 0) {
>> +		pr_err("a83x-quirk: couldn't get cm_96m_fck\n");
>> +		return;
>> +	}
>> +	if (clk_set_parent(clkout2, cm96fck) < 0) {
>> +		pr_err("a83x-quirk: couldn't reparent clkout2_src_ck\n");
>> +		return;
>> +	}
>> +
>> +	/* Set clkout2 to 24MHz for internal usb hub*/
>> +	pr_info("%s: Set clkout2 to 24MHz for internal usb hub\n", __func__);
>> +	clkout2 = clk_get(NULL, "sys_clkout2");
>> +	if (clkout2 < 0) {
>> +		pr_err("%s: couldn't get sys_clkout2\n", __func__);
>> +		return;
>> +	}
>> +	if (clk_set_rate(clkout2, 24000000) < 0) {
>> +		pr_err("%s: couldn't set sys_clkout2 rate\n", __func__);
>> +		return;
>> +	}
>> +	if (clk_prepare_enable(clkout2) < 0) {
>> +		pr_err("%s: couldn't enable sys_clkout2\n", __func__);
>> +		return;
>> +	}
>> +
>> +	/* Initialize display */
>>   	omap3_dbb056_display_init_of();
>>   }
>>   #endif /* CONFIG_ARCH_OMAP3 */
>> --
>> 1.7.10.4
>>
Christoph Fritz March 5, 2014, 1:25 p.m. UTC | #3
On Wed, 2014-03-05 at 15:07 +0200, Tero Kristo wrote:
> On 03/01/2014 12:37 AM, Tony Lindgren wrote:
> > * Christoph Fritz <chf.fritz@googlemail.com> [140214 06:24]:
> >> Full device tree support for clock control, especially to set frequencies,
> >> is not yet accomplished. Until then, configure the 24Mhz of sys_clkout2 to
> >> feed an USB-Hub here.
> >
> > Hmm would like to see Tero's comments on this, I wonder if we should
> > wait on this to avoid extra churn?
> 
> Well, the set I posted that adds default clock parenting / default rate 
> support to DT hasn't actually moved forward, so you might want to take 
> this in as is now if it should be rushed. The clk-enable part isn't done 
> currently by anything anyway. Just wondering though, should you create 
> some sort of driver for your usb-hub which would control these clocks?

The USB-Hub, a USB2512 is wired as non-configurable. Its pin
'XTAL1/CLKIN' can be connected to either a crystal or an external clock
input. To economise the crystal, the clock-out of the omap is wired
here.

So in my view, a driver is unnecessary.

 Thanks
  -- Christoph
Tony Lindgren March 5, 2014, 5:21 p.m. UTC | #4
* Christoph Fritz <chf.fritz@googlemail.com> [140305 05:28]:
> On Wed, 2014-03-05 at 15:07 +0200, Tero Kristo wrote:
> > On 03/01/2014 12:37 AM, Tony Lindgren wrote:
> > > * Christoph Fritz <chf.fritz@googlemail.com> [140214 06:24]:
> > >> Full device tree support for clock control, especially to set frequencies,
> > >> is not yet accomplished. Until then, configure the 24Mhz of sys_clkout2 to
> > >> feed an USB-Hub here.
> > >
> > > Hmm would like to see Tero's comments on this, I wonder if we should
> > > wait on this to avoid extra churn?
> > 
> > Well, the set I posted that adds default clock parenting / default rate 
> > support to DT hasn't actually moved forward, so you might want to take 
> > this in as is now if it should be rushed. The clk-enable part isn't done 
> > currently by anything anyway. Just wondering though, should you create 
> > some sort of driver for your usb-hub which would control these clocks?
> 
> The USB-Hub, a USB2512 is wired as non-configurable. Its pin
> 'XTAL1/CLKIN' can be connected to either a crystal or an external clock
> input. To economise the crystal, the clock-out of the omap is wired
> here.
> 
> So in my view, a driver is unnecessary.

Yeah that makes sense. Let's try not to rely on pdata-quirks.c for
the new boards.

Regards,

Tony
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c
index 435a823..e36ac3f 100644
--- a/arch/arm/mach-omap2/pdata-quirks.c
+++ b/arch/arm/mach-omap2/pdata-quirks.c
@@ -172,6 +172,43 @@  static void __init am3517_evm_legacy_init(void)
 
 static void __init omap3_dbb056_legacy_init(void)
 {
+	struct clk *clkout2;
+	struct clk *cm96fck;
+
+	/* Reparent clkout2 to 96M_FCK */
+	pr_info("%s: Late Reparent clkout2 to 96M_FCK\n", __func__);
+	clkout2 = clk_get(NULL, "clkout2_src_ck");
+	if (clkout2 < 0) {
+		pr_err("a83x-quirk: couldn't get clkout2_src_ck\n");
+		return;
+	}
+	cm96fck = clk_get(NULL, "cm_96m_fck");
+	if (cm96fck < 0) {
+		pr_err("a83x-quirk: couldn't get cm_96m_fck\n");
+		return;
+	}
+	if (clk_set_parent(clkout2, cm96fck) < 0) {
+		pr_err("a83x-quirk: couldn't reparent clkout2_src_ck\n");
+		return;
+	}
+
+	/* Set clkout2 to 24MHz for internal usb hub*/
+	pr_info("%s: Set clkout2 to 24MHz for internal usb hub\n", __func__);
+	clkout2 = clk_get(NULL, "sys_clkout2");
+	if (clkout2 < 0) {
+		pr_err("%s: couldn't get sys_clkout2\n", __func__);
+		return;
+	}
+	if (clk_set_rate(clkout2, 24000000) < 0) {
+		pr_err("%s: couldn't set sys_clkout2 rate\n", __func__);
+		return;
+	}
+	if (clk_prepare_enable(clkout2) < 0) {
+		pr_err("%s: couldn't enable sys_clkout2\n", __func__);
+		return;
+	}
+
+	/* Initialize display */
 	omap3_dbb056_display_init_of();
 }
 #endif /* CONFIG_ARCH_OMAP3 */