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>
/* clock device associated with the hcd */
static struct clk *clk;
/* clock device associated with the hcd */
static struct clk *clk;
+static struct clk *usb_clk;
/* forward definitions */
/* forward definitions */
struct s3c2410_hcd_info *info = dev->dev.platform_data;
dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
struct s3c2410_hcd_info *info = dev->dev.platform_data;
dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
+
+ clk_enable(usb_clk);
+ mdelay(2); /* let the bus clock stabilise */
+
clk_enable(clk);
if (info != NULL) {
clk_enable(clk);
if (info != NULL) {
}
/* ohci_s3c2410_hub_status_data
}
/* ohci_s3c2410_hub_status_data
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
dev_err(&dev->dev, "request_mem_region failed");
retval = -EBUSY;
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
dev_err(&dev->dev, "request_mem_region failed");
retval = -EBUSY;
- clk = clk_get(NULL, "usb-host");
+ clk = clk_get(&dev->dev, "usb-host");
if (IS_ERR(clk)) {
dev_err(&dev->dev, "cannot get usb-host clock\n");
retval = -ENOENT;
if (IS_ERR(clk)) {
dev_err(&dev->dev, "cannot get usb-host clock\n");
retval = -ENOENT;
+ goto err_mem;
+ }
+
+ usb_clk = clk_get(&dev->dev, "upll");
+ if (IS_ERR(usb_clk)) {
+ dev_err(&dev->dev, "cannot get usb-host clock\n");
+ retval = -ENOENT;
+ goto err_clk;
}
s3c2410_start_hc(dev, hcd);
}
s3c2410_start_hc(dev, hcd);
if (!hcd->regs) {
dev_err(&dev->dev, "ioremap failed\n");
retval = -ENOMEM;
if (!hcd->regs) {
dev_err(&dev->dev, "ioremap failed\n");
retval = -ENOMEM;
}
ohci_hcd_init(hcd_to_ohci(hcd));
retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
if (retval != 0)
}
ohci_hcd_init(hcd_to_ohci(hcd));
retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
if (retval != 0)
s3c2410_stop_hc(dev);
iounmap(hcd->regs);
s3c2410_stop_hc(dev);
iounmap(hcd->regs);
+ clk_put(usb_clk);
+
+ err_clk:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
return retval;
}
usb_put_hcd(hcd);
return retval;
}