From patchwork Tue Feb 14 04:08:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 93917 Delivered-To: patches@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1388726qgi; Mon, 13 Feb 2017 20:08:12 -0800 (PST) X-Received: by 10.107.174.7 with SMTP id x7mr24359372ioe.35.1487045292406; Mon, 13 Feb 2017 20:08:12 -0800 (PST) Return-Path: Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com. [2607:f8b0:4001:c0b::22f]) by mx.google.com with ESMTPS id v1si1572681itb.117.2017.02.13.20.08.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Feb 2017 20:08:12 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:4001:c0b::22f as permitted sender) client-ip=2607:f8b0:4001:c0b::22f; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:4001:c0b::22f as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-it0-x22f.google.com with SMTP id x75so17460746itb.0 for ; Mon, 13 Feb 2017 20:08:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=FCI4Om3oX88usbtAuXd+KFEvzKWeFTzLv9nidlQZp98=; b=VGI+2e6/HAeKzPJjDyHtJ01KkAV5ESPEC1NXj7lf57dG4Uxa4RYowzlEM3sWxia5u5 0X2vdiq1XR0NDtgXLe6nyMI6Z36Frig9KifKV5J3qaIB+3t5vCm61A5SAarDfaMmHoJJ B8WD5QkVi6dSB8U0KdsbU70K8XKcnQYcX9dIA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FCI4Om3oX88usbtAuXd+KFEvzKWeFTzLv9nidlQZp98=; b=owhQVHKrWNDDuXoRf2qrJdPdWAFDhABqXZaGmVNsEzwNU/tqCff/0s3/uQ9PVsv0mb dNam8v4Y+ErMb60MJOt6Qrfm0yrb9iHWGAiwQGJCJ+mwsHGG/siBBZvmgyZQtg2xdBGC 3EOK6JJGcZxN6HpWySZt+076dpeb65G83RYsE848jtYbNM0wPa8IEKk9sY/elLQyPXSl C8b6IFmNPkKhu+fOwGtU2pSVRZuZFfqiotuFxE2LwqGN1E0UErb6uoyCo5BO9vxw00Ul hRCzZ3uK5CGjZ2OhErFvjGmNCZbT43kelFRq3gSKswhh11H6adaQfiVMgRFdqGky11mI BzWg== X-Gm-Message-State: AMke39mqTbliI/ZWTSMZELuvELy//tG7UAHwp/YdAMo5woVZ0q/fw9jYuiB/JHY1lOYIEpdOttI= X-Received: by 10.98.88.133 with SMTP id m127mr30011961pfb.155.1487045292029; Mon, 13 Feb 2017 20:08:12 -0800 (PST) Return-Path: Received: from localhost.localdomain ([2601:1c2:1002:83f0:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id 66sm23452925pfx.29.2017.02.13.20.08.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 13 Feb 2017 20:08:10 -0800 (PST) From: John Stultz To: lkml Cc: John Stultz , Wei Xu , Guodong Xu , Amit Pundir , Rob Herring , John Youn , Douglas Anderson , Chen Yu , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [RFC][PATCH] usb: dwc2: Make sure we disconnect the gadget state Date: Mon, 13 Feb 2017 20:08:08 -0800 Message-Id: <1487045288-1505-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 Just wanted to get some early feedback on this before I submit it for real for the 4.12 timeframe. This is the last patch, that isn't already queued, which I need to get hikey's USB working properly. Feedback would be greatly appreciated! thanks -john I had seen some odd behavior with HiKey's usb-gadget interface that I finally seemed to have chased down. Basically every other time I pluged in the OTG port, the gadget interface would properly initialize. The other times, I'd get a big WARN_ON in dwc2_hsotg_init_fifo() about the fifo_map not being clear. Ends up if we don't disconnect the gadget state, the fifo-map doesn't get cleared properly, which causes WARN_ON messages and also results in the device not properly being setup as a gadget every other time the OTG port is connected. So this patch adds a call to dwc2_hsotg_disconnect() in the reset path so the state is properly cleared. With it, the gadget interface initializes properly on every plug in. Cc: Wei Xu Cc: Guodong Xu Cc: Amit Pundir Cc: Rob Herring Cc: John Youn Cc: Douglas Anderson Cc: Chen Yu Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org Signed-off-by: John Stultz --- drivers/usb/dwc2/hcd.c | 1 + 1 file changed, 1 insertion(+) -- 2.7.4 Acked-by: John Youn diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 90bd248..067202d 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3266,6 +3266,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work) dwc2_core_init(hsotg, false); dwc2_enable_global_interrupts(hsotg); spin_lock_irqsave(&hsotg->lock, flags); + dwc2_hsotg_disconnect(hsotg); dwc2_hsotg_core_init_disconnected(hsotg, false); spin_unlock_irqrestore(&hsotg->lock, flags); dwc2_hsotg_core_connect(hsotg);