diff mbox

[2/2] mxc: enable EHCI PER clock

Message ID 1355941777-99352-2-git-send-email-gwenhael.goavec-merou@armadeus.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gwenhael Goavec-Merou Dec. 19, 2012, 6:29 p.m. UTC
EHCI PER clock (aka usb_div) must be enabled to have EHCI driver working.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>
---
 drivers/usb/host/ehci-mxc.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

Comments

Fabio Estevam Dec. 19, 2012, 7:04 p.m. UTC | #1
On Wed, Dec 19, 2012 at 4:29 PM, Gwenhael Goavec-Merou
<gwenhael.goavec-merou@armadeus.com> wrote:
> EHCI PER clock (aka usb_div) must be enabled to have EHCI driver working.
>
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>

Have you considered to use the chipidea usb driver in mx27 instead?
mx28/mx6 are already converted to the chipidea usb driver.

Regards,

Fabio Estevm
Marek Vasut Dec. 19, 2012, 7:45 p.m. UTC | #2
Dear Fabio Estevam,

> On Wed, Dec 19, 2012 at 4:29 PM, Gwenhael Goavec-Merou
> 
> <gwenhael.goavec-merou@armadeus.com> wrote:
> > EHCI PER clock (aka usb_div) must be enabled to have EHCI driver working.
> > 
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>
> 
> Have you considered to use the chipidea usb driver in mx27 instead?
> mx28/mx6 are already converted to the chipidea usb driver.

True, we should kill ehci-mxc ASAP. On the other hand, I'm not opposed to 
applying these, just bear in mind the driver might just disappear.

Best regards,
Marek Vasut
Sascha Hauer Dec. 19, 2012, 8:29 p.m. UTC | #3
On Wed, Dec 19, 2012 at 07:29:37PM +0100, Gwenhael Goavec-Merou wrote:
> EHCI PER clock (aka usb_div) must be enabled to have EHCI driver working.
> 
> Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>
> ---
>  drivers/usb/host/ehci-mxc.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
> index ec7f5d2..8050631 100644
> --- a/drivers/usb/host/ehci-mxc.c
> +++ b/drivers/usb/host/ehci-mxc.c
> @@ -31,7 +31,7 @@
>  #define ULPI_VIEWPORT_OFFSET	0x170
>  
>  struct ehci_mxc_priv {
> -	struct clk *usbclk, *ahbclk, *phyclk;
> +	struct clk *usbclk, *ahbclk, *perclk, *phyclk;
>  	struct usb_hcd *hcd;
>  };
>  
> @@ -150,6 +150,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
>  	}
>  	clk_prepare_enable(priv->ahbclk);
>  
> +	priv->perclk = devm_clk_get(&pdev->dev, "per");
> +	if (IS_ERR(priv->perclk)) {
> +		ret = PTR_ERR(priv->perclk);
> +		goto err_clk_per;
> +	}
> +	clk_prepare_enable(priv->perclk);

Have you checked this clock is present on all SoCs using this driver?

Other than that, +1 on using the chipidea driver as Fabio and Marek
already noted.

Sascha
Gwenhael Goavec-Merou Jan. 8, 2013, 12:52 p.m. UTC | #4
On Wed, 19 Dec 2012 21:29:26 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Wed, Dec 19, 2012 at 07:29:37PM +0100, Gwenhael Goavec-Merou wrote:
> > EHCI PER clock (aka usb_div) must be enabled to have EHCI driver working.
> > 
> > Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>
> > ---
> >  drivers/usb/host/ehci-mxc.c |   12 +++++++++++-
> >  1 files changed, 11 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
> > index ec7f5d2..8050631 100644
> > --- a/drivers/usb/host/ehci-mxc.c
> > +++ b/drivers/usb/host/ehci-mxc.c
> > @@ -31,7 +31,7 @@
> >  #define ULPI_VIEWPORT_OFFSET	0x170
> >  
> >  struct ehci_mxc_priv {
> > -	struct clk *usbclk, *ahbclk, *phyclk;
> > +	struct clk *usbclk, *ahbclk, *perclk, *phyclk;
> >  	struct usb_hcd *hcd;
> >  };
> >  
> > @@ -150,6 +150,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
> >  	}
> >  	clk_prepare_enable(priv->ahbclk);
> >  
> > +	priv->perclk = devm_clk_get(&pdev->dev, "per");
> > +	if (IS_ERR(priv->perclk)) {
> > +		ret = PTR_ERR(priv->perclk);
> > +		goto err_clk_per;
> > +	}
> > +	clk_prepare_enable(priv->perclk);
> 
> Have you checked this clock is present on all SoCs using this driver?
> 
Yes
>
> Other than that, +1 on using the chipidea driver as Fabio and Marek
> already noted.
>
True. But I need to use a non-dt board based on imx27. Chipidea is
not working yet for this chip and I have currently not enough time to do that.

Gwenhaƫl
Marek Vasut Jan. 8, 2013, 1:01 p.m. UTC | #5
Dear gwenhael.goavec,

> On Wed, 19 Dec 2012 21:29:26 +0100
> 
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Wed, Dec 19, 2012 at 07:29:37PM +0100, Gwenhael Goavec-Merou wrote:
> > > EHCI PER clock (aka usb_div) must be enabled to have EHCI driver
> > > working.
> > > 
> > > Signed-off-by: Gwenhael Goavec-Merou
> > > <gwenhael.goavec-merou@armadeus.com> ---
> > > 
> > >  drivers/usb/host/ehci-mxc.c |   12 +++++++++++-
> > >  1 files changed, 11 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
> > > index ec7f5d2..8050631 100644
> > > --- a/drivers/usb/host/ehci-mxc.c
> > > +++ b/drivers/usb/host/ehci-mxc.c
> > > @@ -31,7 +31,7 @@
> > > 
> > >  #define ULPI_VIEWPORT_OFFSET	0x170
> > >  
> > >  struct ehci_mxc_priv {
> > > 
> > > -	struct clk *usbclk, *ahbclk, *phyclk;
> > > +	struct clk *usbclk, *ahbclk, *perclk, *phyclk;
> > > 
> > >  	struct usb_hcd *hcd;
> > >  
> > >  };
> > > 
> > > @@ -150,6 +150,13 @@ static int ehci_mxc_drv_probe(struct
> > > platform_device *pdev)
> > > 
> > >  	}
> > >  	clk_prepare_enable(priv->ahbclk);
> > > 
> > > +	priv->perclk = devm_clk_get(&pdev->dev, "per");
> > > +	if (IS_ERR(priv->perclk)) {
> > > +		ret = PTR_ERR(priv->perclk);
> > > +		goto err_clk_per;
> > > +	}
> > > +	clk_prepare_enable(priv->perclk);
> > 
> > Have you checked this clock is present on all SoCs using this driver?
> 
> Yes
> 
> > Other than that, +1 on using the chipidea driver as Fabio and Marek
> > already noted.
> 
> True. But I need to use a non-dt board based on imx27. Chipidea is
> not working yet for this chip and I have currently not enough time to do
> that.

You're on your own then, sorry :-(

Best regards,
Marek Vasut
Gwenhael Goavec-Merou Jan. 8, 2013, 1:41 p.m. UTC | #6
On Tue, 8 Jan 2013 14:01:36 +0100
Marek Vasut <marex@denx.de> wrote:

> Dear gwenhael.goavec,
> 
> > On Wed, 19 Dec 2012 21:29:26 +0100
> > 
> > Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > > On Wed, Dec 19, 2012 at 07:29:37PM +0100, Gwenhael Goavec-Merou wrote:
> > > > EHCI PER clock (aka usb_div) must be enabled to have EHCI driver
> > > > working.
> > > > 
> > > > Signed-off-by: Gwenhael Goavec-Merou
> > > > <gwenhael.goavec-merou@armadeus.com> ---
> > > > 
> > > >  drivers/usb/host/ehci-mxc.c |   12 +++++++++++-
> > > >  1 files changed, 11 insertions(+), 1 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
> > > > index ec7f5d2..8050631 100644
> > > > --- a/drivers/usb/host/ehci-mxc.c
> > > > +++ b/drivers/usb/host/ehci-mxc.c
> > > > @@ -31,7 +31,7 @@
> > > > 
> > > >  #define ULPI_VIEWPORT_OFFSET	0x170
> > > >  
> > > >  struct ehci_mxc_priv {
> > > > 
> > > > -	struct clk *usbclk, *ahbclk, *phyclk;
> > > > +	struct clk *usbclk, *ahbclk, *perclk, *phyclk;
> > > > 
> > > >  	struct usb_hcd *hcd;
> > > >  
> > > >  };
> > > > 
> > > > @@ -150,6 +150,13 @@ static int ehci_mxc_drv_probe(struct
> > > > platform_device *pdev)
> > > > 
> > > >  	}
> > > >  	clk_prepare_enable(priv->ahbclk);
> > > > 
> > > > +	priv->perclk = devm_clk_get(&pdev->dev, "per");
> > > > +	if (IS_ERR(priv->perclk)) {
> > > > +		ret = PTR_ERR(priv->perclk);
> > > > +		goto err_clk_per;
> > > > +	}
> > > > +	clk_prepare_enable(priv->perclk);
> > > 
> > > Have you checked this clock is present on all SoCs using this driver?
> > 
> > Yes
> > 
> > > Other than that, +1 on using the chipidea driver as Fabio and Marek
> > > already noted.
> > 
> > True. But I need to use a non-dt board based on imx27. Chipidea is
> > not working yet for this chip and I have currently not enough time to do
> > that.
> 
> You're on your own then, sorry :-(
> 
Yes i Know. But currently all i.MX27 based board without DT support have USB
not working.
Gwenhael
diff mbox

Patch

diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index ec7f5d2..8050631 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -31,7 +31,7 @@ 
 #define ULPI_VIEWPORT_OFFSET	0x170
 
 struct ehci_mxc_priv {
-	struct clk *usbclk, *ahbclk, *phyclk;
+	struct clk *usbclk, *ahbclk, *perclk, *phyclk;
 	struct usb_hcd *hcd;
 };
 
@@ -150,6 +150,13 @@  static int ehci_mxc_drv_probe(struct platform_device *pdev)
 	}
 	clk_prepare_enable(priv->ahbclk);
 
+	priv->perclk = devm_clk_get(&pdev->dev, "per");
+	if (IS_ERR(priv->perclk)) {
+		ret = PTR_ERR(priv->perclk);
+		goto err_clk_per;
+	}
+	clk_prepare_enable(priv->perclk);
+
 	/* "dr" device has its own clock on i.MX51 */
 	priv->phyclk = devm_clk_get(&pdev->dev, "phy");
 	if (IS_ERR(priv->phyclk))
@@ -233,6 +240,8 @@  err_init:
 	if (priv->phyclk)
 		clk_disable_unprepare(priv->phyclk);
 
+	clk_disable_unprepare(priv->perclk);
+err_clk_per:
 	clk_disable_unprepare(priv->ahbclk);
 err_clk_ahb:
 	clk_disable_unprepare(priv->usbclk);
@@ -259,6 +268,7 @@  static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(priv->usbclk);
 	clk_disable_unprepare(priv->ahbclk);
+	clk_disable_unprepare(priv->perclk);
 
 	if (priv->phyclk)
 		clk_disable_unprepare(priv->phyclk);