From patchwork Mon Feb 5 14:12:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13545599 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 A40EC2C18E; Mon, 5 Feb 2024 14:12: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=1707142351; cv=none; b=YjSkxp7p/0O9fhI08kHSAzXRCJ/Z9dj7Qo76cg+FHjbgEUKhDjHxxaW/h6YAk5YO20G/d8dCifbnVrz90MEcgUe0/C6w7S+Ec5k8y8cQjwOE8G9GIV08vAiZexJyJv/FJ6YI8+hX1yRSPdC8XXVKS2hQnyQwpIgmWrr7sbBXXxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707142351; c=relaxed/simple; bh=urtEjxHtQ0tLs7UZipwqHGtE50M7Twxd9Gk6q8wZNtM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EZ0wWP59UQ7iSk0jJfrB7oh3lpIQDOEuXqhw57ETHUYIQnLMcd994svHVHLj2Qwnf24xNrH6wD9BWK6sBSuOhovUigRNI+d1wxiZCp56VKeA0yM3X20ZhENkmUqo7acIGNhxYVrJz0RtLQDFiIxsvGS9SwSXkiRrqR2GSpkzjYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uz8UiBt5; 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="uz8UiBt5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DEE2C43394; Mon, 5 Feb 2024 14:12:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707142350; bh=urtEjxHtQ0tLs7UZipwqHGtE50M7Twxd9Gk6q8wZNtM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uz8UiBt5bRPMD4HwD+/olBGwvQbDaf/0O0BIuMXK2lvtCZzRVcfKhBWO7GjvmHfGd 1cTvJ1gBEB7iRlIinS68oLTnagFFXKL54o+vvQcWKKelUpALVxkD1VBLiuKwkwwhbc jzU2wUfGJ+hWjRJJH2EeHH57OuDjfDfLY42ZXQtVM1INpo4oEI4bMTxhm7Pulj1l0t rzXJzF2nDgV4c8CSXooChGuJshXlWAQnRNCuGSVPzwt2/gzDrR99YEqGlAqWrfx+6u wIZPEhAlFgYLStapgZkjWwVfyq20lXpBs0/oiBPKuvs1aIXHA1p5aoNErdtTvLeMoe K4CqkowwSzQzA== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, afd@ti.com, nm@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH v2 1/5] usb: dwc3-am62: call of_platform_depopulate in .remove() Date: Mon, 5 Feb 2024 16:12:17 +0200 Message-Id: <20240205141221.56076-2-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org> References: <20240205141221.56076-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- Notes: Changelog: v2: no change 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 Mon Feb 5 14:12:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13545600 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 324092C6A9; Mon, 5 Feb 2024 14:12: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=1707142354; cv=none; b=Jw8mftVnWtYmAxK3NUWB9XTTgPRle0dXUe4c47weEa2LDbdZ9cx4KEosPZcB5Ifc20PTL6ta3vtrfJClxyOLMAc7mefR1KVYkBzzLR0AxRMg0MDSBtyBL9+0vHUUgS2qlbgu9Bjdx+oJpIEBXTxow1haVNvy1MalY4WqT1ALubg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707142354; c=relaxed/simple; bh=/rPhwXHZ3xKXpN/7zhU9DA4Kcd5ElnQq+143lheukRc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eVAixK6YpGzKcJsoc3RxN487huaKhYTmcRbfHfo+bGkFA56ZXkdaDkPDeMfEamr/iwyw+zfqC/WZg5+4QZr0xIuLDTzxmW0FRIBD1UNQEZrYtCAUqQZOoJ5P5o+Bsz4O0HfdW29J9Nd5CLVAby+olPfkvO8w1Un91cLOjLk7WAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pwYqA+6Y; 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="pwYqA+6Y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30098C43399; Mon, 5 Feb 2024 14:12:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707142353; bh=/rPhwXHZ3xKXpN/7zhU9DA4Kcd5ElnQq+143lheukRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwYqA+6YbdtPGlEOzoSOtBbozjKAMKFVpTgUyq2t182CXX4m3L3ku1nwv8rM6f1EC cc2VP9Ba5yV6zBxUVaHDUIJhK1n2GvIkxPA3/xeOXQIt35Us/F5YrLZufzQBduQcGR 3Jk0AXGTzC+uNqPDOiOIcLjgZfnkSQTDKqluuY+NqP11kIz5NpwqqsoQ1KPHnmmnsO +ROL2ckwH+vT1/GZFgNxLvn+4zpSU/bcsxySENz/mA9Dhgwe9TWp9SHPkCm3wb2lfj Z0qBxZTo3E1GXzgLBhOK2eoiFpgb2udzaMQBNNdh0ksEDGEXXpPAumvC2FZYBmUv73 pjH/1msR7nsrw== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, afd@ti.com, nm@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH v2 2/5] usb: dwc3-am62: fix error on module removal Date: Mon, 5 Feb 2024 16:12:18 +0200 Message-Id: <20240205141221.56076-3-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org> References: <20240205141221.56076-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- Notes: Changelog: v2: no change 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 Mon Feb 5 14:12:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13545601 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 0B2F82CCD6; Mon, 5 Feb 2024 14:12: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=1707142357; cv=none; b=dwlVGXVSUPlk6I3tpjOJR1KomVevWuCo+6H4ZfcDtvgrYjCawDSrzDLM3ni8wQFOddoOnEodpYJ9Y09VMzH5VWZotbrGQRmLrdZGmCkssaNPc+nsq/YuTon74RvK03kHAofd190cNRuzr/g2geYFV0J0b42hOU2ASIq2r5/pHX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707142357; c=relaxed/simple; bh=S9XKJn2RHODf26m6srBV7+w5C4ie6RweVa74MFrSSxA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HyvXUJwGfwkTC0AZsFDKGbT6B9yz1Q0JdbePq5l+TCA1ZYCIHo+cx1fWQ5po/1TqlM98Toa2xjUSu5RZWOg3K4sg8ouvekd5mq56Pl53Qgn8xW6LZ/P5Wc1OVQ0/M64DCAj/EJJTsGYkYeTHay6CFwv70JlmnuzHeyzFmJCAm3k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DbStuYSg; 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="DbStuYSg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FC35C433F1; Mon, 5 Feb 2024 14:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707142356; bh=S9XKJn2RHODf26m6srBV7+w5C4ie6RweVa74MFrSSxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DbStuYSg62t/WWT1G6IEM5F0zJt80/z/9bkfIwQ4SvcYrR6MsoLnrgBJdGKd4aT8o xuwJEpRpIKyuQs9T+D+kfZuv2zq4Gnd50nQZuBkTgj29F807nCrTYaa7htVmmC+7GO 1pmw0MdwtIYaxOEWjoMV7fliIdfhrz4MwdySohwq5dFHPku5kpSuwbFkloCQpyiSZV ibOZ7BQ2CbDKY2kFGElNXZ9cfu6br+l686Pb/Ons7Xyt+F0MyzsbIpb+XPRFXn6C9N t+qFKwSF1sGlmSPZe1yxNJtQs+Q2uxBfdIp91HMdHB7yim2W102QJJpCGgTvJEIjbl 9cclPjZ8ojutA== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, afd@ti.com, nm@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH v2 3/5] usb: dwc3-am62: Fix PHY core voltage selection Date: Mon, 5 Feb 2024 16:12:19 +0200 Message-Id: <20240205141221.56076-4-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org> References: <20240205141221.56076-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- Notes: Changelog: 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 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 Mon Feb 5 14:12:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13545602 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 B94962DF9C; Mon, 5 Feb 2024 14:12: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=1707142360; cv=none; b=QSM6yznwJSvxnwy9E2wuce3ph2AENXXtv1af+iAyZGATESRMkUmneQO00FZVoikoYJdGI76RO2gbwgAZ8donAPZJjPj9LHF+QWI4rCo3cwIh529AbI/7kZyQ342gg/+jh41ptfBrLTfR9Oc2CPZl3taGI1ziMKFGodkWteuQfqw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707142360; c=relaxed/simple; bh=UaF9stSQq/i7PAh9QAvHKjDgSTByGyBL3jN4QH2nFhI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eT4UcnUCH+7ziaFFpt0V6gFijSIvmat2R5EN78Zl1iuFrIR+CDhq0YCvd+9kpzkgsHSli0/DgZACVIScHoW4meOnXjoBOVz4pExqlxxIqrvunulBEMckbR6HXeXZsT9hk2Na74EhrrQurjlTzXG/SybjDFAJDZbR8zxXOdSZr/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lu076dhi; 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="lu076dhi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F84EC43390; Mon, 5 Feb 2024 14:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707142360; bh=UaF9stSQq/i7PAh9QAvHKjDgSTByGyBL3jN4QH2nFhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lu076dhi2j+OqgTuT2dkoP933tZGc8LJCDmZ0o0gbgiBRnLgaZJESaRRV9QPPFCQM go7dEcV/hV/1YTeOK5EDZqjo5khm7bSO5rVnLAsP59sd+XLp5/JB4KRxJYvkSzT4aR R8xNLFgtzLfgf7HgFotYzuBGEDCIJzDnaZRQlQaGpJmXsdRqnXDeFonnn+vfIVMT9W R9Hu4OFjnNAOMpxQXLawafu5BGcMXZb6EXqVTj4XOVA6FnS2Uc49zxulmuLLgTOZba pNvjf3N0a9BDqrSlGcWL2X1Xdj5OMjETxMvJPifWg3TNADkL64sy1Oc0omdBacLz/F Hzb+yG9LJNZQg== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, afd@ti.com, nm@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH v2 4/5] dt-bindings: usb/ti,am62-usb.yaml: Add PHY2 register space Date: Mon, 5 Feb 2024 16:12:20 +0200 Message-Id: <20240205141221.56076-5-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org> References: <20240205141221.56076-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Signed-off-by: Roger Quadros --- Notes: Changelog: v2: add minItems and update commit log 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 Mon Feb 5 14:12:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 13545603 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 5035F32C93; Mon, 5 Feb 2024 14:12: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=1707142364; cv=none; b=VODbLqgIY37TzxNhc+iW5n/gawAz+zgkTeBpO0Y6ykfL9llyC6JDgna1E5VeNdTh55ezyukZiFY0SYvpjTD3pO1ClMuY6jl+Xd1be2PP4AZm6DDW4rvBq9/CvUZn88Yo9pmJScRnTCvumXTWs3VkYyiJwz8mlQ50nloxGlsSOMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707142364; c=relaxed/simple; bh=h/Wjhl4phEKjtwys+YLS96BL5IrD+pUdM1DisLakQwI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=j5+VoSisPhSP/p1AsV0azcolmmDJ1JqejGpkiBVObtz1kLIq1YcMkZMzy+76gMO7eMe1/xjKIXuBrDta8J0nNycXzetmkPTABtiV1SpgCK+AvMHlewsGJAGQTkndKPQLksGSM2Fh/+75oyggAUzv9/fMV32K0N1A6gHswlNJblo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gd8iKo+q; 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="Gd8iKo+q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1439C433A6; Mon, 5 Feb 2024 14:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707142363; bh=h/Wjhl4phEKjtwys+YLS96BL5IrD+pUdM1DisLakQwI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gd8iKo+qWSY0wR4esH/qgfx2hrvkVTjGhH9Nz/yHmqLI4WTGVETLnqOsTpUmRaMKJ qoHQuQnZ5DGIU+WhQEDoOJWvdnUDz+EDBOcttpoIlIrzLJdfO/hiXJdp/VhkwhyPVH YWb5skYGzrfu56Qx1e52hPecq5mK777xKqViQ/zcrcOgR/N934Cw1R0Ho7diN/RMHc kURZj6+Hlkgcg8sGbDafscm4LoxHvXx4rEvKkdIoSDLOBq1CRO/ZHoPJVcx/bTNbNP PU/EEf+jVoLYUraguGBbgfvs9FXyiLvbVOp7ZGQx85WU5nL5BT9qyuz8af47v73Eq+ Vzphk47VCKxOg== From: Roger Quadros To: Thinh.Nguyen@synopsys.com Cc: gregkh@linuxfoundation.org, r-gunasekaran@ti.com, b-liu@ti.com, afd@ti.com, nm@ti.com, srk@ti.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros , Rob Herring , Krzysztof Kozlowski , Conor Dooley Subject: [PATCH v2 5/5] usb: dwc3-am62: add workaround for Errata i2409 Date: Mon, 5 Feb 2024 16:12:21 +0200 Message-Id: <20240205141221.56076-6-rogerq@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240205141221.56076-1-rogerq@kernel.org> References: <20240205141221.56076-1-rogerq@kernel.org> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: Conor Dooley Signed-off-by: Roger Quadros --- Notes: Changelog: 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 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/dwc3-am62.c b/drivers/usb/dwc3/dwc3-am62.c index af1ce934e7fb..5ae5c3087b0f 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); @@ -201,6 +207,12 @@ static int dwc3_ti_probe(struct platform_device *pdev) return PTR_ERR(am62->usbss); } + 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; + } + am62->usb2_refclk = devm_clk_get(dev, "ref"); if (IS_ERR(am62->usb2_refclk)) { dev_err(dev, "can't get usb2_refclk\n"); @@ -227,6 +239,13 @@ static int dwc3_ti_probe(struct platform_device *pdev) if (ret) return ret; + /* Workaround Errata i2409 */ + if (phy) { + 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);