summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-03-18 19:37:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-26 10:50:52 +0100
commitc0ab6bb0597363532f178f3cd7b7fb527eef39e2 (patch)
treec3fd5f2e41bde5ea39a833aaabaee4a569741e71 /drivers/usb/misc
parentcdc-wdm: return correct error codes (diff)
downloadlinux-c0ab6bb0597363532f178f3cd7b7fb527eef39e2.tar.xz
linux-c0ab6bb0597363532f178f3cd7b7fb527eef39e2.zip
usb/misc/usb3503: Always read refclk frequency from DT
This is necessary to set REF_SEL appropriately in uses where refclk is always available. Signed-off-by: Ben Gamari <ben@smart-cactus.org> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/usb3503.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index 258d2f546e43..64ff5b91752d 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -186,8 +186,31 @@ static int usb3503_probe(struct usb3503 *hub)
hub->mode = pdata->initial_mode;
} else if (np) {
struct clk *clk;
+ u32 rate = 0;
hub->port_off_mask = 0;
+ if (!of_property_read_u32(np, "refclk-frequency", &rate)) {
+ switch (rate) {
+ case 38400000:
+ case 26000000:
+ case 19200000:
+ case 12000000:
+ hub->secondary_ref_clk = 0;
+ break;
+ case 24000000:
+ case 27000000:
+ case 25000000:
+ case 50000000:
+ hub->secondary_ref_clk = 1;
+ break;
+ default:
+ dev_err(dev,
+ "unsupported reference clock rate (%d)\n",
+ (int) rate);
+ return -EINVAL;
+ }
+ }
+
clk = devm_clk_get(dev, "refclk");
if (IS_ERR(clk) && PTR_ERR(clk) != -ENOENT) {
dev_err(dev, "unable to request refclk (%ld)\n",
@@ -196,31 +219,9 @@ static int usb3503_probe(struct usb3503 *hub)
}
if (!IS_ERR(clk)) {
- u32 rate = 0;
hub->clk = clk;
- if (!of_property_read_u32(np, "refclk-frequency",
- &rate)) {
-
- switch (rate) {
- case 38400000:
- case 26000000:
- case 19200000:
- case 12000000:
- hub->secondary_ref_clk = 0;
- break;
- case 24000000:
- case 27000000:
- case 25000000:
- case 50000000:
- hub->secondary_ref_clk = 1;
- break;
- default:
- dev_err(dev,
- "unsupported reference clock rate (%d)\n",
- (int) rate);
- return -EINVAL;
- }
+ if (rate != 0) {
err = clk_set_rate(hub->clk, rate);
if (err) {
dev_err(dev,