diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2015-01-14 11:21:58 -0500 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2015-01-15 08:35:13 -0500 |
commit | 9aa0216550b227f41e3e515d3bfdb336bb92dc38 (patch) | |
tree | 48f4cdfbbf579ee69510c727cf54eeae9580724a /drivers/usb | |
parent | 7923540385615c5379792fd21f98b24877b22734 (diff) |
usb: gadget: at91_udc: Drop uclk clock
Now that at91 system clocks forward set_rate request to their parent we
can remove the uclk clock and directly call clk_set_rate on fclk.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/udc/at91_udc.c | 27 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/at91_udc.h | 2 |
2 files changed, 4 insertions, 25 deletions
diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c index 9ff2f7e5c6a7..d33f2994b7c4 100644 --- a/drivers/usb/gadget/udc/at91_udc.c +++ b/drivers/usb/gadget/udc/at91_udc.c | |||
@@ -895,8 +895,6 @@ static void clk_on(struct at91_udc *udc) | |||
895 | return; | 895 | return; |
896 | udc->clocked = 1; | 896 | udc->clocked = 1; |
897 | 897 | ||
898 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
899 | clk_enable(udc->uclk); | ||
900 | clk_enable(udc->iclk); | 898 | clk_enable(udc->iclk); |
901 | clk_enable(udc->fclk); | 899 | clk_enable(udc->fclk); |
902 | } | 900 | } |
@@ -909,8 +907,6 @@ static void clk_off(struct at91_udc *udc) | |||
909 | udc->gadget.speed = USB_SPEED_UNKNOWN; | 907 | udc->gadget.speed = USB_SPEED_UNKNOWN; |
910 | clk_disable(udc->fclk); | 908 | clk_disable(udc->fclk); |
911 | clk_disable(udc->iclk); | 909 | clk_disable(udc->iclk); |
912 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
913 | clk_disable(udc->uclk); | ||
914 | } | 910 | } |
915 | 911 | ||
916 | /* | 912 | /* |
@@ -1781,25 +1777,17 @@ static int at91udc_probe(struct platform_device *pdev) | |||
1781 | /* get interface and function clocks */ | 1777 | /* get interface and function clocks */ |
1782 | udc->iclk = clk_get(dev, "pclk"); | 1778 | udc->iclk = clk_get(dev, "pclk"); |
1783 | udc->fclk = clk_get(dev, "hclk"); | 1779 | udc->fclk = clk_get(dev, "hclk"); |
1784 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | 1780 | if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) { |
1785 | udc->uclk = clk_get(dev, "usb_clk"); | ||
1786 | if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk) || | ||
1787 | (IS_ENABLED(CONFIG_COMMON_CLK) && IS_ERR(udc->uclk))) { | ||
1788 | DBG("clocks missing\n"); | 1781 | DBG("clocks missing\n"); |
1789 | retval = -ENODEV; | 1782 | retval = -ENODEV; |
1790 | goto fail1; | 1783 | goto fail1; |
1791 | } | 1784 | } |
1792 | 1785 | ||
1793 | /* don't do anything until we have both gadget driver and VBUS */ | 1786 | /* don't do anything until we have both gadget driver and VBUS */ |
1794 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | 1787 | clk_set_rate(udc->fclk, 48000000); |
1795 | clk_set_rate(udc->uclk, 48000000); | ||
1796 | retval = clk_prepare(udc->uclk); | ||
1797 | if (retval) | ||
1798 | goto fail1; | ||
1799 | } | ||
1800 | retval = clk_prepare(udc->fclk); | 1788 | retval = clk_prepare(udc->fclk); |
1801 | if (retval) | 1789 | if (retval) |
1802 | goto fail1a; | 1790 | goto fail1; |
1803 | 1791 | ||
1804 | retval = clk_prepare_enable(udc->iclk); | 1792 | retval = clk_prepare_enable(udc->iclk); |
1805 | if (retval) | 1793 | if (retval) |
@@ -1873,12 +1861,7 @@ fail1c: | |||
1873 | clk_unprepare(udc->iclk); | 1861 | clk_unprepare(udc->iclk); |
1874 | fail1b: | 1862 | fail1b: |
1875 | clk_unprepare(udc->fclk); | 1863 | clk_unprepare(udc->fclk); |
1876 | fail1a: | ||
1877 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
1878 | clk_unprepare(udc->uclk); | ||
1879 | fail1: | 1864 | fail1: |
1880 | if (IS_ENABLED(CONFIG_COMMON_CLK) && !IS_ERR(udc->uclk)) | ||
1881 | clk_put(udc->uclk); | ||
1882 | if (!IS_ERR(udc->fclk)) | 1865 | if (!IS_ERR(udc->fclk)) |
1883 | clk_put(udc->fclk); | 1866 | clk_put(udc->fclk); |
1884 | if (!IS_ERR(udc->iclk)) | 1867 | if (!IS_ERR(udc->iclk)) |
@@ -1924,15 +1907,11 @@ static int __exit at91udc_remove(struct platform_device *pdev) | |||
1924 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1907 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1925 | release_mem_region(res->start, resource_size(res)); | 1908 | release_mem_region(res->start, resource_size(res)); |
1926 | 1909 | ||
1927 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
1928 | clk_unprepare(udc->uclk); | ||
1929 | clk_unprepare(udc->fclk); | 1910 | clk_unprepare(udc->fclk); |
1930 | clk_unprepare(udc->iclk); | 1911 | clk_unprepare(udc->iclk); |
1931 | 1912 | ||
1932 | clk_put(udc->iclk); | 1913 | clk_put(udc->iclk); |
1933 | clk_put(udc->fclk); | 1914 | clk_put(udc->fclk); |
1934 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
1935 | clk_put(udc->uclk); | ||
1936 | 1915 | ||
1937 | return 0; | 1916 | return 0; |
1938 | } | 1917 | } |
diff --git a/drivers/usb/gadget/udc/at91_udc.h b/drivers/usb/gadget/udc/at91_udc.h index 017524663381..e647d1c2ada4 100644 --- a/drivers/usb/gadget/udc/at91_udc.h +++ b/drivers/usb/gadget/udc/at91_udc.h | |||
@@ -126,7 +126,7 @@ struct at91_udc { | |||
126 | unsigned active_suspend:1; | 126 | unsigned active_suspend:1; |
127 | u8 addr; | 127 | u8 addr; |
128 | struct at91_udc_data board; | 128 | struct at91_udc_data board; |
129 | struct clk *iclk, *fclk, *uclk; | 129 | struct clk *iclk, *fclk; |
130 | struct platform_device *pdev; | 130 | struct platform_device *pdev; |
131 | struct proc_dir_entry *pde; | 131 | struct proc_dir_entry *pde; |
132 | void __iomem *udp_baseaddr; | 132 | void __iomem *udp_baseaddr; |