* wake up from a serial port
@ 2007-08-25 22:38 Budhee Jamaich
2007-08-27 7:06 ` Tony Lindgren
0 siblings, 1 reply; 8+ messages in thread
From: Budhee Jamaich @ 2007-08-25 22:38 UTC (permalink / raw)
To: linux-omap-open-source
hello list,
i am working on 2430 and I need to enable
wakeup from a serial port.
a patch which does this very thing has just been posted on lkml:
http://article.gmane.org/gmane.linux.kernel/574545
is it relevant to me ?
or is there already a way to do that ?
thank you very much
budhee
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wake up from a serial port
2007-08-25 22:38 wake up from a serial port Budhee Jamaich
@ 2007-08-27 7:06 ` Tony Lindgren
2007-08-27 8:38 ` Budhee Jamaich
0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2007-08-27 7:06 UTC (permalink / raw)
To: Budhee Jamaich; +Cc: linux-omap-open-source
* Budhee Jamaich <budheej@gmail.com> [070827 00:00]:
> hello list,
>
> i am working on 2430 and I need to enable
> wakeup from a serial port.
>
> a patch which does this very thing has just been posted on lkml:
> http://article.gmane.org/gmane.linux.kernel/574545
>
> is it relevant to me ?
>
> or is there already a way to do that ?
You also need to use the omap serial wake-up events, or mux rx pin
temporarily to a wake-up capable GPIO pin.
Tony
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wake up from a serial port
2007-08-27 7:06 ` Tony Lindgren
@ 2007-08-27 8:38 ` Budhee Jamaich
2007-08-27 11:14 ` Tony Lindgren
0 siblings, 1 reply; 8+ messages in thread
From: Budhee Jamaich @ 2007-08-27 8:38 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-omap-open-source
On 8/27/07, Tony Lindgren <tony@atomide.com> wrote:
> * Budhee Jamaich <budheej@gmail.com> [070827 00:00]:
> > i am working on 2430 and I need to enable
> > wakeup from a serial port.
> >
> > a patch which does this very thing has just been posted on lkml:
> > http://article.gmane.org/gmane.linux.kernel/574545
> >
> > is it relevant to me ?
> >
> > or is there already a way to do that ?
>
> You also need to use the omap serial wake-up events, or mux rx pin
> temporarily to a wake-up capable GPIO pin.
Are there any examples how to do either of these ?
If I mux the rx pin to a wake-up capable GPIO pin - should I still apply the
patch I mentioned above ?
(And how can I do this muxing ? Is there an API for that ?)
Thank you very much Tony.
Budhee
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wake up from a serial port
2007-08-27 8:38 ` Budhee Jamaich
@ 2007-08-27 11:14 ` Tony Lindgren
2007-08-27 12:21 ` Woodruff, Richard
0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2007-08-27 11:14 UTC (permalink / raw)
To: Budhee Jamaich; +Cc: linux-omap-open-source
* Budhee Jamaich <budheej@gmail.com> [070827 01:38]:
> On 8/27/07, Tony Lindgren <tony@atomide.com> wrote:
> > * Budhee Jamaich <budheej@gmail.com> [070827 00:00]:
> > > i am working on 2430 and I need to enable
> > > wakeup from a serial port.
> > >
> > > a patch which does this very thing has just been posted on lkml:
> > > http://article.gmane.org/gmane.linux.kernel/574545
> > >
> > > is it relevant to me ?
> > >
> > > or is there already a way to do that ?
> >
> > You also need to use the omap serial wake-up events, or mux rx pin
> > temporarily to a wake-up capable GPIO pin.
>
> Are there any examples how to do either of these ?
Well it used to work at least for 5912OSK. Maybe grep for
CONFIG_OMAP_SERIAL_WAKE.
> If I mux the rx pin to a wake-up capable GPIO pin - should I still apply the
> patch I mentioned above ?
That means you still have to have the functional clock for the UART
on, which will block omap retention. So using the async GPIO wake-up
events will be better.
> (And how can I do this muxing ? Is there an API for that ?)
See CONFIG_OMAP_SERIAL_WAKE.
> Thank you very much Tony.
No problem, if you get it working on 2430, please send patches :)
BTW, I never got the 2420 serial wake events to work, maybe they
need separate interrupt handlers registered. But the GPIO trick
should still work even if the serial wake-up events won't work.
Regards,
Tony
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: wake up from a serial port
2007-08-27 11:14 ` Tony Lindgren
@ 2007-08-27 12:21 ` Woodruff, Richard
2007-08-31 17:40 ` Tony Lindgren
0 siblings, 1 reply; 8+ messages in thread
From: Woodruff, Richard @ 2007-08-27 12:21 UTC (permalink / raw)
To: Tony Lindgren, Budhee Jamaich; +Cc: linux-omap-open-source
> > > You also need to use the omap serial wake-up events, or mux rx pin
> > > temporarily to a wake-up capable GPIO pin.
> >
> > Are there any examples how to do either of these ?
This is necessary to get a wake up on the RX ball if you are in
retention. IE non-functional mode. In effect it is a GPIO wake up not a
serial one.
If you want to wake up from UART from a functional mode, then having
that patch is fine, but you still need to do some work on the OMAP side
to link the module wake up into the PRCM wake up mechanism.
Then needs parallel what is necessary for the GPIO wake up. The same
kind of thing can be said for USB. If you want to go to a low power
state but have USB still able to respond to events, you need to make USB
bus suspend work so its capable of asserting its mstandby signal
properly and you must also do the linkage into the PRCM.
> Well it used to work at least for 5912OSK. Maybe grep for
> CONFIG_OMAP_SERIAL_WAKE.
>
> > If I mux the rx pin to a wake-up capable GPIO pin - should I still
apply
> the
> > patch I mentioned above ?
I doubt it would be necessary. It really depends on what level you how
to sleep to and what functionally you need at wake up.
If its ok to loose the first character perhaps two and consider them
wake up events then going GPIO is likely fine. You must think about how
its all connected. You may need your DMA handsake lines set with
something similar.
> That means you still have to have the functional clock for the UART
> on, which will block omap retention. So using the async GPIO wake-up
> events will be better.
>
> > (And how can I do this muxing ? Is there an API for that ?>
> See CONFIG_OMAP_SERIAL_WAKE.
>
> > Thank you very much Tony.
>
> No problem, if you get it working on 2430, please send patches :)
>
> BTW, I never got the 2420 serial wake events to work, maybe they
> need separate interrupt handlers registered. But the GPIO trick
> should still work even if the serial wake-up events won't work.
These in 2420 can't wake core from RETETION. They can wake the core
from clockstop.
I'll throw rough numbers out for (chip) each domain has its own
combination. Each lower state requires the previous state to be hit all
at 1.05v. clcokstop=~1.2mA, ~retention=150uA, off=~50uA. Clock stop can
be higher depending on the 'partial' activity necessary, and perhaps
also lower.
Regards,
Richard W.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: wake up from a serial port
2007-08-27 12:21 ` Woodruff, Richard
@ 2007-08-31 17:40 ` Tony Lindgren
0 siblings, 0 replies; 8+ messages in thread
From: Tony Lindgren @ 2007-08-31 17:40 UTC (permalink / raw)
To: Woodruff, Richard; +Cc: linux-omap-open-source
* Woodruff, Richard <r-woodruff2@ti.com> [070827 05:21]:
> >
> > BTW, I never got the 2420 serial wake events to work, maybe they
> > need separate interrupt handlers registered. But the GPIO trick
> > should still work even if the serial wake-up events won't work.
>
> These in 2420 can't wake core from RETETION. They can wake the core
> from clockstop.
OK, thanks that explains. So multiplexing the rx lines for GPIO
temporarily is the way to go then.
> I'll throw rough numbers out for (chip) each domain has its own
> combination. Each lower state requires the previous state to be hit all
> at 1.05v. clcokstop=~1.2mA, ~retention=150uA, off=~50uA. Clock stop can
> be higher depending on the 'partial' activity necessary, and perhaps
> also lower.
OK
Tony
^ permalink raw reply [flat|nested] 8+ messages in thread
* + wake-up-from-a-serial-port.patch added to -mm tree
@ 2007-09-10 8:31 akpm
[not found] ` <20070910132703.2dd92485@the-village.bc.nu>
0 siblings, 1 reply; 8+ messages in thread
From: akpm @ 2007-09-10 8:31 UTC (permalink / raw)
To: mm-commits; +Cc: g.liakhovetski, alan, greg, pavel, rjw, rmk
The patch titled
wake up from a serial port
has been added to the -mm tree. Its filename is
wake-up-from-a-serial-port.patch
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this
------------------------------------------------------
Subject: wake up from a serial port
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Enable wakeup from serial ports, make it run-time configurable over sysfs,
e.g.,
echo enabled > /sys/devices/platform/serial8250.0/tty/ttyS0/power/wakeup
Requires
# CONFIG_SYSFS_DEPRECATED is not set
Linkstation / kurobox systems from Buffalo Tech. have an AVR controller
connected to host's UART. The AVR controls power, buttons, fan, LEDs,
sensors... So, practically the only way to wake the system up is to press a
button, which sends a byte from the AVR to the CPU.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/serial/8250.c | 30 ++++++++++++++++++++++++++----
drivers/serial/serial_core.c | 9 ++++++++-
2 files changed, 34 insertions(+), 5 deletions(-)
diff -puN drivers/serial/8250.c~wake-up-from-a-serial-port drivers/serial/8250.c
--- a/drivers/serial/8250.c~wake-up-from-a-serial-port
+++ a/drivers/serial/8250.c
@@ -129,6 +129,7 @@ struct uart_8250_port {
unsigned char mcr;
unsigned char mcr_mask; /* mask of user bits */
unsigned char mcr_force; /* mask of forced bits */
+ char suspended;
/*
* Some bits in registers are cleared on a read, so they must
@@ -2701,6 +2702,14 @@ static int __devexit serial8250_remove(s
return 0;
}
+static int serial8250_match_port(struct device *dev, void *data)
+{
+ struct uart_port *port = data;
+ dev_t devt = MKDEV(serial8250_reg.major, serial8250_reg.minor) + port->line;
+
+ return dev->devt == devt; /* Actually, only one tty per port */
+}
+
static int serial8250_suspend(struct platform_device *dev, pm_message_t state)
{
int i;
@@ -2708,8 +2717,16 @@ static int serial8250_suspend(struct pla
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
- if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
- uart_suspend_port(&serial8250_reg, &up->port);
+ if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) {
+ struct device *tty_dev = device_find_child(up->port.dev, &up->port,
+ serial8250_match_port);
+ if (device_may_wakeup(tty_dev))
+ enable_irq_wake(up->port.irq);
+ else {
+ uart_suspend_port(&serial8250_reg, &up->port);
+ up->suspended = 1;
+ }
+ }
}
return 0;
@@ -2722,8 +2739,13 @@ static int serial8250_resume(struct plat
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
- if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
- serial8250_resume_port(i);
+ if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev) {
+ if (up->suspended) {
+ serial8250_resume_port(i);
+ up->suspended = 0;
+ } else
+ disable_irq_wake(up->port.irq);
+ }
}
return 0;
diff -puN drivers/serial/serial_core.c~wake-up-from-a-serial-port drivers/serial/serial_core.c
--- a/drivers/serial/serial_core.c~wake-up-from-a-serial-port
+++ a/drivers/serial/serial_core.c
@@ -2271,6 +2271,7 @@ int uart_add_one_port(struct uart_driver
{
struct uart_state *state;
int ret = 0;
+ struct device *tty_dev;
BUG_ON(in_interrupt());
@@ -2306,7 +2307,13 @@ int uart_add_one_port(struct uart_driver
* Register the port whether it's detected or not. This allows
* setserial to be used to alter this ports parameters.
*/
- tty_register_device(drv->tty_driver, port->line, port->dev);
+ tty_dev = tty_register_device(drv->tty_driver, port->line, port->dev);
+ if (likely(!IS_ERR(tty_dev))) {
+ device_can_wakeup(tty_dev) = 1;
+ device_set_wakeup_enable(tty_dev, 0);
+ } else
+ printk(KERN_ERR "Cannot register tty device on line %d\n",
+ port->line);
/*
* If this driver supports console, and it hasn't been
_
Patches currently in -mm which might be from g.liakhovetski@gmx.de are
git-powerpc.patch
wake-up-from-a-serial-port.patch
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-09-13 20:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-25 22:38 wake up from a serial port Budhee Jamaich
2007-08-27 7:06 ` Tony Lindgren
2007-08-27 8:38 ` Budhee Jamaich
2007-08-27 11:14 ` Tony Lindgren
2007-08-27 12:21 ` Woodruff, Richard
2007-08-31 17:40 ` Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2007-09-10 8:31 + wake-up-from-a-serial-port.patch added to -mm tree akpm
[not found] ` <20070910132703.2dd92485@the-village.bc.nu>
[not found] ` <Pine.LNX.4.60.0709102251250.5200@poirot.grange>
[not found] ` <20070911081220.GA20847@flint.arm.linux.org.uk>
[not found] ` <Pine.LNX.4.60.0709111217470.19259@poirot.grange>
[not found] ` <20070911121057.34b9e066@the-village.bc.nu>
2007-09-12 18:50 ` [PATCH] wake up from a serial port Guennadi Liakhovetski
2007-09-12 21:06 ` Michael Mauch
2007-09-13 20:29 ` Guennadi Liakhovetski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.