aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-nxp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ohci-nxp.c')
-rw-r--r--drivers/usb/host/ohci-nxp.c50
1 files changed, 22 insertions, 28 deletions
diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index f4988fbe78e7..5d7eb72c5064 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -223,8 +223,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
223 223
224 isp1301_i2c_client = isp1301_get_client(isp1301_node); 224 isp1301_i2c_client = isp1301_get_client(isp1301_node);
225 if (!isp1301_i2c_client) { 225 if (!isp1301_i2c_client) {
226 ret = -EPROBE_DEFER; 226 return -EPROBE_DEFER;
227 goto out;
228 } 227 }
229 228
230 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 229 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
@@ -234,7 +233,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
234 if (usb_disabled()) { 233 if (usb_disabled()) {
235 dev_err(&pdev->dev, "USB is disabled\n"); 234 dev_err(&pdev->dev, "USB is disabled\n");
236 ret = -ENODEV; 235 ret = -ENODEV;
237 goto out; 236 goto fail_disable;
238 } 237 }
239 238
240 /* Enable AHB slave USB clock, needed for further USB clock control */ 239 /* Enable AHB slave USB clock, needed for further USB clock control */
@@ -245,19 +244,19 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
245 if (IS_ERR(usb_pll_clk)) { 244 if (IS_ERR(usb_pll_clk)) {
246 dev_err(&pdev->dev, "failed to acquire USB PLL\n"); 245 dev_err(&pdev->dev, "failed to acquire USB PLL\n");
247 ret = PTR_ERR(usb_pll_clk); 246 ret = PTR_ERR(usb_pll_clk);
248 goto out1; 247 goto fail_pll;
249 } 248 }
250 249
251 ret = clk_enable(usb_pll_clk); 250 ret = clk_enable(usb_pll_clk);
252 if (ret < 0) { 251 if (ret < 0) {
253 dev_err(&pdev->dev, "failed to start USB PLL\n"); 252 dev_err(&pdev->dev, "failed to start USB PLL\n");
254 goto out2; 253 goto fail_pllen;
255 } 254 }
256 255
257 ret = clk_set_rate(usb_pll_clk, 48000); 256 ret = clk_set_rate(usb_pll_clk, 48000);
258 if (ret < 0) { 257 if (ret < 0) {
259 dev_err(&pdev->dev, "failed to set USB clock rate\n"); 258 dev_err(&pdev->dev, "failed to set USB clock rate\n");
260 goto out3; 259 goto fail_rate;
261 } 260 }
262 261
263 /* Enable USB device clock */ 262 /* Enable USB device clock */
@@ -265,13 +264,13 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
265 if (IS_ERR(usb_dev_clk)) { 264 if (IS_ERR(usb_dev_clk)) {
266 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 265 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
267 ret = PTR_ERR(usb_dev_clk); 266 ret = PTR_ERR(usb_dev_clk);
268 goto out4; 267 goto fail_dev;
269 } 268 }
270 269
271 ret = clk_enable(usb_dev_clk); 270 ret = clk_enable(usb_dev_clk);
272 if (ret < 0) { 271 if (ret < 0) {
273 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 272 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
274 goto out5; 273 goto fail_deven;
275 } 274 }
276 275
277 /* Enable USB otg clocks */ 276 /* Enable USB otg clocks */
@@ -279,7 +278,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
279 if (IS_ERR(usb_otg_clk)) { 278 if (IS_ERR(usb_otg_clk)) {
280 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n"); 279 dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
281 ret = PTR_ERR(usb_otg_clk); 280 ret = PTR_ERR(usb_otg_clk);
282 goto out6; 281 goto fail_otg;
283 } 282 }
284 283
285 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL); 284 __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
@@ -287,7 +286,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
287 ret = clk_enable(usb_otg_clk); 286 ret = clk_enable(usb_otg_clk);
288 if (ret < 0) { 287 if (ret < 0) {
289 dev_err(&pdev->dev, "failed to start USB DEV Clock\n"); 288 dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
290 goto out7; 289 goto fail_otgen;
291 } 290 }
292 291
293 isp1301_configure(); 292 isp1301_configure();
@@ -296,20 +295,14 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
296 if (!hcd) { 295 if (!hcd) {
297 dev_err(&pdev->dev, "Failed to allocate HC buffer\n"); 296 dev_err(&pdev->dev, "Failed to allocate HC buffer\n");
298 ret = -ENOMEM; 297 ret = -ENOMEM;
299 goto out8; 298 goto fail_hcd;
300 } 299 }
301 300
302 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 301 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
303 if (!res) {
304 dev_err(&pdev->dev, "Failed to get MEM resource\n");
305 ret = -ENOMEM;
306 goto out8;
307 }
308
309 hcd->regs = devm_ioremap_resource(&pdev->dev, res); 302 hcd->regs = devm_ioremap_resource(&pdev->dev, res);
310 if (IS_ERR(hcd->regs)) { 303 if (IS_ERR(hcd->regs)) {
311 ret = PTR_ERR(hcd->regs); 304 ret = PTR_ERR(hcd->regs);
312 goto out8; 305 goto fail_resource;
313 } 306 }
314 hcd->rsrc_start = res->start; 307 hcd->rsrc_start = res->start;
315 hcd->rsrc_len = resource_size(res); 308 hcd->rsrc_len = resource_size(res);
@@ -317,7 +310,7 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
317 irq = platform_get_irq(pdev, 0); 310 irq = platform_get_irq(pdev, 0);
318 if (irq < 0) { 311 if (irq < 0) {
319 ret = -ENXIO; 312 ret = -ENXIO;
320 goto out8; 313 goto fail_resource;
321 } 314 }
322 315
323 nxp_start_hc(); 316 nxp_start_hc();
@@ -331,23 +324,24 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev)
331 return ret; 324 return ret;
332 325
333 nxp_stop_hc(); 326 nxp_stop_hc();
334out8: 327fail_resource:
335 usb_put_hcd(hcd); 328 usb_put_hcd(hcd);
336out7: 329fail_hcd:
337 clk_disable(usb_otg_clk); 330 clk_disable(usb_otg_clk);
338out6: 331fail_otgen:
339 clk_put(usb_otg_clk); 332 clk_put(usb_otg_clk);
340out5: 333fail_otg:
341 clk_disable(usb_dev_clk); 334 clk_disable(usb_dev_clk);
342out4: 335fail_deven:
343 clk_put(usb_dev_clk); 336 clk_put(usb_dev_clk);
344out3: 337fail_dev:
338fail_rate:
345 clk_disable(usb_pll_clk); 339 clk_disable(usb_pll_clk);
346out2: 340fail_pllen:
347 clk_put(usb_pll_clk); 341 clk_put(usb_pll_clk);
348out1: 342fail_pll:
343fail_disable:
349 isp1301_i2c_client = NULL; 344 isp1301_i2c_client = NULL;
350out:
351 return ret; 345 return ret;
352} 346}
353 347