From patchwork Wed Feb 14 09:46:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13556222 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 23150168D9; Wed, 14 Feb 2024 09:48:30 +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=1707904110; cv=none; b=SFBnDTIdH3pDuAAg65K3HrTfYqP+wm19uwc7+fSLpsKGLiuVhYpUywaFV/R6AlgcgJ3a6j49bcJopM/I8O6qKsk6B1FG8/s8A2/ySh6sHkrP4i/y7CeDjFXXPcQOeoCL+yViI8xdqZXSEvaHUm1LY7RZLRn+8biE1orscyRY4fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904110; c=relaxed/simple; bh=+YQjj12fvrN7EjejQqd3eEjgJcWm5h707zbaTCa9ejU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ajPFk7snkWzm4NEUqh+2Arg8p+uqq7jwbnJ9LtDd/GDEoUO/S3xC1MqVCuIT0Q+/VJEn7zoNWMo1gv4IrRC6PChmBJ3NrG0WCqhiMMJBMzolZ6sz2E5G0FhH3TLchEarUdrVq2NmQy+l+mItzkNpWGS/5Ifdwqomsh/8nh1VrdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bKjmJTUQ; 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="bKjmJTUQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFFB8C43394; Wed, 14 Feb 2024 09:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904110; bh=+YQjj12fvrN7EjejQqd3eEjgJcWm5h707zbaTCa9ejU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bKjmJTUQj2yBIN2wpUGr14Yr6l0OUDmUSV8BPyGagMMqITK75ZRI/L4M0OWxneqe+ B1bjStVSwuHQKGyN6zj1JMlVsXPmcuk94z8Moli5VgK83vpms+JUt74IMJmbJCf5uo RBMDEv8o7I3h6Ot5OkNgLxVchHYguAjlxYl5v1mTW+R1bQs02jAPYlz4Q/8H4MM97n ijF/gOHMaGObKSnURWyf4vBjfV+7UnfRCGShM0EVIIfY1HKJnMXDB8TM8YMrRNw4/H q0eMuM3Hyt8S5uZ4Ra5Rs4cFIfwNaDtblleUvTMPshOng+4NDTxFpn1nHRgmTx5YAL 8+DIS37FicCfQ== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:45 +0200 Subject: [PATCH v3 1/5] usb: dwc3-am62: call of_platform_depopulate in .remove() Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-for-v6-9-am62-usb-errata-3-0-v3-1-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@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=1353; i=rogerq@kernel.org; h=from:subject:message-id; bh=+YQjj12fvrN7EjejQqd3eEjgJcWm5h707zbaTCa9ejU=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxm/mKZq8OtOjZItcAd8wThW9h0JFYQc7raM yf82a5YMiSJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k8SPEACEmoUKIWlvznsye4hkR7g9jVgwtch++eLoryntJwaU3XU6RhkzquPaZr/dKLparniV2ON 0tjnxNu/KtJXw+HbNbtYRskkO9FfXTHQK4n80LmicbxNM7c8BsYyUAHxuc5NdNuGUduQw6Py+jO iPGQGc0n7Id1qYQ12lT6WCDq8XV/eAldvo5ovEx1FLSW3Axilp2Z00nrviSIm2kh1T6Gm8bih98 Bsu8OFgzJTOkMmsXf2o1w/UcyVK+2GSJgW87ccabJSzlH/aAg4rENXhmyJuLDF2v0kOtiHTjF3+ UsYrcrdHQdD0UIif4BPlAHsXGYwu1ZbnqeUOeHm0WiEUHMNu19Mr4jngVQbVaijhGFFfWVMnGRN aZUQmPKtLHiq9lxIlETSmnNHXmx3e63X1nwQuv2wAz/9MoQuqiMYtk+9fKD1bmPK4vWw3FNi3IB BP7igbzLcGc7lfJuayfRC0itrRoJCfHY9ovPUtUeFNLgjllr86WB/CH+9jA10C3U4MArTZFkyg0 CsXBgsB40hAg7m/3iRIsmw/8PmyhcZHLa3HLEmz4uuODi4EJJTm5mbetHBJePv3weM7jLci1Fkv ADdu/aHUDcGiiUiXEL4ziWDA0/OrIh7OLfL2mmmIRHmnhuRxUYCpPZ1j0rabcGMq4ufNUKYSCAa k2VVCawk/gknC2Q== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 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(). Signed-off-by: Roger Quadros Acked-by: Thinh Nguyen --- Changelog: v3: no change v2: no change https://lore.kernel.org/all/20240205141221.56076-2-rogerq@kernel.org/ v1: https://lore.kernel.org/all/20240201121220.5523-2-rogerq@kernel.org/ --- drivers/usb/dwc3/dwc3-am62.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 90a587bc29b7..1bfc9e67614f 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -267,21 +267,13 @@ 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); + of_platform_depopulate(dev); /* Clear mode valid bit */ reg = dwc3_ti_readl(am62, USBSS_MODE_CONTROL); From patchwork Wed Feb 14 09:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13556223 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 49FC7134B7; Wed, 14 Feb 2024 09:48:33 +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=1707904114; cv=none; b=Sr3NYNxq3w0poUbjr6FoJVEka2ZB9JlzWo+wR0+VO2a2nC6idHOf+KJlwkmqkxsFbmzAB2E2/1upWfSpWCRHGo+KeyMLySN1x5DC9Ey/hnJURWyPEyEF0ulQWIfFUjzQqhxnjf+2R6/33NCcFlsZy0Gd6IELgnffNqiG+Fd2UgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904114; c=relaxed/simple; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uWNsOqT3ii+ra9H2TymC8JpFjYGWcX39yDUc+o0CIv7sgbG7M6uC/2anaGgJgSUnGeT6XnQRMZnRgQvm0Us1mPEQfNnPY4yJZWtt6rVZ4i0l3nVkJQoYJATrnPSgIs2IRiwqE8TQTyk8c5hZviF0flWOLccL/F/KSLCdlmBSBS4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c8c+f7gA; 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="c8c+f7gA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73BBEC433C7; Wed, 14 Feb 2024 09:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904113; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=c8c+f7gAoInFPPuMVB4yAtDaQAsBeQMYAs1JZDObosYWgmk6ShzYpJeNLtasQJkPH 5GZqqFx0ZokEJUKJsNIon6mxzdy8buXVPDmy6gpzo53reFivF1XJMgn3nSYpgZj76L DkJ/DA3Y5g4Wg3ksoLXBz2f/SWar0SCM62zmJnvm9XBbWCrH1IAj300Gx8dh2qh/Ol iMLV3SLaZ5JcsaHjUpmOgOPyX+UkgbQSs3/4bjZZYLqSVtx/tjh99t8ZWIo30RgU6t TaowW00cSEOT9nTSNRjiXati2xRUenFmUqvsXiV0raQYHQjELbxshpOv1WGb/LNN6v XqS6wQxJMvq8A== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:46 +0200 Subject: [PATCH v3 2/5] usb: dwc3-am62: fix error on module removal Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-for-v6-9-am62-usb-errata-3-0-v3-2-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@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=1664; i=rogerq@kernel.org; h=from:subject:message-id; bh=X6q1RJmRQMsVDI4YiUe1YyTnSAgbGDQ417oRLZK4lXI=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxm+plz9xtRjCi0mKOJqe+jko1TMnexVm8D4 lVjylqMW36JAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k7LDD/0aKob4z9hUZeVJF/q1v63kbVkPai6rpB8aVtdKAK7hM2JeVP57ozvkWCIryJJ4I13aV2d cQV/C+ivi4BluDvr+zPm9PtddmGfuF390+KyfwM6BRwwZBag3IKQtPRv14Q/HXTfp6iXgZQvAQI xYWuRBxojnoQDL4i7X5CzdF1XImo/4PymMnZS/BGaAk7aV6o+vL2lZqlYlqJFv6bMLB3AtCIL6x 56Yvxb8lfCrrBaZ455mKCO5kMS9WRw+MoNCJZ6RYGwe97L1rD4foauUK1QzIs9wB6+Tr9NyuHki 92quRgRF+axVYAmA6s0L1bj2nuvEnfCFOBbN0kGuxCM1dTTuyR1ZorR/vKxxQweIew0qWbeKwdE nOHs8UWZhoiVs9DdTsuBcGzdzTVcVPAPkgwxZ8nAmAATCe7+D4RFH2thsKqDVUgW/3EJzyfXlf7 2a6WtfIGgVA897S2A5mvPx0zErxkrYO+E5CEtbYSZe/yIfL626Ajy1ZruMwSJW61dxxHj0v9eD7 pE3Gee2tInjDs2Ag3HMnSPwFbven8qDKuvop0S0nCaDv138wt19ot7D9Z1O7ssSTwmkTtFEs5Lu 0s99/fqcz53OgrH4UOh3crXi9ezqypu3WIYZTAFcnwtzeY6Q/w+ZVQp+aCqdADij0M6VtcQOwRr QGrpEfxBdSIn+Cw== 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 Signed-off-by: Roger Quadros Acked-by: Thinh Nguyen --- Changelog: v3: no change v2: no change https://lore.kernel.org/all/20240205141221.56076-3-rogerq@kernel.org/ v1: https://lore.kernel.org/all/20240201121220.5523-3-rogerq@kernel.org/ --- drivers/usb/dwc3/dwc3-am62.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index 1bfc9e67614f..600ba9cfefea 100644 --- a/drivers/usb/dwc3/dwc3-am62.c +++ b/drivers/usb/dwc3/dwc3-am62.c @@ -273,6 +273,11 @@ static void dwc3_ti_remove(struct platform_device *pdev) struct dwc3_am62 *am62 = platform_get_drvdata(pdev); u32 reg; + pm_runtime_get_sync(dev); + + device_wakeup_disable(dev); + device_set_wakeup_capable(dev, false); + of_platform_depopulate(dev); /* Clear mode valid bit */ @@ -281,7 +286,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 Wed Feb 14 09:46:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13556224 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 109591863B; Wed, 14 Feb 2024 09:48:37 +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=1707904118; cv=none; b=CNUFq5sPrad3Y2PUNnSdJavFU1NF3q3KphYTMshw1cbhx5xosOLyXmWl7bAn8YraNwSmFXnkKkdmyppYGafMVyw0KHWXXy7vuImESB3Ci8krk7Ib2TzPm7wQu7xstoheWYdEZJUMLrl3KSzhu8shsliqKZiqECSdWJ9YVRYTQNs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904118; c=relaxed/simple; bh=jyYmSrgq2fdCLWgGVgy9+gpU9CJvUIBFv3KADPN8uts=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ql3r20ODy+CPmuHc8cAa1r9FWHk5rvPrYL6Lv2Iq1+9A7Hh02p4buZu0BJhRsTybnl59ZDHj3txgOvB+hQwf3mVCW+jQMu6hBcJaysfOIQNFW3x4c6dNzeyz8tlz0NIYdB+zl0LGAj1Rwz5SZ3L5zTXO2Rh+DKy5dP/gXzqfILA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uDFZgPSb; 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="uDFZgPSb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C2ADC433F1; Wed, 14 Feb 2024 09:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904117; bh=jyYmSrgq2fdCLWgGVgy9+gpU9CJvUIBFv3KADPN8uts=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uDFZgPSbEm5k3mx27ZY5ed1oi2eB20QMowucxsA2fuwmn1DJSksHdbFFuepBdXCsX 5PIHXC7XHU18sqPjWd18jEv4K5owHIXxdDfduOFEBEwPlM+II+50Svs+h6a9QjKsmS av51FuySmYlWBYAe3TuIui+8AhA/JqkzJ/2iXDDSd+cpkAuIM7A4BuToQTWL6DUTBF Rr/5yj9xk8BANbhc3pylIdEZpcB9c1H405DEcudmJ8UrYm1rhd+zSMHMvL/8prM5t8 RRBTctpLSKAbJGmG6WPHiua/mYL7ggV1yAcPCl3JvR7GVFsA3BCElu4+mkRMDzuMlx mCOIxMvVdRInQ== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:47 +0200 Subject: [PATCH v3 3/5] 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: <20240214-for-v6-9-am62-usb-errata-3-0-v3-3-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@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=1539; i=rogerq@kernel.org; h=from:subject:message-id; bh=jyYmSrgq2fdCLWgGVgy9+gpU9CJvUIBFv3KADPN8uts=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxmwGvMIw/xVB+Dla8X7O0q+r5a7e6aLKOIM n7hUHxFuRaJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k6DKD/0XW5DQ0cDZdTSQd/96rgY16YDvYIGnuBMTDx9gaY0kQTfiZE2xYACRHd4qLW1YaDYFSQI m8g1BVIjKGVrYTS7T8d0cAaNPqw98p/zW+0yIWDdhOWPWtwwjVWcxU7bXdvF3mz6gCyb+xP4F5z OgjkVL5GpBigYsaOM3plHu4+NJbC90P4Kx3NW+G8V6d/6KhmsKVlYTzPh4nVpLKlnYrxBhvOeav eZhPj3E+23aR0aY7+LeWPNIcekDju3xk94f2G/1+NF7d/N18odQdseSGTacfSSKXjZZ+BOf1/Mr 3oV4qn3YVRx7cET9zcgOYC8gKhMTE/4FGkXvDjXjO5xOrzy1AsOtsMASkqtR0fvU00RGnpYGabc sDTJ7Y8f1CjzDtcRCRh4xTmDiCY+E9hxFOqSOQQUjOdzxk+rL8fHwkjC3hE2s2kM4N4wREAyODC XSrDINIu77a6AJ7ryfwN9ALeI64H0ctkoAcemtLB2LLMi1+6k2SpqPGI7T43ly5pES9+6YMIS5P X6ckD7IXnKli6WlxBY01RUfpM0BDOlupxCikMUUHtXQvW7S8slfym+vMJtTvT2BNpVtHV5HfpXi qTr9trE/WF16Ou1YiPsaldxwWDQJ8b24HADaSpTR1QQYQZJ52Id90HW68EFJcbktPH6ZL4JAhwa +KwEdNhrOR4GQ9g== 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: v3: no change v2: no change https://lore.kernel.org/all/20240205141221.56076-4-rogerq@kernel.org/ 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 600ba9cfefea..af1ce934e7fb 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 Wed Feb 14 09:46: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: 13556225 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 A8E7015AE0; Wed, 14 Feb 2024 09:48:41 +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=1707904121; cv=none; b=hyl/PZrKuflTlWKd0CDyjf6Uy0L3JIYTFcLWlnX+LLoHtibvfJWVxtFxWBhgigbY6ljH5yOdSlyhcYDwCCh6FIm07neoLImKz0YkjqoS6/hArHjprf/fmUSCYwkWLb39FFM5WE7C7Z9btPFXwIBI3OqGjssBty9T1s9bXIQ63RQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904121; c=relaxed/simple; bh=8f43hjZKhQSxbAyrgwruozpP6DsOBuauW42V2nrYgss=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IZZHY9Ng2ickmci9Bl5EyncIVKyo8TkTH1qq+IKQf13vQXGEoMLADvAqvSAvH2V5LHgyGHIFJh0/oq8DpoY/RfJJJ7O72YDnbXfVDpjIgKnrVgWADev2JvBGCCUmIfUHFCmpe0uBNpBS425HY6VXY/SUCtOs8tW9x4thV3rjPZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XIsqQB8Z; 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="XIsqQB8Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8D31C4166A; Wed, 14 Feb 2024 09:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904121; bh=8f43hjZKhQSxbAyrgwruozpP6DsOBuauW42V2nrYgss=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=XIsqQB8Zm0Jb+sl8MzSyxBPD8Eg8whH6wzIVgpkROiMsQBvbVmJwWfgPlRvK41Joh SiRCezS21e9wMZVW3URVVt6A544ktyR98mPm4rv5n7oK5+U1jEjSDy7UB5Nhme6nCI 7oCBzC1agE0twgq6euLcWY+4d2+WNaajfdscSwpxGWLvOna/CP86koKF0ux+3gtfik BHMQwZniBt8H/PVdeW8qD6l/lDxjJPbO3zf4XBnK5YzvY4R8v/OYd5Hf4pA1xSaqvu t5KUj/GgSTC0XufCT+thh+SOPc0kzeEsuGVUoasE8F+RLnIlOyS/zBeFJCyP77kErN FvXJ3VjY/L6AQ== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:48 +0200 Subject: [PATCH v3 4/5] dt-bindings: usb/ti,am62-usb.yaml: Add PHY2 register space Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240214-for-v6-9-am62-usb-errata-3-0-v3-4-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@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=1686; i=rogerq@kernel.org; h=from:subject:message-id; bh=8f43hjZKhQSxbAyrgwruozpP6DsOBuauW42V2nrYgss=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxmYoXsUd1qhjCRsCV2AnVfR4rLh2DaufhUP 2AZVhhJvACJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k8A8D/4nqQkxv9A9tnIq1iw1o4H7cxqPMg1c8wIMKgVInqTDAvwobYv/InyRsHWX4ybjtDkRyV2 JIoR1MOnifXaXnsmfqINhVSH3SG3rCWlKmRETIoLcb2gbnJ1msMerYKknhuoo9P2W/d+QP1Vg27 p5hQ4HSWi+a4crUJzJRTj5n8jwlvG9OUxVC40sG3mrDVIYbDhrfCzh9YFu/JhSnCoCXCv1T3UHY f+WGLJHBlG+Ojt+qR+l4UEs8kU1lPsrNlP2r/8Auxf1qBtROPl9sbKmjUyaYwzLFRT3HzckNV+/ 2GOGMOa8ao8YVW5tsIz4xvPLFniHpVhULWLKL5+L4XMCvVq9NQfwtEKiqAWXVw9Lz4k5Af/hfAw 7YdxHe2qw6wlTUB+VnyYSa44hTXt4vbVUJ6eKkWT0KTZ4Qlio7/nimfXYI9yf4Ts32rtGSYWDde Ldgibseb5jZB556MG8MueOjliAo2sSfN0VmoxGNhOHIFQZjlNR/rdkExVrGMJLsX1kHDfdSTD+e NL2+lJX5tlrBiZefAmmTAhmNZjTFq9BLjYdQAZUF9U66GYr//8jq2xPrfKsX/u+2fWws4t7VbEn Doh5sSZ2eC1f+7rh/BZFpVRK3DxPMwzZnpHI96RSvoxByHeFRC7NOJgSJlZ6F016Ljxl/7Wxq8w 4B1Vs1h3y7t8Meg== X-Developer-Key: i=rogerq@kernel.org; a=openpgp; fpr=412165D44C9F52780FAB1058D25A6BD3BE763093 Add PHY2 register space to DT binding documentation. We use minItems: 1 as DT update will come later and we don't want warnings for existing DTs. So far this register space was not required but due to the newly identified Errata i2409 [1] we need to poke this register space. [1] https://www.ti.com/lit/er/sprz487d/sprz487d.pdf Signed-off-by: Roger Quadros Acked-by: Rob Herring --- Changelog: v3: no change v2: add minItems and update commit log https://lore.kernel.org/all/20240205141221.56076-5-rogerq@kernel.org/ v1: was sent as part of different series https://lore.kernel.org/all/20240201120332.4811-5-rogerq@kernel.org/ --- Documentation/devicetree/bindings/usb/ti,am62-usb.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml index fec5651f5602..f6e6d084d1c5 100644 --- a/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml +++ b/Documentation/devicetree/bindings/usb/ti,am62-usb.yaml @@ -14,7 +14,10 @@ properties: const: ti,am62-usb reg: - maxItems: 1 + minItems: 1 + items: + - description: USB CFG register space + - description: USB PHY2 register space ranges: true @@ -82,7 +85,8 @@ examples: usbss1: usb@f910000 { compatible = "ti,am62-usb"; - reg = <0x00 0x0f910000 0x00 0x800>; + reg = <0x00 0x0f910000 0x00 0x800>, + <0x00 0x0f918000 0x00 0x400>; clocks = <&k3_clks 162 3>; clock-names = "ref"; ti,syscon-phy-pll-refclk = <&wkup_conf 0x4018>; From patchwork Wed Feb 14 09:46: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: 13556226 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 7A9971AAC4; Wed, 14 Feb 2024 09:48:45 +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=1707904125; cv=none; b=ndifOT/96zfslGHPgJIL1G0YU5ceB3PDTISfmutopeF6FbHBKSqp8ts//Rd26TtT3A1Qx8Aq2z8CPs2ljH7iA3bt7TpcWUUYZ7EmWO1MWXqTzYRd8IO+rpyTnQzGLyurJX5pTcL71cfCGWkUNBMPoJbfq00DTUbIuSW+8ni3Gb4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707904125; c=relaxed/simple; bh=6PUcC/csq5fQvr9+kVvXnCmkEzTXjd+DEMWwhUxgkws=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q8sK55irtKrB4vPqelG5aPx8P+pg1o4vOyBI7iIActMiSqSrGZUT3PmUlM9dDzRlJebHSr0ODDeNgAX3WmUj1PvhtSEr0QF/t6vgsLeW5MIl2C26+TQv7jww5j1sF3mudQQDzMsg+g1OvEybwpIr2yLS0jIfWaBtZNAb5iicLJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=chg1WU9g; 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="chg1WU9g" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA6B2C433F1; Wed, 14 Feb 2024 09:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707904124; bh=6PUcC/csq5fQvr9+kVvXnCmkEzTXjd+DEMWwhUxgkws=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=chg1WU9g7reS7OYILqKi3gPx1pMQhgI3henHrdOcxfpTLGLTuTsojGDkIP86YnmEz ItVPNspOxNeUHlAgvM83atKQ2+dcNBUc+bj80YnuAkA5eGXaDo0TQvR8EtVLumGVwn LSO50gTuLiL4iKmixcS3ZlZ2hf6WwvD6IiZfhkSlUtM+VFEkm05x1wpZEQmy8FN57U QzbhNF7aXKI3LxQnu0T/M9gb/0dM0fEcBVzFkDB7KB4dl7+t2+Sk0JNo8N0BKHiEAT mH6qPWo7Ck3Uvddya/w9GXsNnamZIcklmzz6Sqsp1uY/YuH4DfK5g2Rxj666/aIJqB E+HVeu8QoaPQQ== From: Roger Quadros Date: Wed, 14 Feb 2024 11:46:49 +0200 Subject: [PATCH v3 5/5] 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: <20240214-for-v6-9-am62-usb-errata-3-0-v3-5-147ec5eae18c@kernel.org> References: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@kernel.org> In-Reply-To: <20240214-for-v6-9-am62-usb-errata-3-0-v3-0-147ec5eae18c@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=2305; i=rogerq@kernel.org; h=from:subject:message-id; bh=6PUcC/csq5fQvr9+kVvXnCmkEzTXjd+DEMWwhUxgkws=; b=owEBbQKS/ZANAwAIAdJaa9O+djCTAcsmYgBlzIxm8KWDYg+HSQTW54dy3G5LJyxK8C/tbzPQW XFtI3WySAeJAjMEAAEIAB0WIQRBIWXUTJ9SeA+rEFjSWmvTvnYwkwUCZcyMZgAKCRDSWmvTvnYw k9VhD/9+X1MeZYthg4izWH39FxY2P5FuMoRsFtyXb5iKBMAxx8mq6JQia5O1+VCXIFvGbNWDMlc sB45Ek//gEFjOH2c+JAEpB4daqAIeTqDWRkXl2Jr0epeF+7/csac2EH41dVOSnCM6GVMizlIGxz /dCzqw/PWMriRQG/hLalRLKeWhHuM8aL+RqmFZWbCbK1eakgfSCWFa1LqlHzR36WBMvlIcbyjjZ I04Im8TjkiB885hYHJeBtpbqgKJfGiWr7xCFfKueWBCcHuA+2FrCz94XwxxqeTaED8xxHTUTO9W HXY+1hssg7Tq8ENXcK+kN7nSPsR1fDdXXFffNKaBvo3daN935jKx5b+WSkkbOsRXz4l4u9Yw8FA TIa1WaaNyEn7jw99VrKaLo4LqjT3lYPH6GKr2dOg0UEQl1eYTDMH/wOI4Y8cHXkvXoQOTjgW4Ge TsTBXe2GQQg0CpnfTT0q4rQDcj332wR4sdzJmMKO4U1uucowNcQ6BU1wiLEa7E9rAw+ZJ5TqB2x Guv4VXqqcll2FXglJQKo3gl2y4IVR29qHCqB/+OHNRfepx5ut75Dw/up5WHFe6sDUzTwvuClEQw x3i8qiA2kPBYSvTmc14Ng8/aUDYM0dhAQ3TOCsc1QE//I5+Uj1wYO0iNKlj7O8SkvMFe7bJfhxk zR/QQh1hRNvHDog== 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: 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 https://lore.kernel.org/all/20240205141221.56076-5-rogerq@kernel.org/ 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 af1ce934e7fb..163278050595 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);