From patchwork Thu Sep 1 00:40:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 9308115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E45B460487 for ; Thu, 1 Sep 2016 00:44:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D314E28C53 for ; Thu, 1 Sep 2016 00:44:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5FC829150; Thu, 1 Sep 2016 00:44:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4822528C53 for ; Thu, 1 Sep 2016 00:44:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bfG5Z-0008NR-2j; Thu, 01 Sep 2016 00:42:41 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bfG42-0007YO-Pz for linux-arm-kernel@lists.infradead.org; Thu, 01 Sep 2016 00:41:09 +0000 Received: by mail-pf0-x229.google.com with SMTP id x72so24780670pfd.2 for ; Wed, 31 Aug 2016 17:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uch56ZvhF5xp5y6dvw/o5yQzsyDzQXKAfAJl8gmsyJk=; b=RmDtgnyg3zcl42tpUfxECgbJK41hHCOEaDQyIG+sM6ChNztkKwIekQvTO3cKlW9Zut L8qdMNo+4JvJudyvS+rok8Kt3BFbUraQuMcnatMJC3OlWi3SOpdRWFkjGacJj1dkc3bx PYlXJGZXSl3/NQFFvATLICKPyjAajCx/t26is= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uch56ZvhF5xp5y6dvw/o5yQzsyDzQXKAfAJl8gmsyJk=; b=cKdsWDtBnQa1U9qQXbaBFp3tBswZ73wwxkasBBFQO7d8W9n86e1Ktvn17g7CmvaYNE ioDrgOPHPnbXKBQVUgUmKmYE9YM4Ye8ITDFhX+jLGAFyeu6F1eVyCjblU/Is/GYq49YO 19lDHwcEv3w6/w69DfElEj5s+XTg1eUDn9ejLlMIR5Sc8I+O5wMCZ/3XTHrIu13wDxVe yU4UTkrglptFdJTeREyAKmkjInbB7U+/Bk4M4UuNrWinNnNWLuJOHiS191ZlKXC6DaNc kA1NLSNYHBo7jzyGIx9sQqf76LDpt5FihWv1D4caAodLKprAoqaB0RTlXe00FoHb3vTE 4GjA== X-Gm-Message-State: AE9vXwMUY3h9ReEtyrZ2vku4rPa4BEyKndS9s3kD0qIGdwQh3xIBcyN2ZS+VXqeNbsuVh/9Q X-Received: by 10.98.69.73 with SMTP id s70mr21912061pfa.115.1472690445943; Wed, 31 Aug 2016 17:40:45 -0700 (PDT) Received: from localhost.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id m5sm2292303paw.40.2016.08.31.17.40.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 17:40:45 -0700 (PDT) From: Stephen Boyd To: linux-usb@vger.kernel.org Subject: [PATCH v3 07/22] usb: chipidea: Notify events when switching host mode Date: Wed, 31 Aug 2016 17:40:21 -0700 Message-Id: <20160901004036.23936-8-stephen.boyd@linaro.org> X-Mailer: git-send-email 2.9.0.rc2.8.ga28705d In-Reply-To: <20160901004036.23936-1-stephen.boyd@linaro.org> References: <20160901004036.23936-1-stephen.boyd@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160831_174107_100190_9DAD609C X-CRM114-Status: GOOD ( 14.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Felipe Balbi , Arnd Bergmann , Neil Armstrong , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Andersson , Peter Chen , Greg Kroah-Hartman , Andy Gross , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The chipidea/udc.c file sends a CI_HDRC_CONTROLLER_RESET_EVENT to the wrapper drivers when it calls hw_device_reset(), but that function is not called from chipidea/host.c. And the udc.c file sends the CI_HDRC_CONTROLLER_STOPPED_EVENT but the host.c file doesn't do anything. The intent of the reset event is to allow the wrapper driver to do any wrapper specific things after the reset bit has been set in the usb command register. Therefore, add this event hook in the host role after we toggle that bit. Similarly, the intent of the stopped event is to allow the wrapper driver to do any wrapper specific things after the device is stopped. So when we stop the host role, send the stopped event. Acked-by: Peter Chen Cc: Greg Kroah-Hartman Signed-off-by: Stephen Boyd --- drivers/usb/chipidea/host.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c index 053bac9d983c..a1d8551ca79d 100644 --- a/drivers/usb/chipidea/host.c +++ b/drivers/usb/chipidea/host.c @@ -87,6 +87,9 @@ static int ehci_ci_reset(struct usb_hcd *hcd) if (ret) return ret; + if (ci->platdata->notify_event) + ci->platdata->notify_event(ci, CI_HDRC_CONTROLLER_RESET_EVENT); + ci_platform_configure(ci); return ret; @@ -184,6 +187,9 @@ static void host_stop(struct ci_hdrc *ci) struct usb_hcd *hcd = ci->hcd; if (hcd) { + if (ci->platdata->notify_event) + ci->platdata->notify_event(ci, + CI_HDRC_CONTROLLER_STOPPED_EVENT); usb_remove_hcd(hcd); usb_put_hcd(hcd); if (ci->platdata->reg_vbus && !ci_otg_is_fsm_mode(ci) &&