Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp125252ybv; Wed, 19 Feb 2020 17:42:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzol/dOUiq6GDUo/2XshM0I3ZTw/hYknhg8XyKneIVGJgtPRJJgcsjsiPhyB3NOf0yjQd97 X-Received: by 2002:a9d:7607:: with SMTP id k7mr21553159otl.205.1582162949597; Wed, 19 Feb 2020 17:42:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582162949; cv=none; d=google.com; s=arc-20160816; b=AXl6HiQXmGCRPLkUtRH4Q2eoASNvEQXLHeShLuXpXGYn3bEKp3Q/DuENT0hryvJUoL TOiPd4qWTQ426NzypgJPCXbJ17SGHjVpEpVaAmxvOyPJUd4cdBxpj5q/eMLJjs+Oy8g0 2kewo/AEWQBRcYUfDsV5ruJKOjjpkLojDdlorg4W/R+CnGRghGHfA4FmPYHn/UV8Nb/X ugAm/cGND9m0TQw8l70d5XtR9G1uiGCHmr+rLruvaArbnraHOcNzuHfnVf9F4lKi40rq 3klaeL1+NJCe6AGZtglC7RE/a4dysQmmRXKGhRvGBVo7OIsWGRB2K6g+DFzCkIsWyKH3 Jjog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:to:from:subject:message-id; bh=XhoFF7tLJETCIqeBjtjkwvqht9mCYWJs4zcu7U/cHUw=; b=WiufrxlJaPwR/kah3BL4K08JR7I0eLqpX80a3GtR30J5xltHVh8XUaKkoPzJWa8Ko6 2F5G72q0dcP1gJezi3a/ntc/e3WQIRAipjECGzzkGkZ61nt/oFPCwbJbfLSsDTtP4NIA Ep2mpthUWTUCbY/DEADxvtuORW6jiBZOy1nGDT8OsZVjccmn7FaW5BnB+l3IIfZkfaW2 RSOm/q+cXE3rS3RHtWTl49qZNDpJcaIT8XmC/r5uH6IE+C0C7uOS0OYOyJwbGCK3IKf4 3QD49J2XDBVnpwNrb4pvqgDKMxqtEBuzp0fllIz8+hwpZKF/bvxkiqOumP8im3eppb1X gXaw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si846998otp.184.2020.02.19.17.41.51; Wed, 19 Feb 2020 17:42:29 -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; 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 S1727469AbgBTBka (ORCPT + 99 others); Wed, 19 Feb 2020 20:40:30 -0500 Received: from kernel.crashing.org ([76.164.61.194]:32960 "EHLO kernel.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgBTBka (ORCPT ); Wed, 19 Feb 2020 20:40:30 -0500 Received: from localhost (gate.crashing.org [63.228.1.57]) (authenticated bits=0) by kernel.crashing.org (8.14.7/8.14.7) with ESMTP id 01K1dkWX028195 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 19 Feb 2020 19:39:49 -0600 Message-ID: <55e77bcb37ec780094b8d226f89bd5557e30d913.camel@kernel.crashing.org> Subject: Re: [PATCH 2/2] usb: gadget: aspeed: fixup usb1 device descriptor at init time From: Benjamin Herrenschmidt To: rentao.bupt@gmail.com, 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 Date: Thu, 20 Feb 2020 12:39:45 +1100 In-Reply-To: <20200218235600.6763-3-rentao.bupt@gmail.com> References: <20200218235600.6763-1-rentao.bupt@gmail.com> <20200218235600.6763-3-rentao.bupt@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > 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)