Skip to contentSkip to conversation

arm: omap4: pandaboard: turn on PHY reference clock at init

PATCH In review Anand Gadiyar 5 participants 6 messages Jan 10, 2011

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

PATCH 1/1 arm: omap4: pandaboard: turn on PHY reference clock at init

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

---
Tony,

The clock database changes were merged just before Christmas, so we did not detect this sooner. Would be nice to get this merged in the -rc series, so that we get EHCI and ethernet functional on the Panda.

Ming Lei,

Could you please test this and confirm it fixes the issue for you?

- Anand

 arch/arm/mach-omap2/board-omap4panda.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/mach-omap2/board-omap4panda.c +10 -0
Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/leds.h>
 #include <linux/gpio.h>
@@ -95,7 +96,16 @@ static const struct ehci_hcd_omap_platfo
 static void __init omap4_ehci_init(void)
 {
 	int ret;
+	struct clk *phy_ref_clk;
 
+	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+	phy_ref_clk = clk_get(NULL, "auxclk3_ck");
+	if (IS_ERR(phy_ref_clk)) {
+		pr_err("Cannot request auxclk3\n");
+		goto error1;
+	}
+	clk_set_rate(phy_ref_clk, 19200000);
+	clk_enable(phy_ref_clk);
 
 	/* disable the power to the usb hub prior to init */
 	ret = gpio_request(GPIO_HUB_POWER, "hub_power");
#1 lore raw

Hi,

2011/1/10 Anand Gadiyar <[email protected]>:

Quoted 20 lines

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

---
Tony,

Quoted 7 lines

The clock database changes were merged just before Christmas, so we did not detect this sooner. Would be nice to get this merged in the -rc series, so that we get EHCI and ethernet functional on the Panda.

Ming Lei,

Could you please test this and confirm it fixes the issue for you?

Yes, the patch does fix the issue on my panda board even CONFIG_OMAP_RESET_CLOCKS is enabled.

thanks,

Signature · 1 line
Lei Ming
#2 lore raw
In reply to Anand Gadiyar

Hi,

Quoted 49 lines · Anand Gadiyar

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

---
Tony,

The clock database changes were merged just before Christmas, so we did not detect this sooner. Would be nice to get this merged in the -rc series, so that we get EHCI and ethernet functional on the Panda.

Ming Lei,

Could you please test this and confirm it fixes the issue for you?

- Anand

 arch/arm/mach-omap2/board-omap4panda.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +1 -0
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/leds.h>
 #include <linux/gpio.h>
@@ -95,7 +96,16 @@ static const struct ehci_hcd_omap_platfo
 static void __init omap4_ehci_init(void)
 {
 	int ret;

arch/arm/mach-omap2/board-omap4panda.c static const struct ehci_hcd_omap_platfo · line 108

Quoted 10 lines
arch/arm/mach-omap2/board-omap4panda.c +9 -0
+	struct clk *phy_ref_clk;
 
+	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+	phy_ref_clk = clk_get(NULL, "auxclk3_ck");
+	if (IS_ERR(phy_ref_clk)) {
+		pr_err("Cannot request auxclk3\n");
+		goto error1;
+	}
+	clk_set_rate(phy_ref_clk, 19200000);
+	clk_enable(phy_ref_clk);

shouldn't you be enabling a child of this clock which would be the PHY's reference clock ? What about PM, are you keeping this clock on forever ? Wouldn't it be better to, at least, pass down a function pointer to driver so it uses during probe() (to enable clocks) and suspend/resume ??

Signature · 1 line
balbi
#3 lore raw
Quoted 54 lines · Felipe Balbi

Hi,

Quoted 51 lines · Anand Gadiyar

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

---
Tony,

The clock database changes were merged just before Christmas, so we did not detect this sooner. Would be nice to get this merged in the -rc series, so that we get EHCI and ethernet functional on the Panda.

Ming Lei,

Could you please test this and confirm it fixes the issue for you?

- Anand

 arch/arm/mach-omap2/board-omap4panda.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===================================================================

arch/arm/mach-omap2/board-omap4panda.c +2 -0
@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/leds.h>
 #include <linux/gpio.h>
@@ -95,7 +96,16 @@ static const struct ehci_hcd_omap_platfo
 static void __init omap4_ehci_init(void)
 {
 	int ret;
+	struct clk *phy_ref_clk;
 
Quoted 11 lines

arch/arm/mach-omap2/board-omap4panda.c static const struct ehci_hcd_omap_platfo · line 108

Quoted 8 lines
arch/arm/mach-omap2/board-omap4panda.c +8 -0
+	/* FREF_CLK3 provides the 19.2 MHz reference clock to the PHY */
+	phy_ref_clk = clk_get(NULL, "auxclk3_ck");
+	if (IS_ERR(phy_ref_clk)) {
+		pr_err("Cannot request auxclk3\n");
+		goto error1;
+	}
+	clk_set_rate(phy_ref_clk, 19200000);
+	clk_enable(phy_ref_clk);

shouldn't you be enabling a child of this clock which would be the PHY's reference clock ? What about PM, are you keeping this clock on forever ?

This is simply one of 5 reference clock-outs that the OMAP provides to various components on the PCB. It's a simple divide-down from the OMAP's own reference system clock, or DPLLs. There are no children for this clock right now.

Keeping this on forever was intentional. There's no reason to control this clock dynamically at this point, given the driver doesn't currently gate other clocks.

We haven't yet come up with a policy for when this clock can be safely turned off, and that's not what this patch is supposed to do right now. In this patch, we're only restoring behavior that existed before the clock data was updated to include this clock.

Quoted 3 lines

Wouldn't it be better to, at least, pass down a function pointer to driver so it uses during probe() (to enable clocks) and suspend/resume ??

Yes, this would work, but it didn't seem to be useful, given that only the Panda uses this right now. It's very much board specific.

Reviewed-by on v1 1/1
#4 lore raw
In reply to Anand Gadiyar
Quoted 9 lines · Anand Gadiyar

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Quoted 8 lines

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

- Paul

maintainer
#5 lore raw
Quoted 14 lines · Paul Walmsley
Quoted 12 lines · Anand Gadiyar

The SMSC 3320 USB PHY on the OMAP4 Pandaboard needs a 19.2 MHz reference clock. This clock is provided from the OMAP4's fref_clk3 pad.

Recent changes to clock44xx_data.c made the clock framework aware of the existence of these fref_clk[i] lines. If the option CONFIG_OMAP_RESET_CLOCKS is enabled in the kernel, then the clock framework will turn these clocks off during bootup.

Explicitly request and keep this clock enabled at init for the Pandaboard, so that the PHY receives this clock at all times.

Quoted 7 lines
Quoted 5 lines
Cc Benoit Cousson <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Tony Lindgren <[email protected]>

Will queue as a fix.

Tony