Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp838436imj; Fri, 15 Feb 2019 07:38:36 -0800 (PST) X-Google-Smtp-Source: AHgI3IZIBMfbN3/BpWe++oMs4cEOXziIVRjjepiG3RjmbUNQd9GC4ibrsbEqIi7QfLQBzDnMhtfX X-Received: by 2002:a63:4a4d:: with SMTP id j13mr6065545pgl.127.1550245116428; Fri, 15 Feb 2019 07:38:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550245116; cv=none; d=google.com; s=arc-20160816; b=Hv4khrtSsA9NUjshzSu3bgjeXIxRpAKATyMv6JgvEGetpxFJySfGVcETHagA8R7Rl7 tyKccndn/DV77/mu/gQ22fatr0NNuvOcJGg48OJ5L2b4Lf3jiBnUs7zZ1O539Ac4WL3g HSWgUoMybfoE82U96rpQUQESc7VfgaJSj0x8gfQnBf3r/tMEbNAmuiE0lt+vKnY0k0iq 0erALgsSIcpd/54y6xgFAKYlwgEwQxUU9EfP8OFOhpZa2o5+KKhs1nALKHbgKzYKuG1D sQlh8Cop7gTIuTqGWSj7xFZEtl/OMU9plXxqCazjJhsy+kgkDYgofY3uLLduDQ1KUMnR Likw== 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:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=9LaRQolBKpQXCQHQ6YbaAq1tvSl9HKcBbGI8kdLU+ds=; b=nbPqXEQr9jYIztrF05XQlbVjN86yFHB5MF2c9TtgYRC0FFb+rWSgJ70vSwjcNwUr2e OCVn3kqgUlK1FCuLBuhpFHjFmJ2rMJrIDlOzSgEKc0wZ0UtaMTGUP9dnXMwUPs219EkP U+mJY+foGGalyljYBx8fSfoC1F5/jr3/fI5a80QX7sJ3OLGkq855crhWg4IicOxKLl2i NjLiNfcQ4h2yeHmKZxEWJNm4LxbzIsgfd6EjJz61zl0rVVhzVbxJhsok5zkyScmLsGl8 ByiHhvs88Y4dUdiDu3VHjlxaa24EGzr4L2zTl+6oaPrYUUz/1wG6EMYLCGC+alufwLyy mI2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=EqMmBiDf; 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si5538904pgr.131.2019.02.15.07.38.20; Fri, 15 Feb 2019 07:38:36 -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=@nxp.com header.s=selector1 header.b=EqMmBiDf; 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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404351AbfBOIjY (ORCPT + 99 others); Fri, 15 Feb 2019 03:39:24 -0500 Received: from mail-eopbgr70089.outbound.protection.outlook.com ([40.107.7.89]:17293 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726396AbfBOIjX (ORCPT ); Fri, 15 Feb 2019 03:39:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9LaRQolBKpQXCQHQ6YbaAq1tvSl9HKcBbGI8kdLU+ds=; b=EqMmBiDfS/Dj/79g1KylkvCFLu7o1ANVX7UsFl2f7J17hKwJ1Gxnhoouqznp1JrHzSq2yr7YTPBSYDLar6cD8K3f2ReW3vYBwIUv+WpPbNxFxEPE5yaTpgv+RvxsDD2KILDtCz7Gkh3wIGXKfThREwaNzfARjwowhs6hrCtU9G8= Received: from AM5PR0402MB2865.eurprd04.prod.outlook.com (10.175.41.148) by AM5PR0402MB2931.eurprd04.prod.outlook.com (10.175.42.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.19; Fri, 15 Feb 2019 08:39:19 +0000 Received: from AM5PR0402MB2865.eurprd04.prod.outlook.com ([fe80::54f5:3bc4:9018:f123]) by AM5PR0402MB2865.eurprd04.prod.outlook.com ([fe80::54f5:3bc4:9018:f123%6]) with mapi id 15.20.1601.023; Fri, 15 Feb 2019 08:39:19 +0000 From: Ran Wang To: Felipe Balbi CC: Greg Kroah-Hartman , Rob Herring , Mark Rutland , "linux-usb@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch when boot Thread-Topic: [PATCH 2/2] usb: dwc3: Add workaround for host mode VBUS glitch when boot Thread-Index: AQHUrWdx3CIJLXThzk+kTWUVQ+nAh6Wx3xQAgC7U+7A= Date: Fri, 15 Feb 2019 08:39:19 +0000 Message-ID: References: <20190116064820.20007-3-ran.wang_1@nxp.com> <201901162139.dkm3lJv5%fengguang.wu@intel.com> In-Reply-To: <201901162139.dkm3lJv5%fengguang.wu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=ran.wang_1@nxp.com; x-originating-ip: [183.240.196.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 638a441d-2d0e-402b-7080-08d6932113a6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM5PR0402MB2931; x-ms-traffictypediagnostic: AM5PR0402MB2931: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1;AM5PR0402MB2931;23:BmUjUUEFSQ+PyNPaTkSsPrRdJNypJruntc8LaM2?= =?us-ascii?Q?xV+cCwzHa6iPxRYzMJQhpkxPCXBjS2ew7BwSFdk8DklCN5phvRWhLQI+GX5g?= =?us-ascii?Q?TWlqCsq46wQjW76KxpjpAdfbFY6YuMnJLvE9PNZUScY/OUuAlB1QpGPEO5ab?= =?us-ascii?Q?4GvTcKo8IoUL+8taB1dQWMqsG6oPhmf+KjGQolOmXW5+LjuuX7A/58bFDKqE?= =?us-ascii?Q?JVyszhlL3xRtERK6vYrQTGxeFSmQYqXA7GZ/r1+jLyFSex92kdo2qZdLum8I?= =?us-ascii?Q?qswjpB2F8M22eqiiS3iqboJ6Dw0YTalM0wFsNGDC+w7s9Ijib35nzhpJ5qTe?= =?us-ascii?Q?72deF0l27mKVK2XM3JbC2YnKBTjcV3YLgA9xUSNfEuMxvXrIc0LUkDrEia8o?= =?us-ascii?Q?9mqJG4mP/JhEvTMOR7j4nDs1+1KcQmGDOF8pno2SnFAa5cetCnnsg804lKv/?= =?us-ascii?Q?FNkxVbKPyrdkS2wp6SKsSW6+EXnJEvzzbyeXxKhVVQGnOy+keMir6N9MlDk0?= =?us-ascii?Q?fIegXYeDf/3q2fDlyjXDv+ZB9NAzJHTC7sQJWbN72W2iBHAAgf+oKhRjdV4F?= =?us-ascii?Q?bXJTqzTAZlFwLRJDtzrqxk8FudWLGJ2MOBBewbJPhFfyUl/8fE3veEiIxgJm?= =?us-ascii?Q?auXlabkUgIcnCAhJFVHDtc2fnq8CjsnVQyou38sIcLoeq9LEyObs8DYGd68f?= =?us-ascii?Q?OiOMEswsWXR7mT55BKHF2xaJieQkcc6oJJDCXg/AFRDF5fBThEJwLHI3yyO6?= =?us-ascii?Q?CbmZ5fweIypk9+T3tM4UjFK3J7VKfWChyj2qyAHhalxpS9f5OPHwlQmBGzHc?= =?us-ascii?Q?nd4aToUi9smXcbTXEexnwgjVXlRar7n6JQbMZe/4gI9/9pLXQ078/rIQelFD?= =?us-ascii?Q?52SJcwNH2mvFA6lcSOvToYKZ5yd84brCrOgKf9vJyuUGPv+cLYQgI3ke1fog?= =?us-ascii?Q?gIy5Zhg29r9RWUkWsGxC9AWK3olo+FA22lHWipmXvLRA5uF+9iLMgFqeFfP/?= =?us-ascii?Q?gJcSe0HK9ghffY2EHYwOh2INff4bpg+PG2dWkhFYd5K8ZbdPmc43JQKnjcDe?= =?us-ascii?Q?f5EBSIBU7O0iUL6X/g09Xnf7p+8rESMf8Hdt1M7MbVHua/C3Hnfy/l/hFr+6?= =?us-ascii?Q?/46PFyX7J/CIJFbL4nP3QfMmi0WRMqozrxMM8P38OlLv/s4a6hK0KMA=3D?= =?us-ascii?Q?=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 09497C15EB x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(366004)(199004)(189003)(8676002)(81166006)(9686003)(106356001)(81156014)(105586002)(446003)(476003)(11346002)(99286004)(4326008)(486006)(186003)(26005)(102836004)(71190400001)(76176011)(316002)(54906003)(14454004)(7736002)(86362001)(55016002)(305945005)(256004)(71200400001)(74316002)(25786009)(97736004)(7696005)(478600001)(33656002)(53936002)(229853002)(6116002)(3846002)(2906002)(6506007)(6916009)(6436002)(66066001)(68736007)(6246003)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0402MB2931;H:AM5PR0402MB2865.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: e01G6zsjb0yl9fNb6qeKKGP4qbvPDwv7ud6wJl+M7+7FzWCGvQ5O8IV3LGZUFkuAa6znt1tDXDmzuhLIZGKbm5bgYQko+7pM5dUrfJ81McWWx1fLvaCqHEPrQTiICAteowj7MLXW4Z1ZhubFPiJYNo9/WTHwmPf8SAWnPuxYdim6/mAP4bpyYUon0n+oUjKGqSkGU+UnzAQGwCPfr2UQ1ps157aKcmIJlPZ04r2Io3TzsLNeFShm9z5MnZ2rmD/7+tAeMbZWIrvEZveuVKPj1IlYqlnBJyA/t5neGDSx2e6wmz1yvPF2CPbbjOfgyHyRPnXY8uHJAsSZ7HmfDj+9cCed6sMKJ/MpbwoY/OX4UAuEh9FBXUJgVwIPUqXpXndBo/Kct8CzpgyETRad9sq48ttQRzn8TOD3lFNZp3q7mLg= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 638a441d-2d0e-402b-7080-08d6932113a6 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Feb 2019 08:39:19.1471 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0402MB2931 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Felipe, Sorry for the late response, I didn't receive your mail. Felipe Balbi wrotes: >Hi, > >Ran Wang writes: >> +static void dwc3_power_off_all_roothub_ports(struct dwc3 *dwc) >> +{ >> + int i, port_num; >> + u32 reg, op_regs_base, offset; >> + void __iomem *xhci_regs; >> + >> + /* xhci regs is not mapped yet, do it temperary here */ >> + if (dwc->xhci_resources[0].start) { >> + xhci_regs =3D ioremap(dwc->xhci_resources[0].start, >> + DWC3_XHCI_REGS_END); >> + if (IS_ERR(xhci_regs)) { >> + dev_err(dwc->dev, "Failed to ioremap xhci_regs\n"); >> + return; >> + } >> + >> + op_regs_base =3D HC_LENGTH(readl(xhci_regs)); >> + reg =3D readl(xhci_regs + XHCI_HCSPARAMS1); >> + port_num =3D HCS_MAX_PORTS(reg); >> + >> + for (i =3D 1; i <=3D port_num; i++) { >> + offset =3D op_regs_base + XHCI_PORTSC_BASE + 0x10*(i-1); >> + reg =3D readl(xhci_regs + offset); >> + reg &=3D ~PORT_POWER; >> + writel(reg, xhci_regs + offset); >> + } >> + >> + iounmap(xhci_regs); > >why can't this be done during xhci_gen_setup()? Actually I have done experiment like what you suggested (in xhci-plat.c), b= ut the timing seems too late--making VBUS waveform look like a square wave as below: Here DWC3 enable host mode, VBUS on | +5V /---------\ 40ms /---------------------------.... 0V ________/ 90ms \______/ | | =20 | Here do xhci reset, VBUS back to +5V again Here set all PORTSC[PP] to 0 in xhci_gen_setup() So I am afraid the solution might have to be added in DWC3 core driver wher= e just after host mode enabling code if want fix this :( Regards, Ran