Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1434265yba; Thu, 9 May 2019 17:00:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHa1QXGA5QTDTCMHBwzvZg2gFkInuy6OFqHvVAaVgM4WhYg+WPhyf7pcffDrOHdB/IGyhU X-Received: by 2002:aa7:8453:: with SMTP id r19mr9437990pfn.44.1557446455581; Thu, 09 May 2019 17:00:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557446455; cv=none; d=google.com; s=arc-20160816; b=mO9tfQrRAUgiKvMMFkUbxWla76eRSw98yfFfWFFoiSJUPkxIoyYJKCakwqChBA3Jzh 91XlwydPXLq6UHBGEK/APDPC359GN+Lmsr/ms2y83XmgRqWP5Qo/pR0lwuycB7uVZIG5 q4UCTj7GRhRnP1sxRl2Sums2U7UodlKS04jhmhudAMKoPUxzGRDMlgAOIwIFX9liZQJp UHOxcWurqs4fLX06Bj2uAiX7drZCaHluGS7+dytaoXez6SEhmTxTx9NiOcjUp83r3FXS j7qYR85JNiHiY1nGJ9RktXPxzI+v+UQ+ZjKGNMqzAkg5uY+YgQtvzQ3+dY6+7yOOZ1w/ 1hQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=m+4F4SUrnn/qBmCEmIhjKrCJIELcHqdUFD3+NXV8lhg=; b=u6jYMH7SitA1ee5qykt2/aJg1/wNyfqyhkEnWnvHblx0RIGDQW31fysX4pvfLRxbBF XrnjbyepRCtnE2RnSZQ5EP403nVrnA1MSqRbBlt5NLqOXwmcmIzvkbmgj1wMlfHQiNIj sDi7k50YRijIuJ7mppfuk2lBUCEvz4STowoVQh5QUHS0+W4GOYypwtketad40bm1MFiX ZwZYH3i/eU8S2g0dj083GAyHcj3VwA39XZSbUSVEW9UYwrE5rZ6cRZiNMJxzv9OU79fz EAqBIygZAfYCbE7svNWF8Bynw+hh/NK15T2JIMrJKjYYp6JJGplnEeK2aJuo4FEGZG9D t5wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Mwm1+mM2; 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=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 36si5016089pgx.477.2019.05.09.17.00.37; Thu, 09 May 2019 17:00:55 -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; dkim=pass header.i=@synopsys.com header.s=mail header.b=Mwm1+mM2; 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=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfEIX7r (ORCPT + 99 others); Thu, 9 May 2019 19:59:47 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.47.102]:53444 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726701AbfEIX7r (ORCPT ); Thu, 9 May 2019 19:59:47 -0400 Received: from mailhost.synopsys.com (dc8-mailhost1.synopsys.com [10.13.135.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 1DA2DC00D0; Thu, 9 May 2019 23:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1557446390; bh=EnqrzmpzPbj+nGgnpyTF6VzPxqLccG3bhMGQETJ3X8c=; h=From:To:CC:Subject:Date:References:From; b=Mwm1+mM2RVhLnJUa6D1AJx3dhWWhijAAloSjByMrWk0GErXdoZcGJgIvqxb04DICq 4Rd8dHDIf+eUdbZTU/S6yP3HNZlbHbwibdu5L8p83z+LT9GYKw7chIaRKA1vto5trE yM+dNdFMW0qnGR7rLSK+WEjYrAzSD898OoDpaun3KVo9DXfP/eATtMQRk8RNIx9d2G sbaiHMMrlT2/vmSsITdWIQ44RwsifsAp/mmqpusjPXgIy+rz2pf7lVIuvblZKs2mea GMtQbSkfRHvlw3hl6h3TAAzl6VawULLss2hQpwZc+b1hEzH446Wh56q1Vgi1o/F866 WA3d2nrj3UX5w== Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPS id 936DFA005D; Thu, 9 May 2019 23:59:45 +0000 (UTC) Received: from us01wembx1.internal.synopsys.com ([169.254.1.223]) by US01WXQAHTC1.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Thu, 9 May 2019 16:59:45 -0700 From: Thinh Nguyen To: Anurag Kumar Vulisha , Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Mark Rutland , "Felipe Balbi" , "Claus H. Stovgaard" CC: "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "v.anuragkumar@gmail.com" Subject: Re: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries Thread-Topic: [PATCH v2 3/3] usb: dwc3: gadget: Add support for disabling U1 and U2 entries Thread-Index: AQHVBXNg9QMnfODDx0qS+2/7kcKJQQ== Date: Thu, 9 May 2019 23:59:43 +0000 Message-ID: <30102591E157244384E984126FC3CB4F639E9E8F@us01wembx1.internal.synopsys.com> References: <1557302091-7455-1-git-send-email-anurag.kumar.vulisha@xilinx.com> <1557302091-7455-4-git-send-email-anurag.kumar.vulisha@xilinx.com> <30102591E157244384E984126FC3CB4F639E9823@us01wembx1.internal.synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.184.19] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Anurag,=0A= =0A= Anurag Kumar Vulisha wrote:=0A= >>> + return -EINVAL;=0A= >>>=0A= >>> reg =3D dwc3_readl(dwc->regs, DWC3_DCTL);=0A= >>> if (set)=0A= >>> @@ -626,7 +630,10 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, s= truct=0A= >> usb_ctrlrequest *ctrl)=0A= >>> * nothing is pending from application.=0A= >>> */=0A= >>> reg =3D dwc3_readl(dwc->regs, DWC3_DCTL);=0A= >>> - reg |=3D (DWC3_DCTL_ACCEPTU1ENA |=0A= >> DWC3_DCTL_ACCEPTU2ENA);=0A= >>> + if (!dwc->dis_u1_entry_quirk)=0A= >>> + reg |=3D DWC3_DCTL_ACCEPTU1ENA;=0A= >>> + if (!dwc->dis_u2_entry_quirk)=0A= >>> + reg |=3D DWC3_DCTL_ACCEPTU2ENA;=0A= >>> dwc3_writel(dwc->regs, DWC3_DCTL, reg);=0A= >>> }=0A= >>> break;=0A= >>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c=0A= >>> index e293400..f2d3112 100644=0A= >>> --- a/drivers/usb/dwc3/gadget.c=0A= >>> +++ b/drivers/usb/dwc3/gadget.c=0A= >>> @@ -2073,6 +2073,24 @@ static int dwc3_gadget_stop(struct usb_gadget *g= )=0A= >>> return 0;=0A= >>> }=0A= >>>=0A= >>> +static void dwc3_gadget_config_params(struct usb_gadget *g,=0A= >>> + struct usb_dcd_config_params *params)=0A= >>> +{=0A= >>> + struct dwc3 *dwc =3D gadget_to_dwc(g);=0A= >>> +=0A= >>> + /* U1 Device exit Latency */=0A= >>> + if (dwc->dis_u1_entry_quirk)=0A= >>> + params->bU1devExitLat =3D 0;=0A= >> It doesn't make sense to have exit latency of 0. Rejecting=0A= >> SET_FEATURE(enable U1/U2) should already let the host know that the=0A= >> device doesn't support U1/U2.=0A= >>=0A= > I am okay to remove this, but I feel that it is better to report zero val= ue instead=0A= > of a non-zero value in exit latency of BOS when U1 or U2 entries are not = supported. =0A= > Advantage of reporting 0 is that some hosts doesn't even send SET_FEATURE= (U1/U2)=0A= > requests on seeing zero value in BOS descriptor. Also there can be cases = where U1 is=0A= > disabled and U2 entry is allowed or vice versa, for these kind of cases t= he driver can=0A= > set zero exit latency value for U1 and non-zero exit latency value for U2= . Based on this=0A= > I think it would be better to report 0 when U1/U2 states are not enabled.= Please provide=0A= > your opinion on this.=0A= =0A= Hm... I assume you're testing against linux usb stack and xhci host. If=0A= that's the case, it looks like host will still request the device to=0A= enter U1/U2 despite the device rejecting SET_FEATURE(enable U1/U2). This=0A= needs to be fixed. I think what you have is fine to workaround this issue.= =0A= =0A= Thanks,=0A= Thinh=0A=