[PATCH v3 6/7] USB: ohci-at91: add usb_clk for transition to common clk framework

Alan Stern stern at rowland.harvard.edu
Wed Jul 17 11:33:54 EDT 2013


On Tue, 16 Jul 2013, Boris BREZILLON wrote:

> 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 add 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 the usb clk).

This does not take into account any of the changes you discussed with 
Russell King and me -- it is exactly the same as the previous version.

> @@ -144,6 +150,11 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
>  		goto err2;
>  	}
>  
> +	uclk = clk_get(&pdev->dev, "usb_clk");
> +	if (IS_ERR(uclk)) {
> +		uclk = NULL;
> +		dev_warn(&pdev->dev, "failed to get usb_clk\n");
> +	}
>  	iclk = clk_get(&pdev->dev, "ohci_clk");
>  	if (IS_ERR(iclk)) {
>  		dev_err(&pdev->dev, "failed to get ohci_clk\n");
> @@ -212,10 +223,11 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
>  	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
>  	usb_put_hcd(hcd);
>  
> +	clk_put(uclk);

What will clk_put() do when uclk is NULL?

Alan Stern




More information about the linux-arm-kernel mailing list