Skip to contentSkip to conversation

OMAP3: Enable and autoidle DPLL5 at boot

PATCH In review Anand Gadiyar 3 participants 5 messages Sep 4, 2009 – Sep 8, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3: Enable and autoidle DPLL5 at boot

From: Rajendra Nayak <[email protected]>

OMAP3: Enable and autoidle DPLL5 at boot

Enable DPLL5 at bootup and put it into auto-idle.
This is required for the USBHOST 120MHz f-clock and USBTLL f-clock to work.

---
 arch/arm/mach-omap2/clock34xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)
arch/arm/mach-omap2/clock34xx.c +25 -0
Index: linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c
===================================================================
@@ -1056,6 +1056,25 @@ void omap2_clk_prepare_for_reboot(void)
 #endif
 }
 
+static void omap3_lock_dpll5(void)
+{
+	struct clk *dpll5_clk;
+	struct clk *dpll5_m2_clk;
+
+	dpll5_clk = clk_get(NULL, "dpll5_ck");
+	clk_set_rate(dpll5_clk, 120000000);
+	clk_enable(dpll5_clk);
+
+	/* Enable autoidle to allow it to enter low power bypass */
+	omap3_dpll_allow_idle(dpll5_clk);
+
+	/* Program dpll5_m2_clk divider for no division */
+	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
+	clk_enable(dpll5_m2_clk);
+	clk_set_rate(dpll5_m2_clk, 120000000);
+	return;
+}
+
 /* REVISIT: Move this init stuff out into clock.c */
 
 /*
@@ -1148,6 +1167,12 @@ int __init omap2_clk_init(void)
 	 */
 	clk_enable_init_clocks();
 
+	/*
+	 * Lock DPLL5 and put it in autoidle.
+	 */
+	if (omap_rev() >= OMAP3430_REV_ES2_0)
+		omap3_lock_dpll5();
+
 	/* Avoid sleeping during omap2_clk_prepare_for_reboot() */
 	/* REVISIT: not yet ready for 343x */
 #if 0
maintainer
#1 lore raw

Hi Anand,

looks like a good approach, just a few minor comments.

Quoted 19 lines · Anand Gadiyar

From: Rajendra Nayak <[email protected]>

OMAP3: Enable and autoidle DPLL5 at boot

Enable DPLL5 at bootup and put it into auto-idle.
This is required for the USBHOST 120MHz f-clock and USBTLL f-clock to work.

---
 arch/arm/mach-omap2/clock34xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c
===================================================================

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1059

Quoted 4 lines
arch/arm/mach-omap2/clock34xx.c +1 -0
@@ -1056,6 +1056,25 @@ void omap2_clk_prepare_for_reboot(void)
 #endif
 }
 
+static void omap3_lock_dpll5(void)

Please put "clk" in this function name, like "omap3_clk_lock_dpll5" or something similar...

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1065

Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +6 -0
+{
+	struct clk *dpll5_clk;
+	struct clk *dpll5_m2_clk;
+
+	dpll5_clk = clk_get(NULL, "dpll5_ck");
+	clk_set_rate(dpll5_clk, 120000000);

Please move this constant up to a macro at the top of the file and add a brief descriptive comment answering the question: "why 120000000" -- e.g., needed by USB, etc.

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1074

Quoted 9 lines
arch/arm/mach-omap2/clock34xx.c +9 -0
+	clk_enable(dpll5_clk);
+
+	/* Enable autoidle to allow it to enter low power bypass */
+	omap3_dpll_allow_idle(dpll5_clk);
+
+	/* Program dpll5_m2_clk divider for no division */
+	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
+	clk_enable(dpll5_m2_clk);
+	clk_set_rate(dpll5_m2_clk, 120000000);

Shouldn't we clk_disable() dpll5_clk and dpll5_m2_clk here? The rationale is that we should keep these disabled until some driver signals that it needs them with a clk_enable().

Quoted 20 lines
arch/arm/mach-omap2/clock34xx.c +9 -1
+	return;
+}
+
 /* REVISIT: Move this init stuff out into clock.c */
 
 /*
@@ -1148,6 +1167,12 @@ int __init omap2_clk_init(void)
 	 */
 	clk_enable_init_clocks();
 
+	/*
+	 * Lock DPLL5 and put it in autoidle.
+	 */
+	if (omap_rev() >= OMAP3430_REV_ES2_0)
+		omap3_lock_dpll5();
+
 	/* Avoid sleeping during omap2_clk_prepare_for_reboot() */
 	/* REVISIT: not yet ready for 343x */
 #if 0
--
Quoted 4 lines

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

- Paul

#2 lore raw
Quoted 29 lines · Paul Walmsley

Hi Anand,

looks like a good approach, just a few minor comments.

Quoted 22 lines · Anand Gadiyar

From: Rajendra Nayak <[email protected]>

OMAP3: Enable and autoidle DPLL5 at boot

Enable DPLL5 at bootup and put it into auto-idle.
This is required for the USBHOST 120MHz f-clock and USBTLL f-clock to work.

---
 arch/arm/mach-omap2/clock34xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c
===================================================================

arch/arm/mach-omap2/clock34xx.c +0 -0
@@ -1056,6 +1056,25 @@ void omap2_clk_prepare_for_reboot(void)
 #endif
 }
 
Quoted 5 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1059

Quoted 1 line
arch/arm/mach-omap2/clock34xx.c +1 -0
+static void omap3_lock_dpll5(void)

Please put "clk" in this function name, like "omap3_clk_lock_dpll5" or something similar...

Okay.

Quoted 10 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1065

Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +6 -0
+{
+	struct clk *dpll5_clk;
+	struct clk *dpll5_m2_clk;
+
+	dpll5_clk = clk_get(NULL, "dpll5_ck");
+	clk_set_rate(dpll5_clk, 120000000);

Please move this constant up to a macro at the top of the file and add a brief descriptive comment answering the question: "why 120000000" -- e.g., needed by USB, etc.

Okay.

Quoted 14 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1074

Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +9 -0
+	clk_enable(dpll5_clk);
+
+	/* Enable autoidle to allow it to enter low power bypass */
+	omap3_dpll_allow_idle(dpll5_clk);
+
+	/* Program dpll5_m2_clk divider for no division */
+	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
+	clk_enable(dpll5_m2_clk);
+	clk_set_rate(dpll5_m2_clk, 120000000);

Shouldn't we clk_disable() dpll5_clk and dpll5_m2_clk here? The rationale is that we should keep these disabled until some driver signals that it needs them with a clk_enable().

The idea behind enabling these upfront was:
- If done when the USB controller (the only user of this DPLL) needs the USB clocks, there would be an additional delay required to lock this DPLL.
- Enabling and placing these DPLLs in bypass at init leaves no additional power drain in the OMAP, and avoids the above delay at first clock-init.

What do you think?

- Anand

#3 lore raw

Hi Anand,

Quoted 76 lines

-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Gadiyar, Anand
Sent: Tuesday, September 08, 2009 10:32 AM
To: Paul Walmsley
Cc: [email protected]; Nayak, Rajendra
Subject: RE: [PATCH] OMAP3: Enable and autoidle DPLL5 at boot

Quoted 29 lines · Paul Walmsley

Hi Anand,

looks like a good approach, just a few minor comments.

Quoted 22 lines · Anand Gadiyar

From: Rajendra Nayak <[email protected]>

OMAP3: Enable and autoidle DPLL5 at boot

Enable DPLL5 at bootup and put it into auto-idle.
This is required for the USBHOST 120MHz f-clock and USBTLL f-clock to work.

---
 arch/arm/mach-omap2/clock34xx.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+)

Index: linux-omap-2.6/arch/arm/mach-omap2/clock34xx.c
===================================================================

arch/arm/mach-omap2/clock34xx.c +0 -0
@@ -1056,6 +1056,25 @@ void omap2_clk_prepare_for_reboot(void)
 #endif
 }
 
Quoted 5 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1059

Quoted 1 line
arch/arm/mach-omap2/clock34xx.c +1 -0
+static void omap3_lock_dpll5(void)

Please put "clk" in this function name, like "omap3_clk_lock_dpll5" or something similar...

Okay.

Quoted 9 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1065

Quoted 6 lines
arch/arm/mach-omap2/clock34xx.c +6 -0
+{
+	struct clk *dpll5_clk;
+	struct clk *dpll5_m2_clk;
+
+	dpll5_clk = clk_get(NULL, "dpll5_ck");
+	clk_set_rate(dpll5_clk, 120000000);

Please move this constant up to a macro at the top of the file and add a brief descriptive comment answering the question: "why 120000000" --

e.g.,

Quoted 1 line

needed by USB, etc.

Okay.

Quoted 12 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1074

Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +9 -0
+	clk_enable(dpll5_clk);
+
+	/* Enable autoidle to allow it to enter low power bypass */
+	omap3_dpll_allow_idle(dpll5_clk);
+
+	/* Program dpll5_m2_clk divider for no division */
+	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
+	clk_enable(dpll5_m2_clk);
+	clk_set_rate(dpll5_m2_clk, 120000000);

Shouldn't we clk_disable() dpll5_clk and dpll5_m2_clk here? The

rationale

Quoted 2 lines

is that we should keep these disabled until some driver signals that it needs them with a clk_enable().

Quoted 8 lines

The idea behind enabling these upfront was:
- If done when the USB controller (the only user of this DPLL) needs the USB clocks, there would be an additional delay required to lock this
DPLL.
- Enabling and placing these DPLLs in bypass at init leaves no additional power drain in the OMAP, and avoids the above delay at first clock-init.

What do you think?

There is an additional power drain because you cannot stop the DPLL, so you will have some dynamic consumption on the VPLL rail. The point is that if nobody ever used the USB you will add an extra consumption for nothing.
You'd better keep the DPLL in stop mode and enable it only when needed.

Regards,
Benoit

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

<snip>

Quoted 31 lines
Quoted 15 lines
Quoted 14 lines

arch/arm/mach-omap2/clock34xx.c void omap2_clk_prepare_for_reboot(void) · line 1074

Quoted 10 lines
arch/arm/mach-omap2/clock34xx.c +9 -0
+	clk_enable(dpll5_clk);
+
+	/* Enable autoidle to allow it to enter low power bypass */
+	omap3_dpll_allow_idle(dpll5_clk);
+
+	/* Program dpll5_m2_clk divider for no division */
+	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
+	clk_enable(dpll5_m2_clk);
+	clk_set_rate(dpll5_m2_clk, 120000000);

Shouldn't we clk_disable() dpll5_clk and dpll5_m2_clk here? The rationale is that we should keep these disabled until some driver signals that it needs them with a clk_enable().

Quoted 8 lines

The idea behind enabling these upfront was:
- If done when the USB controller (the only user of this DPLL) needs the USB clocks, there would be an additional delay required to lock this
DPLL.
- Enabling and placing these DPLLs in bypass at init leaves no additional power drain in the OMAP, and avoids the above delay at first clock-init.

What do you think?

There is an additional power drain because you cannot stop the DPLL, so you will have some dynamic consumption on the VPLL rail. The point is that if nobody ever used the USB you will add an extra consumption for nothing.
You'd better keep the DPLL in stop mode and enable it only when needed.

Quoted 3 lines

Regards,
Benoit

Okay. Will fix and resend in a bit.

- Anand