Shaojun Wang

Wakeup MX53 from Stop Mode by Usb Device

Discussion created by Shaojun Wang Employee on Oct 11, 2012

Mx53 SMD and LOCO board can be wakeup from stop mode, by plugging usb device to USBOTG or USBH1 port.

In 1109 BSP, need to apply following patch and rework LOCO/DA9053 board.

 

1. Patch

The patch based on 1109 BSP is

 

diff --git a/arch/arm/mach-mx5/mx53_loco.c b/arch/arm/mach-mx5/mx53_loco.c

index c8417da..76fbc30

--- a/arch/arm/mach-mx5/mx53_loco.c

+++ b/arch/arm/mach-mx5/mx53_loco.c

@@ -272,10 +272,11 @@ static void loco_da9053_irq_wakeup_only_fixup(void)

                pr_err("fail to map MX53_TZIC_BASE_ADDR\n");

                return;

        }

-       __raw_writel(0, tzic_base + TZIC_WAKEUP0_OFFSET);

+       /* enable irq wakeup for usbh1 and usbotg */

+       __raw_writel(0x1 << MXC_INT_USB_H1 | 0x1 << MXC_INT_USB_OTG, tzic_base + TZIC_WAKEUP0_OFFSET);

        __raw_writel(0, tzic_base + TZIC_WAKEUP1_OFFSET);

        __raw_writel(0, tzic_base + TZIC_WAKEUP2_OFFSET);

-       /* only enable irq wakeup for da9053 */

+       /* enable irq wakeup for da9053 */

        __raw_writel(GPIO7_0_11_IRQ_BIT, tzic_base + TZIC_WAKEUP3_OFFSET);

        iounmap(tzic_base);

        pr_info("only da9053 irq is wakeup-enabled\n");

@@ -285,7 +286,7 @@ static void loco_suspend_enter(void)

{

        if (!board_is_mx53_loco_mc34708()) {

                loco_da9053_irq_wakeup_only_fixup();

-               da9053_suspend_cmd_sw();

+               da9053_suspend_cmd_hw();

        }

}

 

diff --git a/arch/arm/mach-mx5/mx53_smd.c b/arch/arm/mach-mx5/mx53_smd.c

index 97ec0fb..69c7127

--- a/arch/arm/mach-mx5/mx53_smd.c

+++ b/arch/arm/mach-mx5/mx53_smd.c

@@ -435,10 +435,11 @@ static void smd_da9053_irq_wakeup_only_fixup(void)

                pr_err("fail to map MX53_TZIC_BASE_ADDR\n");

                return;

        }

-       __raw_writel(0, tzic_base + TZIC_WAKEUP0_OFFSET);

+       /* enable irq wakeup for usbh1 and usbotg */

+       __raw_writel(0x1 << MXC_INT_USB_H1 | 0x1 << MXC_INT_USB_OTG, tzic_base + TZIC_WAKEUP0_OFFSET);

        __raw_writel(0, tzic_base + TZIC_WAKEUP1_OFFSET);

        __raw_writel(0, tzic_base + TZIC_WAKEUP2_OFFSET);

-       /* only enable irq wakeup for da9053 */

+       /* enable irq wakeup for da9053 */

        __raw_writel(GPIO7_0_11_IRQ_BIT, tzic_base + TZIC_WAKEUP3_OFFSET);

        iounmap(tzic_base);

        pr_info("only da9053 irq is wakeup-enabled\n");

 

2. Wakeup SMD and LOCO/MC34708 board

2.1 To wakeup SMD and LOCO/MC34708, run below command after bootup Linux

        $ echo enabled > /sys/devices/platform/fsl-usb2-otg/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-usb2-udc/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-ehci.0/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-ehci.1/power/wakeup

        $ echo enabled > /sys/bus/usb/devices/usb1/power/wakeup

        $ echo enabled > /sys/bus/usb/devices/usb2/power/wakeup

        $ echo enabled > /sys/bus/usb/devices/2-1/power/wakeup (no need in LOCO board)

 

2.2 Run “echo mem > /sys/power/state” to put system into stop mode.

 

2.3 After insert usb mouse to USBOTG or USBH1 port, system can be wakeup.

 

3. Wakeup LOCO/DA9053 board

3.1 Hw rework: connect TP5(PMIC_STBY_REQ) to TP14(SYS_EN_GPIO_8).

 

3.2 Run below command after bootup Linux

        $ echo enabled > /sys/devices/platform/fsl-usb2-otg/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-usb2-udc/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-ehci.0/power/wakeup

        $ echo enabled > /sys/devices/platform/fsl-ehci.1/power/wakeup

        $ echo enabled > /sys/bus/usb/devices/usb1/power/wakeup

        $ echo enabled > /sys/bus/usb/devices/usb2/power/wakeup

 

3.3 Run “echo mem > /sys/power/state” to put system into stop mode.

 

3.4 After insert usb mouse to USBOTG or USBH1 port, system can be wakeup.

Outcomes