From patchwork Tue Oct 25 13:52:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 79180 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp3125719qge; Tue, 25 Oct 2016 06:53:30 -0700 (PDT) X-Received: by 10.99.219.81 with SMTP id x17mr33095032pgi.138.1477403610239; Tue, 25 Oct 2016 06:53:30 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si20853509pfw.3.2016.10.25.06.53.29; Tue, 25 Oct 2016 06:53:30 -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 S1759075AbcJYNxU (ORCPT + 27 others); Tue, 25 Oct 2016 09:53:20 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36039 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759014AbcJYNxN (ORCPT ); Tue, 25 Oct 2016 09:53:13 -0400 Received: by mail-wm0-f49.google.com with SMTP id b80so165124874wme.1 for ; Tue, 25 Oct 2016 06:53:12 -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=scAsZDKvFIi2aoe/oXImDxjaH7JQo/hKnLf5R2Jou2g=; b=c6V0kkaPJAe1B+p8owvno1rIJ8XRzSwnQ/qTYgL2GSfEMb4pbn5BNJgQ5OVY7+PSBw eveyxyTeLJ/z5ASOxIfpePLPC/VjLhunEIwemLPrPNeNZKvi5hMOu1zMridePy28Uk3N cRluUoc2MUZzL2aXGq2o3du1bjC+uKlnB5VwZE6qRsPllGd216viLkTlMxUMjZfZTnJB Jo1Ay1zlDl33PY43aPShXkamqXg/RgVq7i4V6omG4LCFQRVSHB3IaWAid/6RkaqSegk8 xCWJqfa6h6EemLYhaoKtY7T7vC4VKn8BVHJ4qgpouHwpwyQIutRZRuORSEqaDY70tO7S Wp2g== 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=scAsZDKvFIi2aoe/oXImDxjaH7JQo/hKnLf5R2Jou2g=; b=DMQYMkFOgKAGfbVfEZN7Xv92TAM7RP3rryWhckhkVopBBdOdMi4m6yWfU/sh2eOfsS ZBjCWp5AkfTDly2EvM6qux5Q6wgbx6b+X2hN6dkUgeQkCEA5CqNi1AchMPc+o2MoP1pb Lj/eYpfER1C/3R1NBuYfbX5btZwaAZ69/JQi73aYVC6mvgBYc2QXSqBhp+1E4bdbavHt XP3yPhwbrXE+QAeOiyuUS8F1Zj5dKd6aJcpvO3ya+ZU7Y55ZpnL6y9fLcpH7K+dobO3o HWHQf0F7N6iX2zH0NUplZtWargnzSJwwIS6Td7mM7Ttn5TAbH1r+4OarnaVMS62xpah0 9lPQ== X-Gm-Message-State: ABUngve2JtbQXlT852cct4jzT+YG4MWsGp0CXMwGWwaWqkOMmsPnUA4GAodJRKUL79GWjQdk X-Received: by 10.28.60.7 with SMTP id j7mr3179928wma.7.1477403591758; Tue, 25 Oct 2016 06:53:11 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id v4sm3801282wmd.17.2016.10.25.06.53.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 06:53:11 -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 3/3] usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode Date: Tue, 25 Oct 2016 15:52:56 +0200 Message-Id: <1477403576-11825-4-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1477403576-11825-1-git-send-email-abailon@baylibre.com> References: <1477403576-11825-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 ec93602..be10c51 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. */