Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2011452rdf; Mon, 6 Nov 2023 01:52:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmWE1VnM741h203CYAMIuibNMuHun6QZFE1wSxjOY9w0wF+/R7GbV6UrSWwpTppjXTTq86 X-Received: by 2002:a05:6808:6d5:b0:3ad:f6ad:b9d2 with SMTP id m21-20020a05680806d500b003adf6adb9d2mr29959271oih.16.1699264362476; Mon, 06 Nov 2023 01:52:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699264362; cv=none; d=google.com; s=arc-20160816; b=LrF+HMJX6ZcFR2q7DC3OgvdPNVG99vPzI+I2VIj4tUmGVUYSIfRgbWBIWWrOH+v4PY FPH55aSWypACdT/DVY4C3sxLrT52c5XPzx/fNAVYMJQ5XFpIfW1qFGSesRdsOeHfzabc maGqo2dYRIhEgWmmrqGgAzUTNcPMvHkPUkzNQL8kmNCY2J1IfklTSjH05/6tpyLbi8St /cuzLmDxN6W8coR/KpteoOKNMgahRMqXYh9J1B4uT0oBL3tegOeT+ki8KjR3KyHV4LrM VcktC6cDAtaZ9Lw4ZxOm29C2Hg9emH24QptTA3MW3JiUmCsLfWVFQ/xqJcePmHVUOeOr RAEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nk5FP0mr1PeO3ReZ0HlJwIfXjEPy+N8YqXm9llUrhBk=; fh=8LiuKVPvFhh/3q8a1uy7AO1GSC6mw9mlMTt8x+4S0cc=; b=iYrqpE0nBSaVBX5kk4N1wRBvtZ7xlWpKt1sZsoGB2gpvJbT8IwcitizuT31ECMpKyn /ZqTbN2HuJ2FenGwQ2063RGWbuqqKk4nnDudb/yA+xDJG4aQyyoh+xN8BD/bP2mSizzW gWv2B4UduMZ6Fah84GBZVRR+p1/8BNVKjlEi4vRsCubGGnkPQj9vL8J8foUvxLoP+cF4 RRxbOPdpmumVVE8IipD3Bz9gF24o+MAa5CuhIHHZlvXRdH6VE8hTIJfZ9ZGH52IehVP2 /BcYG8F9XaIgaxNd/tHe+fUUWGPvgG0P8lGYSwbTINZKqPIwsdMbWnYawbBz1hYTje6Y osdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T1m8kRbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id fk11-20020a056a003a8b00b006c320a95e8esi7147732pfb.404.2023.11.06.01.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 01:52:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T1m8kRbW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id BF29480AF3CD; Mon, 6 Nov 2023 01:52:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbjKFJwa (ORCPT + 99 others); Mon, 6 Nov 2023 04:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229478AbjKFJw2 (ORCPT ); Mon, 6 Nov 2023 04:52:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D601DB; Mon, 6 Nov 2023 01:52:26 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9165C433C8; Mon, 6 Nov 2023 09:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699264345; bh=E4/L+LlFjPb2WwOsFdRog7Iics6lqBe9DHzObFZjQaQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T1m8kRbWZJn7jsk5RLHokR9jTw6xjTC7WAG3HzgnbzkI4rIjkbPbBe1xbsxTjC9ZG bQD/OVdd2XWQfDScwPip752ciLnUAU9sTG4Nag+Il9hHmCU9wx92SirzX93CcAldqe Q19vK4kZHziaINx+dpu1dRcaB6bAsL0Wdf4KQjiwM5zUMYDkShQatGQ5LnsMqpHI7E 666nsBMFCYw/naCOjZzJQbS2kPc6WDZs+la98bV6LFiUl6gf63uKDyxU8LB7HPsm8C sG78jW0v8g6Kqw8NETlTVsiq0OCadkK47lKKpiQX3RgqkfhO4TpWxYkYUsiKenry3/ M0sR8hlOWTbGA== Received: from johan by xi.lan with local (Exim 4.96) (envelope-from ) id 1qzwIA-0007JB-2C; Mon, 06 Nov 2023 10:53:10 +0100 Date: Mon, 6 Nov 2023 10:53:10 +0100 From: Johan Hovold To: Stanley =?utf-8?B?Q2hhbmdb5piM6IKy5b63XQ==?= Cc: Stefan Eichenberger , Johan Hovold , Mathias Nyman , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Maxime Ripard Subject: Re: [PATCH] USB: xhci-plat: fix legacy PHY double inity Message-ID: References: <20231103164323.14294-1-johan+linaro@kernel.org> <5a493e6fedb449bc93f83f31a682e5b9@realtek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5a493e6fedb449bc93f83f31a682e5b9@realtek.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 06 Nov 2023 01:52:37 -0800 (PST) On Mon, Nov 06, 2023 at 06:53:23AM +0000, Stanley Chang[昌育德] wrote: > > > On Fri, Nov 03, 2023 at 05:43:23PM +0100, Johan Hovold wrote: > > > > Commits 7b8ef22ea547 ("usb: xhci: plat: Add USB phy support") and > > > > 9134c1fd0503 ("usb: xhci: plat: Add USB 3.0 phy support") added > > > > support for looking up legacy PHYs from the sysdev devicetree node > > > > and initialising them. > > > > > > > > This broke drivers such as dwc3 which manages PHYs themself as the > > > > PHYs would now be initialised twice, something which specifically > > > > can lead to resources being left enabled during suspend (e.g. with > > > > the usb_phy_generic PHY driver). > > > > > > > > As the dwc3 driver uses driver-name matching for the xhci platform > > > > device, fix this by only looking up and initialising PHYs for > > > > devices that have been matched using OF. > > Tested-by: Stanley Chang > I am sorry to notify you this patch is tested fail. Hmm. Thanks for testing. > I test the Realtek phy driver at drivers/phy/Realtek/phy-rtk-usb2.c again. > But I can't get the phy in xhci. > It is a dwc3 generic phy driver, and it is also a usb phy driver. That sounds broken (i.e. to be relying on both frameworks), but indeed that seems to be the current state of the generic and legacy USB PHY implementations. What a mess. > Base on you modified, I can't run on callback > rtk_phy->phy.notify_port_status = rtk_phy_notify_port_status; Which dwc3 driver are you using? Unless I'm missing something this would not be an issue unless you are doing something crazy like describing the same PHY twice in the devicetree (i.e. both as a generic and legacy PHY). Apparently, there are no in-tree users of this particular realtek PHY so I can't check the devicetree, but we do have other instances of such abuse since at least a decade: 6747caa76cab ("usb: phy: twl4030: use the new generic PHY framework") And, yes, then this is sort of expected. The dwc3 driver has always managed its own PHYs, but functionality has now been bolted on top so that people may have started relying on it being managed *also* by xhci, well at least for notifications like the one you just added: a08799cf17c2 ("usb: phy: add usb phy notify port status API") Johan