Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: g.liakhovetski@gmx.de (Guennadi Liakhovetski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/8] fsl_mx3_udc: Add i.MX35 support
Date: Fri, 12 Mar 2010 10:56:42 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.1003121054370.4385@axis700.grange> (raw)
In-Reply-To: <1265295825-8705-2-git-send-email-s.hauer@pengutronix.de>

(added usb to cc)

On Thu, 4 Feb 2010, Sascha Hauer wrote:

> The i.MX35 works fine with this driver, but we do not have
> the usb_ahb clock.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Sorry for a delay...

> ---
>  drivers/usb/gadget/fsl_mx3_udc.c |   31 ++++++++++++++++++++-----------
>  1 files changed, 20 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/gadget/fsl_mx3_udc.c b/drivers/usb/gadget/fsl_mx3_udc.c
> index 4bc2bf3..20a802e 100644
> --- a/drivers/usb/gadget/fsl_mx3_udc.c
> +++ b/drivers/usb/gadget/fsl_mx3_udc.c
> @@ -17,6 +17,8 @@
>  #include <linux/fsl_devices.h>
>  #include <linux/platform_device.h>
>  
> +#include <mach/hardware.h>
> +
>  static struct clk *mxc_ahb_clk;
>  static struct clk *mxc_usb_clk;
>  
> @@ -28,14 +30,16 @@ int fsl_udc_clk_init(struct platform_device *pdev)
>  
>  	pdata = pdev->dev.platform_data;
>  
> -	mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb");
> -	if (IS_ERR(mxc_ahb_clk))
> -		return PTR_ERR(mxc_ahb_clk);
> +	if (!cpu_is_mx35()) {
> +		mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb");
> +		if (IS_ERR(mxc_ahb_clk))
> +			return PTR_ERR(mxc_ahb_clk);
>  
> -	ret = clk_enable(mxc_ahb_clk);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n");
> -		goto eenahb;
> +		ret = clk_enable(mxc_ahb_clk);
> +		if (ret < 0) {
> +			dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n");
> +			goto eenahb;
> +		}
>  	}
>  
>  	/* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */
> @@ -50,6 +54,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
>  	if (pdata->phy_mode != FSL_USB2_PHY_ULPI &&
>  	    (freq < 59999000 || freq > 60001000)) {
>  		dev_err(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq);
> +		ret = -EINVAL;
>  		goto eclkrate;
>  	}
>  
> @@ -66,9 +71,11 @@ eclkrate:
>  	clk_put(mxc_usb_clk);
>  	mxc_usb_clk = NULL;
>  egusb:
> -	clk_disable(mxc_ahb_clk);
> +	if (!cpu_is_mx35())
> +		clk_disable(mxc_ahb_clk);
>  eenahb:
> -	clk_put(mxc_ahb_clk);
> +	if (!cpu_is_mx35())
> +		clk_put(mxc_ahb_clk);
>  	return ret;
>  }
>  

You could do

egusb:
	if (!cpu_is_mx35()) {
		clk_disable(mxc_ahb_clk);
eenahb:
		clk_put(mxc_ahb_clk);
	}

here, which (arguably) looks a bit better, but that's not anything 
critical, I think. Otherwise

Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

> @@ -90,6 +97,8 @@ void fsl_udc_clk_release(void)
>  		clk_disable(mxc_usb_clk);
>  		clk_put(mxc_usb_clk);
>  	}
> -	clk_disable(mxc_ahb_clk);
> -	clk_put(mxc_ahb_clk);
> +	if (!cpu_is_mx35()) {
> +		clk_disable(mxc_ahb_clk);
> +		clk_put(mxc_ahb_clk);
> +	}
>  }
> -- 
> 1.6.6
> 

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

  parent reply	other threads:[~2010-03-12  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-04 15:03 [PATCH] Add USB support for i.MX27/35 and Phytec i.MX boards Sascha Hauer
2010-02-04 15:03 ` [PATCH 1/8] fsl_mx3_udc: Add i.MX35 support Sascha Hauer
2010-02-04 15:03   ` [PATCH 2/8] i.MX ehci platform support: Some fixes Sascha Hauer
2010-02-04 15:03     ` [PATCH 3/8] i.MX27: Add USB control register access support Sascha Hauer
2010-02-04 15:03       ` [PATCH 4/8] i.MX35: " Sascha Hauer
2010-02-04 15:03         ` [PATCH 5/8] i.MX27 pca100: Add USB support Sascha Hauer
2010-02-04 15:03           ` [PATCH 6/8] i.MX27 pcm038: " Sascha Hauer
2010-02-04 15:03             ` [PATCH 7/8] i.MX31 pcm037: " Sascha Hauer
2010-02-04 15:03               ` [PATCH 8/8] i.MX27 pca100: " Sascha Hauer
2010-03-15 17:17               ` [PATCH 7/8] i.MX31 pcm037: " Alberto Panizzo
2010-02-04 16:02         ` [PATCH 4/8] i.MX35: Add USB control register access support Enrico Scholz
2010-02-04 16:22           ` Sascha Hauer
2010-02-04 16:26         ` Sascha Hauer
2010-03-12  9:56   ` Guennadi Liakhovetski [this message]
2010-02-04 18:34 ` [PATCH] Add USB support for i.MX27/35 and Phytec i.MX boards Baruch Siach
2010-02-04 20:29   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1003121054370.4385@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox