summaryrefslogtreecommitdiff
path: root/arch/arm/mach-mx5/usb_h1.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx5/usb_h1.c')
-rw-r--r--arch/arm/mach-mx5/usb_h1.c81
1 files changed, 69 insertions, 12 deletions
diff --git a/arch/arm/mach-mx5/usb_h1.c b/arch/arm/mach-mx5/usb_h1.c
index 7f0c463d45c1..3c53ed8901ae 100644
--- a/arch/arm/mach-mx5/usb_h1.c
+++ b/arch/arm/mach-mx5/usb_h1.c
@@ -17,14 +17,15 @@
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
+#include <asm/delay.h>
#include <mach/arc_otg.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include "usb.h"
#include "iomux.h"
#include "mx51_pins.h"
-
-
+//#undef pr_debug
+//#define pr_debug printk
/*
* USB Host1 HS port
*/
@@ -70,25 +71,67 @@ static void _wake_up_enable(struct fsl_usb2_platform_data *pdata, bool enable)
{
if (enable)
USBCTRL |= UCTRL_H1WIE;
- else
+ else {
USBCTRL &= ~UCTRL_H1WIE;
+ /* The interrupt must be disabled for at least 3
+ * cycles of the standby clock(32k Hz) , that is 0.094 ms*/
+ udelay(100);
+ }
+}
+
+static void _phy_lowpower_suspend(bool enable)
+{
+ if (enable) {
+ UH1_PORTSC1 |= PORTSC_PHCD;
+ }else {
+ UH1_PORTSC1 &= ~PORTSC_PHCD;
+ }
}
static void usbotg_clock_gate(bool on)
{
- struct clk *usboh3_clk = clk_get(NULL, "usboh3_clk");
- struct clk *usb_ahb_clk = clk_get(NULL, "usb_ahb_clk");
+ struct clk *usb_clk;
+ if (cpu_is_mx50()) {
+ if (on) {
+ usb_clk = clk_get(NULL, "usb_ahb_clk");
+ clk_enable(usb_clk);
+ clk_put(usb_clk);
+
+ } else {
+ usb_clk = clk_get(NULL, "usb_ahb_clk");
+ clk_disable(usb_clk);
+ clk_put(usb_clk);
+ }
+ return;
+ }
+ if (cpu_is_mx53()) {
+ usb_clk = clk_get(NULL, "usb_phy2_clk");
+ if (on) {
+ clk_enable(usb_clk);
+ } else {
+ clk_disable(usb_clk);
+ }
+ clk_put(usb_clk);
+ }
if (on) {
- clk_enable(usb_ahb_clk);
- clk_enable(usboh3_clk);
+ usb_clk = clk_get(NULL, "usb_ahb_clk");
+ clk_enable(usb_clk);
+ clk_put(usb_clk);
+
+ usb_clk = clk_get(NULL, "usboh3_clk");
+ clk_enable(usb_clk);
+ clk_put(usb_clk);
+
} else {
- clk_disable(usboh3_clk);
- clk_disable(usb_ahb_clk);
- }
+ usb_clk = clk_get(NULL, "usboh3_clk");
+ clk_disable(usb_clk);
+ clk_put(usb_clk);
- clk_put(usboh3_clk);
- clk_put(usb_ahb_clk);
+ usb_clk = clk_get(NULL, "usb_ahb_clk");
+ clk_disable(usb_clk);
+ clk_put(usb_clk);
+ }
}
static int fsl_usb_host_init_ext(struct platform_device *pdev)
@@ -109,6 +152,10 @@ static int fsl_usb_host_init_ext(struct platform_device *pdev)
usb_clk = clk_get(NULL, "usb_utmi_clk");
clk_disable(usb_clk);
clk_put(usb_clk);
+ } else if (cpu_is_mx50()) {
+ usb_clk = clk_get(NULL, "usb_phy2_clk");
+ clk_enable(usb_clk);
+ clk_put(usb_clk);
}
ret = fsl_usb_host_init(pdev);
@@ -143,7 +190,12 @@ static void fsl_usb_host_uninit_ext(struct fsl_usb2_platform_data *pdata)
usb_clk = clk_get(&pdata->pdev->dev, "usb_phy2_clk");
clk_disable(usb_clk);
clk_put(usb_clk);
+ } else if (cpu_is_mx50()) {
+ usb_clk = clk_get(NULL, "usb_phy2_clk");
+ clk_disable(usb_clk);
+ clk_put(usb_clk);
}
+
fsl_usb_host_uninit(pdata);
}
@@ -156,9 +208,14 @@ static struct fsl_usb2_platform_data usbh1_config = {
.power_budget = 500, /* 500 mA max power */
.wake_up_enable = _wake_up_enable,
.usb_clock_for_pm = usbotg_clock_gate,
+ .phy_lowpower_suspend = _phy_lowpower_suspend,
.transceiver = "utmi",
};
+void mx5_set_host1_vbus_func(driver_vbus_func driver_vbus)
+{
+ usbh1_config.platform_driver_vbus = driver_vbus;
+}
void __init mx5_usbh1_init(void)
{
if (cpu_is_mx51()) {