Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
[cascardo/linux.git] / drivers / usb / host / ehci-atmel.c
index 5831a88..284f841 100644 (file)
@@ -30,13 +30,17 @@ static const char hcd_name[] = "ehci-atmel";
 static struct hc_driver __read_mostly ehci_atmel_hc_driver;
 
 /* interface and function clocks */
-static struct clk *iclk, *fclk;
+static struct clk *iclk, *fclk, *uclk;
 static int clocked;
 
 /*-------------------------------------------------------------------------*/
 
 static void atmel_start_clock(void)
 {
+       if (IS_ENABLED(CONFIG_COMMON_CLK)) {
+               clk_set_rate(uclk, 48000000);
+               clk_prepare_enable(uclk);
+       }
        clk_prepare_enable(iclk);
        clk_prepare_enable(fclk);
        clocked = 1;
@@ -46,6 +50,8 @@ static void atmel_stop_clock(void)
 {
        clk_disable_unprepare(fclk);
        clk_disable_unprepare(iclk);
+       if (IS_ENABLED(CONFIG_COMMON_CLK))
+               clk_disable_unprepare(uclk);
        clocked = 0;
 }
 
@@ -90,9 +96,7 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
         * Since shared usb code relies on it, set it here for now.
         * Once we have dma capability bindings this can go away.
         */
-       if (!pdev->dev.dma_mask)
-               pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-       retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+       retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
        if (retval)
                goto fail_create_hcd;
 
@@ -131,6 +135,14 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
                retval = -ENOENT;
                goto fail_request_resource;
        }
+       if (IS_ENABLED(CONFIG_COMMON_CLK)) {
+               uclk = devm_clk_get(&pdev->dev, "usb_clk");
+               if (IS_ERR(uclk)) {
+                       dev_err(&pdev->dev, "failed to get uclk\n");
+                       retval = PTR_ERR(uclk);
+                       goto fail_request_resource;
+               }
+       }
 
        ehci = hcd_to_ehci(hcd);
        /* registers start at offset 0x0 */