All of lore.kernel.org
 help / color / mirror / Atom feed
From: balbi@ti.com (Felipe Balbi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/12] usb: gadget: at91_udc: Drop uclk clock
Date: Wed, 14 Jan 2015 11:37:36 -0600	[thread overview]
Message-ID: <20150114173736.GH16533@saruman> (raw)
In-Reply-To: <1421252524-24452-7-git-send-email-alexandre.belloni@free-electrons.com>

On Wed, Jan 14, 2015 at 05:21:58PM +0100, Alexandre Belloni wrote:
> From: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> Now that at91 system clocks forward set_rate request to their parent we
> can remove the uclk clock and directly call clk_set_rate on fclk.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/gadget/udc/at91_udc.c | 27 +++------------------------
>  drivers/usb/gadget/udc/at91_udc.h |  2 +-
>  2 files changed, 4 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
> index 9ff2f7e5c6a7..d33f2994b7c4 100644
> --- a/drivers/usb/gadget/udc/at91_udc.c
> +++ b/drivers/usb/gadget/udc/at91_udc.c
> @@ -895,8 +895,6 @@ static void clk_on(struct at91_udc *udc)
>  		return;
>  	udc->clocked = 1;
>  
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_enable(udc->uclk);
>  	clk_enable(udc->iclk);
>  	clk_enable(udc->fclk);
>  }
> @@ -909,8 +907,6 @@ static void clk_off(struct at91_udc *udc)
>  	udc->gadget.speed = USB_SPEED_UNKNOWN;
>  	clk_disable(udc->fclk);
>  	clk_disable(udc->iclk);
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_disable(udc->uclk);
>  }
>  
>  /*
> @@ -1781,25 +1777,17 @@ static int at91udc_probe(struct platform_device *pdev)
>  	/* get interface and function clocks */
>  	udc->iclk = clk_get(dev, "pclk");
>  	udc->fclk = clk_get(dev, "hclk");
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		udc->uclk = clk_get(dev, "usb_clk");
> -	if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk) ||
> -	    (IS_ENABLED(CONFIG_COMMON_CLK) && IS_ERR(udc->uclk))) {
> +	if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
>  		DBG("clocks missing\n");
>  		retval = -ENODEV;
>  		goto fail1;
>  	}
>  
>  	/* don't do anything until we have both gadget driver and VBUS */
> -	if (IS_ENABLED(CONFIG_COMMON_CLK)) {
> -		clk_set_rate(udc->uclk, 48000000);
> -		retval = clk_prepare(udc->uclk);
> -		if (retval)
> -			goto fail1;
> -	}
> +	clk_set_rate(udc->fclk, 48000000);
>  	retval = clk_prepare(udc->fclk);
>  	if (retval)
> -		goto fail1a;
> +		goto fail1;
>  
>  	retval = clk_prepare_enable(udc->iclk);
>  	if (retval)
> @@ -1873,12 +1861,7 @@ fail1c:
>  	clk_unprepare(udc->iclk);
>  fail1b:
>  	clk_unprepare(udc->fclk);
> -fail1a:
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_unprepare(udc->uclk);
>  fail1:
> -	if (IS_ENABLED(CONFIG_COMMON_CLK) && !IS_ERR(udc->uclk))
> -		clk_put(udc->uclk);
>  	if (!IS_ERR(udc->fclk))
>  		clk_put(udc->fclk);
>  	if (!IS_ERR(udc->iclk))
> @@ -1924,15 +1907,11 @@ static int __exit at91udc_remove(struct platform_device *pdev)
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	release_mem_region(res->start, resource_size(res));
>  
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_unprepare(udc->uclk);
>  	clk_unprepare(udc->fclk);
>  	clk_unprepare(udc->iclk);
>  
>  	clk_put(udc->iclk);
>  	clk_put(udc->fclk);
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_put(udc->uclk);
>  
>  	return 0;
>  }
> diff --git a/drivers/usb/gadget/udc/at91_udc.h b/drivers/usb/gadget/udc/at91_udc.h
> index 017524663381..e647d1c2ada4 100644
> --- a/drivers/usb/gadget/udc/at91_udc.h
> +++ b/drivers/usb/gadget/udc/at91_udc.h
> @@ -126,7 +126,7 @@ struct at91_udc {
>  	unsigned			active_suspend:1;
>  	u8				addr;
>  	struct at91_udc_data		board;
> -	struct clk			*iclk, *fclk, *uclk;
> +	struct clk			*iclk, *fclk;
>  	struct platform_device		*pdev;
>  	struct proc_dir_entry		*pde;
>  	void __iomem			*udp_baseaddr;
> -- 
> 2.1.0
> 

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150114/ee4ed61a/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@ti.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Felipe Balbi <balbi@ti.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Arnd Bergmann <arnd@arndb.de>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Subject: Re: [PATCH 06/12] usb: gadget: at91_udc: Drop uclk clock
Date: Wed, 14 Jan 2015 11:37:36 -0600	[thread overview]
Message-ID: <20150114173736.GH16533@saruman> (raw)
In-Reply-To: <1421252524-24452-7-git-send-email-alexandre.belloni@free-electrons.com>

[-- Attachment #1: Type: text/plain, Size: 3679 bytes --]

On Wed, Jan 14, 2015 at 05:21:58PM +0100, Alexandre Belloni wrote:
> From: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> Now that at91 system clocks forward set_rate request to their parent we
> can remove the uclk clock and directly call clk_set_rate on fclk.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/gadget/udc/at91_udc.c | 27 +++------------------------
>  drivers/usb/gadget/udc/at91_udc.h |  2 +-
>  2 files changed, 4 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
> index 9ff2f7e5c6a7..d33f2994b7c4 100644
> --- a/drivers/usb/gadget/udc/at91_udc.c
> +++ b/drivers/usb/gadget/udc/at91_udc.c
> @@ -895,8 +895,6 @@ static void clk_on(struct at91_udc *udc)
>  		return;
>  	udc->clocked = 1;
>  
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_enable(udc->uclk);
>  	clk_enable(udc->iclk);
>  	clk_enable(udc->fclk);
>  }
> @@ -909,8 +907,6 @@ static void clk_off(struct at91_udc *udc)
>  	udc->gadget.speed = USB_SPEED_UNKNOWN;
>  	clk_disable(udc->fclk);
>  	clk_disable(udc->iclk);
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_disable(udc->uclk);
>  }
>  
>  /*
> @@ -1781,25 +1777,17 @@ static int at91udc_probe(struct platform_device *pdev)
>  	/* get interface and function clocks */
>  	udc->iclk = clk_get(dev, "pclk");
>  	udc->fclk = clk_get(dev, "hclk");
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		udc->uclk = clk_get(dev, "usb_clk");
> -	if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk) ||
> -	    (IS_ENABLED(CONFIG_COMMON_CLK) && IS_ERR(udc->uclk))) {
> +	if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
>  		DBG("clocks missing\n");
>  		retval = -ENODEV;
>  		goto fail1;
>  	}
>  
>  	/* don't do anything until we have both gadget driver and VBUS */
> -	if (IS_ENABLED(CONFIG_COMMON_CLK)) {
> -		clk_set_rate(udc->uclk, 48000000);
> -		retval = clk_prepare(udc->uclk);
> -		if (retval)
> -			goto fail1;
> -	}
> +	clk_set_rate(udc->fclk, 48000000);
>  	retval = clk_prepare(udc->fclk);
>  	if (retval)
> -		goto fail1a;
> +		goto fail1;
>  
>  	retval = clk_prepare_enable(udc->iclk);
>  	if (retval)
> @@ -1873,12 +1861,7 @@ fail1c:
>  	clk_unprepare(udc->iclk);
>  fail1b:
>  	clk_unprepare(udc->fclk);
> -fail1a:
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_unprepare(udc->uclk);
>  fail1:
> -	if (IS_ENABLED(CONFIG_COMMON_CLK) && !IS_ERR(udc->uclk))
> -		clk_put(udc->uclk);
>  	if (!IS_ERR(udc->fclk))
>  		clk_put(udc->fclk);
>  	if (!IS_ERR(udc->iclk))
> @@ -1924,15 +1907,11 @@ static int __exit at91udc_remove(struct platform_device *pdev)
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	release_mem_region(res->start, resource_size(res));
>  
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_unprepare(udc->uclk);
>  	clk_unprepare(udc->fclk);
>  	clk_unprepare(udc->iclk);
>  
>  	clk_put(udc->iclk);
>  	clk_put(udc->fclk);
> -	if (IS_ENABLED(CONFIG_COMMON_CLK))
> -		clk_put(udc->uclk);
>  
>  	return 0;
>  }
> diff --git a/drivers/usb/gadget/udc/at91_udc.h b/drivers/usb/gadget/udc/at91_udc.h
> index 017524663381..e647d1c2ada4 100644
> --- a/drivers/usb/gadget/udc/at91_udc.h
> +++ b/drivers/usb/gadget/udc/at91_udc.h
> @@ -126,7 +126,7 @@ struct at91_udc {
>  	unsigned			active_suspend:1;
>  	u8				addr;
>  	struct at91_udc_data		board;
> -	struct clk			*iclk, *fclk, *uclk;
> +	struct clk			*iclk, *fclk;
>  	struct platform_device		*pdev;
>  	struct proc_dir_entry		*pde;
>  	void __iomem			*udp_baseaddr;
> -- 
> 2.1.0
> 

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-01-14 17:37 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 16:21 [PATCH 00/12] Atmel matrix, SMC and UDC rework Alexandre Belloni
2015-01-14 16:21 ` Alexandre Belloni
2015-01-14 16:21 ` [PATCH 01/12] mfd: syscon: Add atmel-matrix registers definition Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-18 12:52   ` Lee Jones
2015-01-18 12:52     ` Lee Jones
2015-01-18 13:11     ` Boris Brezillon
2015-01-18 13:11       ` Boris Brezillon
2015-01-19  8:16       ` Lee Jones
2015-01-19  8:16         ` Lee Jones
2015-01-14 16:21 ` [PATCH 02/12] mfd: syscon: Add Atmel Matrix bus DT binding documentation Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-18 12:53   ` Lee Jones
2015-01-18 12:53     ` Lee Jones
2015-01-14 16:21 ` [PATCH 03/12] mfd: syscon: Add atmel-smc registers definition Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-18 12:53   ` Lee Jones
2015-01-18 12:53     ` Lee Jones
2015-01-14 16:21 ` [PATCH 04/12] mfd: syscon: Add Atmel SMC binding doc Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-18 12:54   ` Lee Jones
2015-01-18 12:54     ` Lee Jones
2015-01-14 16:21 ` [PATCH 05/12] usb: gadget: at91_udc: Fix clock names Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-14 17:37   ` Felipe Balbi
2015-01-14 17:37     ` Felipe Balbi
2015-01-14 16:21 ` [PATCH 06/12] usb: gadget: at91_udc: Drop uclk clock Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-14 17:37   ` Felipe Balbi [this message]
2015-01-14 17:37     ` Felipe Balbi
2015-01-14 16:21 ` [PATCH 07/12] usb: gadget: at91_udc: Document DT clocks and clock-names property Alexandre Belloni
2015-01-14 16:21   ` Alexandre Belloni
2015-01-14 16:22 ` [PATCH 08/12] usb: gadget: at91_udc: Remove non-DT handling code Alexandre Belloni
2015-01-14 16:22   ` Alexandre Belloni
2015-01-14 17:38   ` Felipe Balbi
2015-01-14 17:38     ` Felipe Balbi
2015-01-14 18:35     ` Alexandre Belloni
2015-01-14 18:35       ` Alexandre Belloni
2015-01-14 18:39       ` Felipe Balbi
2015-01-14 18:39         ` Felipe Balbi
2015-01-14 16:22 ` [PATCH 09/12] usb: gadget: at91_udc: Simplify probe and remove functions Alexandre Belloni
2015-01-14 16:22   ` Alexandre Belloni
2015-01-14 17:38   ` Felipe Balbi
2015-01-14 17:38     ` Felipe Balbi
2015-01-14 16:22 ` [PATCH 10/12] usb: gadget: at91_udc: Rework for multi-platform kernel support Alexandre Belloni
2015-01-14 16:22   ` Alexandre Belloni
2015-01-14 17:38   ` Felipe Balbi
2015-01-14 17:38     ` Felipe Balbi
2015-01-14 16:22 ` [PATCH 11/12] usb: gadget: at91_udc: Update DT binding documentation Alexandre Belloni
2015-01-14 16:22   ` Alexandre Belloni
2015-01-14 16:22 ` [PATCH 12/12] usb: gadget: at91_udc: Allocate udc instance Alexandre Belloni
2015-01-14 16:22   ` Alexandre Belloni
2015-01-14 17:39   ` Felipe Balbi
2015-01-14 17:39     ` Felipe Balbi
2015-01-15 13:30 ` [PATCH 00/12] Atmel matrix, SMC and UDC rework Nicolas Ferre
2015-01-15 13:30   ` Nicolas Ferre

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=20150114173736.GH16533@saruman \
    --to=balbi@ti.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.