From patchwork Tue Feb 27 09:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 776411 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DD0913664A; Tue, 27 Feb 2024 09:24:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025876; cv=none; b=QH5NnnHhwBat7h/BDQNRmG2RBMKH+Kbv22eHCgPJiHckuTeCXkdLQhLrZZyyxSw8/8FWOr3wxT8jC2S6fZKdXQ2qge4rS5mao7ehl2jvuk/4FyU3qCW1AGla8fSOBreYbw0A2vaYwXehbui3mid+3aQ+BGgt/Ax4LcKvE/XQlao= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025876; c=relaxed/simple; bh=Sz9nJ+PulDCcEx0CakS2YZwWogDhSl4ZmUdI8Lrp4Vo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aAXf4+cRxo1qXSvGkbI2/ewUZ6cvUopXdUTWHwSdn2FRiZ2MwqCYomJCydtwUfnTAxAM/uIG03rFKFcfdQNF+8oY0RJ6LxbU2VzSM+kxEKd6l7HDVotRuW7/56ATRSuuizemsm3PHY14m04xcAzCLpVqmOc+/eU0A+LPiACk/Ho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PmRsNwsK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PmRsNwsK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8023FC43399; Tue, 27 Feb 2024 09:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709025876; bh=Sz9nJ+PulDCcEx0CakS2YZwWogDhSl4ZmUdI8Lrp4Vo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PmRsNwsKtvGQ9cJ80zmJ0HP44AZeJirwM22t9rswcm01rqqa0JtweHmavVDeIpLLk konkQW5imB6yfX2fZerQcHHxgeeOVSrToy3cnyOKho4yTxtqbnlCgeQ/owHO8kpZ0G RHtes9HwMz3ieabI+DMUcPR1Z8BwLkXVvZYVZjb6iwjzFFhnRBkvVFRrcpcsQYquLl AmIELSLt8R7dRprg4NRTkaQm03AjDwXGHuI8ToVSRZS3mHdHZcYL23OYnAQhSNmDcs KFs6EdseKZ4rEGTkgevzeMiaFYU/PdjRYTmEXcqIHYpKUGjaah9TDAFiyqIJy6PtMI tDQhs1lpHzofw== From: Roger Quadros Date: Tue, 27 Feb 2024 11:23:48 +0200 Subject: [PATCH v4 1/4] usb: dwc3-am62: fix module unload/reload behavior Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-for-v6-9-am62-usb-errata-3-0-v4-1-0ada8ddb0767@kernel.org> References: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> In-Reply-To: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> To: Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: nm@ti.com, r-gunasekaran@ti.com, afd@ti.com, b-liu@ti.com, srk@ti.com, francesco@dolcini.it, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros , stable@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2306; i=rogerq@kernel.org; h=from:subject:message-id; bh=Sz9nJ+PulDCcEx0CakS2YZwWogDhSl4ZmUdI8Lrp4Vo=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBl3apLdZV3c/YRSrpT8MJFKw9rBW2nha4QHRRpS NaW1tkqrM+JAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZd2qSwAKCRDSWmvTvnYw k7GZEACZjsNT+oAr16VuQSY/QKXAhqsRqg/vlQYuM6jZlUwflmfwRz+VCn2tddGa/uYE/uqT9Gm ihLdaH6OngFnDLnMBdFArcbl1evom77uA6g9veSc07gkULgwyo+VqlTS4kAVXx2hyQS0kz18RoV wjZxmaP9kDUo0oFwl0VFC3FLaWgMUFUGOvUVyrilu9UF0CfsUep2qPcENqeemiVYfyXXFeCBvO8 OHt15Uky6dcBkcTfANO65g9pPc8rqwj1rUNozOVeaO+BY9j/z3kjGnxxB5HXO+Y3OsYDDMriYDX ivcw7mHcOi30XmCxUUjNzTZ1s/azrhVGlHQ+xbbyKhXQ8Bpgt4Die8vpmBaceSsRv2TPyOwec6O d+b6UqPhnUygsskZwkzCEofmr9Z2V2XcB7Z5PpOXKmMr6usO9A+F3xf37ylhFYmPlb6ZgFaXfhS ojdK5tHut0M4UIoxIIrSNVkh1kVZOouvXxqkOuQ1d0bUVl/ts2ZyERXwjje4Na7JwHoYd73Hrrm 3EJtZcfkCpYFqIVz6QOdASrBSuOfAMPqc4RDeovx02dECkuR0e4uH2EEBYXzqvS7iVhdUu8e2Qd HxFcxXFNw9BSlG4Li/Dh8hGNgB/KeFQC0VI4X+8hD0PE181FErJYomsLeyJea1XcwsHGvejrnKk lPGopMG5MC9/7FQ== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 As runtime PM is enabled, the module can be runtime suspended when .remove() is called. Do a pm_runtime_get_sync() to make sure module is active before doing any register operations. Doing a pm_runtime_put_sync() should disable the refclk so no need to disable it again. Fixes the below warning at module removel. [ 39.705310] ------------[ cut here ]------------ [ 39.710004] clk:162:3 already disabled [ 39.713941] WARNING: CPU: 0 PID: 921 at drivers/clk/clk.c:1090 clk_core_disable+0xb0/0xb8 We called of_platform_populate() in .probe() so call the cleanup function of_platform_depopulate() in .remove(). Get rid of the now unnnecessary dwc3_ti_remove_core(). Without this, module re-load doesn't work properly. Fixes: e8784c0aec03 ("drivers: usb: dwc3: Add AM62 USB wrapper driver") Cc: # v5.19+ Signed-off-by: Roger Quadros --- Changelog: v4: - added Fixes and Cc stable. - added of_platform_depopulate() changes here. - drop wakeup disable code. v3: no change v2: no change --- drivers/usb/dwc3/dwc3-am62.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 90a587bc29b7..f85603b7f7c5 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -267,21 +267,14 @@ static int dwc3_ti_probe(struct platform_device *pdev) return ret; } -static int dwc3_ti_remove_core(struct device *dev, void *c) -{ - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - return 0; -} - static void dwc3_ti_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg; - device_for_each_child(dev, NULL, dwc3_ti_remove_core); + pm_runtime_get_sync(dev); + of_platform_depopulate(dev); /* Clear mode valid bit */ reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL); @@ -289,7 +282,6 @@ static void dwc3_ti_remove(struct platform_device *pdev) dwc3_ti_writel(am62, USBSS_MODE_CONTROL, reg); pm_runtime_put_sync(dev); - clk_disable_unprepare(am62->usb2_refclk); pm_runtime_disable(dev); pm_runtime_set_suspended(dev); } From patchwork Tue Feb 27 09:23:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 776818 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7509C136991; Tue, 27 Feb 2024 09:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025880; cv=none; b=HDLHTxyKejLBjoIbDmHD0a5BM803Uzia5xIEa9ZtZ1J+4rWIdAjXhD2dt4hO8gcMliDsWWhvHEV4sBNzUObdkKsCdg/u8cz3IFgke3pcZPSTHq0TblPvqEp24YswzQz8xhHzfQ1i6ecXN5WW6Ix0t5CBJJNM/C0LOQ9YkwrYDmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025880; c=relaxed/simple; bh=508DhFAqXr8/FZ4dv70h/hSD4v7ugc/f9K6ffAa4qs8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X+GvWK5y4JiTpgkADDhP+2d6vw7QhTPa/n7UPEz0RWR2ZVO08pCxMshx6Hw9NZbVL756e07kMyOMMex5C+0+rk3/HlND30+e4DuYxN97m17IHigKJkKbqNLNyjQNguLaXNGkK7YWeHTozM1sdGRHyvp9Ev9QQb9Eoft2M9VhBGY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nQvw8YpI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nQvw8YpI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 769E2C43390; Tue, 27 Feb 2024 09:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709025880; bh=508DhFAqXr8/FZ4dv70h/hSD4v7ugc/f9K6ffAa4qs8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nQvw8YpIokRwsNAo+X2jG5eRsQ+mlTqm8/IeSJD2f6W/O3NzWVgaVHMXhavUOKDAs hLy+CHwq97ay9Of6xK5ubZI6Tc7aCg4lwczoyn2gA1P33QiMs2AxqP1mc4uei5ycCs 4cUmAXDEDEn8JpZWCzA5v5bvfGyJuhlqU+xUx1U7zBLhTnHq9PaqxJFp4whtejjyYD qFTaodDVMkdOL3qQna1QVl1ztp3kaAnNIJrhriaBCXTnmlIugbq/gzhqE1UcMj+GgU fiVVjc6zrjNKbaiT+AOtG4MRPm7txZwfuz95Sgws0nSAOtgu4TzywayM1wVFdAWbqx l10v48Uma/hVQ== From: Roger Quadros Date: Tue, 27 Feb 2024 11:23:49 +0200 Subject: [PATCH v4 2/4] usb: dwc3-am62: Disable wakeup at remove Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-for-v6-9-am62-usb-errata-3-0-v4-2-0ada8ddb0767@kernel.org> References: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> In-Reply-To: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> To: Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: nm@ti.com, r-gunasekaran@ti.com, afd@ti.com, b-liu@ti.com, srk@ti.com, francesco@dolcini.it, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros , stable@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=971; i=rogerq@kernel.org; h=from:subject:message-id; bh=508DhFAqXr8/FZ4dv70h/hSD4v7ugc/f9K6ffAa4qs8=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBl3apLOCYkR3mS3D/aWVbUo8XqBYLz9ubOfkAr3 VwCTP3jJD2JAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZd2qSwAKCRDSWmvTvnYw k64QEADCg1dvBEPiw/OX6Y41G0KgglDLO7P8jV8uSE1TODgD86cvL+J71RWxTtxB/u8bmc29mxu ZTpHv4h9RagyO3FFdfqn6qkr9F27DPsmW3X+yKwjnfI5AivOH6t2El0V6bxjk8kEUUYlbgsVJmK 0R8pdwqcm3KcWcnO77GiwjQ4hByZlhp91X1HIrALw1pVZKVpmY/FWYKt7Kyg+r5beBgTQEuCwDS Og+0X98VqkiTohYaBODctgH9tq2SPvEADaMSoSRX2zLNm5AoVGqQiY+5ST7dWjTsJ/DpjemxoUl 1SPUzIL3B7GFoo+Wa3qjeXPbt6W11h6IaB3hFgKfMLOZujVHmUPzl80fYZbdtSW8nr336mmu5Ep kmqco0ewtitUxueeKEelLH6N04vHTszwHlJz2WNMIDSYCwiHTp7rmeDzmezypY4hg4aP3eHuuQa ev65oZSrAMT5Db+7DJKHgf7pNExD1JMpwrO1KDPj69II4VCxJceexzt1z1h3MqtceZp4aNFT2wB BTOzoPsZCsFy9a+tgW6bHlJ8bqFSXyzFVG/zkMv5Dz5NnxJGkahPbn4nzuHI1rsLE0c2Csjaesr d8y45gYR/2do6AxtwfLga0oVBWSJUyoI/xRvcWEIs12M1wG+c7eJonhNcVDnv0aTp5FMqc5d7bM baDIrrdSE4yZoaA== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 Disable wakeup at remove. Fixes the below warnings on module unload and reload. > dwc3-am62 f900000.dwc3-usb: couldn't enable device as a wakeup source: -17 > dwc3-am62 f910000.dwc3-usb: couldn't enable device as a wakeup source: -17 Fixes: 4e3972b589da ("usb: dwc3-am62: Enable as a wakeup source by default") Cc: # v6.4+ Signed-off-by: Roger Quadros --- Changelog: v4 - new patch. split out from v3 patch 2. --- drivers/usb/dwc3/dwc3-am62.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index f85603b7f7c5..ea6e29091c0c 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -274,6 +274,7 @@ static void dwc3_ti_remove(struct platform_device *pdev) u32 reg; pm_runtime_get_sync(dev); + device_init_wakeup(dev, false); of_platform_depopulate(dev); /* Clear mode valid bit */ From patchwork Tue Feb 27 09:23:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 776410 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22230136991; Tue, 27 Feb 2024 09:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025884; cv=none; b=GlLpbhjyIrqK80Y5HtrXPloI3dML06eUTma5c8ZIcxVPMdRv4p75BIzFAByZETqsoamtMUyzJfzl5X3Ad1gC0cNlFjXzwYSNlYKBYaPrsMkdMHwYqAZDB+LIrg/kRyk3wtwAxJ4oxqoEFvgT+/B/Pk3es/wkFQIHf522SZ8e6zM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025884; c=relaxed/simple; bh=F0A6vQO//Uj1T20JqS9Pe7m1ckUNgr/dnHmSUeV0dxo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pufW9GnmUczVH+hCoGceCoKf0keerEhZ3j51SdN5a9NKqccOH4rPWRWxNyZqENJU3RJ8AqVQUwbMJjHIJnh9RZct/ON/ia0d9unS0j+o4SK28fnfNSwzpWz7o/Uyg+xM2ww5j9uh8NH98RZZlcXIjm7O1g4rVKQGQ6RvG7Ymn9o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KEuAl/gf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KEuAl/gf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74B94C433F1; Tue, 27 Feb 2024 09:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709025883; bh=F0A6vQO//Uj1T20JqS9Pe7m1ckUNgr/dnHmSUeV0dxo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KEuAl/gf9cnj1JeOrE0UAaHbfEXn+dDGN8VWqcB/ap3oXjl9qQwnrDFWIRPb4jvhm OrHH6d4u8OL2Y8KTT6a0FL78+cxoxLMmgPTdW6966RGkCrg96rQ21Eg4fjtXxDG51z bzrNS+FF6jvkmxKmxO82ARzxTmNARv+hZwil3c92B60lJYp40MWIYeQdJ48brnFc+J yNFdhk2xSryzqNGkCTL5laYmkFAshJATnNCMKUN9arzIoRX1OhxkAt7xth4RTFAnlE SXvDX0DWMQ4eSd1STkcbIxLx3U+g4EI7DYAQ6RSkQ9lPTdzL4fh02J9x7/lt7brXXH sb0fssCEsbEmQ== From: Roger Quadros Date: Tue, 27 Feb 2024 11:23:50 +0200 Subject: [PATCH v4 3/4] usb: dwc3-am62: Fix PHY core voltage selection Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-for-v6-9-am62-usb-errata-3-0-v4-3-0ada8ddb0767@kernel.org> References: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> In-Reply-To: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> To: Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: nm@ti.com, r-gunasekaran@ti.com, afd@ti.com, b-liu@ti.com, srk@ti.com, francesco@dolcini.it, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1533; i=rogerq@kernel.org; h=from:subject:message-id; bh=F0A6vQO//Uj1T20JqS9Pe7m1ckUNgr/dnHmSUeV0dxo=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBl3apLluERQIpayJ8M4f8TJfsGLKTWS3+iX9aoF 5FoDL7kQ0GJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZd2qSwAKCRDSWmvTvnYw k0LrEACbANZFxhPpAuN6pDPDVsOVulXzz8oEYIe683yjjBbIYpHKugkKFZ9WR/Lgbp4P9NRLQxb Obj1VuI7LEAvDptmyRKbvDMl9t3WnDUmmdYb/ednuGy7fz3H7ILBXG9khG9WRcXdZ9OSADUwdP4 QMJ6yKkOPPgOHhEDNQgtLcKCvqQ9ezdyerpazkiH+GGCDUeEcWqNIYZMfdmgmPqQoqZbKMxy3js 9kUupj0ixoDf2lTCGLQzdQKN6lIRDq9GSbcONIHV15kYiVdzsL3lqW66wK/rKSd6AWa2mziTd35 PKYdTAZ5Ihk3FaFJKOWThguVdaHhDJqtRVzQL4xuZ3OWbnKOqMGX2hnkRURcVAchlALjzIH2ATk K4YcV3USrm/C5yB3Umi4Y/CiuZczJJAdfbfoGeaumLuJcCYZjC7XhIAAmZFFvADy4qUDGP0U/tl rxeBJDLZTpYM1VLwsvjBa71+up0XSwMPKmD//MGUWVwAqyQaceB1UhyNCYKJbflysrho0d/HZSi xMqACYG64YSJJR0vmnBYZlb/VI1RomkEy8hbFd1yaUNUZ/r2gTs6xTmYGkF3SiFG1QdGwkLdiqf FkTl5YPI2HcPQeRk4/H6I69daA7pha+E4UCxZvEwhlSQK+Hgb7PL8kUG4iL0C2W4dWWIM1zP4Fw 2nPbkUVxCPctU3A== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 TRM information is outdated and design team has confirmed that PHY_CORE_VOLTAGE should be 0 irrespective of VDD_CORE voltage. Signed-off-by: Roger Quadros Acked-by: Thinh Nguyen --- Changelog: v4: Added Acked-by v3: no change v2: no change v1: https://lore.kernel.org/all/20240201121220.5523-4-rogerq@kernel.org/ --- drivers/usb/dwc3/dwc3-am62.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index ea6e29091c0c..09b1f5a1c4fb 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -97,7 +97,8 @@ #define USBSS_VBUS_STAT_SESSVALID BIT(2) #define USBSS_VBUS_STAT_VBUSVALID BIT(0) -/* Mask for PHY PLL REFCLK */ +/* USB_PHY_CTRL register bits in CTRL_MMR */ +#define PHY_CORE_VOLTAGE_MASK BIT(31) #define PHY_PLL_REFCLK_MASK GENMASK(3, 0) #define DWC3_AM62_AUTOSUSPEND_DELAY 100 @@ -162,6 +163,13 @@ static int phy_syscon_pll_refclk(struct dwc3_am62 *am62) am62->offset = args.args[0]; + /* Core voltage. PHY_CORE_VOLTAGE bit Recommended to be 0 always */ + ret = regmap_update_bits(am62->syscon, am62->offset, PHY_CORE_VOLTAGE_MASK, 0); + if (ret) { + dev_err(dev, "failed to set phy core voltage\n"); + return ret; + } + ret = regmap_update_bits(am62->syscon, am62->offset, PHY_PLL_REFCLK_MASK, am62->rate_code); if (ret) { dev_err(dev, "failed to set phy pll reference clock rate\n"); From patchwork Tue Feb 27 09:23:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 776817 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8F13136991; Tue, 27 Feb 2024 09:24:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025888; cv=none; b=U2pBOGJSyo2GiS/8e9UdgT4xDHy/ANkaYraRTP6C4YInfMlU0IdftavtWlu/2/Ce7QIXXprqfxFvE/knZu7n5phUpdYYBSQky27wpRqZJMLTk8Swm94LRFquUL4LIorApNSgeSIWPmbS5OA5f+5ec4SxnegHw2d/hG7Qt5906kk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709025888; c=relaxed/simple; bh=nRhSXkHSCQaq7hKSlocKBCiXPwHTyVzbdYzD4QN2vWA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=AbYE66I6/l2E7NtJrhDM5QakoPsSpm8HVkVrm+wsxAkaBhaSho13mYHM1JkPxHPGVXzwgDTjMBwJf/5mRqbei8BotaB1d9W6KuxGGplkf38Rd7XlA/TSGinqQEkI9mCN1ta09G5TFOxgKpwKwaXoLZPfVRvygs8oH8X1RhaZwLA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MlJQJE9S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MlJQJE9S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3979AC433C7; Tue, 27 Feb 2024 09:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709025887; bh=nRhSXkHSCQaq7hKSlocKBCiXPwHTyVzbdYzD4QN2vWA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MlJQJE9SAyEXCNaj2L/4R2vf5OVfDQlJU+S2DHAwF5zULcTae7xCZiLRbyGTmCwaa 1/rqrqFicvhHR23SDLm9MIYHyqaqM9xvoHX9DhjWbmGXzSOdX0Pf1NdjlQaGG0gMqE P0YZsqdzWBjvw6cdbOF/fVAZI10PX8u0NH4kcj7ZJxg7av0hE5xhqemTYjFK9Xqmbp yp1HEsMt0gAfaeu2jrl5/e6T0tyTECeOp4ozUJlGCxWcbuylfZ6soRUOzqedmNvjdB DmlFF+SSCbitLFojlxlaof+GRoQyyxh1e9PoCjtBw9zADT64Q2uGjStl9S9on0ZWWr tvuzjAfDwm7Rw== From: Roger Quadros Date: Tue, 27 Feb 2024 11:23:51 +0200 Subject: [PATCH v4 4/4] usb: dwc3-am62: add workaround for Errata i2409 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240227-for-v6-9-am62-usb-errata-3-0-v4-4-0ada8ddb0767@kernel.org> References: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> In-Reply-To: <20240227-for-v6-9-am62-usb-errata-3-0-v4-0-0ada8ddb0767@kernel.org> To: Thinh Nguyen , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: nm@ti.com, r-gunasekaran@ti.com, afd@ti.com, b-liu@ti.com, srk@ti.com, francesco@dolcini.it, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Roger Quadros X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2293; i=rogerq@kernel.org; h=from:subject:message-id; bh=nRhSXkHSCQaq7hKSlocKBCiXPwHTyVzbdYzD4QN2vWA=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBl3apMqGm1+GkACNuRhdnWag9WVMqRyI3WZj4ma p1ovgKuEJiJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZd2qTAAKCRDSWmvTvnYw k7YyD/9Atkwmu1zPusaDS+gHdq4hF/+AhfHRq9LaIeAi/RkQ5Io4gtMvQ3fcZUUj3stWI2jQDDf jFlQRPyPRBtzQsqNNa++JlzBm8PUeyTZpNVNwhs7K80iIV+hnDBa5zSIYNslGPa7VVFz/+8h8J2 uSKv+hMF/Oo+AADAxhLV2Xuach+Kk54Lq1NeStrr6qD2mUAF5pUaUZlRpQGYScwIfxGC0W7JW3u aRpbSW03T1riLcaKEt0FvfZpevQTRnc1IoEvwiRpWFJ8/eSaLCn/6AeCm65J1vhpM19P94h2oVU DuKY2qau4e82wkZdptO3Mqwqqr8riMkt2MZKinx9iCKbQMHd0LILa5wfmahpf3Aazh4z50SvW4E tN21qTROhGSxb295jQdhMmZVk+4voxmDY8yaP+Viuzd/RCdGHfKVBreEpvU1PJ5+p74ajLhDtlg 48h7ygOs/qbKYSpPz+x12Nnm+uwXhxHaHrHUii+U7/4OGvSYlBvo6R6NFYJD5qs3L4lg3RZymyD yysvaZJwDGH2J0sFstawEoEgc/cz/2EFVn5CFJ1Y/i8Ckk6OFPQisOHqpcIclvvWfXFkH0BOONX 8NraNhqdWEa2MZrc8c3RrkxqLHTzm8Wco17wHP6lcOG//5UjfoZyv3bkiqbN0PN1IYz5m9/MtxE uP8cgNOF/i1NzGA== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 All AM62 devices have Errata i2409 [1] due to which USB2 PHY may lock up due to short suspend. Workaround involves setting bit 5 and 4 PLL_REG12 in PHY2 register space after USB controller is brought out of LPSC reset but before controller initialization. Handle this workaround. [1] - https://www.ti.com/lit/er/sprz487d/sprz487d.pdf Signed-off-by: Roger Quadros Acked-by: Thinh Nguyen --- Changelog: v4: Added Acked-by v3: move requesting of PHY2 region to right where we need it v2: don't add phy read/write helpers or add phy to private data v1: https://lore.kernel.org/all/20240201121220.5523-5-rogerq@kernel.org/ --- drivers/usb/dwc3/dwc3-am62.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 09b1f5a1c4fb..fad151e78fd6 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -101,6 +101,11 @@ #define PHY_CORE_VOLTAGE_MASK BIT(31) #define PHY_PLL_REFCLK_MASK GENMASK(3, 0) +/* USB PHY2 register offsets */ +#define USB_PHY_PLL_REG12 0x130 +#define USB_PHY_PLL_LDO_REF_EN BIT(5) +#define USB_PHY_PLL_LDO_REF_EN_EN BIT(4) + #define DWC3_AM62_AUTOSUSPEND_DELAY 100 struct dwc3_am62 { @@ -184,8 +189,9 @@ static int dwc3_ti_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *node = pdev->dev.of_node; struct dwc3_am62 *am62; - int i, ret; unsigned long rate; + void __iomem *phy; + int i, ret; u32 reg; am62 = devm_kzalloc(dev, sizeof(*am62), GFP_KERNEL); @@ -227,6 +233,17 @@ static int dwc3_ti_probe(struct platform_device *pdev) if (ret) return ret; + /* Workaround Errata i2409 */ + phy = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(phy)) { + dev_err(dev, "can't map PHY IOMEM resource. Won't apply i2409 fix.\n"); + phy = NULL; + } else { + reg = readl(phy + USB_PHY_PLL_REG12); + reg |= USB_PHY_PLL_LDO_REF_EN | USB_PHY_PLL_LDO_REF_EN_EN; + writel(reg, phy + USB_PHY_PLL_REG12); + } + /* VBUS divider select */ am62->vbus_divider = device_property_read_bool(dev, "ti,vbus-divider"); reg = dwc3_ti_readl(am62, USBSS_PHY_CONFIG);