diff options
Diffstat (limited to 'drivers/usb/host/ohci-at91.c')
-rw-r--r-- | drivers/usb/host/ohci-at91.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index a87564559e03..b3cdd1467521 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -31,8 +31,8 @@ | |||
31 | #define at91_for_each_port(index) \ | 31 | #define at91_for_each_port(index) \ |
32 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) | 32 | for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++) |
33 | 33 | ||
34 | /* interface and function clocks; sometimes also an AHB clock */ | 34 | /* interface, function and usb clocks; sometimes also an AHB clock */ |
35 | static struct clk *iclk, *fclk, *hclk; | 35 | static struct clk *iclk, *fclk, *uclk, *hclk; |
36 | static int clocked; | 36 | static int clocked; |
37 | 37 | ||
38 | extern int usb_disabled(void); | 38 | extern int usb_disabled(void); |
@@ -41,6 +41,10 @@ extern int usb_disabled(void); | |||
41 | 41 | ||
42 | static void at91_start_clock(void) | 42 | static void at91_start_clock(void) |
43 | { | 43 | { |
44 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | ||
45 | clk_set_rate(uclk, 48000000); | ||
46 | clk_prepare_enable(uclk); | ||
47 | } | ||
44 | clk_prepare_enable(hclk); | 48 | clk_prepare_enable(hclk); |
45 | clk_prepare_enable(iclk); | 49 | clk_prepare_enable(iclk); |
46 | clk_prepare_enable(fclk); | 50 | clk_prepare_enable(fclk); |
@@ -52,6 +56,8 @@ static void at91_stop_clock(void) | |||
52 | clk_disable_unprepare(fclk); | 56 | clk_disable_unprepare(fclk); |
53 | clk_disable_unprepare(iclk); | 57 | clk_disable_unprepare(iclk); |
54 | clk_disable_unprepare(hclk); | 58 | clk_disable_unprepare(hclk); |
59 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
60 | clk_disable_unprepare(uclk); | ||
55 | clocked = 0; | 61 | clocked = 0; |
56 | } | 62 | } |
57 | 63 | ||
@@ -162,6 +168,14 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
162 | retval = PTR_ERR(hclk); | 168 | retval = PTR_ERR(hclk); |
163 | goto err5; | 169 | goto err5; |
164 | } | 170 | } |
171 | if (IS_ENABLED(CONFIG_COMMON_CLK)) { | ||
172 | uclk = clk_get(&pdev->dev, "usb_clk"); | ||
173 | if (IS_ERR(uclk)) { | ||
174 | dev_err(&pdev->dev, "failed to get uclk\n"); | ||
175 | retval = PTR_ERR(uclk); | ||
176 | goto err6; | ||
177 | } | ||
178 | } | ||
165 | 179 | ||
166 | at91_start_hc(pdev); | 180 | at91_start_hc(pdev); |
167 | ohci_hcd_init(hcd_to_ohci(hcd)); | 181 | ohci_hcd_init(hcd_to_ohci(hcd)); |
@@ -173,6 +187,9 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver, | |||
173 | /* Error handling */ | 187 | /* Error handling */ |
174 | at91_stop_hc(pdev); | 188 | at91_stop_hc(pdev); |
175 | 189 | ||
190 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
191 | clk_put(uclk); | ||
192 | err6: | ||
176 | clk_put(hclk); | 193 | clk_put(hclk); |
177 | err5: | 194 | err5: |
178 | clk_put(fclk); | 195 | clk_put(fclk); |
@@ -212,6 +229,8 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd, | |||
212 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 229 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
213 | usb_put_hcd(hcd); | 230 | usb_put_hcd(hcd); |
214 | 231 | ||
232 | if (IS_ENABLED(CONFIG_COMMON_CLK)) | ||
233 | clk_put(uclk); | ||
215 | clk_put(hclk); | 234 | clk_put(hclk); |
216 | clk_put(fclk); | 235 | clk_put(fclk); |
217 | clk_put(iclk); | 236 | clk_put(iclk); |