Received: by 10.223.185.116 with SMTP id b49csp8028930wrg; Thu, 1 Mar 2018 15:48:21 -0800 (PST) X-Google-Smtp-Source: AG47ELvrz4XAAYE/tTdBoZsarjfMEHaNujr/KLEVDS3qGMJcK7fhYQhxJOwxM7kBBKJoiG/tyRpt X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr3490669plb.280.1519948101577; Thu, 01 Mar 2018 15:48:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519948101; cv=none; d=google.com; s=arc-20160816; b=nMX+8jX0jr+3QsXldPiDPMoIl/NX22DCmGStxxorj55F5mGQpvodhLmoilgT73nIB/ lGdOkbLQxH3ts+1mDkJk5hZeCVsq7YoRmPnmivSBp5Fif64A+lJGwGxBUYRr3G6a/Z4+ YozIKfQYrqLycQ6NDIE79B5qmHQkQ8h1H0xsR6Cu/5nf2k2akC3Fikf8DdKuBpaS2W4K 0Ei0/s503rkiWTK0+JlXeGjn5Rrk1skXxCoI4SzqhEGNDHV/TPNlnP0P4kE+Fxsa5fbn FdKiF26DO+Tp//mxdBqbPyjkR4vlaC4EFoMN2hCBrRRyTJEwoYdaNtwSoMXXttTf0WLh XBwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:date:message-id :subject:from:cc:to:arc-authentication-results; bh=NdqVYzOFmORVMCGMsXPfSYJSwYtZXEY9tdRPJ9n7ljY=; b=CpC2aqTWgqIuHJcC+x58s3Yssle3fcIuggbjQwNKZO0rjUQuj0n4oIzw06CoNGLBBy A/wjIx8B6wvKByNm2IvKB33NcFwA39j0RuqK8jfgL5cWhTcjP2EIod9C+eUGbBtxkSaD wEbOceXhKb10LzVT0hgAfmKc/u8yqZFpTX0/na0a8xh0zkQMEIYqk0JrG2vANFTRYJ1i NR6jXqoHry13ZLKaiXXR8EkwI+bcsACVAi4U5R6xETY8k+AI0x5vAl0lZ1VPhQQXYrTb UTUa1S8I8g8OzB/iW8O8/jGvcI6QOknyIkYx/9KtEHpDgjfVFwNnxeV1O1bS6PGJN5By C6nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z3-v6si3758599plb.137.2018.03.01.15.48.06; Thu, 01 Mar 2018 15:48:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163541AbeCAXrY (ORCPT + 99 others); Thu, 1 Mar 2018 18:47:24 -0500 Received: from nala.villavu.com ([188.165.243.101]:40293 "EHLO nala.villavu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163229AbeCAXrW (ORCPT ); Thu, 1 Mar 2018 18:47:22 -0500 Received: from a82-161-36-93.adsl.xs4all.nl ([82.161.36.93] helo=[0.0.0.0]) by nala.villavu.com with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.85) (envelope-from ) id 1erXuy-0003gv-BI; Fri, 02 Mar 2018 00:47:20 +0100 To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Pali_Roh=c3=a1r?= , Ivaylo Dimitrov , linux-omap@vger.kernel.org From: Merlijn Wajer Subject: usb: musb: "(null)" in sysfs mode file after disabling a gadget (and at other times, system hangs) Message-ID: Date: Fri, 2 Mar 2018 00:47:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux armv7l; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oppHN8720nJDSW0moTFny67VymaCCNuFA" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oppHN8720nJDSW0moTFny67VymaCCNuFA Content-Type: multipart/mixed; boundary="92YCC1hftCZSStZab6Cetqmpq8LUyXBGQ"; protected-headers="v1" From: Merlijn Wajer To: Bin Liu Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Pali_Roh=c3=a1r?= , Ivaylo Dimitrov , linux-omap@vger.kernel.org Message-ID: Subject: usb: musb: "(null)" in sysfs mode file after disabling a gadget (and at other times, system hangs) --92YCC1hftCZSStZab6Cetqmpq8LUyXBGQ Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable Hi, I found that the "mode" file in musb sys node will return "(null)" when one would expect it show b_idle. Wrong /mode file: [Fresh boot, cable not connected yet] root@n900devuan:~# modprobe g_nokia [Insert cable connected to PC] root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode b_peripheral [Remove cable connected to PC] root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode b_idle root@n900devuan:~# rmmod g_nokia root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode (null) [Insert cable connected to PC] root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode b_idle I would expect it to state "b_idle" instead of "(null)". I have also been able to reproduce this "(null)" state using only configfs (and not deprecated g_nokia module), but this example is more cumbersome to write up) Sometimes it crashes the entire system (reproducibly): [Fresh boot, USB cable connect to PC at all times] root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode b_idle root@n900devuan:~# modprobe g_nokia root@n900devuan:~# cat /sys/devices/platform/68000000.ocp/480ab000.usb_otg_hs/musb-hdrc.0.auto/m= ode b_peripheral root@n900devuan:~# rmmod g_nokia (Hangs, reboots after a few seconds, probably due to watchdog) This occurs on Nokia N900 (RX-51). Kernel config has: CONFIG_USB_LIBCOMPOSITE=3Dm CONFIG_USB_F_*=3Dm CONFIG_USB_G_*=3Dm I don't have a trace because I don't have a serial on my Nokia N900. I have not yet tested this on other musb devices, but I can do that if that helps reproducing the issue. Cheers, Merlijn --92YCC1hftCZSStZab6Cetqmpq8LUyXBGQ-- --oppHN8720nJDSW0moTFny67VymaCCNuFA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRM5LT7NbLF9yb6a/UGN09rynK8WgUCWpiQ+wAKCRAGN09rynK8 WtVMAP4himSJrs3BWzRBvU2MnT/2LcIYc63PBQE7RKE03uB4FwD/Rgjdw0KyeEDX z2D6zNvYfN/0ssZE3v4vQ7ig7W4H/go= =wlPG -----END PGP SIGNATURE----- --oppHN8720nJDSW0moTFny67VymaCCNuFA--