Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp765464ybx; Wed, 30 Oct 2019 04:47:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6mipCMOjgzu/jmgWKFKByy1Srl1IGvQKsVXkAw6/eCrmqbNrcIuXnjtsTR6zT1sWRbcBb X-Received: by 2002:a17:906:680c:: with SMTP id k12mr8486326ejr.118.1572436059930; Wed, 30 Oct 2019 04:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572436059; cv=none; d=google.com; s=arc-20160816; b=AzIVnx4PJa6IbyfKdldH0sS/KewUr2A54zq/RetbbckQnY9k0hgeFcVB2NVZYG6+eg R6TFmDcS1fYVBMZv+S86/4CtivUYUDF2QRI5n1Ibgdirj7HHrFw6zRWQqtScC9HbjXlD mYQWdHCWCvJVgP2B11qmUC0q8pd37YYJJ6TZaIxZc8eXK10mwH5wy42jsWqKxQB+LfqU FzjwJE+3gzOfOigSSUTU6dBwOlhQZk8GasLdi0VxUIA5wNK8jCV+ea+CiONc8tKc+wSr WJ4rfDQPmrimvP37rFHhTEXeKYkny+acVXLzbLbupoRgtRoELlOiuCdcEaJFGr3pKW3A nlIQ== 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:date:references :in-reply-to:subject:cc:to:from; bh=q755MSAIf4TTBhcbIWR8VrAt6qGwj+OD7kCZt4lC3io=; b=Z/0I/3u14bgE9nQOkQuRaJDAaM+ciNM+otZpDMjJmB+0tlipKbBjzJ2dxNTGWlK3MJ olGEJ4dUoEIG8kp/oDlqSjkBeTN5ScyliuvtPWt291FtYw6c/al0ALwJoaZz75dl7Qmp 8VGGNaHRBNaqG62RPB6dCDnhhfVrYwXBAFY/pLyzn9N0olGvLk25iBRwkG2DdBHBXPwV nrQmaA+PlLcA2Ir454uvk3xq5nN4qc82ffZIHoKwZCCnlTY6DrohRtyfoRugg7VQfR3I NNFPr9FFCU/UjjxLP7gzYBUozt3v8O9Svs28p8g9HaYDg1HgQ2J73D3R4X0vauLH0DiW SqJg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si1046250ejn.392.2019.10.30.04.47.16; Wed, 30 Oct 2019 04:47:39 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726816AbfJ3LqM (ORCPT + 99 others); Wed, 30 Oct 2019 07:46:12 -0400 Received: from mga17.intel.com ([192.55.52.151]:19266 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbfJ3LqL (ORCPT ); Wed, 30 Oct 2019 07:46:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 04:46:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,247,1569308400"; d="scan'208";a="283529510" Received: from pipin.fi.intel.com (HELO pipin) ([10.237.72.175]) by orsmga001.jf.intel.com with ESMTP; 30 Oct 2019 04:46:08 -0700 From: Felipe Balbi To: Roger Quadros , gregkh@linuxfoundation.org Cc: pawell@cadence.com, peter.chen@nxp.com, nsekhar@ti.com, kurahul@cadence.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: Re: [PATCH] usb: cdns3: gadget: Fix g_audio use case when connected to Super-Speed host In-Reply-To: <20191029151514.28495-1-rogerq@ti.com> References: <20191029151514.28495-1-rogerq@ti.com> Date: Wed, 30 Oct 2019 13:46:07 +0200 Message-ID: <87y2x2e9s0.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Roger Quadros writes: > Take into account gadget driver's speed limit when programming > controller speed. > > Signed-off-by: Roger Quadros > --- > Hi Greg, > > Please apply this for -rc. if you want this in -rc, you should have a Fixes line there. > Without this, g_audio is broken on cdns3 USB controller is > connected to a Super-Speed host. > > cheers, > -roger > > drivers/usb/cdns3/gadget.c | 31 ++++++++++++++++++++++++++----- > 1 file changed, 26 insertions(+), 5 deletions(-) > > diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c > index 40dad4e8d0dc..1c724c20d468 100644 > --- a/drivers/usb/cdns3/gadget.c > +++ b/drivers/usb/cdns3/gadget.c > @@ -2338,9 +2338,35 @@ static int cdns3_gadget_udc_start(struct usb_gadget *gadget, > { > struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget); > unsigned long flags; > + enum usb_device_speed max_speed = driver->max_speed; > > spin_lock_irqsave(&priv_dev->lock, flags); > priv_dev->gadget_driver = driver; > + > + /* limit speed if necessary */ > + max_speed = min(driver->max_speed, gadget->max_speed); > + > + switch (max_speed) { > + case USB_SPEED_FULL: > + writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf); > + writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); > + break; > + case USB_SPEED_HIGH: > + writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); > + break; seems like this can be simplified a little: switch (max_speed) { case USB_SPEED_FULL: writel(USB_CONF_SFORCE_FS, &priv_dev->regs->usb_conf); /* fallthrough */ case USB_SPEED_HIGH: writel(USB_CONF_USB3DIS, &priv_dev->regs->usb_conf); /* fallthrough */ case USB_SPEED_SUPER: break; [...] -- balbi