aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2006-04-01 19:45:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-04-14 14:12:26 -0400
commit3799c40189570133f9bb3176be24f0edb0e823c6 (patch)
tree594f7dd587788c602cb43ae93a22ebeb096f8e9f /drivers/usb
parentbfb25849f00d0b8453191ee12125738b5f5c9146 (diff)
[PATCH] USB: S3C2410: use clk_enable() to ensure 48MHz to OHCI core
Get the "usb-bus" clock and ensure it is enabled when the OHCI core is in use. It seems that a few bootloaders do not enable the UPLL at startup, which stops the OHCI core having a 48MHz bus clock. The improvements to the clock framework for the s3c24xx now allow the USB PLL to be started and stopped when being used. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ohci-s3c2410.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index b27669fe9f0f..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
32static struct clk *clk; 32static struct clk *clk;
33static struct clk *usb_clk;
33 34
34/* forward definitions */ 35/* forward definitions */
35 36
@@ -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
@@ -354,14 +360,21 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
354 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)) {
355 dev_err(&dev->dev, "request_mem_region failed"); 361 dev_err(&dev->dev, "request_mem_region failed");
356 retval = -EBUSY; 362 retval = -EBUSY;
357 goto err0; 363 goto err_put;
358 } 364 }
359 365
360 clk = clk_get(NULL, "usb-host"); 366 clk = clk_get(&dev->dev, "usb-host");
361 if (IS_ERR(clk)) { 367 if (IS_ERR(clk)) {
362 dev_err(&dev->dev, "cannot get usb-host clock\n"); 368 dev_err(&dev->dev, "cannot get usb-host clock\n");
363 retval = -ENOENT; 369 retval = -ENOENT;
364 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;
365 } 378 }
366 379
367 s3c2410_start_hc(dev, hcd); 380 s3c2410_start_hc(dev, hcd);
@@ -370,26 +383,29 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
370 if (!hcd->regs) { 383 if (!hcd->regs) {
371 dev_err(&dev->dev, "ioremap failed\n"); 384 dev_err(&dev->dev, "ioremap failed\n");
372 retval = -ENOMEM; 385 retval = -ENOMEM;
373 goto err2; 386 goto err_ioremap;
374 } 387 }
375 388
376 ohci_hcd_init(hcd_to_ohci(hcd)); 389 ohci_hcd_init(hcd_to_ohci(hcd));
377 390
378 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); 391 retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
379 if (retval != 0) 392 if (retval != 0)
380 goto err2; 393 goto err_ioremap;
381 394
382 return 0; 395 return 0;
383 396
384 err2: 397 err_ioremap:
385 s3c2410_stop_hc(dev); 398 s3c2410_stop_hc(dev);
386 iounmap(hcd->regs); 399 iounmap(hcd->regs);
400 clk_put(usb_clk);
401
402 err_clk:
387 clk_put(clk); 403 clk_put(clk);
388 404
389 err1: 405 err_mem:
390 release_mem_region(hcd->rsrc_start, hcd->rsrc_len); 406 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
391 407
392 err0: 408 err_put:
393 usb_put_hcd(hcd); 409 usb_put_hcd(hcd);
394 return retval; 410 return retval;
395} 411}