aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/atmel_usba_udc.c
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-07-18 03:43:08 -0400
committerFelipe Balbi <balbi@ti.com>2013-07-29 06:58:13 -0400
commit0d98b9d6429c21132fa08c452e62127fd5032b55 (patch)
tree74fd9c46b2f59b6c494ed80beeec7536ce1b8a5e /drivers/usb/gadget/atmel_usba_udc.c
parent925403f425a4a9c503f2fc295652647b1eb10d82 (diff)
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>
Diffstat (limited to 'drivers/usb/gadget/atmel_usba_udc.c')
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index 1d9722203ca6..f018017e3a77 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1772,6 +1772,7 @@ out:
1772static int atmel_usba_start(struct usb_gadget *gadget, 1772static int atmel_usba_start(struct usb_gadget *gadget,
1773 struct usb_gadget_driver *driver) 1773 struct usb_gadget_driver *driver)
1774{ 1774{
1775 int ret = 0;
1775 struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); 1776 struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget);
1776 unsigned long flags; 1777 unsigned long flags;
1777 1778
@@ -1781,8 +1782,14 @@ static int atmel_usba_start(struct usb_gadget *gadget,
1781 udc->driver = driver; 1782 udc->driver = driver;
1782 spin_unlock_irqrestore(&udc->lock, flags); 1783 spin_unlock_irqrestore(&udc->lock, flags);
1783 1784
1784 clk_enable(udc->pclk); 1785 ret = clk_prepare_enable(udc->pclk);
1785 clk_enable(udc->hclk); 1786 if (ret)
1787 goto out;
1788 ret = clk_prepare_enable(udc->hclk);
1789 if (ret) {
1790 clk_disable_unprepare(udc->pclk);
1791 goto out;
1792 }
1786 1793
1787 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name); 1794 DBG(DBG_GADGET, "registered driver `%s'\n", driver->driver.name);
1788 1795
@@ -1797,9 +1804,11 @@ static int atmel_usba_start(struct usb_gadget *gadget,
1797 usba_writel(udc, CTRL, USBA_ENABLE_MASK); 1804 usba_writel(udc, CTRL, USBA_ENABLE_MASK);
1798 usba_writel(udc, INT_ENB, USBA_END_OF_RESET); 1805 usba_writel(udc, INT_ENB, USBA_END_OF_RESET);
1799 } 1806 }
1807
1808out:
1800 spin_unlock_irqrestore(&udc->lock, flags); 1809 spin_unlock_irqrestore(&udc->lock, flags);
1801 1810
1802 return 0; 1811 return ret;
1803} 1812}
1804 1813
1805static int atmel_usba_stop(struct usb_gadget *gadget, 1814static int atmel_usba_stop(struct usb_gadget *gadget,
@@ -1822,8 +1831,8 @@ static int atmel_usba_stop(struct usb_gadget *gadget,
1822 1831
1823 udc->driver = NULL; 1832 udc->driver = NULL;
1824 1833
1825 clk_disable(udc->hclk); 1834 clk_disable_unprepare(udc->hclk);
1826 clk_disable(udc->pclk); 1835 clk_disable_unprepare(udc->pclk);
1827 1836
1828 DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name); 1837 DBG(DBG_GADGET, "unregistered driver `%s'\n", driver->driver.name);
1829 1838
@@ -2022,10 +2031,14 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2022 platform_set_drvdata(pdev, udc); 2031 platform_set_drvdata(pdev, udc);
2023 2032
2024 /* Make sure we start from a clean slate */ 2033 /* Make sure we start from a clean slate */
2025 clk_enable(pclk); 2034 ret = clk_prepare_enable(pclk);
2035 if (ret) {
2036 dev_err(&pdev->dev, "Unable to enable pclk, aborting.\n");
2037 goto err_clk_enable;
2038 }
2026 toggle_bias(0); 2039 toggle_bias(0);
2027 usba_writel(udc, CTRL, USBA_DISABLE_MASK); 2040 usba_writel(udc, CTRL, USBA_DISABLE_MASK);
2028 clk_disable(pclk); 2041 clk_disable_unprepare(pclk);
2029 2042
2030 if (pdev->dev.of_node) 2043 if (pdev->dev.of_node)
2031 udc->usba_ep = atmel_udc_of_init(pdev, udc); 2044 udc->usba_ep = atmel_udc_of_init(pdev, udc);
@@ -2081,6 +2094,7 @@ err_add_udc:
2081 free_irq(irq, udc); 2094 free_irq(irq, udc);
2082err_request_irq: 2095err_request_irq:
2083err_alloc_ep: 2096err_alloc_ep:
2097err_clk_enable:
2084 iounmap(udc->fifo); 2098 iounmap(udc->fifo);
2085err_map_fifo: 2099err_map_fifo:
2086 iounmap(udc->regs); 2100 iounmap(udc->regs);