Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 187570
b: refs/heads/master
c: ba593e5
h: refs/heads/master
v: v3
  • Loading branch information
Sascha Hauer committed Feb 4, 2010
1 parent 4f33349 commit a51b51e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9fd96bbb6a3a1fd9ba24e84a2d7ccc6ccb6beb60
refs/heads/master: ba593e5966440deec8684863e0cba9b502c4a377
31 changes: 20 additions & 11 deletions trunk/drivers/usb/gadget/fsl_mx3_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <linux/fsl_devices.h>
#include <linux/platform_device.h>

#include <mach/hardware.h>

static struct clk *mxc_ahb_clk;
static struct clk *mxc_usb_clk;

Expand All @@ -28,14 +30,16 @@ int fsl_udc_clk_init(struct platform_device *pdev)

pdata = pdev->dev.platform_data;

mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb");
if (IS_ERR(mxc_ahb_clk))
return PTR_ERR(mxc_ahb_clk);
if (!cpu_is_mx35()) {
mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb");
if (IS_ERR(mxc_ahb_clk))
return PTR_ERR(mxc_ahb_clk);

ret = clk_enable(mxc_ahb_clk);
if (ret < 0) {
dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n");
goto eenahb;
ret = clk_enable(mxc_ahb_clk);
if (ret < 0) {
dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n");
goto eenahb;
}
}

/* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */
Expand All @@ -50,6 +54,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
if (pdata->phy_mode != FSL_USB2_PHY_ULPI &&
(freq < 59999000 || freq > 60001000)) {
dev_err(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq);
ret = -EINVAL;
goto eclkrate;
}

Expand All @@ -66,9 +71,11 @@ int fsl_udc_clk_init(struct platform_device *pdev)
clk_put(mxc_usb_clk);
mxc_usb_clk = NULL;
egusb:
clk_disable(mxc_ahb_clk);
if (!cpu_is_mx35())
clk_disable(mxc_ahb_clk);
eenahb:
clk_put(mxc_ahb_clk);
if (!cpu_is_mx35())
clk_put(mxc_ahb_clk);
return ret;
}

Expand All @@ -90,6 +97,8 @@ void fsl_udc_clk_release(void)
clk_disable(mxc_usb_clk);
clk_put(mxc_usb_clk);
}
clk_disable(mxc_ahb_clk);
clk_put(mxc_ahb_clk);
if (!cpu_is_mx35()) {
clk_disable(mxc_ahb_clk);
clk_put(mxc_ahb_clk);
}
}

0 comments on commit a51b51e

Please sign in to comment.