diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-07-19 04:40:50 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 17:35:43 -0400 |
commit | e50bf385bfadeaacfb8af07b9b78dcfdef339981 (patch) | |
tree | 22814cd0fb63f6bf0e10966685b50af14d3db13e /drivers/usb/gadget | |
parent | a33e7136e9652374f7d54ded3cff8062d8e1e84f (diff) |
USB: s3c-hsotg: Add support for external USB clock
The PLL that drives the USB clock supports 3 input clocks: 12, 24 and 48Mhz.
This patch adds support to the USB driver for setting the correct register bit
according to the given clock.
This depends on the following patch:
[PATCH] ARM: S3C64XX: Add USB external clock definition
Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/s3c-hsotg.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 825b6ca62941..a4e0b0fa0191 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/clk.h> | ||
28 | 29 | ||
29 | #include <linux/usb/ch9.h> | 30 | #include <linux/usb/ch9.h> |
30 | #include <linux/usb/gadget.h> | 31 | #include <linux/usb/gadget.h> |
@@ -2798,6 +2799,7 @@ static void __devinit s3c_hsotg_initep(struct s3c_hsotg *hsotg, | |||
2798 | */ | 2799 | */ |
2799 | static void s3c_hsotg_otgreset(struct s3c_hsotg *hsotg) | 2800 | static void s3c_hsotg_otgreset(struct s3c_hsotg *hsotg) |
2800 | { | 2801 | { |
2802 | struct clk *xusbxti; | ||
2801 | u32 osc; | 2803 | u32 osc; |
2802 | 2804 | ||
2803 | writel(0, S3C_PHYPWR); | 2805 | writel(0, S3C_PHYPWR); |
@@ -2805,6 +2807,23 @@ static void s3c_hsotg_otgreset(struct s3c_hsotg *hsotg) | |||
2805 | 2807 | ||
2806 | osc = hsotg->plat->is_osc ? S3C_PHYCLK_EXT_OSC : 0; | 2808 | osc = hsotg->plat->is_osc ? S3C_PHYCLK_EXT_OSC : 0; |
2807 | 2809 | ||
2810 | xusbxti = clk_get(hsotg->dev, "xusbxti"); | ||
2811 | if (xusbxti && !IS_ERR(xusbxti)) { | ||
2812 | switch (clk_get_rate(xusbxti)) { | ||
2813 | case 12*MHZ: | ||
2814 | osc |= S3C_PHYCLK_CLKSEL_12M; | ||
2815 | break; | ||
2816 | case 24*MHZ: | ||
2817 | osc |= S3C_PHYCLK_CLKSEL_24M; | ||
2818 | break; | ||
2819 | default: | ||
2820 | case 48*MHZ: | ||
2821 | /* default reference clock */ | ||
2822 | break; | ||
2823 | } | ||
2824 | clk_put(xusbxti); | ||
2825 | } | ||
2826 | |||
2808 | writel(osc | 0x10, S3C_PHYCLK); | 2827 | writel(osc | 0x10, S3C_PHYCLK); |
2809 | 2828 | ||
2810 | /* issue a full set of resets to the otg and core */ | 2829 | /* issue a full set of resets to the otg and core */ |