Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934554AbcJ0RQd (ORCPT ); Thu, 27 Oct 2016 13:16:33 -0400 Received: from vern.gendns.com ([206.190.152.46]:49813 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752154AbcJ0RQa (ORCPT ); Thu, 27 Oct 2016 13:16:30 -0400 Subject: Re: [PATCH v2 0/3] usb: musb: da8xx: Fix few issues To: Alexandre Bailon , khilman@baylibre.com, b-liu@ti.com, balbi@kernel.org References: <1477479503-5131-1-git-send-email-abailon@baylibre.com> Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org From: David Lechner Message-ID: <2220c0c3-de72-4d3e-f438-56cb6e9cac15@lechnology.com> Date: Thu, 27 Oct 2016 12:16:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1477479503-5131-1-git-send-email-abailon@baylibre.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1937 Lines: 51 On 10/26/2016 05:58 AM, Alexandre Bailon wrote: > Currently, the USB OTG of the da8xx doesn't work. > This series intend to fix them. > > Change in v2: > * Fix the error path da8xx_musb_init() > > Alexandre Bailon (3): > usb: musb: da8xx: Call earlier clk_prepare_enable() > phy: da8xx-usb: Configure CFGCHIP2 to support OTG workaround > usb: musb: da8xx: Only execute the OTG workaround when phy in OTG mode > > drivers/phy/phy-da8xx-usb.c | 17 ++++++++++++----- > drivers/usb/musb/da8xx.c | 28 +++++++++++++++++++--------- > 2 files changed, 31 insertions(+), 14 deletions(-) > I have found another problem with peripheral mode. When we force peripheral mode, the glue layer currently uses CFGCHIP2 to override the VBUS and ID. This causes it to not be able to detect disconnection because the VBUS is overridden. Here is a patch to fix the problem. I have tested this on LEGO MINDSTORMS EV3 (AM1808). This works because the ID pin is internally pulled up on the SoC, so we don't need to override it. --- diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 2bc12a2..33daa3b 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -374,9 +374,7 @@ static int da8xx_musb_set_mode(struct musb *musb, u8 musb_mode) case MUSB_HOST: /* Force VBUS valid, ID = 0 */ phy_mode = PHY_MODE_USB_HOST; break; - case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */ - phy_mode = PHY_MODE_USB_DEVICE; - break; + case MUSB_PERIPHERAL: case MUSB_OTG: /* Don't override the VBUS/ID comparators */ phy_mode = PHY_MODE_USB_OTG; break; --- If this works for other SoCs/boards, I think we should make this change. If it doesn't work, we could work around the VBUS problem by polling VBUSSENSE in CFGCHIP2. But, I like the simple solution above better.