From: David Virag <virag.david003@gmail.com>
To: "Vinod Koul" <vkoul@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Alim Akhtar" <alim.akhtar@samsung.com>,
"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
"Chanwoo Choi" <cw00.choi@samsung.com>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Thinh Nguyen" <Thinh.Nguyen@synopsys.com>,
"Peter Griffin" <peter.griffin@linaro.org>,
"André Draszik" <andre.draszik@linaro.org>,
"Sam Protsenko" <semen.protsenko@linaro.org>,
"David Virag" <virag.david003@gmail.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org
Subject: [PATCH 11/13] phy: exynos5-usbdrd: support Exynos7885 USB PHY
Date: Sun, 4 Aug 2024 23:53:56 +0200 [thread overview]
Message-ID: <20240804215458.404085-12-virag.david003@gmail.com> (raw)
In-Reply-To: <20240804215458.404085-1-virag.david003@gmail.com>
The Exynos7885 SoC has an Exynos USB PHY that theoretically supports
USB3 SuperSpeed, but all known devices using it only have USB2 and the
vendor driver has USB3 function stubbed out, so we'll only support USB2.
Apart from this mysterius USB3 capability, it's the closest to Exynos850
out of those supported. Unlike other SoCs though, this one doesn't set
the reference clock by default, so we have to set it manually.
For this, create a set_ref_clk_rate property in drvdata that can be set
to a predefined value to set the clockrate to.
Signed-off-by: David Virag <virag.david003@gmail.com>
---
drivers/phy/samsung/phy-exynos5-usbdrd.c | 21 +++++++++++++++++++++
include/linux/soc/samsung/exynos-regs-pmu.h | 3 +++
2 files changed, 24 insertions(+)
diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c b/drivers/phy/samsung/phy-exynos5-usbdrd.c
index df52b78a120b..466c72d8a93c 100644
--- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
+++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
@@ -367,6 +367,7 @@ struct exynos5_usbdrd_phy_drvdata {
int n_clks;
const char * const *core_clk_names;
int n_core_clks;
+ u32 set_ref_clk_rate;
const char * const *regulator_names;
int n_regulators;
u32 pmu_offset_usbdrd0_phy;
@@ -1361,6 +1362,10 @@ static int exynos5_usbdrd_phy_clk_handle(struct exynos5_usbdrd_phy *phy_drd)
return dev_err_probe(phy_drd->dev, -ENODEV,
"failed to find phy reference clock\n");
+ /* Exynos7885 SoC has reference clock unset by default */
+ if (phy_drd->drv_data->set_ref_clk_rate)
+ clk_set_rate(ref_clk, phy_drd->drv_data->set_ref_clk_rate);
+
ref_rate = clk_get_rate(ref_clk);
ret = exynos5_rate_to_clk(ref_rate, &phy_drd->extrefclk);
if (ret)
@@ -1460,6 +1465,19 @@ static const struct exynos5_usbdrd_phy_drvdata exynos7_usbdrd_phy = {
.n_regulators = ARRAY_SIZE(exynos5_regulator_names),
};
+static const struct exynos5_usbdrd_phy_drvdata exynos7885_usbdrd_phy = {
+ .phy_cfg = phy_cfg_exynos850,
+ .phy_ops = &exynos850_usbdrd_phy_ops,
+ .pmu_offset_usbdrd0_phy = EXYNOS7885_PHY_CTRL_USB20,
+ .clk_names = exynos5_clk_names,
+ .n_clks = ARRAY_SIZE(exynos5_clk_names),
+ .core_clk_names = exynos5_core_clk_names,
+ .n_core_clks = ARRAY_SIZE(exynos5_core_clk_names),
+ .regulator_names = exynos5_regulator_names,
+ .n_regulators = ARRAY_SIZE(exynos5_regulator_names),
+ .set_ref_clk_rate = 50 * MHZ,
+};
+
static const struct exynos5_usbdrd_phy_drvdata exynos850_usbdrd_phy = {
.phy_cfg = phy_cfg_exynos850,
.phy_ops = &exynos850_usbdrd_phy_ops,
@@ -1663,6 +1681,9 @@ static const struct of_device_id exynos5_usbdrd_phy_of_match[] = {
}, {
.compatible = "samsung,exynos7-usbdrd-phy",
.data = &exynos7_usbdrd_phy
+ }, {
+ .compatible = "samsung,exynos7885-usbdrd-phy",
+ .data = &exynos7885_usbdrd_phy
}, {
.compatible = "samsung,exynos850-usbdrd-phy",
.data = &exynos850_usbdrd_phy
diff --git a/include/linux/soc/samsung/exynos-regs-pmu.h b/include/linux/soc/samsung/exynos-regs-pmu.h
index ce1a3790d6fb..04ef93625eab 100644
--- a/include/linux/soc/samsung/exynos-regs-pmu.h
+++ b/include/linux/soc/samsung/exynos-regs-pmu.h
@@ -657,6 +657,9 @@
#define EXYNOS5433_PAD_RETENTION_UFS_OPTION (0x3268)
#define EXYNOS5433_PAD_RETENTION_FSYSGENIO_OPTION (0x32A8)
+/* For Exynos7885 */
+#define EXYNOS7885_PHY_CTRL_USB20 (0x674)
+
/* For Tensor GS101 */
#define GS101_SYSIP_DAT0 (0x810)
#define GS101_SYSTEM_CONFIGURATION (0x3A00)
--
2.46.0
next prev parent reply other threads:[~2024-08-04 21:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-04 21:53 [PATCH 00/13] Add USB support to Exynos7885 David Virag
2024-08-04 21:53 ` [PATCH 01/13] dt-bindings: clock: exynos7885: Fix duplicated binding David Virag
2024-08-04 21:53 ` [PATCH 02/13] dt-bindings: clock: exynos7885: Add CMU_TOP PLL MUX indices David Virag
2024-08-04 21:53 ` [PATCH 03/13] dt-bindings: clock: exynos7885: Add indices for USB clocks David Virag
2024-08-04 21:53 ` [PATCH 04/13] dt-bindings: phy: samsung,usb3-drd-phy: Add Exynos7885 support David Virag
2024-08-05 5:46 ` Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 05/13] dt-bindings: usb: samsung,exynos-dwc3: " David Virag
2024-08-05 5:47 ` Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 06/13] clk: samsung: exynos7885: Update CLKS_NR_FSYS after bindings fix David Virag
2024-08-05 5:49 ` Krzysztof Kozlowski
2024-08-05 12:44 ` David Virag
2024-08-05 13:38 ` Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 07/13] clk: samsung: exynos7885: Add missing MUX clocks from PLLs in CMU_TOP David Virag
2024-08-04 21:53 ` [PATCH 08/13] clk: samsung: clk-pll: Add support for pll_1418x David Virag
2024-08-04 21:53 ` [PATCH 09/13] clk: samsung: exynos7885: Add USB related clocks to CMU_FSYS David Virag
2024-08-05 5:50 ` Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 10/13] usb: dwc3: exynos: Add support for Exynos7885 David Virag
2024-08-04 21:53 ` David Virag [this message]
2024-08-05 5:52 ` [PATCH 11/13] phy: exynos5-usbdrd: support Exynos7885 USB PHY Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 12/13] arm64: dts: exynos: Enable USB in Exynos7885 David Virag
2024-08-05 5:52 ` Krzysztof Kozlowski
2024-08-04 21:53 ` [PATCH 13/13] arm64: dts: exynos: exynos7885-jackpotlte: Enable USB support David Virag
2024-08-05 5:45 ` [PATCH 00/13] Add USB support to Exynos7885 Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240804215458.404085-12-virag.david003@gmail.com \
--to=virag.david003@gmail.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=conor+dt@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mturquette@baylibre.com \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).