From patchwork Wed Mar 18 13:55:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 6039731 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 17262BF90F for ; Wed, 18 Mar 2015 13:58:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F927203F1 for ; Wed, 18 Mar 2015 13:58:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE87C204A9 for ; Wed, 18 Mar 2015 13:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933589AbbCRN4d (ORCPT ); Wed, 18 Mar 2015 09:56:33 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:48628 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933574AbbCRN43 (ORCPT ); Wed, 18 Mar 2015 09:56:29 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t2IDuOfg029345; Wed, 18 Mar 2015 08:56:24 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t2IDuNR3007019; Wed, 18 Mar 2015 08:56:23 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Wed, 18 Mar 2015 08:56:23 -0500 Received: from rockdesk.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t2IDu3kJ005491; Wed, 18 Mar 2015 08:56:20 -0500 From: Roger Quadros To: , , CC: , , , , , , , Roger Quadros Subject: [RFC][PATCH 5/9] usb: hcd: adapt to OTG Date: Wed, 18 Mar 2015 15:55:59 +0200 Message-ID: <1426686963-11613-6-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426686963-11613-1-git-send-email-rogerq@ti.com> References: <1426686963-11613-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Register with OTG core as part of usb_add_hcd() and unregister from it in usb_remove_hcd(). For OTG device the HCD is actually started or stopped from the OTG FSM. Signed-off-by: Roger Quadros --- drivers/usb/core/hcd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index e28bd9d..9e8ecc9 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "usb.h" @@ -2826,9 +2827,12 @@ int usb_add_hcd(struct usb_hcd *hcd, goto err_request_irq; } - retval = usb_start_hcd(hcd); - if (retval) - goto err_hcd_driver_start; + /* If OTG device, OTG core takes care of starting HCD */ + if (usb_otg_register_hcd(hcd)) { + retval = usb_start_hcd(hcd); + if (retval) + goto err_hcd_driver_start; + } return 0; @@ -2936,7 +2940,9 @@ void usb_remove_hcd(struct usb_hcd *hcd) { dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); - usb_stop_hcd(hcd); + /* If OTG device, OTG core takes care of stopping HCD */ + if (usb_otg_unregister_hcd(hcd)) + usb_stop_hcd(hcd); if (usb_hcd_is_primary_hcd(hcd)) { if (hcd->irq > 0)