提交 ba593e59 编写于 作者: S Sascha Hauer

fsl_mx3_udc: Add i.MX35 support

The i.MX35 works fine with this driver, but we do not have
the usb_ahb clock.
Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
上级 9fd96bbb
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <mach/hardware.h>
static struct clk *mxc_ahb_clk; static struct clk *mxc_ahb_clk;
static struct clk *mxc_usb_clk; static struct clk *mxc_usb_clk;
...@@ -28,6 +30,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) ...@@ -28,6 +30,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
if (!cpu_is_mx35()) {
mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb"); mxc_ahb_clk = clk_get(&pdev->dev, "usb_ahb");
if (IS_ERR(mxc_ahb_clk)) if (IS_ERR(mxc_ahb_clk))
return PTR_ERR(mxc_ahb_clk); return PTR_ERR(mxc_ahb_clk);
...@@ -37,6 +40,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) ...@@ -37,6 +40,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n"); dev_err(&pdev->dev, "clk_enable(\"usb_ahb\") failed\n");
goto eenahb; goto eenahb;
} }
}
/* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */ /* make sure USB_CLK is running at 60 MHz +/- 1000 Hz */
mxc_usb_clk = clk_get(&pdev->dev, "usb"); mxc_usb_clk = clk_get(&pdev->dev, "usb");
...@@ -50,6 +54,7 @@ int fsl_udc_clk_init(struct platform_device *pdev) ...@@ -50,6 +54,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
if (pdata->phy_mode != FSL_USB2_PHY_ULPI && if (pdata->phy_mode != FSL_USB2_PHY_ULPI &&
(freq < 59999000 || freq > 60001000)) { (freq < 59999000 || freq > 60001000)) {
dev_err(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq); dev_err(&pdev->dev, "USB_CLK=%lu, should be 60MHz\n", freq);
ret = -EINVAL;
goto eclkrate; goto eclkrate;
} }
...@@ -66,8 +71,10 @@ int fsl_udc_clk_init(struct platform_device *pdev) ...@@ -66,8 +71,10 @@ int fsl_udc_clk_init(struct platform_device *pdev)
clk_put(mxc_usb_clk); clk_put(mxc_usb_clk);
mxc_usb_clk = NULL; mxc_usb_clk = NULL;
egusb: egusb:
if (!cpu_is_mx35())
clk_disable(mxc_ahb_clk); clk_disable(mxc_ahb_clk);
eenahb: eenahb:
if (!cpu_is_mx35())
clk_put(mxc_ahb_clk); clk_put(mxc_ahb_clk);
return ret; return ret;
} }
...@@ -90,6 +97,8 @@ void fsl_udc_clk_release(void) ...@@ -90,6 +97,8 @@ void fsl_udc_clk_release(void)
clk_disable(mxc_usb_clk); clk_disable(mxc_usb_clk);
clk_put(mxc_usb_clk); clk_put(mxc_usb_clk);
} }
if (!cpu_is_mx35()) {
clk_disable(mxc_ahb_clk); clk_disable(mxc_ahb_clk);
clk_put(mxc_ahb_clk); clk_put(mxc_ahb_clk);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册