From patchwork Mon Oct 20 10:45:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39034 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DF0AE203C5 for ; Mon, 20 Oct 2014 10:45:58 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf513453eek.6 for ; Mon, 20 Oct 2014 03:45:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=VlLpo4Z8/7ZIWpNeKHGe9gg/c/9LrfVPnYxcNt253ZI=; b=JNSzmgA+ZUC+e0PPOJVp/faRreIBSJ3o+fbkoKebavAEAnPvkArFQHz6Z//BQC13lj cBu8q31uPOAr469TqFTLwWvMH5rHoseK/DIbJqbz7TxPLtif4NVa9xu7+hQVMOGP/5ri 4rWc69a0MmvpByciKSAIr1QwkEsjrmdoIXRa4prIgnAE+P/6wAxwIOaCjUVvxlOGbCS8 2/+tFlIJYGnGj/sDPOr6qm9oGJ4HL641lZ7/g7eH4sGUlbIhQHBQXQwdbpjVgVMzXHnT /ORj62c1cFoXoBBn1APcdcDR5OuHpbWWFiSeK0djTzIBdViiNV4IDcKuGXPF0CnGXMK7 6etA== X-Gm-Message-State: ALoCoQltDNsZ5xfH16XsJixkDHpWMWj1TudMAdp98NtE6Ir4dUWVwrY2rMk2XqG4WshnABNTRGL3 X-Received: by 10.152.25.202 with SMTP id e10mr3919441lag.2.1413801958077; Mon, 20 Oct 2014 03:45:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.202 with SMTP id y10ls444244lad.51.gmail; Mon, 20 Oct 2014 03:45:57 -0700 (PDT) X-Received: by 10.152.25.200 with SMTP id e8mr4501191lag.28.1413801957934; Mon, 20 Oct 2014 03:45:57 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id rm7si13714580lbb.55.2014.10.20.03.45.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Oct 2014 03:45:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id b6so3623218lbj.31 for ; Mon, 20 Oct 2014 03:45:57 -0700 (PDT) X-Received: by 10.152.120.200 with SMTP id le8mr26031994lab.67.1413801957804; Mon, 20 Oct 2014 03:45:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp278543lbz; Mon, 20 Oct 2014 03:45:57 -0700 (PDT) X-Received: by 10.70.108.232 with SMTP id hn8mr19316961pdb.76.1413801955644; Mon, 20 Oct 2014 03:45:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1si7468524pdd.136.2014.10.20.03.45.55 for ; Mon, 20 Oct 2014 03:45:55 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753535AbaJTKpx (ORCPT + 6 others); Mon, 20 Oct 2014 06:45:53 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:16259 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753245AbaJTKpv (ORCPT ); Mon, 20 Oct 2014 06:45:51 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDQ00MXNOP1Z610@mailout2.w1.samsung.com>; Mon, 20 Oct 2014 11:48:37 +0100 (BST) X-AuditID: cbfec7f5-b7f956d000005ed7-38-5444e7dcfbb6 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 0E.82.24279.CD7E4445; Mon, 20 Oct 2014 11:45:48 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDQ009U7OK7MS20@eusync4.samsung.com>; Mon, 20 Oct 2014 11:45:48 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Felipe Balbi , Kyungmin Park , Robert Baldyga , Paul Zimmerman , Krzysztof Kozlowski Subject: [PATCH v2 01/10] usb: dwc2/gadget: report disconnect event from 'end session' irq Date: Mon, 20 Oct 2014 12:45:31 +0200 Message-id: <1413801940-31086-2-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1413801940-31086-1-git-send-email-m.szyprowski@samsung.com> References: <1413801940-31086-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsVy+t/xa7p3nruEGHxbpmhx8H69xesXhhZn m96wW8w4v4/JYtGyVmaLtUfusltsnzKdyeLB4Z3sDhwefVtWMXps2f+Z0eP4je1MHp83yQWw RHHZpKTmZJalFunbJXBlvF82iamgk6Niw6YmtgbGG2xdjJwcEgImEjsPnmeFsMUkLtxbDxTn 4hASWMoosfdpOwuE08cksWZDCztIFZuAoUTX2y6wbhEBB4klS++A2cwCPxklJk+16WLk4BAW iJE4s0wLJMwioCpxdeIsRhCbV8BDYvpvmGVyEv9frmACsTkFPCXevJgGViMEVLNp+UuWCYy8 CxgZVjGKppYmFxQnpeca6RUn5haX5qXrJefnbmKEBNTXHYxLj1kdYhTgYFTi4d1h5hIixJpY VlyZe4hRgoNZSYS3+zZQiDclsbIqtSg/vqg0J7X4ECMTB6dUA+PtrIfJKtwKuqx+FQdl0++u W/D6+YEts2sa2uI2Ob7NqjnE4OHLHFQiVXHDPoVdQm1N+eeYGqPO7nMOK6UjsxUu5Dz+1P7r 0elp/4KTVsrFi+WueWA475fkmwfMd447XrndoRDy9oLK9/e+gR81BLR3O+59yG5ZljbT6c3p F4zJ/QyaDkU8Z5VYijMSDbWYi4oTAQQyDd8GAgAA Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds a call to s3c_hsotg_disconnect() from 'end session' interrupt (GOTGINT_SES_END_DET) to correctly notify gadget subsystem about unplugged usb cable. 'disconnected' interrupt (DISCONNINT) might look a bit more suitable for this event, but it is asserted only in host mode, so in device mode we need to use something else. Signed-off-by: Marek Szyprowski --- drivers/usb/dwc2/gadget.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7b5856fadd93..119c8a3effc2 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2279,6 +2279,12 @@ irq_retry: dev_info(hsotg->dev, "OTGInt: %08x\n", otgint); writel(otgint, hsotg->regs + GOTGINT); + + if (otgint & GOTGINT_SES_END_DET) { + if (hsotg->gadget.speed != USB_SPEED_UNKNOWN) + s3c_hsotg_disconnect(hsotg); + hsotg->gadget.speed = USB_SPEED_UNKNOWN; + } } if (gintsts & GINTSTS_SESSREQINT) {