Hi Fabio,
I will try this approach, but it will require some time as I need to prepare a u-Boot image and a minimal linux rootfs.
Despite of that, I have got some interesting information about which IRQs are wakeup enabled, after system initialization, by adding some debug logs to the tzic_set_wake_irq function at tzic.c file:
/ # dmesg | grep -i "tzic\|mc34708\|gpio-keys"
[ 0.000000] TrustZone Interrupt Controller (TZIC) initialized
[ 0.343900] mc34708 irq: 331
[ 0.558520] TZIC wake enabled=1 irq=18
[ 0.565045] TZIC wake enabled=1 irq=107
[ 0.568975] mc_pmic 0-0008: Adding mc34708-regulator subdevice!
[ 0.601998] mc_pmic 0-0008: Adding mc34708-rtc subdevice!
[ 0.607616] mc_pmic 0-0008: Adding mc34708_ts subdevice!
[ 0.613180] mc_pmic 0-0008: Adding mc34708-onkey subdevice!
[ 1.493624] TZIC wake enabled=1 irq=14
[ 1.828458] input: gpio-keys as /devices/platform/gpio-keys/input/input1
[ 1.840217] input: mc34708_ts as /devices/platform/imx-i2c.0/i2c-0/0-0008/mc34708_ts/input/input2
[ 1.851587] input: mc34708-onkey as /devices/platform/imx-i2c.0/i2c-0/0-0008/mc34708-onkey/input/input3
[ 1.864770] mc34708-onkey mc34708-onkey: mc34708-onkey successfully probed!
[ 1.900666] using rtc device, mc34708-rtc, for alarms
[ 1.905587] mc34708-rtc mc34708-rtc: rtc core: registered mc34708-rtc as rtc0
[ 2.923613] mc34708-rtc mc34708-rtc: setting system clock to 2013-10-08 19:04:01 UTC (1381259041)
Accordingly to attached document, these IRQs are for USB Host (14), USB OTG (18) and GPIO7[0-15] (107), which is the PMIC INT signal. The GPIO-keys IRQ is not wake-up enabled! That must be the reason why we are not being able to wake up the system with the GPIO-key button. None of these IRQs is able to wakeup the device after it goes to sleep. If any of them occurs while system is going to sleep, sleep mode is canceled and the system stays awake. But if the system is already in sleep mode, then none of them is capable of waking system up.
These are the TZIC register values when the system is in sleep mode (I have read them just before system freezes):
[ 95.721511] TZIC_ENCLEAR[0]=0x45E40
[ 95.725021] TZIC_ENSET[0]=0x45E40
[ 95.728531] TZIC_WAKEUP[0]=0x44000
[ 95.732039] TZIC_ENCLEAR[1]=0xC3FC0090
[ 95.735809] TZIC_ENSET[1]=0xC3FC0090
[ 95.739577] TZIC_WAKEUP[1]=0x0
[ 95.742738] TZIC_ENCLEAR[2]=0xD0022D
[ 95.746333] TZIC_ENSET[2]=0xD0022D
[ 95.749928] TZIC_WAKEUP[2]=0x0
[ 95.753088] TZIC_ENCLEAR[3]=0x1F80
[ 95.756510] TZIC_ENSET[3]=0x1F80
[ 95.759931] TZIC_WAKEUP[3]=0x800
[ 95.767372] TZIC_INTCNTL=0x10001
As we can see, all interrupts we are interested in are enabled and wakeup-enabled at this time. I do not understand why these interrupts are being ignored by the system.