diff options
Diffstat (limited to 'drivers/usb/host/ohci-s3c2410.c')
-rw-r--r-- | drivers/usb/host/ohci-s3c2410.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index 682bf2215660..1da5de573a6f 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -30,6 +30,7 @@ | |||
30 | /* clock device associated with the hcd */ | 30 | /* clock device associated with the hcd */ |
31 | 31 | ||
32 | static struct clk *clk; | 32 | static struct clk *clk; |
33 | static struct clk *usb_clk; | ||
33 | 34 | ||
34 | /* forward definitions */ | 35 | /* forward definitions */ |
35 | 36 | ||
@@ -37,7 +38,7 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); | |||
37 | 38 | ||
38 | /* conversion functions */ | 39 | /* conversion functions */ |
39 | 40 | ||
40 | struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) | 41 | static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) |
41 | { | 42 | { |
42 | return hcd->self.controller->platform_data; | 43 | return hcd->self.controller->platform_data; |
43 | } | 44 | } |
@@ -47,6 +48,10 @@ static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd) | |||
47 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | 48 | struct s3c2410_hcd_info *info = dev->dev.platform_data; |
48 | 49 | ||
49 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); | 50 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); |
51 | |||
52 | clk_enable(usb_clk); | ||
53 | mdelay(2); /* let the bus clock stabilise */ | ||
54 | |||
50 | clk_enable(clk); | 55 | clk_enable(clk); |
51 | 56 | ||
52 | if (info != NULL) { | 57 | if (info != NULL) { |
@@ -75,6 +80,7 @@ static void s3c2410_stop_hc(struct platform_device *dev) | |||
75 | } | 80 | } |
76 | 81 | ||
77 | clk_disable(clk); | 82 | clk_disable(clk); |
83 | clk_disable(usb_clk); | ||
78 | } | 84 | } |
79 | 85 | ||
80 | /* ohci_s3c2410_hub_status_data | 86 | /* ohci_s3c2410_hub_status_data |
@@ -316,7 +322,8 @@ static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc) | |||
316 | * | 322 | * |
317 | */ | 323 | */ |
318 | 324 | ||
319 | void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | 325 | static void |
326 | usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | ||
320 | { | 327 | { |
321 | usb_remove_hcd(hcd); | 328 | usb_remove_hcd(hcd); |
322 | s3c2410_stop_hc(dev); | 329 | s3c2410_stop_hc(dev); |
@@ -334,8 +341,8 @@ void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | |||
334 | * through the hotplug entry's driver_data. | 341 | * through the hotplug entry's driver_data. |
335 | * | 342 | * |
336 | */ | 343 | */ |
337 | int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | 344 | static int usb_hcd_s3c2410_probe (const struct hc_driver *driver, |
338 | struct platform_device *dev) | 345 | struct platform_device *dev) |
339 | { | 346 | { |
340 | struct usb_hcd *hcd = NULL; | 347 | struct usb_hcd *hcd = NULL; |
341 | int retval; | 348 | int retval; |
@@ -353,14 +360,21 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | |||
353 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 360 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
354 | dev_err(&dev->dev, "request_mem_region failed"); | 361 | dev_err(&dev->dev, "request_mem_region failed"); |
355 | retval = -EBUSY; | 362 | retval = -EBUSY; |
356 | goto err0; | 363 | goto err_put; |
357 | } | 364 | } |
358 | 365 | ||
359 | clk = clk_get(NULL, "usb-host"); | 366 | clk = clk_get(&dev->dev, "usb-host"); |
360 | if (IS_ERR(clk)) { | 367 | if (IS_ERR(clk)) { |
361 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | 368 | dev_err(&dev->dev, "cannot get usb-host clock\n"); |
362 | retval = -ENOENT; | 369 | retval = -ENOENT; |
363 | goto err1; | 370 | goto err_mem; |
371 | } | ||
372 | |||
373 | usb_clk = clk_get(&dev->dev, "upll"); | ||
374 | if (IS_ERR(usb_clk)) { | ||
375 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | ||
376 | retval = -ENOENT; | ||
377 | goto err_clk; | ||
364 | } | 378 | } |
365 | 379 | ||
366 | s3c2410_start_hc(dev, hcd); | 380 | s3c2410_start_hc(dev, hcd); |
@@ -369,26 +383,29 @@ int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | |||
369 | if (!hcd->regs) { | 383 | if (!hcd->regs) { |
370 | dev_err(&dev->dev, "ioremap failed\n"); | 384 | dev_err(&dev->dev, "ioremap failed\n"); |
371 | retval = -ENOMEM; | 385 | retval = -ENOMEM; |
372 | goto err2; | 386 | goto err_ioremap; |
373 | } | 387 | } |
374 | 388 | ||
375 | ohci_hcd_init(hcd_to_ohci(hcd)); | 389 | ohci_hcd_init(hcd_to_ohci(hcd)); |
376 | 390 | ||
377 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); | 391 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); |
378 | if (retval != 0) | 392 | if (retval != 0) |
379 | goto err2; | 393 | goto err_ioremap; |
380 | 394 | ||
381 | return 0; | 395 | return 0; |
382 | 396 | ||
383 | err2: | 397 | err_ioremap: |
384 | s3c2410_stop_hc(dev); | 398 | s3c2410_stop_hc(dev); |
385 | iounmap(hcd->regs); | 399 | iounmap(hcd->regs); |
400 | clk_put(usb_clk); | ||
401 | |||
402 | err_clk: | ||
386 | clk_put(clk); | 403 | clk_put(clk); |
387 | 404 | ||
388 | err1: | 405 | err_mem: |
389 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 406 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
390 | 407 | ||
391 | err0: | 408 | err_put: |
392 | usb_put_hcd(hcd); | 409 | usb_put_hcd(hcd); |
393 | return retval; | 410 | return retval; |
394 | } | 411 | } |