How can I use uart.1 to wake up system?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I use uart.1 to wake up system?

4,106 Views
billyhe
Contributor II

I'm use i.mx53. When I read the iMX53RM.pdf document, from the Table 3-1, the irq = 31 is uart-1, it's that meat set the irq can wake up system, so I modify the code in arch/arm/mach-mx5/mx53_loco.c like this:

static void loco_da9053_irq_wakeup_only_fixup(void)

{

void __iomem *tzic_base;

tzic_base = ioremap(MX53_TZIC_BASE_ADDR, SZ_4K);

if (NULL == tzic_base) {

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

  return;

}

// __raw_writel(0, tzic_base + TZIC_WAKEUP0_OFFSET);

__raw_writel(1 << 31, 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 */

__raw_writel(GPIO7_0_11_IRQ_BIT, tzic_base + TZIC_WAKEUP3_OFFSET);

iounmap(tzic_base);

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

}

But not work, can anybody tell me how to do? Thanks!!

Labels (2)
Tags (2)
0 Kudos
13 Replies

1,964 Views
billyhe
Contributor II

By test, the uart's interrupt has happened, and the bit AWAKE for uart status register has set, why it can not wake up the system ?

0 Kudos

1,964 Views
lily_zhang
NXP Employee
NXP Employee

As we mentioned in early time, there are two kinds of DA9052 PMIC boards. For the board with DA9053 which only supports software suspend solution, only the power key which is connected to NONKEY_KEEP_ACT signal can wakeup the system.

0 Kudos

1,964 Views
billyhe
Contributor II

But I can assign any gpio who not connect to NONKEY_KEEP_ACT signal to wakeup the system.

0 Kudos

1,964 Views
lily_zhang
NXP Employee
NXP Employee

So is the voltage raised back when the key is pressed?

Best Regards

Lily Zhang

Freescale MPU Support

0 Kudos

1,964 Views
billyhe
Contributor II

No, when the board go to suspend, the function da9053_suspend_cmd_sw() or da9053_suspend_cmd_hw() has not executed, because I remove it.

So the voltage has no change when the key is pressed.

0 Kudos

1,964 Views
leonlin
Contributor I

Hi all,

            Have any update about UART1 wake up system? Our customer also have the same requirement on iMX53 SMD platform with PMIC DA9053 and system enter suspend mode is called function by da9053_suspend_cmd_hw(void). Our serial drivers are mxc_uart.c, mxc_uart_early.c and serial_core.c. We already modified function  smd_da9053_wakeup_only_fixup(void) to enable UART1 wake up source but the system still can't wake up by UART1. We don't know if we should need to enable AWAKEN bit and we also don't see any codes about this in serial drivers. Is there any document describes what are the exact steps should be implemented in SW to make sure UART1 can wake up system ? Or who can tell me what step I miss to let UART1 wake up my system? Thanks~

our codes are as follow :

#define UART1_IRQ_BIT(0x1<<31)

static void smd_da9053_irq_wakeup_only_fixup(void)

{

void __iomem *tzic_base;
tzic_base = ioremap(MX53_TZIC_BASE_ADDR, SZ_4K);
if (NULL == tzic_base) {
    pr_err("fail to map MX53_TZIC_BASE_ADDR\n");
       return;
}
__raw_writel(0, 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 and SRTC and UART1 */
__raw_writel(SRTC_ALARM_IRQ_BIT | UART1_IRQ_BIT, tzic_base + TZIC_WAKEUP0_OFFSET);
__raw_writel(GPIO7_0_11_IRQ_BIT, tzic_base + TZIC_WAKEUP3_OFFSET);
iounmap(tzic_base);
pr_info("only da9053 irq and SRTC and UART1 are wakeup-enabled\n");

}

0 Kudos

1,964 Views
JithCR
Contributor III

Have you configured the UART1 as wake up source ?

0 Kudos

1,964 Views
fabio_estevam
NXP Employee
NXP Employee

The following patch I did allows the UART on i.mx to be used as a source of wakeup:

commit db1a9b55004c83ded54c1f869f81a8a59c6dde87

Author: Fabio Estevam <festevam@gmail.com>

Date:   Tue Dec 13 01:23:48 2011 -0200

    tty: serial: imx: Allow UART to be a source for wakeup

   

    Allow UART to be a source for wakeup from low power mode.

   

    Tested on a MX27PDK by doing:

   

    echo enabled > /sys/devices/platform/imx21-uart.0/tty/ttymxc0/power/wakeup

   

    echo mem > /sys/power/state

   

    and then pressing a key in the console will wakeup the sytem.


1,964 Views
billyhe
Contributor II

Thank you for you reply!

I had tried your method

echo enabled > /sys/devices/platform/mxcintuart.1/tty/ttymxc1/power/wakeup

echo mem > /sys/power/state

then I press a key in the console, but the system had not wakeup...

0 Kudos

1,964 Views
fabio_estevam
NXP Employee
NXP Employee

If you are using the Freescale kernel, please make sure you have this patch applied:

linux-2.6-imx.git - Freescale i.MX Linux Tree

Regards,

Fabio Estevam

0 Kudos

1,964 Views
lily_zhang
NXP Employee
NXP Employee

Do you check whether it's related to HW behavior? I remembered MX53 Dialog PMIC has two suspend methods:

- A software suspend solution can be deployed for DA9053 suspend operation. It is implemented via

a standalone polling-mode i2c interface to preset the voltage of DA9053 deep sleep mode. It also

issues the DEEP_SLEEP command to DA9053. See the implementation

“da9053_suspend_cmd_sw” under arch/arm/mach-mx5/pm_da9053.c. With this solution, only

power key which is connected to NONKEY_KEEP_ACT signal can wakeup the system.

- A hardware suspend solution can be deployed for DA9053 suspend operation. See the function

“da9053_suspend_cmd_hw” under arch/arm/mach-mx5/pm_da9053.c for the details. For HW

solution, please ensure the right DA9053 chip is used. With this solution, all CPU interrupts can be

used as wakeup resources.

From your code descriptions, i guess your system is using software suspend solution which only support one wakeup resource.


0 Kudos

1,964 Views
billyhe
Contributor II

Thank you for your reply.

Yes, you are right.

The system only support one wakeup resource. When I debug the interrupt function, there is only one gpio(GPIO_16) can trigger the interrupt function, can you tell me anyother registers need configure ?

0 Kudos

1,964 Views
lily_zhang
NXP Employee
NXP Employee

Firstly, please ensure your PMIC can support all wakeup resources.

Secondly, if your PMIC support all wakeup resource,  please remove loco_da9053_irq_wakeup_only_fixup funciton from your software. So the wakeup resources are defined by your software configurations, not hardcode.