From patchwork Wed Oct 26 10:58:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 79396 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp341505qge; Wed, 26 Oct 2016 03:58:50 -0700 (PDT) X-Received: by 10.99.251.5 with SMTP id o5mr2594025pgh.160.1477479530683; Wed, 26 Oct 2016 03:58:50 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r133si1943828pgr.239.2016.10.26.03.58.50; Wed, 26 Oct 2016 03:58:50 -0700 (PDT) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.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 S1754993AbcJZK6l (ORCPT + 27 others); Wed, 26 Oct 2016 06:58:41 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:33902 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754452AbcJZK6i (ORCPT ); Wed, 26 Oct 2016 06:58:38 -0400 Received: by mail-lf0-f42.google.com with SMTP id b81so4092906lfe.1 for ; Wed, 26 Oct 2016 03:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Pegt/7xanBAhqa2leCs78cTuHl+yaOCLT700NnWZZRE=; b=g/5MFbVP8BbZP6x+H1FfxPyNxUc/sxvmirgJZKvjqt9vsUaWU4KdRXtI9lqAuzM7Z4 sNDA/70JCo2FA1ucpkbiuM5QogEiUTkDg3E/5DG3AWMgiNsTsBHDgu7rcrNkZfr/zDN8 Fc7RyuNvNSb5V0f2U2pYk4BMoYJ+8Ko+W2Y0w/qitFsGi5eW6aMsWmxi5sn9XryyDo7B XpwBFwjoPvEjboqcNQUe3oSWUj1DBg334NMaCvQ92CifnOfKiJj91xOzDw30JpEB4bEb myd1N4AuyYOK2kpv/KbjdV9n93TX4Y/HJ8oqnTuxj3Dj4opK1m06xR1lmxvZzRWg+ZX2 v35w== 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=Pegt/7xanBAhqa2leCs78cTuHl+yaOCLT700NnWZZRE=; b=e8CTk9LvCCEqnU6FYq5sw2OKdU+0aZfQD0PNGX7al8+heZOiSUOEkWAzxP5hpwNE8l /OuXBow26bJAOGBD+HrO+QyFVR9UxL9IElD6eqxd52DXNjFE++CbgxFB3BYG7utHX/QH JEaW8SiEVww+8kIJnn4CWOkKlWm8z/yi+Grpf/+vQEhJCpGqYG5FfJ6k/zgskL8iKPJx rnPrpLXZBdiTW88nrQEKbOK8j1V/Rf4VPVFq+NAyA2kSdbQTmpX/Ab3d5MCWY7Wb02Ao 48igZMfMBL7ci1v0JaUkj5fMr9S0d31l3JpZJOuBmIzCXxCRAHp8z5Zxq+pLHFjJ5joR nAYQ== X-Gm-Message-State: ABUngvcjLuRPpnqOHMCo/R8tbOC9QaViE9YqlxVoDSjis8THkaFDgvQYjqE3Yu4h4jf9aiq/ X-Received: by 10.194.191.136 with SMTP id gy8mr1617319wjc.117.1477479516829; Wed, 26 Oct 2016 03:58:36 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id yo1sm1972572wjc.16.2016.10.26.03.58.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Oct 2016 03:58:36 -0700 (PDT) From: Alexandre Bailon To: khilman@baylibre.com, david@lechnology.com, b-liu@ti.com, balbi@kernel.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH v2 3/3] usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode Date: Wed, 26 Oct 2016 12:58:23 +0200 Message-Id: <1477479503-5131-4-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1477479503-5131-1-git-send-email-abailon@baylibre.com> References: <1477479503-5131-1-git-send-email-abailon@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the phy is forced in host mode, only the first hot plug and hot remove works. That is actually because the driver execute the OTG workaround, whereas it is not applicable in host or device mode. Indeed, to work correctly, the VBUS sense and session end comparator must be enabled, what is only possible when the phy is in OTG mode. Only execute the workaround if the phy is in OTG mode. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 2.7.3 diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 6749aa1..b8a6b65 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -145,6 +145,17 @@ static void otg_timer(unsigned long _musb) unsigned long flags; /* + * We should only execute the OTG workaround when the phy is in OTG + * mode. The workaround require the VBUS sense and the session end + * comparator to be enabled, what is only possible if the phy is in + * OTG mode. As the workaround is only required to detect if the + * controller must act as host or device, we can safely exit OTG is + * not in use. + */ + if (musb->port_mode != MUSB_PORT_MODE_DUAL_ROLE) + return; + + /* * We poll because DaVinci's won't expose several OTG-critical * status change events (from the transceiver) otherwise. */