From 902e9c2d3ea0751ed8e8b7378b3ba003c73b0455 Mon Sep 17 00:00:00 2001 From: make shi Date: Thu, 20 Sep 2012 17:12:47 +0800 Subject: [PATCH] ENGR00225131-04 MX6 USB: implement platform_phy_power_on for USB otg and h1 IC designer had clarified that 1P1 can be turned off if we do not need support remote wakeup. So If there is no requirement for USB remote wake up, the 1P1 can be turn off. USB driver will support dynamically turn on(off) 1P1 during system suspend. 1P1 will be turn on depend on USB wakeup is enabled. Set stop_mode_config bit to turn on 1P1 during system suspend to support USB host remote wake up or USB device DP/DM wake up. Signed-off-by: make shi --- arch/arm/mach-mx6/usb_dr.c | 9 +++++++++ arch/arm/mach-mx6/usb_h1.c | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/arch/arm/mach-mx6/usb_dr.c b/arch/arm/mach-mx6/usb_dr.c index 908af2482c8c..7b79d98c7d5c 100644 --- a/arch/arm/mach-mx6/usb_dr.c +++ b/arch/arm/mach-mx6/usb_dr.c @@ -229,6 +229,13 @@ static void usbotg_clock_gate(bool on) pr_debug("usb_oh3_clk:%d, usb_phy_clk1_ref_count:%d\n", clk_get_usecount(usb_oh3_clk), clk_get_usecount(usb_phy1_clk)); } +static void dr_platform_phy_power_on(void) +{ + void __iomem *anatop_base_addr = MX6_IO_ADDRESS(ANATOP_BASE_ADDR); + __raw_writel(BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG, + anatop_base_addr + HW_ANADIG_ANA_MISC0_SET); +} + void mx6_set_otghost_vbus_func(driver_vbus_func driver_vbus) { dr_utmi_config.platform_driver_vbus = driver_vbus; @@ -625,6 +632,7 @@ void __init mx6_usb_dr_init(void) dr_utmi_config.is_wakeup_event = _is_host_wakeup; dr_utmi_config.wakeup_pdata = &dr_wakeup_config; dr_utmi_config.wakeup_handler = host_wakeup_handler; + dr_utmi_config.platform_phy_power_on = dr_platform_phy_power_on; pdev = imx6q_add_fsl_ehci_otg(&dr_utmi_config); dr_wakeup_config.usb_pdata[1] = pdev->dev.platform_data; #endif @@ -639,6 +647,7 @@ void __init mx6_usb_dr_init(void) dr_utmi_config.wakeup_pdata = &dr_wakeup_config; dr_utmi_config.wakeup_handler = device_wakeup_handler; dr_utmi_config.charger_base_addr = anatop_base_addr; + dr_utmi_config.platform_phy_power_on = dr_platform_phy_power_on; pdev = imx6q_add_fsl_usb2_udc(&dr_utmi_config); dr_wakeup_config.usb_pdata[2] = pdev->dev.platform_data; #endif diff --git a/arch/arm/mach-mx6/usb_h1.c b/arch/arm/mach-mx6/usb_h1.c index 36aa2aabbe88..f86a4f42b0bd 100644 --- a/arch/arm/mach-mx6/usb_h1.c +++ b/arch/arm/mach-mx6/usb_h1.c @@ -90,6 +90,13 @@ static void usbh1_internal_phy_clock_gate(bool on) } } +static void usbh1_platform_phy_power_on(void) +{ + void __iomem *anatop_base_addr = MX6_IO_ADDRESS(ANATOP_BASE_ADDR); + __raw_writel(BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG, + anatop_base_addr + HW_ANADIG_ANA_MISC0_SET); +} + static int usb_phy_enable(struct fsl_usb2_platform_data *pdata) { u32 tmp; @@ -367,6 +374,7 @@ static struct fsl_usb2_platform_data usbh1_config = { .phy_lowpower_suspend = _phy_lowpower_suspend, .is_wakeup_event = _is_usbh1_wakeup, .wakeup_handler = h1_wakeup_handler, + .platform_phy_power_on = usbh1_platform_phy_power_on, .transceiver = "utmi", .phy_regs = USB_PHY1_BASE_ADDR, }; -- 2.39.5