public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel•com (Nicolas Ferre)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2] USB: ohci-at91: add usb_clk for transition to common clk framework
Date: Mon, 12 Aug 2013 15:55:28 +0200	[thread overview]
Message-ID: <5208E950.3050205@atmel.com> (raw)
In-Reply-To: <1375376953-22823-1-git-send-email-b.brezillon@overkiz.com>

On 01/08/2013 19:09, Boris BREZILLON :
> The AT91 PMC (Power Management Controller) provides an USB clock used by
> USB Full Speed host (ohci) and USB Full Speed device (udc).
> The usb drivers (ohci and udc) must configure this clock to 48Mhz.
> This configuration was formely done in mach-at91/clock.c, but this
> implementation will be removed when moving to common clk framework.
>
> This patch adds support for usb clock retrieval and configuration, and is
> backward compatible with the current at91 clk implementation (if usb clk
> is not found, it does not configure/enable it).
>
> Changes since v1:
>   - use IS_ENABLED(CONFIG_COMMON_CLK) to isolate new at91 clk support
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz•com>

Well, for this v2 as well:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel•com>

(even if it is too late)

Bye,


> ---
>   drivers/usb/host/ohci-at91.c |   23 +++++++++++++++++++++--
>   1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 9677f68..db60048 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -31,8 +31,8 @@
>   #define at91_for_each_port(index)	\
>   		for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)
>
> -/* interface and function clocks; sometimes also an AHB clock */
> -static struct clk *iclk, *fclk, *hclk;
> +/* interface, function and usb clocks; sometimes also an AHB clock */
> +static struct clk *iclk, *fclk, *uclk, *hclk;
>   static int clocked;
>
>   extern int usb_disabled(void);
> @@ -41,6 +41,10 @@ extern int usb_disabled(void);
>
>   static void at91_start_clock(void)
>   {
> +	if (IS_ENABLED(CONFIG_COMMON_CLK)) {
> +		clk_set_rate(uclk, 48000000);
> +		clk_prepare_enable(uclk);
> +	}
>   	clk_prepare_enable(hclk);
>   	clk_prepare_enable(iclk);
>   	clk_prepare_enable(fclk);
> @@ -52,6 +56,8 @@ static void at91_stop_clock(void)
>   	clk_disable_unprepare(fclk);
>   	clk_disable_unprepare(iclk);
>   	clk_disable_unprepare(hclk);
> +	if (IS_ENABLED(CONFIG_COMMON_CLK))
> +		clk_disable_unprepare(uclk);
>   	clocked = 0;
>   }
>
> @@ -162,6 +168,14 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
>   		retval = PTR_ERR(hclk);
>   		goto err5;
>   	}
> +	if (IS_ENABLED(CONFIG_COMMON_CLK)) {
> +		uclk = clk_get(&pdev->dev, "usb_clk");
> +		if (IS_ERR(uclk)) {
> +			dev_err(&pdev->dev, "failed to get uclk\n");
> +			retval = PTR_ERR(uclk);
> +			goto err6;
> +		}
> +	}
>
>   	at91_start_hc(pdev);
>   	ohci_hcd_init(hcd_to_ohci(hcd));
> @@ -173,6 +187,9 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
>   	/* Error handling */
>   	at91_stop_hc(pdev);
>
> +	if (IS_ENABLED(CONFIG_COMMON_CLK))
> +		clk_put(uclk);
> + err6:
>   	clk_put(hclk);
>    err5:
>   	clk_put(fclk);
> @@ -212,6 +229,8 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
>   	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
>   	usb_put_hcd(hcd);
>
> +	if (IS_ENABLED(CONFIG_COMMON_CLK))
> +		clk_put(uclk);
>   	clk_put(hclk);
>   	clk_put(fclk);
>   	clk_put(iclk);
>


-- 
Nicolas Ferre

      parent reply	other threads:[~2013-08-12 13:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 17:09 [PATCH v2] USB: ohci-at91: add usb_clk for transition to common clk framework Boris BREZILLON
2013-08-01 17:39 ` Alan Stern
2013-08-12 13:55 ` Nicolas Ferre [this message]

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=5208E950.3050205@atmel.com \
    --to=nicolas.ferre@atmel$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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