Eth0 disconnects when ecm0 does

We have a custom board that uses the WP7603 that has an Ethernet port implemented using the Mangoh Green design, and find whenever ecm0 is disconnected eth0 connectivity is lost also. HSIC is enabled (we can see that using AT!CUSTOM) so that’s not the issue.

Viewing kernel messages via dmesg it seems to be a power issue, with USB going into low power mode and eth0 being lost as a result (or side effect). Kernel messages are below. Note the messages marked as logged while USB is unplugged occur continuously in a message loop that repeats every several seconds. The Ethernet controller’s reset pin is toggled each time it does.

I don’t see anything in the documentation that explains how we can correct this. There’s nothing in the target tools for USB power management and I don’t see any kernel configuration for it. How do we stop this behaviour? Ethernet is an essential feature for us.

Kernel messages output on unplugging USB:

[ 604.283163] msm_otg 78d9000.usb: Avail curr from USB = 2
[ 604.283205] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_SUSPEND_EVENT received
[ 604.283271] android_work: android_work: sent uevent USB_STATE=SUSPENDED
[ 605.851363] diag: USB channel diag disconnected
[ 605.853933] ch_notify on a closed smd_pkt_dev id:2
[ 605.859225] android_work: android_work: sent uevent USB_STATE=DISCONNECTED
[ 605.874101] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_DISCONNECT_EVENT received
[ 605.882218] msm_otg 78d9000.usb: Avail curr from USB = 0
[ 605.984447] QTI:LINK_DOWN Processed
[ 605.999870] QTI:LINK_DOWN message posted
[ 606.962275] msm_otg 78d9000.usb: USB in low power mode

Message loop while USB disconnected: (not certain this is synched correctly to the first message of the series as it’s a continuous stream)

[ 609.109736] PM: suspend entry 2021-11-06 19:07:58.171225251 UTC
[ 609.109769] PM: Syncing filesystems … done.
[ 609.123830] PM: Preparing system for mem sleep
[ 609.128637] Freezing user space processes … (elapsed 0.008 seconds) done.
[ 609.136830] Freezing remaining freezable tasks … (elapsed 0.002 seconds) done.
[ 609.139776] PM: Entering mem sleep
[ 609.139804] Suspending console(s) (use no_console_suspend to debug)
[ 609.168213] smsc95xx 1-1.1:1.0 eth0: disabling pattern match wakeup
[ 609.168233] smsc95xx 1-1.1:1.0 eth0: enabling magic packet wakeup
[ 609.169560] smsc95xx 1-1.1:1.0 eth0: entering SUSPEND0 mode
[ 609.176059] msm_hsic_host 7c00000.hsic_host: HSIC-USB in low power mode
[ 609.178259] PM: suspend of devices complete after 37.060 msecs
[ 609.182488] PM: late suspend of devices complete after 4.184 msecs
[ 609.185439] PM: noirq suspend of devices complete after 2.911 msecs
[ 609.185539] suspend ns: 609185520521 suspend cycles: 49893343923
[ 609.185520] CPU0:msm_cpu_pm_enter_sleep mode:3 during suspend
[ 609.185520] resume cycles: 50054084305
[ 609.187832] PM: noirq resume of devices complete after 1.656 msecs
[ 609.190017] PM: early resume of devices complete after 1.766 msecs
[ 609.193926] msm_hsic_host 7c00000.hsic_host: HSIC-USB exited from low power mode
[ 609.370588] usb 1-1: reset high-speed USB device number 2 using msm_hsic_host
[ 609.820463] usb 1-1.1: reset high-speed USB device number 3 using msm_hsic_host
[ 610.028138] PM: resume of devices complete after 838.070 msecs
[ 610.030447] PM: Finishing wakeup.
[ 610.030468] Restarting tasks … done.
[ 610.052499] sierra_pm_resume
[ 610.053953] PM: suspend exit 2021-11-06 19:08:07.487110404 UTC

Reconnection messages:

[ 1949.162272] msm_otg 78d9000.usb: phy_reset: success
[ 1949.264386] msm_otg 78d9000.usb: USB exited from low power mode
[ 1949.267256] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_RESET_EVENT received
[ 1949.267285] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_CONNECT_EVENT received
[ 1949.271023] msm_otg 78d9000.usb: Avail curr from USB = 2
[ 1949.271084] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_SUSPEND_EVENT received
[ 1949.412196] msm_hsusb msm_hsusb: CI13XXX_CONTROLLER_RESUME_EVENT received
[ 1949.412340] msm_otg 78d9000.usb: Avail curr from USB = 100
[ 1949.412569] android_work: android_work: did not send uevent (0 0 00000000)
[ 1949.539127] android_work: android_work: sent uevent USB_STATE=CONNECTED
[ 1949.543816] android_work: android_work: sent uevent USB_STATE=DISCONNECTED
[ 1949.687066] android_work: android_work: sent uevent USB_STATE=CONNECTED
[ 1949.703885] android_usb gadget: high-speed config #1: 86000c8.android_usb
[ 1949.703960] diag: USB channel diag connected
[ 1949.704135] msm_otg 78d9000.usb: Avail curr from USB = 500
[ 1949.763453] android_work: android_work: sent uevent USB_STATE=CONFIGURED
[ 1950.581172] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[ 1950.720399] QTI:USB tethered modem SMD port opened
[ 1951.040437] QTI:LINK_UP Processed
[ 1951.051915] QTI:ECM mode
[ 1951.066238] QTI:LINK_UP message posted

How about using the following command to make module stay awake when usb disconnect?

echo NO_SLEEP > /sys/power/wake_lock

That worked, thanks. Having got that working now there’s still a couple of things that aren’t:

  • There’s no external internet connectivity over eth0. We can ping it and ssh to it, but nothing outbound works. We checked and the Ethernet LAN’s DNS servers are listed in /etc/resolv.conf. Don’t know what else to look for or try.

  • The setNet tool option to create a fixed MAC address doesn’t seem to be reliable. It creates entries in /etc/network/interfaces (see below) but they seem to be ignored by Linux or Legato (whichever one it is that actually assigns the address). Neither option below works, the address changes anyway.

auto eth0
iface eth0 inet dhcp
hwaddress ether B6:EB:A5:03:DD:3D

auto eth0
iface eth0 inet static
hwaddress ether 72:07:6A:FF:43:24

You can try

udhcpc -i eth0

That worked, thanks once again. And the issue we were having with the setNet tool went away after we reinstalled Legato. The only thing we’re seeing now is Ethernet is inactive after a soft reboot, it requires a full power cycle to get it working again. Is there a configuration change we can make that would change that, maybe something we can add to a startup file?

you can run an unsandboxed legato application to send linux command:

you can also modify init script /etc/init.d/