Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1249043ybv; Thu, 20 Feb 2020 16:21:27 -0800 (PST) X-Google-Smtp-Source: APXvYqz9ALwroIkIVa4Qt6uSVF+ShsHWrLZCr+zcu8ySnp/b6DLtWE74949SbJSeTeLUN7MayvpP X-Received: by 2002:aca:1b17:: with SMTP id b23mr4165522oib.95.1582244487074; Thu, 20 Feb 2020 16:21:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582244487; cv=none; d=google.com; s=arc-20160816; b=l23v7vWgpMF15P5A272VPFxCtO6KNRJwoVfShfD88vLKHer/HVHu/QaZQdlZCWAF62 qtk+DyjS5IHLWJ39KXRiTCmOEAaCAuq1sX7vBRKLg1OV+ILASp7L7dagVYahXcg1k4+/ YjH5uBbBq/+GI834MC0VQ2v09tU0TjbWxoBiup5cx6QgaJLJt4KRNaJzK7J56zsnv1jO 0Bk7HZShD0njERDCmkBILwd+HOdXnBMbw7HH/2mOr05Ybi0Js6dLsAZ+24Qqv8uwmirW uTjnDSBakAAQG+cQifVXmwqFS7m6lYp2c0NIj/+89AjrigMNhBQtdqmqSbNxldLRBplB kpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=a4/ljhrEhbsVqKPnJ2k+YSVwNBU/denU+0a+fK/lh98=; b=npBFotAB2jhZaaOYTa4Hgzz+rZt468XAgoUwCP57hFV6cY9CCp42aOPJyxGEubdep5 f+a6gU6B7JgvFjmTLQKw7gEIpLZ4hXcIBc4EuM9Kk7Qm21YFhPX8pGSdumP4m0zTF62z NoShz9lsW/2Mu8e+9uLEEwcSC+pzSMgRwr2wJrvQfzAk0sRhnFbP20oEKnI0s449mLKH WaXUM8YXo92cZ5TzJvR/c3DBxwOzaD75w5GRLyEK+JxiyujSAHawnvm0EzjflnRvUUD/ sLq7iUP+mHrQjqQINDaKXhGuBu5zRv2UnTcZ0N1i5SwoW71x4DFub7vAFyXV3bWUe2kY o9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EVv11Zk8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y12si605001oti.162.2020.02.20.16.21.14; Thu, 20 Feb 2020 16:21:27 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=EVv11Zk8; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729475AbgBUAVF (ORCPT + 99 others); Thu, 20 Feb 2020 19:21:05 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:36780 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729392AbgBUAVE (ORCPT ); Thu, 20 Feb 2020 19:21:04 -0500 Received: by mail-pf1-f194.google.com with SMTP id 185so264389pfv.3; Thu, 20 Feb 2020 16:21:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=a4/ljhrEhbsVqKPnJ2k+YSVwNBU/denU+0a+fK/lh98=; b=EVv11Zk8AYB9hS7c/Lkhd52HNoMejxxMg8MSwFwHJcv1rgn10PAhKhBkvQKJZ9BaG4 NskY5M0YE8o7EDmxnYtEItF+4qEF9oy85BAypdcQLsWCfoUN5s6/K5sf4UBUKmZFHt21 sPDTaDsivhrGrdnpq+r/7LFFJ6iUnNpEAJYJXg8Ee0SInqr6LR18ucHGaTIv12TSpOY7 T3kbv9FZQGel1oR9RlWLR13Zh+N6dF1UN7NKb9P1kVE3+7PHhjs68qRSxLFcCG6rbc83 bG7S9Xx0Y70mXDOROUbqjhVu+2fpCEoIw+v7N18ETcmTnwuHDxcgjGu+SiaRh2I9/UOe 84zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=a4/ljhrEhbsVqKPnJ2k+YSVwNBU/denU+0a+fK/lh98=; b=V80Bz0ZGMAnZBahABZ3L77yb8lFytDXCSKBA7nBPtQ28Vkz5vVJAvwyKnEFtcUl8Om XByd7hpJ5nnSJYutV5FCNeJS7+NL0FHedFxuYKjpWPVe4WuFgZ6H43cYLWLiYoI1TP0/ epJCNra9iCkmKhIjfl+AgLdMuyXKAnhLbL3yuK1Nt2BcJOe8wBXaqBGRG40DP/CqJ35v babkNFvxu05nCz+7SQChrM+tcfbiL8nhAodwHoa20nqz23R2ZSrOHXS46aPQ1UXF30rD i+rRrsyWeo9NJW/Ge0Uls04j7ehAGU/B+stw5QM5DjUbl89/LaJezADPwWEsSFSE3ALX mpSw== X-Gm-Message-State: APjAAAVkeBNq2on4geQysTic6leQngP62LjxTQPQDhg3WC6qUO5jZIw9 ZFUQjsiVuuzds+nbV7RQFJ0= X-Received: by 2002:a63:3e05:: with SMTP id l5mr35763336pga.293.1582244463971; Thu, 20 Feb 2020 16:21:03 -0800 (PST) Received: from taoren-ubuntu-R90MNF91 ([2620:10d:c090:500::6:8f30]) by smtp.gmail.com with ESMTPSA id t11sm541459pjo.21.2020.02.20.16.21.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Feb 2020 16:21:03 -0800 (PST) Date: Thu, 20 Feb 2020 16:20:59 -0800 From: Tao Ren To: Benjamin Herrenschmidt Cc: Felipe Balbi , Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Chunfeng Yun , Colin Ian King , Stephen Boyd , Rob Herring , Mark Rutland , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Subject: Re: [PATCH 2/2] usb: gadget: aspeed: fixup usb1 device descriptor at init time Message-ID: <20200221002059.GB7815@taoren-ubuntu-R90MNF91> References: <20200218235600.6763-1-rentao.bupt@gmail.com> <20200218235600.6763-3-rentao.bupt@gmail.com> <55e77bcb37ec780094b8d226f89bd5557e30d913.camel@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55e77bcb37ec780094b8d226f89bd5557e30d913.camel@kernel.crashing.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 20, 2020 at 12:39:45PM +1100, Benjamin Herrenschmidt wrote: > On Tue, 2020-02-18 at 15:56 -0800, rentao.bupt@gmail.com wrote: > > From: Tao Ren > > > > This patch moves fixup-usb1-device-descriptor logic from get_descriptor > > handler to "ast_vhub_fixup_dev_desc" function so the device descriptor > > is only patched once (at vhub init time). > > I don't like this either. We should make ast_vhub_dev_desc and patch a > copy here too. I know today there's only one instance of the vhub in a > given SoC but that might not always be the case. Sure. I will introduce per-hub descripor instances in patch v2. Cheers, Tao > > > Signed-off-by: Tao Ren > > --- > > drivers/usb/gadget/udc/aspeed-vhub/hub.c | 20 +++++++++----------- > > 1 file changed, 9 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/udc/aspeed-vhub/hub.c > > index 4e3ef83283a6..b8bf54b12adc 100644 > > --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c > > +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c > > @@ -76,13 +76,6 @@ static struct usb_device_descriptor ast_vhub_dev_desc = { > > .bNumConfigurations = 1, > > }; > > > > -/* Patches to the above when forcing USB1 mode */ > > -static void ast_vhub_patch_dev_desc_usb1(struct usb_device_descriptor *desc) > > -{ > > - desc->bcdUSB = cpu_to_le16(0x0100); > > - desc->bDeviceProtocol = 0; > > -} > > - > > /* > > * Configuration descriptor: same comments as above > > * regarding handling USB1 mode. > > @@ -316,10 +309,6 @@ static int ast_vhub_rep_desc(struct ast_vhub_ep *ep, > > if (len > dsize) > > len = dsize; > > > > - /* Patch it if forcing USB1 */ > > - if (desc_type == USB_DT_DEVICE && ep->vhub->force_usb1) > > - ast_vhub_patch_dev_desc_usb1(ep->buf); > > - > > /* Shoot it from the EP buffer */ > > return ast_vhub_reply(ep, NULL, len); > > } > > @@ -878,6 +867,15 @@ static void ast_vhub_fixup_dev_desc(struct ast_vhub *vhub) > > if (of_str[id]) > > ast_vhub_str_array[i].s = of_str[id]; > > } > > + > > + /* > > + * Update USB Release Number and Protocol code if vhub is running > > + * at USB 1.x speed. > > + */ > > + if (vhub->force_usb1) { > > + ast_vhub_dev_desc.bcdUSB = cpu_to_le16(0x0100); > > + ast_vhub_dev_desc.bDeviceProtocol = 0; > > + } > > } > > > > void ast_vhub_init_hub(struct ast_vhub *vhub) >