From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934607AbcECSU2 (ORCPT ); Tue, 3 May 2016 14:20:28 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:33986 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933947AbcECSUZ (ORCPT ); Tue, 3 May 2016 14:20:25 -0400 Date: Tue, 3 May 2016 20:20:20 +0200 From: Thierry Reding To: Alan Stern , Greg Kroah-Hartman Cc: Stephen Warren , Alexandre Courbot , Jon Hunter , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Philipp Zabel , Hans de Goede Subject: Re: [PATCH] usb: host: ehci-tegra: Avoid getting the same reset twice Message-ID: <20160503182020.GA11457@ulmo.ba.sec> References: <1462298755-20857-1-git-send-email-thierry.reding@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <1462298755-20857-1-git-send-email-thierry.reding@gmail.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, May 03, 2016 at 08:05:55PM +0200, Thierry Reding wrote: > From: Thierry Reding >=20 > Starting with commit 0b52297f2288 ("reset: Add support for shared reset > controls") there is a reference count for reset control assertions. The > goal is to allow resets to be shared by multiple devices and an assert > will take effect only when all instances have asserted the reset. >=20 > In order to preserve backwards-compatibility, all reset controls become > exclusive by default. This is to ensure that reset_control_assert() can > immediately assert in hardware. >=20 > However, this new behaviour triggers the following warning in the EHCI > driver for Tegra: >=20 > [ 3.365019] ------------[ cut here ]------------ > [ 3.369639] WARNING: CPU: 0 PID: 1 at drivers/reset/core.c:187 __of_re= set_control_get+0x16c/0x23c > [ 3.382151] Modules linked in: > [ 3.385214] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0-rc6-next-2= 0160503 #140 > [ 3.392769] Hardware name: NVIDIA Tegra SoC (Flattened Device Tree) > [ 3.399046] [] (unwind_backtrace) from [] (show_st= ack+0x10/0x14) > [ 3.406787] [] (show_stack) from [] (dump_stack+0x= 90/0xa4) > [ 3.414007] [] (dump_stack) from [] (__warn+0xe8/0= x100) > [ 3.420964] [] (__warn) from [] (warn_slowpath_nul= l+0x20/0x28) > [ 3.428525] [] (warn_slowpath_null) from [] (__of_= reset_control_get+0x16c/0x23c) > [ 3.437648] [] (__of_reset_control_get) from [] (t= egra_ehci_probe+0x394/0x518) > [ 3.446600] [] (tegra_ehci_probe) from [] (platfor= m_drv_probe+0x4c/0xb0) > [ 3.455029] [] (platform_drv_probe) from [] (drive= r_probe_device+0x1ec/0x330) > [ 3.463892] [] (driver_probe_device) from [] (__dr= iver_attach+0xb8/0xbc) > [ 3.472320] [] (__driver_attach) from [] (bus_for_= each_dev+0x68/0x9c) > [ 3.480489] [] (bus_for_each_dev) from [] (bus_add= _driver+0x1a0/0x218) > [ 3.488743] [] (bus_add_driver) from [] (driver_re= gister+0x78/0xf8) > [ 3.496738] [] (driver_register) from [] (do_one_i= nitcall+0x40/0x170) > [ 3.504909] [] (do_one_initcall) from [] (kernel_i= nit_freeable+0x158/0x1f8) > [ 3.513600] [] (kernel_init_freeable) from [] (ker= nel_init+0x8/0x114) > [ 3.521770] [] (kernel_init) from [] (ret_from_for= k+0x14/0x3c) > [ 3.529361] ---[ end trace 4bda87dbe4ecef8a ]--- >=20 > The reason is that the EHCI implements three ports, each with a separate > reset line. However the first port's reset also serves as a means to > reset the UTMI pad for all ports. There is special code in the driver to > assert and deassert this shared reset at probe time. It needs to do this > regardless of which port is probed first. Unfortunately this means that > if the first port is probed first, it will request its own reset line > and subsequently request the same reset line again (temporarily) to > perform the reset. This used to work fine before the above-mentioned > commit, but now triggers the new WARN. >=20 > Work around this by making sure we reuse the port's reset if it happens > to be the same as the UTMI pad reset. >=20 > Cc: Philipp Zabel > Cc: Hans de Goede > Signed-off-by: Thierry Reding > --- > drivers/usb/host/ehci-tegra.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) Looks like I sent this too quickly. It doesn't seem to get rid of the warning in all cases, so I'll need to investigate further. Sorry for the noise. Thierry --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJXKOvhAAoJEN0jrNd/PrOhwpMP/0n+KeZ+IeOIcVj/ZXLYQNhd tl7brbh9gisWEDOHf2EV/BrwQv7wEe0b2XDVqwEMw3XGPuIQdaeOJ1mZnnXRtBqG fW9z6dzXYUDAJNYtyGQsViW4hOr2M0LMLISYfYEYvvgBTLxaaottqw3tz/ejllEA IrjYo6y+PqHyfxRAKSel4ydKWCEjjUf73c2Pa80wMNubvtEstUNZkkdAM8f+Zmxj LZYM6CADWjFhTl1lLREpW3ePCNV/Ehnk6HyFDjuZV/2+zlDap/Qta8kIiyAxSRyy Lm4Y4ghmEIHY5Kkr8/boE5eK+p7JzTRj2EFghujAxOeVodT3pNEhUwkEv0qBc7c6 pvtjP90umujYYJZCXVmxP9dLGiaT4JL6Sobb1CNfe3oT+6WERWKeAPWgou3SGmTg eiZZZweq4hDwCfVl0Q1PD6E1DxLrx+YFKUpz+XdqRPepkEUElPsPMA8DqRN9aH0z QADWSc49OSJ8x6B75THDfvlkqOfn421OTPdbkwiRHQ/rCoT/bcVCmU73x1/dxiY5 ShN+VgsSu2VTDkpEwpSvAdpyAUcIMAb6IfBSZgSMovmxwe7HDed/nHDINM7wKenj Ocf54SexWsqgiN8zBw5zi+DxIzf1/ZWcFk23xOLhGdDPOz9gfIftOtFc+C7lsDI5 0xvmbUW+s9GbJZ5f6WkH =dZN/ -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc--