aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorBoris BREZILLON <b.brezillon@overkiz.com>2013-10-18 15:26:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-30 12:41:49 -0400
commit0d768fcfc01098ae0e676c78746c9f4fd8228cd7 (patch)
treedc952daa17af977f0436513459ff31f4e548bc51 /drivers/usb/host
parent9983d6dc4e8a8a1ce599cb426c0ec9384219b476 (diff)
USB: ehci-atmel: add usb_clk for transition to CCF
The AT91 PMC (Power Management Controller) provides a USB clock used by the different USB controllers (ehci, ohci and udc). The atmel-ehci driver must configure the usb clock rate to 48Mhz in order to get a fully functionnal USB host controller. This configuration was formely done in mach-at91/clock.c, but will be bypassed when moving to common clk framework. This patch adds support for usb clock retrieval and configuration only if CCF is enabled (CONFIG_COMMON_CLK). Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-atmel.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 3b645ff46f7b..f417526fb1f4 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -30,13 +30,17 @@ static const char hcd_name[] = "ehci-atmel";
30static struct hc_driver __read_mostly ehci_atmel_hc_driver; 30static struct hc_driver __read_mostly ehci_atmel_hc_driver;
31 31
32/* interface and function clocks */ 32/* interface and function clocks */
33static struct clk *iclk, *fclk; 33static struct clk *iclk, *fclk, *uclk;
34static int clocked; 34static int clocked;
35 35
36/*-------------------------------------------------------------------------*/ 36/*-------------------------------------------------------------------------*/
37 37
38static void atmel_start_clock(void) 38static void atmel_start_clock(void)
39{ 39{
40 if (IS_ENABLED(CONFIG_COMMON_CLK)) {
41 clk_set_rate(uclk, 48000000);
42 clk_prepare_enable(uclk);
43 }
40 clk_prepare_enable(iclk); 44 clk_prepare_enable(iclk);
41 clk_prepare_enable(fclk); 45 clk_prepare_enable(fclk);
42 clocked = 1; 46 clocked = 1;
@@ -46,6 +50,8 @@ static void atmel_stop_clock(void)
46{ 50{
47 clk_disable_unprepare(fclk); 51 clk_disable_unprepare(fclk);
48 clk_disable_unprepare(iclk); 52 clk_disable_unprepare(iclk);
53 if (IS_ENABLED(CONFIG_COMMON_CLK))
54 clk_disable_unprepare(uclk);
49 clocked = 0; 55 clocked = 0;
50} 56}
51 57
@@ -130,6 +136,14 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev)
130 retval = -ENOENT; 136 retval = -ENOENT;
131 goto fail_request_resource; 137 goto fail_request_resource;
132 } 138 }
139 if (IS_ENABLED(CONFIG_COMMON_CLK)) {
140 uclk = devm_clk_get(&pdev->dev, "usb_clk");
141 if (IS_ERR(uclk)) {
142 dev_err(&pdev->dev, "failed to get uclk\n");
143 retval = PTR_ERR(uclk);
144 goto fail_request_resource;
145 }
146 }
133 147
134 ehci = hcd_to_ehci(hcd); 148 ehci = hcd_to_ehci(hcd);
135 /* registers start at offset 0x0 */ 149 /* registers start at offset 0x0 */