Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp316201pxu; Fri, 23 Oct 2020 01:11:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzT1v9huETtK5osWa+OGYXYmU8iKGR6ZvjolUN/RuuAC2g6Dm/oodnzkDxn4sVqLeEqmOnK X-Received: by 2002:a17:906:3b8e:: with SMTP id u14mr805939ejf.127.1603440703421; Fri, 23 Oct 2020 01:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603440703; cv=none; d=google.com; s=arc-20160816; b=NdFR39U6O2BeyOS2hB4C9F4BvtNe9Sdqf5muJom1R+dOcBUxdWDOKDFZl7ANf0JARm ndEniZS6WxwnNfzLu9X2e+9FUs1V7RYa7V2bDjZ2t3Ze0od5kbuOpU5u5nwPOjTxBxiV zDN2e0ikI7Y0qlIX/GZiGnTjN/0HSKxEqC07nwtBg+F4SOy0WTuTYM5iqnZ9DoBV9zhp icGWhcSkwJWzems702GFwhnQvIcplo35z2aPD/eKyxXy+44QkQUEN3sXdCCSQyLj0uw1 AuLAtwn1MIifSjdqBX/pI+9Dw2Kx2tdV+Hhzwr/DlvusLQkmKgPo2d08CF+LhoWfQMF1 dpjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=n5BErMDp+d9199nmfsOG6KdApoA+znIw95/oL7IncJA=; b=I87kPI6bhl3exzdSyWge3CPDttAFgO/70690KXvFjJIcOff6YLMAeVw7nrG50akpJ/ Cd4g29MPSI9HeL+RQJOswPza6qGyt2kLW+0tPG/P87GjJ3iw9Lc+pEYq+oOs/+jXumD/ jK1bXH7KO5FPqYRWp1PYeNedzAApBtuYOoCz0aev7HFhS9ozK683TCngSezA7rs+Pt04 9JYoYc5R+rpUsTcQmdLO7BMpV7R6U0/Sbk3jnYas3wLGjSF8wvrxHbgWWxwnHLruv4Kq fNJGDCrdQtvJ25Q+5T3eBLt1+X8ywh6/NgBNyy1k2+wY99+jt6UnBsfZf2OWvCfndzJk 69fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CQx2P5Ra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b24si329145edt.22.2020.10.23.01.11.21; Fri, 23 Oct 2020 01:11:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CQx2P5Ra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S375525AbgJWHCQ (ORCPT + 99 others); Fri, 23 Oct 2020 03:02:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373766AbgJWHCQ (ORCPT ); Fri, 23 Oct 2020 03:02:16 -0400 Received: from saruman (88-113-213-94.elisa-laajakaista.fi [88.113.213.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5F1EA22254; Fri, 23 Oct 2020 07:02:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603436535; bh=lzvhj8solcyzZiQrYSitbX0f0SxrRe81UuVGQSTbYM0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CQx2P5Raml8nNiUHJfoXYOpRX5biFmc4Yw/OuYC8alkWrOF2kfgG8MIHCVPxSy7VM w40sdMiZ8O3x/w1UzQrKRojM01Yu2AkPg1RSyKBEBI93Edf2naI/kFRHB9NL7rql40 wwTA1uKXwvexhY1MmjIsbuKWL4vIvk9f0GXS1jSw= From: Felipe Balbi To: John Stultz Cc: lkml , Yu Chen , Tejas Joglekar , Yang Fei , YongQin Liu , Andrzej Pietrasiewicz , Thinh Nguyen , Jun Li , Mauro Carvalho Chehab , Greg Kroah-Hartman , Linux USB List Subject: Re: [PATCH v2] usb: dwc3: Trigger a GCTL soft reset when switching modes in DRD In-Reply-To: References: <20201021224619.20796-1-john.stultz@linaro.org> <87y2jyelv6.fsf@kernel.org> Date: Fri, 23 Oct 2020 10:02:06 +0300 Message-ID: <87o8kte87l.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, John Stultz writes: > On Thu, Oct 22, 2020 at 12:55 AM Felipe Balbi wrote: >> John Stultz writes: >> > From: Yu Chen >> > >> > With the current dwc3 code on the HiKey960 we often see the >> > COREIDLE flag get stuck off in __dwc3_gadget_start(), which >> > seems to prevent the reset irq and causes the USB gadget to >> > fail to initialize. >> > >> > We had seen occasional initialization failures with older >> > kernels but with recent 5.x era kernels it seemed to be becoming >> > much more common, so I dug back through some older trees and >> > realized I dropped this quirk from Yu Chen during upstreaming >> > as I couldn't provide a proper rational for it and it didn't >> > seem to be necessary. I now realize I was wrong. >> >> This keeps coming back every few years. It has never been necessary so >> far. Why is it necessary now? > > Sorry, I'm not totally sure I've got all the context here. If you mean > with regards to the HiKey960, it's because the HiKey960 had a somewhat it's a general DWC3 thing. The databook claims that a soft reset is necessary, but it turns out it isn't :-) > complicated vendor patch stack that others and I had been carrying > along and trying to upstream slowly over the last few years. Since > that process of upstreaming required lots of rework, the patch set > changed over time fixing a number of issues and in this case (by > dropping the quirk) introducing others. > > The usb functionality on the board was never perfect. As I said in > the patch, we saw initialization issues *very* rarely with older > kernels - which I suspected was due to the oddball mux/hub driver that > had to be deeply reworked - so the issue was easy to overlook, except > the frequency of it had grown to be quite noticeable. So now that all > but the dts bits are upstream, I've been trying to spend occasional > free cycles figuring out what's wrong. > > That's when I figured out it was the quirk fix I dropped. But the > good news is so far with it I've not hit any initialization issues > (over a few hundred reboots). That's good :-) >> The only thing we need to do is verify >> which registers are shadowed between host and peripheral roles and cache >> only those registers. > > Sorry, could you explain this a bit more? Again, I don't have access > to the hardware docs, so I'm just working with the source and any > vendor patches I can find. Right, initialize it in gadget mode, then take a register dump (I think our regdump facility in dwc3's debugfs is enough). Then flip to host mode and take the same register dump. Now diff them. You'll see that some registers get overwritten. The reason for that is that physically some host and peripheral registers map to the same block of memory in the IP. In other words, the address decoder in the Register File decodes some addresses to the same physical block of memory. This was done, I believe, to save die area by reducing gate count. >> A full soft reset will take a while and is likely to create other >> issues. > > I'm also fine with going back to the quirk approach if you think that > would be lower risk to other devices? I think the soft reset can have unexpected side effects here. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJFBAEBCAAvFiEElLzh7wn96CXwjh2IzL64meEamQYFAl+Sf+4RHGJhbGJpQGtl cm5lbC5vcmcACgkQzL64meEamQbmUA/8D10XDzKeM2fNMkLzE4w19j17W6wPzLUh WxjyYjrKWiv6+bompUykl5a41XaEUxN0vWUFBqyxiFeOHmrAS+yAcD6SqW/8VWrE MlgHpuAiCdJuEd/wwFMsKQZLdnnySMWlXZYhuuLy0FjG1CJEBcYjm/QHhWlktKD+ 1ufTIUV0YrUzW2QYSZzBUfBo23Z1XvQ/Oy59s6iIKEuWo8K21dOPTNXalmlYw8iY cmNZ+yxQuP2YEEfxsf7qBs2vTyv6dtT0AAqEa3O2yHSEx7+K/lMW+HFPAHrYCjwc COB17gaSLOzc6BoDTdnjX30fqPSynuaPy8Uj/4trJp/d+AwMuEhDtDbK60I+krEL yW6o/WBjrJI+L5h67tuq9du0GYJc+RGm0kd/9c+hfmNAeY+Q/aFabPj5yTHLMwmz V5pLx9jDFLwZEZBG1YIRFEK7Mx/BwFhAkPAHSI3zBG9WoSf6ZFvBtpB+j745L0jC xRTASUDyzltT3Gay8I9v7TOBLdgvGfraB48kgknJAgTOkMFbnUll6L7Tbf5wLMAZ oSl18zg8IVvonDA3LbP10ZD3MTsDeGBM0GCR9vu8DainbtpkzqkrhnIqxZ4q+ssf /adKC8cn4LrWyPNdckFMOAqrTjk1t1n0LaBeKhX7HpijuglHAuEME+GMo5PY5sF3 5ijnFTDRevo= =f52/ -----END PGP SIGNATURE----- --=-=-=--