linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mx27: add a clock gate to activate SPLL clock
@ 2012-12-19 18:29 Gwenhael Goavec-Merou
  2012-12-19 18:29 ` [PATCH 2/2] mxc: enable EHCI PER clock Gwenhael Goavec-Merou
  0 siblings, 1 reply; 8+ messages in thread
From: Gwenhael Goavec-Merou @ 2012-12-19 18:29 UTC (permalink / raw)
  To: linux-arm-kernel

A clock gate is mandatory to activate SPLL clock needed, at least, for usb.

Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@armadeus.com>
---
 arch/arm/mach-imx/clk-imx27.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index 4c1d1e4..4f066d13 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -62,7 +62,7 @@ static const char *clko_sel_clks[] = {
 	"32k", "usb_div", "dptc",
 };
 
-static const char *ssi_sel_clks[] = { "spll", "mpll", };
+static const char *ssi_sel_clks[] = { "spll_gate", "mpll", };
 
 enum mx27_clks {
 	dummy, ckih, ckil, mpll, spll, mpll_main2, ahb, ipg, nfc_div, per1_div,
@@ -82,7 +82,7 @@ enum mx27_clks {
 	csi_ahb_gate, brom_ahb_gate, ata_ahb_gate, wdog_ipg_gate, usb_ipg_gate,
 	uart6_ipg_gate, uart5_ipg_gate, uart4_ipg_gate, uart3_ipg_gate,
 	uart2_ipg_gate, uart1_ipg_gate, ckih_div1p5, fpm, mpll_osc_sel,
-	mpll_sel, clk_max
+	mpll_sel, spll_gate, clk_max
 };
 
 static struct clk *clk[clk_max];
@@ -104,6 +104,7 @@ int __init mx27_clocks_init(unsigned long fref)
 			ARRAY_SIZE(mpll_sel_clks));
 	clk[mpll] = imx_clk_pllv1("mpll", "mpll_sel", CCM_MPCTL0);
 	clk[spll] = imx_clk_pllv1("spll", "ckih", CCM_SPCTL0);
+	clk[spll_gate] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
 	clk[mpll_main2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3);
 
 	if (mx27_revision() >= IMX_CHIP_REVISION_2_0) {
@@ -121,7 +122,7 @@ int __init mx27_clocks_init(unsigned long fref)
 	clk[per4_div] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6);
 	clk[vpu_sel] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks));
 	clk[vpu_div] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 6);
-	clk[usb_div] = imx_clk_divider("usb_div", "spll", CCM_CSCR, 28, 3);
+	clk[usb_div] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 28, 3);
 	clk[cpu_sel] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks));
 	clk[clko_sel] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks));
 	if (mx27_revision() >= IMX_CHIP_REVISION_2_0)
-- 
1.7.8.6

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2012-12-19 18:29 [PATCH 1/2] mx27: add a clock gate to activate SPLL clock Gwenhael Goavec-Merou
@ 2012-12-19 18:29 ` Gwenhael Goavec-Merou
  2012-12-19 19:04   ` Fabio Estevam
  2012-12-19 20:29   ` Sascha Hauer
  0 siblings, 2 replies; 8+ messages in thread
From: Gwenhael Goavec-Merou @ 2012-12-19 18:29 UTC (permalink / raw)
  To: linux-arm-kernel

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);
+
 	/* "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);
-- 
1.7.8.6

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2012-12-19 18:29 ` [PATCH 2/2] mxc: enable EHCI PER clock Gwenhael Goavec-Merou
@ 2012-12-19 19:04   ` Fabio Estevam
  2012-12-19 19:45     ` Marek Vasut
  2012-12-19 20:29   ` Sascha Hauer
  1 sibling, 1 reply; 8+ messages in thread
From: Fabio Estevam @ 2012-12-19 19:04 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2012-12-19 19:04   ` Fabio Estevam
@ 2012-12-19 19:45     ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2012-12-19 19:45 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2012-12-19 18:29 ` [PATCH 2/2] mxc: enable EHCI PER clock Gwenhael Goavec-Merou
  2012-12-19 19:04   ` Fabio Estevam
@ 2012-12-19 20:29   ` Sascha Hauer
  2013-01-08 12:52     ` gwenhael.goavec
  1 sibling, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2012-12-19 20:29 UTC (permalink / raw)
  To: linux-arm-kernel

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

-- 
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 |

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2012-12-19 20:29   ` Sascha Hauer
@ 2013-01-08 12:52     ` gwenhael.goavec
  2013-01-08 13:01       ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: gwenhael.goavec @ 2013-01-08 12:52 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2013-01-08 12:52     ` gwenhael.goavec
@ 2013-01-08 13:01       ` Marek Vasut
  2013-01-08 13:41         ` gwenhael.goavec
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2013-01-08 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

* [PATCH 2/2] mxc: enable EHCI PER clock
  2013-01-08 13:01       ` Marek Vasut
@ 2013-01-08 13:41         ` gwenhael.goavec
  0 siblings, 0 replies; 8+ messages in thread
From: gwenhael.goavec @ 2013-01-08 13:41 UTC (permalink / raw)
  To: linux-arm-kernel

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

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

end of thread, other threads:[~2013-01-08 13:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 18:29 [PATCH 1/2] mx27: add a clock gate to activate SPLL clock Gwenhael Goavec-Merou
2012-12-19 18:29 ` [PATCH 2/2] mxc: enable EHCI PER clock Gwenhael Goavec-Merou
2012-12-19 19:04   ` Fabio Estevam
2012-12-19 19:45     ` Marek Vasut
2012-12-19 20:29   ` Sascha Hauer
2013-01-08 12:52     ` gwenhael.goavec
2013-01-08 13:01       ` Marek Vasut
2013-01-08 13:41         ` gwenhael.goavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).