From: Steve deRosier <derosier@gmail.com>
To: linux-embedded@vger.kernel.org
Subject: Help wake from standby with ARM external nIRQ line
Date: Wed, 28 Aug 2013 21:49:13 -0700 [thread overview]
Message-ID: <CALupW3DD9LNLAkCMXnquh=0dRV=V-gne5MYR2B=c4-pnXtu1RA@mail.gmail.com> (raw)
Hi,
I need some help trying to get an ARM based system to wake from
standby using the external nIRQ line.
It's a custom system based on the at91sam9g25ek. We have a
push-button attached to the nIRQ line on PB18. I want to be able to
put the system in standby (`echo standby > /sys/power/state`) and then
wake it by pressing the IRQ button.
I've taken the following steps:
1. Added the proper pinctrl entry in the DT to put PB18 on
perhipherial A (nIRQ function):
pinctrl@fffff400 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "atmel,at91sam9x5-pinctrl",
"atmel,at91rm9200-pinctrl", "simple-bus";
ranges = <0xfffff400 0xfffff400 0x800>;
/* shared pinctrl settings */
irqbtn {
pinctrl_irqbtn: irqb-0 {
atmel,pins =
<1 18 0x1 0x1>; /* PB18 periph A (IRQ) with pullup */
};
};
Unfortunately, problem #1: when I checked PIO_PSR on the running
system the pin was still set as GPIO. There's no conflicting setting
that I can find, so maybe I need to do more to get PB18 set as periph
A?
2. OK, fine, I manually set the PB18 pin on the running system to
perhph A so it does the nIRQ function to the interrupt controller. As
a test, I also manually set the interrupt mask to enable an interrupt
on that pin. Quick push test shows a result in dmesg:
[12547.023437] irq 0, desc: c38040a0, depth: 1, count: 0, unhandled: 0
[12547.023437] ->handle_irq(): c006155c, handle_bad_irq+0x0/0x21c
[12547.023437] ->irq_data.chip(): c04f59fc, no_irq_chip+0x0/0x5c
[12547.023437] ->action(): (null)
[12547.023437] IRQ_NOPROBE set
[12547.023437] IRQ_NOREQUEST set
Yay, did something good. Yes, I know I don't have a handler set,
should be OK for now...
3. Now, I put the thing into standby. Based on the Datasheet and what
I know about ARMs and what I read in the pm.c and related files, if
the nIRQ button is set as IRQ function, on standby the AIC will still
be clocked and when the ARM is in cpu idle (wait for interrupt),
either the nIRQ or nFIQ line can wake the processor, and it'll pull
out of the idle mode (cpu_arm926_do_idle line 102 in
arch/arm/mm/proc-arm926.S). In pm.c's at91_pm_enter(), it will return
from the at91sam9_standby() call, turn on interrupts and gpios and
continue.
Yet, I setup my pin, my IMR and put the sucker to standby. Press the
button... no response. Can't wake it.
4. Fine, try one more thing. I noticed when I force pm to bypass the
real standby code so I can see the various log messages, I see that
the one it prints that gives me the wakeup masks and my pin doesn't
show. OK, so I hack at91_irq_suspend() to || 0x80000000. Still no
joy.
Clearly there's something fundamental I don't understand about waking
the processor from idle mode via an external nIRQ interrupt. I can't
even get this thing setup manually to make it work. I do know the pin
functions and I've managed to get it in nIRQ mode. Just can't get
standby to wake.
I don't mind figuring out how to hack it up and get it manually
configured to work and then later figuring how to properly integrate
this into my system. I need it to work and I'll make it pretty in my
next step.
Any Linux ARM experts out there that can give me a push in the right direction?
Thanks,
- Steve
reply other threads:[~2013-08-29 4:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALupW3DD9LNLAkCMXnquh=0dRV=V-gne5MYR2B=c4-pnXtu1RA@mail.gmail.com' \
--to=derosier@gmail.com \
--cc=linux-embedded@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).