Received: by 10.223.164.221 with SMTP id h29csp910521wrb; Wed, 1 Nov 2017 07:25:44 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tl3wcbDip9gBJ/boqi8QP2RYSK6XBcXwqmLbQJe29vcQFzAutaBxUAMejX+xOGeBuJKoL8 X-Received: by 10.99.115.28 with SMTP id o28mr37474pgc.340.1509546344618; Wed, 01 Nov 2017 07:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509546344; cv=none; d=google.com; s=arc-20160816; b=DawGdrO/OqCI5xhOAU/vjlFTKo6E890HgRmghPWWeoxGgfDUJAqntQ2lFl+i4B0F8s MU2I4HiiQswG6m8cqn/cFBOCLum3CuDlZC8Zz6aQTikR2mzsoJtBhaexy2Cj5eLd4/PT duyTsMXz1wAxXP7c0JwEeUyTocS9pM4vh/NZ4G7adAXjUjjByBbcrghUlv9kxxoPHa/6 phstxoHc0N0BYPavgJr1CYTYCN/9bNxivlbtGWDd/dN5gQcVYIXXZx/3CIzWITwUYbR2 l/V1dWuHxW9C4ydlm5pfyDfgh2sHyTKZdKGzjmVg1FiXLIYZKvz2OgA5unmu+oyFcy+B aCMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=89NAjV0O86pNHmbcmXRCkoj9823T8LVhDPRIRBcSqWQ=; b=wjRsoPR1SfxiWdYVyNiQ/QzG/hFGnGgseHvk5sf3Zh8UMxlLQAlCTyNbJQtk7dlyv9 cOmvNGrF3Q/JPl2YJiJCgHiTr/VRbyGrWqS2zgWgJ6hJqIrb3nKn3qgaGs295xfVU9uB G1a69lb9HUWDGen7G7FCFczc8NgKFV5DGGQuouStZcZImRBqJgmarZaJYBFSyA5mAhnm OjpWbczXAt5bFIa3UeHqP0dVPM7+gvKY8/AOl9dQ3BbsHjDBTMrETMRRc8bBj14OjQV2 KU8duqYA+Jse4KOEF0k8lFEV9X0EEOJRNTEg45+vDfgtW/0Qbq79fyxwHhZJDvua/v01 dvzw== ARC-Authentication-Results: i=1; mx.google.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u196si1111532pgc.643.2017.11.01.07.25.30; Wed, 01 Nov 2017 07:25:44 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754687AbdKAOY5 (ORCPT + 99 others); Wed, 1 Nov 2017 10:24:57 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:46152 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754557AbdKAOYz (ORCPT ); Wed, 1 Nov 2017 10:24:55 -0400 Received: (qmail 1952 invoked by uid 2102); 1 Nov 2017 10:24:54 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 1 Nov 2017 10:24:54 -0400 Date: Wed, 1 Nov 2017 10:24:54 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Roger Quadros cc: balbi@kernel.org, , , , "# v4 . 13+" Subject: Re: [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed handling In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 31 Oct 2017, Roger Quadros wrote: > Currently UDC core calls ->udc_set_speed() with the speed parameter > containing the maximum speed supported by the gadget function > driver. This might very well be more than that supported by the > UDC controller driver. > > Select the lesser of the 2 speeds so both UDC and gadget function > driver are operating within limits. > > This fixes PHY Erratic errors and 2 second enumeration delay on > TI's AM437x platforms. > > Fixes: 6099eca796ae ("usb: gadget: core: introduce ->udc_set_speed() method") > Cc: # v4.13+ > Reported-by: Dylan Howey > Signed-off-by: Roger Quadros > --- > v2: > - Move speed limiting code to UDC core. > > drivers/usb/gadget/udc/core.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c > index d41d07a..def1b05 100644 > --- a/drivers/usb/gadget/udc/core.c > +++ b/drivers/usb/gadget/udc/core.c > @@ -1080,8 +1080,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc) > static inline void usb_gadget_udc_set_speed(struct usb_udc *udc, > enum usb_device_speed speed) > { > - if (udc->gadget->ops->udc_set_speed) > - udc->gadget->ops->udc_set_speed(udc->gadget, speed); > + if (udc->gadget->ops->udc_set_speed) { > + enum usb_device_speed s; > + > + s = min(speed, udc->gadget->max_speed); > + udc->gadget->ops->udc_set_speed(udc->gadget, s); > + } > } > > /** Roger, would you like to send in a follow-up patch that removes the now unnecessary code from dummy_udc_set_speed() in dummy_hcd.c? Alan Stern From 1582781792863818730@xxx Tue Oct 31 13:59:04 +0000 2017 X-GM-THRID: 1582781792863818730 X-Gmail-Labels: Inbox,Category Forums