usb: gadget: atmel_usba: prepare clk before calling enable

Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Boris BREZILLON 2013-07-18 09:43:08 +02:00 committed by Felipe Balbi
parent 925403f425
commit 0d98b9d642

View File

@ -1772,6 +1772,7 @@ static irqreturn_t usba_vbus_irq(int irq, void *devid)
static int atmel_usba_start(struct usb_gadget *gadget, static int atmel_usba_start(struct usb_gadget *gadget,
struct usb_gadget_driver *driver) struct usb_gadget_driver *driver)
{ {
int ret = 0;
struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget);
unsigned long flags; unsigned long flags;
@ -1781,8 +1782,14 @@ static int atmel_usba_start(struct usb_gadget *gadget,
udc->driver = driver; udc->driver = driver;
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
clk_enable(udc->pclk); ret = clk_prepare_enable(udc->pclk);
clk_enable(udc->hclk); if (ret)
goto out;
ret = clk_prepare_enable(udc->hclk);
if (ret) {
clk_disable_unprepare(udc->pclk);
goto out;
}
DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
@ -1797,9 +1804,11 @@ static int atmel_usba_start(struct usb_gadget *gadget,
usba_writel(udc, CTRL, USBA_ENABLE_MASK); usba_writel(udc, CTRL, USBA_ENABLE_MASK);
usba_writel(udc, INT_ENB, USBA_END_OF_RESET); usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
} }
out:
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
return 0; return ret;
} }
static int atmel_usba_stop(struct usb_gadget *gadget, static int atmel_usba_stop(struct usb_gadget *gadget,
@ -1822,8 +1831,8 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
udc->driver = NULL; udc->driver = NULL;
clk_disable(udc->hclk); clk_disable_unprepare(udc->hclk);
clk_disable(udc->pclk); clk_disable_unprepare(udc->pclk);
DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name); DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name);
@ -2022,10 +2031,14 @@ static int __init usba_udc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, udc); platform_set_drvdata(pdev, udc);
/* Make sure we start from a clean slate */ /* Make sure we start from a clean slate */
clk_enable(pclk); ret = clk_prepare_enable(pclk);
if (ret) {
dev_err(&pdev->dev, "Unable to enable pclk, aborting.\n");
goto err_clk_enable;
}
toggle_bias(0); toggle_bias(0);
usba_writel(udc, CTRL, USBA_DISABLE_MASK); usba_writel(udc, CTRL, USBA_DISABLE_MASK);
clk_disable(pclk); clk_disable_unprepare(pclk);
if (pdev->dev.of_node) if (pdev->dev.of_node)
udc->usba_ep = atmel_udc_of_init(pdev, udc); udc->usba_ep = atmel_udc_of_init(pdev, udc);
@ -2081,6 +2094,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
free_irq(irq, udc); free_irq(irq, udc);
err_request_irq: err_request_irq:
err_alloc_ep: err_alloc_ep:
err_clk_enable:
iounmap(udc->fifo); iounmap(udc->fifo);
err_map_fifo: err_map_fifo:
iounmap(udc->regs); iounmap(udc->regs);