HI,
we have a custom board connected via USB to a host where we are trying to use the USB (ethernet gadget) as a wakeup source,
when trying to put the system to suspend-to-ram it gets a wakeup signal and goes to resume:
# cat /sys/kernel/debug/wakeup_sources
name active_count event_count wakeup_count expire_count active_since total_time max_time last_change prevent_suspend_time
381f0040.usb-phy 0 0 0 0 0 0 0 0 0
32f10100.usb 0 0 0 0 0 0 0 0 0
mmc2 0 0 0 0 0 0 0 0 0
alarmtimer.0.auto 0 0 0 0 0 0 0 0 0
30370000.snvs:snvs-rtc-lp 0 0 0 0 0 0 0 0 0
deleted 0 0 0 0 0 0 0 0 0
######################
# echo mem > /sys/power/state
[ 2002.001356] PM: suspend entry (deep)
[ 2002.023910] Filesystems sync: 0.018 seconds
[ 2002.028134] PM: Preparing system for sleep (deep)
[ 2002.033739] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 2002.042078] OOM killer disabled.
[ 2002.045317] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2002.053886] PM: Suspending system (deep)
[ 2002.057830] printk: Suspending console(s) (use no_console_suspend to debug)
[ 2002.074310] PM: suspend of devices complete after 9.048 msecs
[ 2002.074323] PM: start suspend of devices complete after 9.523 msecs
[ 2002.074327] PM: suspend devices took 0.012 seconds
[ 2002.074980] PM: late suspend of devices complete after 0.649 msecs
[ 2002.075545] PM: Triggering wakeup from IRQ 20
[ 2002.075728] PM: noirq suspend of devices complete after 0.628 msecs
[ 2002.075759] Disabling non-boot CPUs ...
[ 2002.075762] Wakeup pending. Abort CPU freeze
[ 2002.075763] Non-boot CPUs are not disabled
[ 2002.077555] PM: noirq resume of devices complete after 1.787 msecs
[ 2002.078112] PM: early resume of devices complete after 0.411 msecs
[ 2002.078977] caam 30900000.crypto: registering rng-caam
[ 2002.079467] PM: resume of devices complete after 1.346 msecs
[ 2002.080056] PM: resume devices took 0.000 seconds
[ 2002.154182] PM: Finishing wakeup.
[ 2002.157526] OOM killer enabled.
[ 2002.160666] Restarting tasks ... done.
[ 2002.165279] random: crng reseeded on system resumption
[ 2002.170457] PM: suspend exit
###################
# cat /proc/interrupts |grep -i usb
20: 5 0 0 0 GICv3 180 Level 32f10100.usb
would appreciate some help,
thanks!
Hello @shlomz
Thank you for reaching out to NXP SUPPORT! We’re glad to have the opportunity to assist you and are committed to providing you with the information you need.
Please share your modifications in device tree.
Best Regards,
Zhiming
HI,
here you go:
&usb3_phy0 {
fsl,phy-tx-vref-tune = <0xe>;
fsl,phy-tx-preemp-amp-tune = <3>;
fsl,phy-tx-vboost-level = <5>;
fsl,phy-comp-dis-tune = <7>;
fsl,pcs-tx-deemph-3p5db = <0x21>;
fsl,phy-pcs-tx-swing-full = <0x7f>;
status = "okay";
};
&usb3_0 {
status = "okay";
};
&usb_dwc3_0 {
dr_mode = "peripheral";
maximum-speed = "high-speed";
status = "okay";
//fsl,magic-packet;
//wakeup-source;
};
thanks.
Hello,
How do you enable the wakeup function? If i use dr_mode = "peripheral", i can't enable wakup with sysfs.
Here are my test steps based on EVK.
1. DTS
&usb_dwc3_0 {
dr_mode = "otg";
hnp-disable;
srp-disable;
adp-disable;
usb-role-switch;
role-switch-default-mode = "none";
snps,dis-u1-entry-quirk;
snps,dis-u2-entry-quirk;
status = "okay";
wakeup-source; ///////////////////////////
port {
usb3_drd_sw: endpoint {
remote-endpoint = <&typec_dr_sw>;
};
};
};
2. setting commands
Here the 3-1 and usbX is decided by kernel log.
[ 5.467641] input: Dell Dell USB Keyboard as /devices/platform/soc@0/32f10100.usb/38100000.usb/xhci-hcd.2.auto/usb3/3-1/3-1.1/3-1.1:1.0/0003:413C:2010.0001/input/input1
echo enabled > /sys/bus/platform/devices/32f10100.usb/power/wakeup
echo enabled > /sys/bus/platform/devices/381f0040.usb-phy/power/wakeup
echo enabled > /sys/bus/platform/devices/xhci-hcd.2.auto/power/wakeup
echo enabled > /sys/bus/platform/devices/xhci-hcd.1.auto/power/wakeup
echo enabled > /sys/bus/usb/devices/3-1/power/wakeup
echo enabled > /sys/bus/usb/devices/usb3/power/wakeup
3, wakeup by keyboard.
You can check if there is any hardware issue about USB VBUS and ID pins.
Best Regards,
Zhiming
Hi,
Apparently using the USB gadget for ethernet is what triggers IRQ 20 during the suspend process. I disabled it in the driver and it now allows the system to suspend.
please verify by setting CONFIG_USB_DWC3_GADGET=y and CONFIG_USB_GADGET=y and setting up the ethernet over USB.
In addition, I found that the USB gadget doesn't natively support wakeonlan (magic packets), so I added it as well.
thanks.
Hi,
Please provide your gadget config steps and any other userspace steps.
Best Regards,
Zhiming