Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0ab6bb0 authored by Ben Gamari's avatar Ben Gamari Committed by Greg Kroah-Hartman
Browse files

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: default avatarBen Gamari <ben@smart-cactus.org>
Acked-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 76cb03e7
Loading
Loading
Loading
Loading
+24 −23
Original line number Original line Diff line number Diff line
@@ -186,22 +186,10 @@ static int usb3503_probe(struct usb3503 *hub)
		hub->mode		= pdata->initial_mode;
		hub->mode		= pdata->initial_mode;
	} else if (np) {
	} else if (np) {
		struct clk *clk;
		struct clk *clk;
		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;
		u32 rate = 0;
			hub->clk = clk;
		hub->port_off_mask = 0;

			if (!of_property_read_u32(np, "refclk-frequency",
						 &rate)) {


		if (!of_property_read_u32(np, "refclk-frequency", &rate)) {
			switch (rate) {
			switch (rate) {
			case 38400000:
			case 38400000:
			case 26000000:
			case 26000000:
@@ -221,6 +209,19 @@ static int usb3503_probe(struct usb3503 *hub)
					(int) rate);
					(int) rate);
				return -EINVAL;
				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);
				err = clk_set_rate(hub->clk, rate);
				if (err) {
				if (err) {
					dev_err(dev,
					dev_err(dev,