2010-07-29 20:50:14 BF524/6 hibernate wake from USB
Michael Dean (UNITED STATES)
Message: 91893
Hi all - I have another hibernate question.
We are on the latest trunk updated 7/29 - Linux version 2.6.34.1-ADI-2010R1-pre-svn9020 (gcc version 4.3.5 (ADI-trunk/svn-1643) ) #157 Thu Jul 29 18:10:57 EDT 201
We are trying to get hibernate wake from USB working. Do you know if this has been tried/should work? I can see the kernel used to have kconfig stuff for wake from USB/CAN, but it seems to be gone now. The processor spec says it should work and the dpmc.h has USBWE defined. We have tried the following in pm.c:
We are entering hibernate using "echo mem > /sys/power/state"
[ 119.680000] PM: Syncing filesystems ... done.
[ 119.710000] Freezing user space processes ... (elapsed 0.02 seconds) done.
[ 119.740000] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done.
[ 119.760000] Suspending console(s) (use no_console_suspend to debug)
at this point we can see all usb activity on d-/+ stop and the lines go low. Our external event causes the USB lines to toggle high but the processor does not exit hibernate. Does do_hibernate support USBWE?
Thanks,
Michael
...
wakeup |= SCKELOW;
wakeup |= USBWE;
...
do_hibernate(wakeup | vr_wakeup);
QuoteReplyEditDelete
2010-07-29 21:53:15 BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 91895
Hi, Michael
At this point, we still not support USBWE hibernate!
Thanks.
QuoteReplyEditDelete
2010-07-30 06:40:41 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 91917
Hi,Michael
In my test do_hibernate support USBWE only when plug in a B device.
But our current svn code doesn't support it, you can temporary test it by adding wakeup |= USBWE to function
bfin_pm_suspend_mem_enter() in file arch/blackfin/mach-common/pm.c.
--
Regards,
-Bob
QuoteReplyEditDelete
2010-07-30 07:21:46 Re: BF524/6 hibernate wake from USB
Michael Hennerich (GERMANY)
Message: 91918 There is some code in musb_core.c:
/* FIXME this handles wakeup irqs wrong */
if (enable_irq_wake(nIrq) == 0) {
musb->irq_wake = 1;
device_init_wakeup(dev, 1);
} else {
musb->irq_wake = 0;
}
Not sure if this code really works based on the comment above...
But in case the common code calls enable_irq_wake() then Blackfin ARCH code will take care of it:
Take a look at arch/Blackfin/mach-common/ints-priority.c:
int bfin_internal_set_wake(unsigned int irq, unsigned int state)
{
[--snip--]
#ifdef IRQ_USB_INT0
case IRQ_USB_INT0:
wakeup |= USBWE;
break;
#endif
[--snip--]
}
-Michael
QuoteReplyEditDelete
2010-07-30 13:25:04 Re: BF524/6 hibernate wake from USB
Michael Dean (UNITED STATES)
Message: 91928
Bob/Michael,
Could you explain your statement from above? Are you saying that you have woken up from hibernate by the insertion of a B device? I have tried the exact change you suggested and it does not wake when the USB data lines go high.
We are running usb in host mode and have an internal USB cell module connected to the BF524. We want to wake up the blackfin from hibernate when we have incoming data. Basically WOL but over usb. We can hibernate the system using the rtcwake and when it wakes up everything is good to go. It seems like just need to get out of hibernate from the USB activity source. I am not close to understanding all this code so we are just trying to understand what should work, what has never been tried, and possibly how difficult this will be to get working.
Thanks,
Michael
QuoteReplyEditDelete
2010-08-02 00:07:04 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 91996
Bob/Michael,
Could you explain your statement from above? Are you saying that you have woken up from hibernate by the insertion of a B device? I have tried the exact change you suggested and it does not wake when the USB data lines go high.
> I have updated the kernel support. And in my test on BF548-0.2, it works ok whether plug in a USB device or plug to a PC host as a device. The processor can be waked up. Would you try it again and serval times?
We are running usb in host mode and have an internal USB cell module connected to the BF524. We want to wake up the blackfin from hibernate when we have incoming data. Basically WOL but over usb. We can hibernate the system using the rtcwake and when it wakes up everything is good to go. It seems like just need to get out of hibernate from the USB activity source. I am not close to understanding all this code so we are just trying to understand what should work, what has never been tried, and possibly how difficult this will be to get working.
>I think it can be wakeup. As the spec said if USB_DP,USB_DM or USB_VBUS edge detected,the wakeup signal can generated, you can try it.
---
Thanks,
Bob
QuoteReplyEditDelete
2010-08-02 02:53:12 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 92001
Please ignore my last message, I made a mistake. Sorry.
In my opinion, currently we can wakeup from hibernate by plug in a USB device or plug to a PC host as a device.
But have no way to wakeup when data come in.
---
Thanks
Bob
QuoteReplyEditDelete
2010-08-02 12:21:51 Re: BF524/6 hibernate wake from USB
Michael Dean (UNITED STATES)
Message: 92055
Hi Bob,
Do you know if the wakeup from usb DATA lines is a hardware limitation, or software?
Thanks,
Michael
QuoteReplyEditDelete
2010-08-02 13:26:44 Re: BF524/6 hibernate wake from USB
Christopher Harrsen (UNITED STATES)
Message: 92060
Hi Michael,
Wake from hibernate is supported in hardware. Please see below from the HRM.
Powering Down the Core (Hibernate State)
The internal supply regulator for the processor can be shut off by writing
b#00
to the FREQ bits of the VR_CTL register. This disables both CCLK and
SCLK
0 V, eliminating any leakage currents from the processor. The internal
supply regulator can be woken up by several user-selectable events, all of
which are controlled in the
. Furthermore, it sets the internal power supply voltage (VDDINT) toVR_CTL register:
• RTC event or assertion of the
(
enabled.
• External GP event, or Ethernet PHY event. Set the PHY wakeup
enable (
RESET pin. Set the wakeup-enableWAKE) control bit. This bit must be set if no other wakeups arePHYWE) control bit to enable wakeup upon assertion of the
PHY_INT/PG15
interrupt is needed, set this bit to enable a general-purpose external
event via the
pin by an external PHY device. If no external PHYPG15 pin.
• Activity between the pins
enable (
bus activity on the
• Pin
is an output pin which is a logical OR of the above wakeup sources,
except Hardware Reset. This pin follows the wakeup signal of the
various wakeup sources.
USBDP and USBDM. Set the USB wakeupUSBWE) control bit to enable wakeup upon detection of USBUSBDP/USBDM pins.EXT_WAKE is provided to indicate the occurrence of wakeup. It
Chris
QuoteReplyEditDelete
2010-08-02 14:23:18 Re: BF524/6 hibernate wake from USB
Robin Getz (UNITED STATES)
Message: 92062
Chris:
the way word is "upon detection" not "upon activity" - they are not the same.
Can you confirm that it is activity?
QuoteReplyEditDelete
2010-08-02 21:49:15 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 92075
> Do you know if the wakeup from usb DATA lines is a hardware limitation, or software?
I think it's the software limitation, as the spec said edge detected on USBUSBDP/USBDM will also generate wakup event.
By the way, are you using the musb in host mode ?
In host mode I can hibernate the system, but I always got the connect interrupt which wakeup the system
immediately.
I can test data wakeup only after fix this problem.
-Bob
QuoteReplyEditDelete
2010-08-04 07:07:34 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 92152
Hi, Michael
I can hibernate the system in host mode correctly now.
But it can't be waked up by plug in a device, because the VBUS is off during hibernate state.
And now I have no way to test the data wakeup as i can't find a device which can provide data without VBUS.
What's your method?
Thanks
-Bob
QuoteReplyEditDelete
2010-08-06 14:21:51 Re: BF524/6 hibernate wake from USB
Michael Dean (UNITED STATES)
Message: 92227
Bob,
We have this working now. The key was setting up the usb controller control 2 register
test = bfin_read_USB_APHY_CNTRL2();
test |= 0x0001;
bfin_write_USB_APHY_CNTRL2(test);
Getting data to be sent to the device to wake it up it a bit of a trick. We have a solution that allows us to test this.
Thanks for your help.
Michael
QuoteReplyEditDelete
2010-08-06 22:14:59 Re: BF524/6 hibernate wake from USB
Bob Liu (CHINA)
Message: 92232
Great !
By the way, have you set kernel config CONFIG_USB_SUSPEND ?
Will you get a connect interrupt which wakeup the system immediately ( Because the VBUS change )?
And after resume is there any connection interrupt ?
Sorry for so many question, but I think my result is very different from your.
Maybe the lastest kernel I updated will have problem.
Thanks a lot.
-Bob