Skip to content

Commit 83253b3

Browse files
vzapolskiygregkh
authored andcommitted
usb: ohci: nxp: remove USB PLL and USB OTG clock management
LPC32xx common clock framework driver correctly manages parent clocks of USB OHCI clock, so there is no need to manually enable and disable them from the driver, which now depends only on a single USB host clock. Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fe54d9b commit 83253b3

File tree

1 file changed

+10
-52
lines changed

1 file changed

+10
-52
lines changed

drivers/usb/host/ohci-nxp.c

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ static struct i2c_client *isp1301_i2c_client;
5858

5959
extern int usb_disabled(void);
6060

61-
static struct clk *usb_pll_clk;
62-
static struct clk *usb_dev_clk;
63-
static struct clk *usb_otg_clk;
61+
static struct clk *usb_host_clk;
6462

6563
static void isp1301_configure_lpc32xx(void)
6664
{
@@ -172,54 +170,20 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
172170
goto fail_disable;
173171
}
174172

175-
/* Enable USB PLL */
176-
usb_pll_clk = devm_clk_get(&pdev->dev, "ck_pll5");
177-
if (IS_ERR(usb_pll_clk)) {
178-
dev_err(&pdev->dev, "failed to acquire USB PLL\n");
179-
ret = PTR_ERR(usb_pll_clk);
173+
/* Enable USB host clock */
174+
usb_host_clk = devm_clk_get(&pdev->dev, NULL);
175+
if (IS_ERR(usb_host_clk)) {
176+
dev_err(&pdev->dev, "failed to acquire USB OHCI clock\n");
177+
ret = PTR_ERR(usb_host_clk);
180178
goto fail_disable;
181179
}
182180

183-
ret = clk_prepare_enable(usb_pll_clk);
181+
ret = clk_prepare_enable(usb_host_clk);
184182
if (ret < 0) {
185-
dev_err(&pdev->dev, "failed to start USB PLL\n");
183+
dev_err(&pdev->dev, "failed to start USB OHCI clock\n");
186184
goto fail_disable;
187185
}
188186

189-
ret = clk_set_rate(usb_pll_clk, 48000);
190-
if (ret < 0) {
191-
dev_err(&pdev->dev, "failed to set USB clock rate\n");
192-
goto fail_rate;
193-
}
194-
195-
/* Enable USB device clock */
196-
usb_dev_clk = devm_clk_get(&pdev->dev, "ck_usbd");
197-
if (IS_ERR(usb_dev_clk)) {
198-
dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
199-
ret = PTR_ERR(usb_dev_clk);
200-
goto fail_rate;
201-
}
202-
203-
ret = clk_prepare_enable(usb_dev_clk);
204-
if (ret < 0) {
205-
dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
206-
goto fail_rate;
207-
}
208-
209-
/* Enable USB otg clocks */
210-
usb_otg_clk = devm_clk_get(&pdev->dev, "ck_usb_otg");
211-
if (IS_ERR(usb_otg_clk)) {
212-
dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
213-
ret = PTR_ERR(usb_otg_clk);
214-
goto fail_otg;
215-
}
216-
217-
ret = clk_prepare_enable(usb_otg_clk);
218-
if (ret < 0) {
219-
dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
220-
goto fail_otg;
221-
}
222-
223187
isp1301_configure();
224188

225189
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
@@ -258,11 +222,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
258222
fail_resource:
259223
usb_put_hcd(hcd);
260224
fail_hcd:
261-
clk_disable_unprepare(usb_otg_clk);
262-
fail_otg:
263-
clk_disable_unprepare(usb_dev_clk);
264-
fail_rate:
265-
clk_disable_unprepare(usb_pll_clk);
225+
clk_disable_unprepare(usb_host_clk);
266226
fail_disable:
267227
isp1301_i2c_client = NULL;
268228
return ret;
@@ -275,9 +235,7 @@ static int ohci_hcd_nxp_remove(struct platform_device *pdev)
275235
usb_remove_hcd(hcd);
276236
ohci_nxp_stop_hc();
277237
usb_put_hcd(hcd);
278-
clk_disable_unprepare(usb_otg_clk);
279-
clk_disable_unprepare(usb_dev_clk);
280-
clk_disable_unprepare(usb_pll_clk);
238+
clk_disable_unprepare(usb_host_clk);
281239
isp1301_i2c_client = NULL;
282240

283241
return 0;

0 commit comments

Comments
 (0)