2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-25 13:43:55 +08:00

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>
This commit is contained in:
Ben Gamari 2015-03-18 14:37:45 -04:00 committed by Greg Kroah-Hartman
parent 76cb03e7d5
commit c0ab6bb059

View File

@ -186,22 +186,10 @@ 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;
clk = devm_clk_get(dev, "refclk");
if (IS_ERR(clk) && PTR_ERR(clk) != -ENOENT) {
dev_err(dev, "unable to request refclk (%ld)\n",
PTR_ERR(clk));
return PTR_ERR(clk);
}
if (!IS_ERR(clk)) {
u32 rate = 0;
hub->clk = clk;
if (!of_property_read_u32(np, "refclk-frequency",
&rate)) {
if (!of_property_read_u32(np, "refclk-frequency", &rate)) {
switch (rate) {
case 38400000:
case 26000000:
@ -221,6 +209,19 @@ static int usb3503_probe(struct usb3503 *hub)
(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",
PTR_ERR(clk));
return PTR_ERR(clk);
}
if (!IS_ERR(clk)) {
hub->clk = clk;
if (rate != 0) {
err = clk_set_rate(hub->clk, rate);
if (err) {
dev_err(dev,