blob: ef3b3a61621165336d12ff1f6485d77e2e4098a5 [file] [log] [blame]
developer5d148cb2023-06-02 13:08:11 +08001From a977dbd79bc888d32fb974f328efa650722590c2 Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:26 +0800
4Subject: [PATCH]
5 [high-speed-io][999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch]
developer8cdcb262022-10-27 14:36:15 +08006
developer8cdcb262022-10-27 14:36:15 +08007---
developer5db5a612022-10-29 11:48:11 +08008 drivers/phy/mediatek/phy-mtk-tphy.c | 37 +++++++++++++++++++++++++++++
9 1 file changed, 37 insertions(+)
developer8cdcb262022-10-27 14:36:15 +080010
11diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
developer5d148cb2023-06-02 13:08:11 +080012index 149464f37..e7ed93799 100644
developer8cdcb262022-10-27 14:36:15 +080013--- a/drivers/phy/mediatek/phy-mtk-tphy.c
14+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
developer5d148cb2023-06-02 13:08:11 +080015@@ -221,6 +221,14 @@
developer8cdcb262022-10-27 14:36:15 +080016 #define P3D_RG_RXDET_STB2_SET_P3 GENMASK(8, 0)
17 #define P3D_RG_RXDET_STB2_SET_P3_VAL(x) (0x1ff & (x))
18
19+#define U3P_U3_PHYD_REG19 0x338
20+#define P3D_RG_PLL_SSC_DELTA1 GENMASK(15, 0)
21+#define P3D_RG_PLL_SSC_DELTA1_VAL(x) (0xffff & (x))
22+
23+#define U3P_U3_PHYD_REG21 0x340
24+#define P3D_RG_PLL_SSC_DELTA GENMASK(31, 16)
25+#define P3D_RG_PLL_SSC_DELTA_VAL(x) ((0xffff & (x)) << 16)
26+
27 #define U3P_SPLLC_XTALCTL3 0x018
28 #define XC3_RG_U3_XTAL_RX_PWD BIT(9)
29 #define XC3_RG_U3_FRC_XTAL_RX_PWD BIT(8)
developer5d148cb2023-06-02 13:08:11 +080030@@ -378,6 +386,8 @@ struct mtk_phy_instance {
developer5db5a612022-10-29 11:48:11 +080031 int eye_vrt;
32 int eye_term;
33 bool bc12_en;
34+ bool u3_pll_ssc_delta;
35+ bool u3_pll_ssc_delta1;
36 };
37
38 struct mtk_tphy {
developer5d148cb2023-06-02 13:08:11 +080039@@ -520,6 +530,20 @@ static void u3_phy_instance_init(struct mtk_tphy *tphy,
developer8cdcb262022-10-27 14:36:15 +080040 tmp |= P3D_RG_RXDET_STB2_SET_P3_VAL(0x10);
41 writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RXDET2);
42
developer5db5a612022-10-29 11:48:11 +080043+ if (instance->u3_pll_ssc_delta1) {
44+ tmp = readl(u3_banks->phyd + U3P_U3_PHYD_REG19);
45+ tmp &= ~P3D_RG_PLL_SSC_DELTA1;
46+ tmp |= P3D_RG_PLL_SSC_DELTA1_VAL(0x1c3);
47+ writel(tmp, u3_banks->phyd + U3P_U3_PHYD_REG19);
48+ }
developer8cdcb262022-10-27 14:36:15 +080049+
developer5db5a612022-10-29 11:48:11 +080050+ if (instance->u3_pll_ssc_delta) {
51+ tmp = readl(u3_banks->phyd + U3P_U3_PHYD_REG21);
52+ tmp &= ~P3D_RG_PLL_SSC_DELTA;
53+ tmp |= P3D_RG_PLL_SSC_DELTA_VAL(0x1c3);
54+ writel(tmp, u3_banks->phyd + U3P_U3_PHYD_REG21);
55+ }
developer8cdcb262022-10-27 14:36:15 +080056+
57 dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
58 }
59
developer5d148cb2023-06-02 13:08:11 +080060@@ -952,6 +976,19 @@ static void phy_parse_property(struct mtk_tphy *tphy,
developer5db5a612022-10-29 11:48:11 +080061 {
62 struct device *dev = &instance->phy->dev;
63
64+ if (instance->type == PHY_TYPE_USB3) {
65+ instance->u3_pll_ssc_delta =
66+ device_property_read_bool(dev,
67+ "mediatek,usb3-pll-ssc-delta");
68+ instance->u3_pll_ssc_delta1 =
69+ device_property_read_bool(dev,
70+ "mediatek,usb3-pll-ssc-delta1");
71+
72+ dev_dbg(dev, "u3_pll_ssc_delta:%i, u3_pll_ssc_delta1:%i\n",
73+ instance->u3_pll_ssc_delta,
74+ instance->u3_pll_ssc_delta1);
75+ }
76+
77 if (instance->type != PHY_TYPE_USB2)
78 return;
79
developer8cdcb262022-10-27 14:36:15 +080080--
developer5d148cb2023-06-02 13:08:11 +0800812.34.1
developer8cdcb262022-10-27 14:36:15 +080082