Merge tag 'phy-for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy

Pull phy updates from Vinod Koul:
"Lots of Qualcomm and Rockchip device support.

New Support:
- Qualcomm SAR2130P qmp usb, SAR2130P qmp pcie, QCS615 qusb2 and
PCIe, IPQ5424 qmp pcie, IPQ5424 QUSB2 and USB3 PHY
- Rockchip rk3576 combo phy support

Updates:
- Drop Shengyang for JH7110 maintainer
- Freescale hdmi register calculation optimization
- Rockchip pcie phy mutex and regmap updates"

* tag 'phy-for-6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/phy/linux-phy: (37 commits)
dt-bindings: phy: qcom,qmp-pcie: document the SM8350 two lanes PCIe PHY
phy: rockchip: phy-rockchip-typec: Fix Copyright description
dt-bindings: phy: qcom,ipq8074-qmp-pcie: Document the IPQ5424 QMP PCIe PHYs
phy: qcom-qusb2: Add support for QCS615
dt-bindings: usb: qcom,dwc3: Add QCS615 to USB DWC3 bindings
phy: core: Simplify API of_phy_simple_xlate() implementation
phy: sun4i-usb: Remove unused of_gpio.h
phy: HiSilicon: Don't use "proxy" headers
phy: samsung-ufs: switch back to syscon_regmap_lookup_by_phandle()
phy: qualcomm: qmp-pcie: add support for SAR2130P
phy: qualcomm: qmp-pcie: define several new registers
phy: qualcomm: qmp-pcie: split PCS_LANE1 region
phy: qualcomm: qmp-combo: add support for SAR2130P
dt-bindings: phy: qcom,sc8280xp-qmp-pcie-phy: Add SAR2130P compatible
dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add SAR2130P compatible
phy: freescale: fsl-samsung-hdmi: Clean up fld_tg_code calculation
phy: freescale: fsl-samsung-hdmi: Stop searching when exact match is found
phy: freescale: fsl-samsung-hdmi: Expand Integer divider range
phy: rockchip-naneng-combo: add rk3576 support
dt-bindings: phy: rockchip: add rk3576 compatible
...

+920 -169
+1
Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml
··· 13 compatible: 14 enum: 15 - rockchip,rk3568-naneng-combphy 16 - rockchip,rk3588-naneng-combphy 17 18 reg:
··· 13 compatible: 14 enum: 15 - rockchip,rk3568-naneng-combphy 16 + - rockchip,rk3576-naneng-combphy 17 - rockchip,rk3588-naneng-combphy 18 19 reg:
+15 -6
Documentation/devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml
··· 15 16 properties: 17 compatible: 18 - enum: 19 - - qcom,ipq6018-qmp-pcie-phy 20 - - qcom,ipq8074-qmp-gen3-pcie-phy 21 - - qcom,ipq8074-qmp-pcie-phy 22 - - qcom,ipq9574-qmp-gen3x1-pcie-phy 23 - - qcom,ipq9574-qmp-gen3x2-pcie-phy 24 25 reg: 26 items:
··· 15 16 properties: 17 compatible: 18 + oneOf: 19 + - enum: 20 + - qcom,ipq6018-qmp-pcie-phy 21 + - qcom,ipq8074-qmp-gen3-pcie-phy 22 + - qcom,ipq8074-qmp-pcie-phy 23 + - qcom,ipq9574-qmp-gen3x1-pcie-phy 24 + - qcom,ipq9574-qmp-gen3x2-pcie-phy 25 + - items: 26 + - enum: 27 + - qcom,ipq5424-qmp-gen3x1-pcie-phy 28 + - const: qcom,ipq9574-qmp-gen3x1-pcie-phy 29 + - items: 30 + - enum: 31 + - qcom,ipq5424-qmp-gen3x2-pcie-phy 32 + - const: qcom,ipq9574-qmp-gen3x2-pcie-phy 33 34 reg: 35 items:
+1
Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
··· 18 oneOf: 19 - items: 20 - enum: 21 - qcom,ipq6018-qusb2-phy 22 - qcom,ipq8074-qusb2-phy 23 - qcom,ipq9574-qusb2-phy
··· 18 oneOf: 19 - items: 20 - enum: 21 + - qcom,ipq5424-qusb2-phy 22 - qcom,ipq6018-qusb2-phy 23 - qcom,ipq8074-qusb2-phy 24 - qcom,ipq9574-qusb2-phy
+6
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-pcie-phy.yaml
··· 16 properties: 17 compatible: 18 enum: 19 - qcom,sa8775p-qmp-gen4x2-pcie-phy 20 - qcom,sa8775p-qmp-gen4x4-pcie-phy 21 - qcom,sc8180x-qmp-pcie-phy 22 - qcom,sc8280xp-qmp-gen3x1-pcie-phy 23 - qcom,sc8280xp-qmp-gen3x2-pcie-phy ··· 34 - qcom,sm8250-qmp-gen3x2-pcie-phy 35 - qcom,sm8250-qmp-modem-pcie-phy 36 - qcom,sm8350-qmp-gen3x1-pcie-phy 37 - qcom,sm8450-qmp-gen3x1-pcie-phy 38 - qcom,sm8450-qmp-gen4x2-pcie-phy 39 - qcom,sm8550-qmp-gen3x2-pcie-phy ··· 142 compatible: 143 contains: 144 enum: 145 - qcom,sc8180x-qmp-pcie-phy 146 - qcom,sdm845-qhp-pcie-phy 147 - qcom,sdm845-qmp-pcie-phy ··· 153 - qcom,sm8250-qmp-gen3x2-pcie-phy 154 - qcom,sm8250-qmp-modem-pcie-phy 155 - qcom,sm8350-qmp-gen3x1-pcie-phy 156 - qcom,sm8450-qmp-gen3x1-pcie-phy 157 - qcom,sm8450-qmp-gen3x2-pcie-phy 158 - qcom,sm8550-qmp-gen3x2-pcie-phy ··· 172 compatible: 173 contains: 174 enum: 175 - qcom,sc8280xp-qmp-gen3x1-pcie-phy 176 - qcom,sc8280xp-qmp-gen3x2-pcie-phy 177 - qcom,sc8280xp-qmp-gen3x4-pcie-phy
··· 16 properties: 17 compatible: 18 enum: 19 + - qcom,qcs615-qmp-gen3x1-pcie-phy 20 - qcom,sa8775p-qmp-gen4x2-pcie-phy 21 - qcom,sa8775p-qmp-gen4x4-pcie-phy 22 + - qcom,sar2130p-qmp-gen3x2-pcie-phy 23 - qcom,sc8180x-qmp-pcie-phy 24 - qcom,sc8280xp-qmp-gen3x1-pcie-phy 25 - qcom,sc8280xp-qmp-gen3x2-pcie-phy ··· 32 - qcom,sm8250-qmp-gen3x2-pcie-phy 33 - qcom,sm8250-qmp-modem-pcie-phy 34 - qcom,sm8350-qmp-gen3x1-pcie-phy 35 + - qcom,sm8350-qmp-gen3x2-pcie-phy 36 - qcom,sm8450-qmp-gen3x1-pcie-phy 37 - qcom,sm8450-qmp-gen4x2-pcie-phy 38 - qcom,sm8550-qmp-gen3x2-pcie-phy ··· 139 compatible: 140 contains: 141 enum: 142 + - qcom,sar2130p-qmp-gen3x2-pcie-phy 143 - qcom,sc8180x-qmp-pcie-phy 144 - qcom,sdm845-qhp-pcie-phy 145 - qcom,sdm845-qmp-pcie-phy ··· 149 - qcom,sm8250-qmp-gen3x2-pcie-phy 150 - qcom,sm8250-qmp-modem-pcie-phy 151 - qcom,sm8350-qmp-gen3x1-pcie-phy 152 + - qcom,sm8350-qmp-gen3x2-pcie-phy 153 - qcom,sm8450-qmp-gen3x1-pcie-phy 154 - qcom,sm8450-qmp-gen3x2-pcie-phy 155 - qcom,sm8550-qmp-gen3x2-pcie-phy ··· 167 compatible: 168 contains: 169 enum: 170 + - qcom,qcs615-qmp-gen3x1-pcie-phy 171 - qcom,sc8280xp-qmp-gen3x1-pcie-phy 172 - qcom,sc8280xp-qmp-gen3x2-pcie-phy 173 - qcom,sc8280xp-qmp-gen3x4-pcie-phy
+2
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb3-uni-phy.yaml
··· 16 properties: 17 compatible: 18 enum: 19 - qcom,ipq6018-qmp-usb3-phy 20 - qcom,ipq8074-qmp-usb3-phy 21 - qcom,ipq9574-qmp-usb3-phy ··· 90 compatible: 91 contains: 92 enum: 93 - qcom,ipq6018-qmp-usb3-phy 94 - qcom,ipq8074-qmp-usb3-phy 95 - qcom,ipq9574-qmp-usb3-phy
··· 16 properties: 17 compatible: 18 enum: 19 + - qcom,ipq5424-qmp-usb3-phy 20 - qcom,ipq6018-qmp-usb3-phy 21 - qcom,ipq8074-qmp-usb3-phy 22 - qcom,ipq9574-qmp-usb3-phy ··· 89 compatible: 90 contains: 91 enum: 92 + - qcom,ipq5424-qmp-usb3-phy 93 - qcom,ipq6018-qmp-usb3-phy 94 - qcom,ipq8074-qmp-usb3-phy 95 - qcom,ipq9574-qmp-usb3-phy
+2
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml
··· 16 properties: 17 compatible: 18 enum: 19 - qcom,sc7180-qmp-usb3-dp-phy 20 - qcom,sc7280-qmp-usb3-dp-phy 21 - qcom,sc8180x-qmp-usb3-dp-phy ··· 128 properties: 129 compatible: 130 enum: 131 - qcom,sc8280xp-qmp-usb43dp-phy 132 - qcom,sm6350-qmp-usb3-dp-phy 133 - qcom,sm8550-qmp-usb3-dp-phy
··· 16 properties: 17 compatible: 18 enum: 19 + - qcom,sar2130p-qmp-usb3-dp-phy 20 - qcom,sc7180-qmp-usb3-dp-phy 21 - qcom,sc7280-qmp-usb3-dp-phy 22 - qcom,sc8180x-qmp-usb3-dp-phy ··· 127 properties: 128 compatible: 129 enum: 130 + - qcom,sar2130p-qmp-usb3-dp-phy 131 - qcom,sc8280xp-qmp-usb43dp-phy 132 - qcom,sm6350-qmp-usb3-dp-phy 133 - qcom,sm8550-qmp-usb3-dp-phy
-1
MAINTAINERS
··· 22507 22508 STARFIVE JH7110 DPHY TX DRIVER 22509 M: Keith Zhao <keith.zhao@starfivetech.com> 22510 - M: Shengyang Chen <shengyang.chen@starfivetech.com> 22511 S: Supported 22512 F: Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml 22513 F: drivers/phy/starfive/phy-jh7110-dphy-tx.c
··· 22507 22508 STARFIVE JH7110 DPHY TX DRIVER 22509 M: Keith Zhao <keith.zhao@starfivetech.com> 22510 S: Supported 22511 F: Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml 22512 F: drivers/phy/starfive/phy-jh7110-dphy-tx.c
-1
drivers/phy/allwinner/phy-sun4i-usb.c
··· 23 #include <linux/module.h> 24 #include <linux/mutex.h> 25 #include <linux/of.h> 26 - #include <linux/of_gpio.h> 27 #include <linux/phy/phy.h> 28 #include <linux/phy/phy-sun4i-usb.h> 29 #include <linux/platform_device.h>
··· 23 #include <linux/module.h> 24 #include <linux/mutex.h> 25 #include <linux/of.h> 26 #include <linux/phy/phy.h> 27 #include <linux/phy/phy-sun4i-usb.h> 28 #include <linux/platform_device.h>
+20 -27
drivers/phy/freescale/phy-fsl-samsung-hdmi.c
··· 331 { 332 u32 pclk = cfg->pixclk; 333 u32 fld_tg_code; 334 - u32 pclk_khz; 335 - u8 div = 1; 336 337 - switch (cfg->pixclk) { 338 - case 22250000 ... 47500000: 339 - div = 1; 340 - break; 341 - case 50349650 ... 99000000: 342 - div = 2; 343 - break; 344 - case 100699300 ... 198000000: 345 - div = 4; 346 - break; 347 - case 205000000 ... 297000000: 348 - div = 8; 349 - break; 350 } 351 352 - writeb(FIELD_PREP(REG12_CK_DIV_MASK, ilog2(div)), phy->regs + PHY_REG(12)); 353 354 /* 355 * Calculation for the frequency lock detector target code (fld_tg_code) ··· 354 * settings rounding up always too. TODO: Check if that is 355 * correct. 356 */ 357 - pclk /= div; 358 - pclk_khz = pclk / 1000; 359 - fld_tg_code = 256 * 1000 * 1000 / pclk_khz * 24; 360 - fld_tg_code = DIV_ROUND_UP(fld_tg_code, 1000); 361 362 /* FLD_TOL and FLD_RP_CODE taken from downstream driver */ 363 writeb(FIELD_PREP(REG13_TG_CODE_LOW_MASK, fld_tg_code), ··· 396 continue; 397 398 /* 399 - * TODO: Ref Manual doesn't state the range of _m 400 - * so this should be further refined if possible. 401 - * This range was set based on the original values 402 - * in the lookup table 403 */ 404 tmp = (u64)fout * (_p * _s); 405 do_div(tmp, 24 * MHZ); 406 - _m = tmp; 407 - if (_m < 0x30 || _m > 0x7b) 408 continue; 409 410 /* 411 * Rev 2 of the Ref Manual states the ··· 429 min_delta = delta; 430 best_freq = tmp; 431 } 432 } 433 } 434 - 435 if (best_freq) { 436 *p = best_p; 437 *m = best_m;
··· 331 { 332 u32 pclk = cfg->pixclk; 333 u32 fld_tg_code; 334 + u32 int_pllclk; 335 + u8 div; 336 337 + /* Find int_pllclk speed */ 338 + for (div = 0; div < 4; div++) { 339 + int_pllclk = pclk / (1 << div); 340 + if (int_pllclk < (50 * MHZ)) 341 + break; 342 } 343 344 + writeb(FIELD_PREP(REG12_CK_DIV_MASK, div), phy->regs + PHY_REG(12)); 345 346 /* 347 * Calculation for the frequency lock detector target code (fld_tg_code) ··· 362 * settings rounding up always too. TODO: Check if that is 363 * correct. 364 */ 365 + 366 + fld_tg_code = DIV_ROUND_UP(24 * MHZ * 256, int_pllclk); 367 368 /* FLD_TOL and FLD_RP_CODE taken from downstream driver */ 369 writeb(FIELD_PREP(REG13_TG_CODE_LOW_MASK, fld_tg_code), ··· 406 continue; 407 408 /* 409 + * The Ref manual doesn't explicitly state the range of M, 410 + * but it does show it as an 8-bit value, so reject 411 + * any value above 255. 412 */ 413 tmp = (u64)fout * (_p * _s); 414 do_div(tmp, 24 * MHZ); 415 + if (tmp > 255) 416 continue; 417 + _m = tmp; 418 419 /* 420 * Rev 2 of the Ref Manual states the ··· 440 min_delta = delta; 441 best_freq = tmp; 442 } 443 + 444 + /* If we have an exact match, stop looking for a better value */ 445 + if (!delta) 446 + goto done; 447 } 448 } 449 + done: 450 if (best_freq) { 451 *p = best_p; 452 *m = best_m;
+8 -3
drivers/phy/hisilicon/phy-hi3670-pcie.c
··· 16 */ 17 18 #include <linux/bitfield.h> 19 #include <linux/clk.h> 20 - #include <linux/gpio.h> 21 - #include <linux/kernel.h> 22 #include <linux/mfd/syscon.h> 23 #include <linux/module.h> 24 - #include <linux/of_gpio.h> 25 #include <linux/phy/phy.h> 26 #include <linux/platform_device.h> 27 #include <linux/regmap.h> 28 29 #define AXI_CLK_FREQ 207500000 30 #define REF_CLK_FREQ 100000000
··· 16 */ 17 18 #include <linux/bitfield.h> 19 + #include <linux/bits.h> 20 #include <linux/clk.h> 21 + #include <linux/delay.h> 22 + #include <linux/device.h> 23 + #include <linux/err.h> 24 + #include <linux/io.h> 25 #include <linux/mfd/syscon.h> 26 + #include <linux/mod_devicetable.h> 27 #include <linux/module.h> 28 + #include <linux/of.h> 29 #include <linux/phy/phy.h> 30 #include <linux/platform_device.h> 31 #include <linux/regmap.h> 32 + #include <linux/types.h> 33 34 #define AXI_CLK_FREQ 207500000 35 #define REF_CLK_FREQ 100000000
+1 -1
drivers/phy/marvell/phy-mvebu-cp110-comphy.c
··· 422 /* wait until clocks are ready */ 423 mdelay(1); 424 425 - /* exlicitly disable 40B, the bits isn't clear on reset */ 426 regmap_read(priv->regmap, MVEBU_COMPHY_CONF6(lane->id), &val); 427 val &= ~MVEBU_COMPHY_CONF6_40B; 428 regmap_write(priv->regmap, MVEBU_COMPHY_CONF6(lane->id), val);
··· 422 /* wait until clocks are ready */ 423 mdelay(1); 424 425 + /* explicitly disable 40B, the bits isn't clear on reset */ 426 regmap_read(priv->regmap, MVEBU_COMPHY_CONF6(lane->id), &val); 427 val &= ~MVEBU_COMPHY_CONF6_40B; 428 regmap_write(priv->regmap, MVEBU_COMPHY_CONF6(lane->id), val);
+44
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
··· 9 #include <linux/module.h> 10 #include <linux/phy/phy.h> 11 #include <linux/platform_device.h> 12 #include <linux/types.h> 13 #include <linux/units.h> 14 #include <linux/nvmem-consumer.h> ··· 480 return ret; 481 } 482 483 struct mtk_hdmi_phy_conf mtk_hdmi_phy_8195_conf = { 484 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, 485 .hdmi_phy_clk_ops = &mtk_hdmi_pll_ops, 486 .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, 487 .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
··· 9 #include <linux/module.h> 10 #include <linux/phy/phy.h> 11 #include <linux/platform_device.h> 12 + #include <linux/regulator/driver.h> 13 + #include <linux/regulator/of_regulator.h> 14 #include <linux/types.h> 15 #include <linux/units.h> 16 #include <linux/nvmem-consumer.h> ··· 478 return ret; 479 } 480 481 + static int mtk_hdmi_phy_pwr5v_enable(struct regulator_dev *rdev) 482 + { 483 + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); 484 + 485 + mtk_phy_set_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O); 486 + 487 + return 0; 488 + } 489 + 490 + static int mtk_hdmi_phy_pwr5v_disable(struct regulator_dev *rdev) 491 + { 492 + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); 493 + 494 + mtk_phy_clear_bits(hdmi_phy->regs + HDMI_CTL_1, RG_HDMITX_PWR5V_O); 495 + 496 + return 0; 497 + } 498 + 499 + static int mtk_hdmi_phy_pwr5v_is_enabled(struct regulator_dev *rdev) 500 + { 501 + struct mtk_hdmi_phy *hdmi_phy = rdev_get_drvdata(rdev); 502 + 503 + return !!(readl(hdmi_phy->regs + HDMI_CTL_1) & RG_HDMITX_PWR5V_O); 504 + } 505 + 506 + static const struct regulator_ops mtk_hdmi_pwr5v_regulator_ops = { 507 + .enable = mtk_hdmi_phy_pwr5v_enable, 508 + .disable = mtk_hdmi_phy_pwr5v_disable, 509 + .is_enabled = mtk_hdmi_phy_pwr5v_is_enabled 510 + }; 511 + 512 + static const struct regulator_desc mtk_hdmi_phy_pwr5v_desc = { 513 + .name = "hdmi-pwr5v", 514 + .id = -1, 515 + .n_voltages = 1, 516 + .fixed_uV = 5000000, 517 + .ops = &mtk_hdmi_pwr5v_regulator_ops, 518 + .type = REGULATOR_VOLTAGE, 519 + .owner = THIS_MODULE, 520 + }; 521 + 522 struct mtk_hdmi_phy_conf mtk_hdmi_phy_8195_conf = { 523 .flags = CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE, 524 + .hdmi_phy_regulator_desc = &mtk_hdmi_phy_pwr5v_desc, 525 .hdmi_phy_clk_ops = &mtk_hdmi_pll_ops, 526 .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, 527 .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
+3
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.h
··· 103 #define HDMI_ANA_CTL 0x7c 104 #define REG_ANA_HDMI20_FIFO_EN BIT(16) 105 106 #define HDMI_CTL_3 0xcc 107 #define REG_HDMITXPLL_DIV GENMASK(4, 0) 108 #define REG_HDMITX_REF_XTAL_SEL BIT(7)
··· 103 #define HDMI_ANA_CTL 0x7c 104 #define REG_ANA_HDMI20_FIFO_EN BIT(16) 105 106 + #define HDMI_CTL_1 0xc4 107 + #define RG_HDMITX_PWR5V_O BIT(9) 108 + 109 #define HDMI_CTL_3 0xcc 110 #define REG_HDMITXPLL_DIV GENMASK(4, 0) 111 #define REG_HDMITX_REF_XTAL_SEL BIT(7)
+28
drivers/phy/mediatek/phy-mtk-hdmi.c
··· 75 clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; 76 } 77 78 static int mtk_hdmi_phy_probe(struct platform_device *pdev) 79 { 80 struct device *dev = &pdev->dev; ··· 171 172 if (hdmi_phy->conf->pll_default_off) 173 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); 174 175 return of_clk_add_provider(dev->of_node, of_clk_src_simple_get, 176 hdmi_phy->pll);
··· 75 clk_init->ops = hdmi_phy->conf->hdmi_phy_clk_ops; 76 } 77 78 + static int mtk_hdmi_phy_register_regulators(struct mtk_hdmi_phy *hdmi_phy) 79 + { 80 + const struct regulator_desc *vreg_desc = hdmi_phy->conf->hdmi_phy_regulator_desc; 81 + const struct regulator_init_data vreg_init_data = { 82 + .constraints = { 83 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 84 + } 85 + }; 86 + struct regulator_config vreg_config = { 87 + .dev = hdmi_phy->dev, 88 + .driver_data = hdmi_phy, 89 + .init_data = &vreg_init_data, 90 + .of_node = hdmi_phy->dev->of_node 91 + }; 92 + 93 + hdmi_phy->rdev = devm_regulator_register(hdmi_phy->dev, vreg_desc, &vreg_config); 94 + if (IS_ERR(hdmi_phy->rdev)) 95 + return PTR_ERR(hdmi_phy->rdev); 96 + 97 + return 0; 98 + } 99 + 100 static int mtk_hdmi_phy_probe(struct platform_device *pdev) 101 { 102 struct device *dev = &pdev->dev; ··· 149 150 if (hdmi_phy->conf->pll_default_off) 151 hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy); 152 + 153 + if (hdmi_phy->conf->hdmi_phy_regulator_desc) { 154 + ret = mtk_hdmi_phy_register_regulators(hdmi_phy); 155 + if (ret) 156 + return ret; 157 + } 158 159 return of_clk_add_provider(dev->of_node, of_clk_src_simple_get, 160 hdmi_phy->pll);
+4
drivers/phy/mediatek/phy-mtk-hdmi.h
··· 13 #include <linux/module.h> 14 #include <linux/phy/phy.h> 15 #include <linux/platform_device.h> 16 #include <linux/types.h> 17 18 struct mtk_hdmi_phy; ··· 22 struct mtk_hdmi_phy_conf { 23 unsigned long flags; 24 bool pll_default_off; 25 const struct clk_ops *hdmi_phy_clk_ops; 26 void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); 27 void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); ··· 35 struct mtk_hdmi_phy_conf *conf; 36 struct clk *pll; 37 struct clk_hw pll_hw; 38 unsigned long pll_rate; 39 unsigned char drv_imp_clk; 40 unsigned char drv_imp_d2;
··· 13 #include <linux/module.h> 14 #include <linux/phy/phy.h> 15 #include <linux/platform_device.h> 16 + #include <linux/regulator/driver.h> 17 + #include <linux/regulator/machine.h> 18 #include <linux/types.h> 19 20 struct mtk_hdmi_phy; ··· 20 struct mtk_hdmi_phy_conf { 21 unsigned long flags; 22 bool pll_default_off; 23 + const struct regulator_desc *hdmi_phy_regulator_desc; 24 const struct clk_ops *hdmi_phy_clk_ops; 25 void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); 26 void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy); ··· 32 struct mtk_hdmi_phy_conf *conf; 33 struct clk *pll; 34 struct clk_hw pll_hw; 35 + struct regulator_dev *rdev; 36 unsigned long pll_rate; 37 unsigned char drv_imp_clk; 38 unsigned char drv_imp_d2;
+8 -15
drivers/phy/phy-core.c
··· 749 750 /** 751 * of_phy_simple_xlate() - returns the phy instance from phy provider 752 - * @dev: the PHY provider device 753 - * @args: of_phandle_args (not used here) 754 * 755 * Intended to be used by phy provider for the common case where #phy-cells is 756 * 0. For other cases where #phy-cells is greater than '0', the phy provider ··· 760 struct phy *of_phy_simple_xlate(struct device *dev, 761 const struct of_phandle_args *args) 762 { 763 - struct phy *phy; 764 - struct class_dev_iter iter; 765 766 - class_dev_iter_init(&iter, &phy_class, NULL, NULL); 767 - while ((dev = class_dev_iter_next(&iter))) { 768 - phy = to_phy(dev); 769 - if (args->np != phy->dev.of_node) 770 - continue; 771 772 - class_dev_iter_exit(&iter); 773 - return phy; 774 - } 775 - 776 - class_dev_iter_exit(&iter); 777 - return ERR_PTR(-ENODEV); 778 } 779 EXPORT_SYMBOL_GPL(of_phy_simple_xlate); 780
··· 749 750 /** 751 * of_phy_simple_xlate() - returns the phy instance from phy provider 752 + * @dev: the PHY provider device (not used here) 753 + * @args: of_phandle_args 754 * 755 * Intended to be used by phy provider for the common case where #phy-cells is 756 * 0. For other cases where #phy-cells is greater than '0', the phy provider ··· 760 struct phy *of_phy_simple_xlate(struct device *dev, 761 const struct of_phandle_args *args) 762 { 763 + struct device *target_dev; 764 765 + target_dev = class_find_device_by_of_node(&phy_class, args->np); 766 + if (!target_dev) 767 + return ERR_PTR(-ENODEV); 768 769 + put_device(target_dev); 770 + return to_phy(target_dev); 771 } 772 EXPORT_SYMBOL_GPL(of_phy_simple_xlate); 773
+100
drivers/phy/qualcomm/phy-qcom-qmp-combo.c
··· 400 QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), 401 }; 402 403 static const struct qmp_phy_init_tbl sm6350_usb3_rx_tbl[] = { 404 QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b), 405 QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), ··· 1779 .usb3_pcs_usb = 0x1700, 1780 .dp_serdes = 0x2000, 1781 .dp_dp_phy = 0x2200, 1782 }; 1783 1784 static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { ··· 3863 } 3864 3865 static const struct of_device_id qmp_combo_of_match_table[] = { 3866 { 3867 .compatible = "qcom,sc7180-qmp-usb3-dp-phy", 3868 .data = &sc7180_usb3dpphy_cfg,
··· 400 QMP_PHY_INIT_CFG(QPHY_V3_PCS_RXEQTRAINING_RUN_TIME, 0x13), 401 }; 402 403 + static const struct qmp_phy_init_tbl sar2130p_usb3_serdes_tbl[] = { 404 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1, 0x55), 405 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1, 0x0e), 406 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE1, 0x02), 407 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE1, 0x16), 408 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE1, 0x36), 409 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORECLK_DIV_MODE1, 0x04), 410 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE1, 0x2e), 411 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x82), 412 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE1, 0x04), 413 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MSB_MODE1, 0x01), 414 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE1, 0x55), 415 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE1, 0xd5), 416 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE1, 0x05), 417 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_SEL_1, 0x01), 418 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE1_MODE1, 0x25), 419 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE2_MODE1, 0x02), 420 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE1, 0xb7), 421 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE1, 0x1e), 422 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE1_MODE0, 0xb7), 423 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BIN_VCOCAL_CMP_CODE2_MODE0, 0x1e), 424 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0, 0x55), 425 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0, 0x0e), 426 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE0, 0x02), 427 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE0, 0x16), 428 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE0, 0x36), 429 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE0, 0x12), 430 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x34), 431 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE0, 0x04), 432 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MSB_MODE0, 0x01), 433 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE0, 0x55), 434 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE0, 0xd5), 435 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE0, 0x05), 436 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE1_MODE0, 0x25), 437 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE2_MODE0, 0x02), 438 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BG_TIMER, 0x0e), 439 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_EN_CENTER, 0x01), 440 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER1, 0x31), 441 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER2, 0x01), 442 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_BUF_ENABLE, 0x0c), 443 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_EN_SEL, 0x1a), 444 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_CFG, 0x14), 445 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE_MAP, 0x04), 446 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORE_CLK_EN, 0x20), 447 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_CONFIG_1, 0x04), 448 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_1, 0xb6), 449 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_2, 0x4b), 450 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_AUTO_GAIN_ADJ_CTRL_3, 0x37), 451 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_ADDITIONAL_MISC, 0x0c), 452 + }; 453 + 454 static const struct qmp_phy_init_tbl sm6350_usb3_rx_tbl[] = { 455 QMP_PHY_INIT_CFG(QSERDES_V3_RX_UCDR_FASTLOCK_FO_GAIN, 0x0b), 456 QMP_PHY_INIT_CFG(QSERDES_V3_RX_RX_EQU_ADAPTOR_CNTRL2, 0x0f), ··· 1728 .usb3_pcs_usb = 0x1700, 1729 .dp_serdes = 0x2000, 1730 .dp_dp_phy = 0x2200, 1731 + }; 1732 + 1733 + static const struct qmp_phy_cfg sar2130p_usb3dpphy_cfg = { 1734 + .offsets = &qmp_combo_offsets_v3, 1735 + 1736 + .serdes_tbl = sar2130p_usb3_serdes_tbl, 1737 + .serdes_tbl_num = ARRAY_SIZE(sar2130p_usb3_serdes_tbl), 1738 + .tx_tbl = sm8550_usb3_tx_tbl, 1739 + .tx_tbl_num = ARRAY_SIZE(sm8550_usb3_tx_tbl), 1740 + .rx_tbl = sm8550_usb3_rx_tbl, 1741 + .rx_tbl_num = ARRAY_SIZE(sm8550_usb3_rx_tbl), 1742 + .pcs_tbl = sm8550_usb3_pcs_tbl, 1743 + .pcs_tbl_num = ARRAY_SIZE(sm8550_usb3_pcs_tbl), 1744 + .pcs_usb_tbl = sm8550_usb3_pcs_usb_tbl, 1745 + .pcs_usb_tbl_num = ARRAY_SIZE(sm8550_usb3_pcs_usb_tbl), 1746 + 1747 + .dp_serdes_tbl = qmp_v6_dp_serdes_tbl, 1748 + .dp_serdes_tbl_num = ARRAY_SIZE(qmp_v6_dp_serdes_tbl), 1749 + .dp_tx_tbl = qmp_v6_dp_tx_tbl, 1750 + .dp_tx_tbl_num = ARRAY_SIZE(qmp_v6_dp_tx_tbl), 1751 + 1752 + .serdes_tbl_rbr = qmp_v6_dp_serdes_tbl_rbr, 1753 + .serdes_tbl_rbr_num = ARRAY_SIZE(qmp_v6_dp_serdes_tbl_rbr), 1754 + .serdes_tbl_hbr = qmp_v6_dp_serdes_tbl_hbr, 1755 + .serdes_tbl_hbr_num = ARRAY_SIZE(qmp_v6_dp_serdes_tbl_hbr), 1756 + .serdes_tbl_hbr2 = qmp_v6_dp_serdes_tbl_hbr2, 1757 + .serdes_tbl_hbr2_num = ARRAY_SIZE(qmp_v6_dp_serdes_tbl_hbr2), 1758 + .serdes_tbl_hbr3 = qmp_v6_dp_serdes_tbl_hbr3, 1759 + .serdes_tbl_hbr3_num = ARRAY_SIZE(qmp_v6_dp_serdes_tbl_hbr3), 1760 + 1761 + .swing_hbr_rbr = &qmp_dp_v5_voltage_swing_hbr_rbr, 1762 + .pre_emphasis_hbr_rbr = &qmp_dp_v6_pre_emphasis_hbr_rbr, 1763 + .swing_hbr3_hbr2 = &qmp_dp_v5_voltage_swing_hbr3_hbr2, 1764 + .pre_emphasis_hbr3_hbr2 = &qmp_dp_v5_pre_emphasis_hbr3_hbr2, 1765 + 1766 + .dp_aux_init = qmp_v4_dp_aux_init, 1767 + .configure_dp_tx = qmp_v4_configure_dp_tx, 1768 + .configure_dp_phy = qmp_v4_configure_dp_phy, 1769 + .calibrate_dp_phy = qmp_v4_calibrate_dp_phy, 1770 + 1771 + .regs = qmp_v6_usb3phy_regs_layout, 1772 + .reset_list = msm8996_usb3phy_reset_l, 1773 + .num_resets = ARRAY_SIZE(msm8996_usb3phy_reset_l), 1774 + .vreg_list = qmp_phy_vreg_l, 1775 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 1776 }; 1777 1778 static const struct qmp_phy_cfg sc7180_usb3dpphy_cfg = { ··· 3767 } 3768 3769 static const struct of_device_id qmp_combo_of_match_table[] = { 3770 + { 3771 + .compatible = "qcom,sar2130p-qmp-usb3-dp-phy", 3772 + .data = &sar2130p_usb3dpphy_cfg, 3773 + }, 3774 { 3775 .compatible = "qcom,sc7180-qmp-usb3-dp-phy", 3776 .data = &sc7180_usb3dpphy_cfg,
+273 -5
drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
··· 728 QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 729 }; 730 731 static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = { 732 QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), 733 QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), ··· 1850 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 1851 }; 1852 1853 - static const struct qmp_phy_init_tbl sdx55_qmp_pcie_ep_pcs_misc_tbl[] = { 1854 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 1855 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 1856 }; ··· 1984 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG2, 0x0d), 1985 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02), 1986 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e), 1987 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 1988 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 1989 }; ··· 2662 static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl[] = { 2663 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16), 2664 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22), 2665 - QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 2666 - QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 2667 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e), 2668 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0x66), 2669 }; ··· 2802 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_INSIG_SW_CTRL7, 0x00), 2803 }; 2804 2805 struct qmp_pcie_offsets { 2806 u16 serdes; 2807 u16 pcs; 2808 u16 pcs_misc; 2809 u16 tx; 2810 u16 rx; 2811 u16 tx2; ··· 2926 int pcs_num; 2927 const struct qmp_phy_init_tbl *pcs_misc; 2928 int pcs_misc_num; 2929 const struct qmp_phy_init_tbl *ln_shrd; 2930 int ln_shrd_num; 2931 }; ··· 2987 void __iomem *serdes; 2988 void __iomem *pcs; 2989 void __iomem *pcs_misc; 2990 void __iomem *tx; 2991 void __iomem *rx; 2992 void __iomem *tx2; ··· 3104 .serdes = 0x1000, 3105 .pcs = 0x1200, 3106 .pcs_misc = 0x1600, 3107 .tx = 0x0000, 3108 .rx = 0x0200, 3109 .tx2 = 0x0800, ··· 3135 .serdes = 0x1000, 3136 .pcs = 0x1200, 3137 .pcs_misc = 0x1400, 3138 .tx = 0x0000, 3139 .rx = 0x0200, 3140 .tx2 = 0x0800, ··· 3311 .pipe_clock_rate = 250000000, 3312 }; 3313 3314 static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = { 3315 .lanes = 1, 3316 ··· 3485 .phy_status = PHYSTATUS, 3486 3487 .skip_start_delay = true, 3488 }; 3489 3490 static const struct qmp_phy_cfg sc8180x_pciephy_cfg = { ··· 3687 .tbls_ep = &(const struct qmp_phy_cfg_tbls) { 3688 .serdes = sdx55_qmp_pcie_ep_serdes_tbl, 3689 .serdes_num = ARRAY_SIZE(sdx55_qmp_pcie_ep_serdes_tbl), 3690 - .pcs_misc = sdx55_qmp_pcie_ep_pcs_misc_tbl, 3691 - .pcs_misc_num = ARRAY_SIZE(sdx55_qmp_pcie_ep_pcs_misc_tbl), 3692 }, 3693 3694 .reset_list = sdm845_pciephy_reset_l, ··· 3787 .pcs_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_tbl), 3788 .pcs_misc = sdx65_qmp_pcie_pcs_misc_tbl, 3789 .pcs_misc_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_misc_tbl), 3790 }, 3791 .reset_list = sdm845_pciephy_reset_l, 3792 .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), ··· 3988 .pcs_num = ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl), 3989 .pcs_misc = sa8775p_qmp_gen4_pcie_pcs_misc_tbl, 3990 .pcs_misc_num = ARRAY_SIZE(sa8775p_qmp_gen4_pcie_pcs_misc_tbl), 3991 }, 3992 3993 .tbls_rc = &(const struct qmp_phy_cfg_tbls) { ··· 4196 void __iomem *rx2 = qmp->rx2; 4197 void __iomem *pcs = qmp->pcs; 4198 void __iomem *pcs_misc = qmp->pcs_misc; 4199 void __iomem *ln_shrd = qmp->ln_shrd; 4200 4201 if (!tbls) ··· 4221 4222 qmp_configure(qmp->dev, pcs, tbls->pcs, tbls->pcs_num); 4223 qmp_configure(qmp->dev, pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); 4224 4225 if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { 4226 qmp_configure(qmp->dev, serdes, cfg->serdes_4ln_tbl, ··· 4673 } 4674 } 4675 4676 clk = devm_get_clk_from_child(dev, np, NULL); 4677 if (IS_ERR(clk)) { 4678 return dev_err_probe(dev, PTR_ERR(clk), ··· 4748 qmp->serdes = base + offs->serdes; 4749 qmp->pcs = base + offs->pcs; 4750 qmp->pcs_misc = base + offs->pcs_misc; 4751 qmp->tx = base + offs->tx; 4752 qmp->rx = base + offs->rx; 4753 ··· 4874 .compatible = "qcom,msm8998-qmp-pcie-phy", 4875 .data = &msm8998_pciephy_cfg, 4876 }, { 4877 .compatible = "qcom,sa8775p-qmp-gen4x2-pcie-phy", 4878 .data = &sa8775p_qmp_gen4x2_pciephy_cfg, 4879 }, { 4880 .compatible = "qcom,sa8775p-qmp-gen4x4-pcie-phy", 4881 .data = &sa8775p_qmp_gen4x4_pciephy_cfg, 4882 }, { 4883 .compatible = "qcom,sc8180x-qmp-pcie-phy", 4884 .data = &sc8180x_pciephy_cfg,
··· 728 QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), 729 }; 730 731 + static const struct qmp_phy_init_tbl qcs615_pcie_serdes_tbl[] = { 732 + QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x18), 733 + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_ENABLE1, 0x10), 734 + QMP_PHY_INIT_CFG(QSERDES_COM_BG_TRIM, 0xf), 735 + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP_EN, 0x1), 736 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_MAP, 0x0), 737 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER1, 0xff), 738 + QMP_PHY_INIT_CFG(QSERDES_COM_VCO_TUNE_TIMER2, 0x1f), 739 + QMP_PHY_INIT_CFG(QSERDES_COM_CMN_CONFIG, 0x6), 740 + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_IVCO, 0xf), 741 + QMP_PHY_INIT_CFG(QSERDES_COM_HSCLK_SEL, 0x0), 742 + QMP_PHY_INIT_CFG(QSERDES_COM_SVS_MODE_CLK_SEL, 0x1), 743 + QMP_PHY_INIT_CFG(QSERDES_COM_CORE_CLK_EN, 0x20), 744 + QMP_PHY_INIT_CFG(QSERDES_COM_CORECLK_DIV, 0xa), 745 + QMP_PHY_INIT_CFG(QSERDES_COM_RESETSM_CNTRL, 0x20), 746 + QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0x9), 747 + QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_EN_SEL, 0x4), 748 + QMP_PHY_INIT_CFG(QSERDES_COM_DEC_START_MODE0, 0x82), 749 + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START3_MODE0, 0x3), 750 + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START2_MODE0, 0x55), 751 + QMP_PHY_INIT_CFG(QSERDES_COM_DIV_FRAC_START1_MODE0, 0x55), 752 + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP3_MODE0, 0x0), 753 + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP2_MODE0, 0xd), 754 + QMP_PHY_INIT_CFG(QSERDES_COM_LOCK_CMP1_MODE0, 0x04), 755 + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_SELECT, 0x35), 756 + QMP_PHY_INIT_CFG(QSERDES_COM_SYS_CLK_CTRL, 0x2), 757 + QMP_PHY_INIT_CFG(QSERDES_COM_SYSCLK_BUF_ENABLE, 0x1f), 758 + QMP_PHY_INIT_CFG(QSERDES_COM_CP_CTRL_MODE0, 0x4), 759 + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_RCTRL_MODE0, 0x16), 760 + QMP_PHY_INIT_CFG(QSERDES_COM_PLL_CCTRL_MODE0, 0x30), 761 + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 0x0), 762 + QMP_PHY_INIT_CFG(QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 0x80), 763 + QMP_PHY_INIT_CFG(QSERDES_COM_BIAS_EN_CTRL_BY_PSM, 0x1), 764 + QMP_PHY_INIT_CFG(QSERDES_COM_BG_TIMER, 0xa), 765 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x1), 766 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER1, 0x31), 767 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_PER2, 0x1), 768 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x2), 769 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x0), 770 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE1, 0x2f), 771 + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_STEP_SIZE2, 0x19), 772 + QMP_PHY_INIT_CFG(QSERDES_COM_CLK_EP_DIV, 0x19), 773 + }; 774 + 775 + static const struct qmp_phy_init_tbl qcs615_pcie_rx_tbl[] = { 776 + QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_ENABLES, 0x1c), 777 + QMP_PHY_INIT_CFG(QSERDES_RX_SIGDET_DEGLITCH_CNTRL, 0x14), 778 + QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL2, 0x1), 779 + QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL3, 0x0), 780 + QMP_PHY_INIT_CFG(QSERDES_RX_RX_EQU_ADAPTOR_CNTRL4, 0xdb), 781 + QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_SATURATION_AND_ENABLE, 0x4b), 782 + QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN, 0x4), 783 + QMP_PHY_INIT_CFG(QSERDES_RX_UCDR_SO_GAIN_HALF, 0x4), 784 + }; 785 + 786 + static const struct qmp_phy_init_tbl qcs615_pcie_tx_tbl[] = { 787 + QMP_PHY_INIT_CFG(QSERDES_TX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN, 0x45), 788 + QMP_PHY_INIT_CFG(QSERDES_TX_LANE_MODE, 0x6), 789 + QMP_PHY_INIT_CFG(QSERDES_TX_RES_CODE_LANE_OFFSET, 0x2), 790 + QMP_PHY_INIT_CFG(QSERDES_TX_RCV_DETECT_LVL_2, 0x12), 791 + }; 792 + 793 + static const struct qmp_phy_init_tbl qcs615_pcie_pcs_tbl[] = { 794 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_ENDPOINT_REFCLK_DRIVE, 0x4), 795 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_OSC_DTCT_ACTIONS, 0x0), 796 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_PWRUP_RESET_DLY_TIME_AUXCLK, 0x40), 797 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB, 0x0), 798 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB, 0x40), 799 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME_AUXCLK_LSB, 0x0), 800 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_LP_WAKEUP_DLY_TIME_AUXCLK, 0x40), 801 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME, 0x73), 802 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_SIGDET_CNTRL, 0x7), 803 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_RX_SIGDET_LVL, 0x99), 804 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M6DB_V0, 0x15), 805 + QMP_PHY_INIT_CFG(QPHY_V2_PCS_TXDEEMPH_M3P5DB_V0, 0xe), 806 + }; 807 + 808 static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = { 809 QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), 810 QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), ··· 1773 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), 1774 }; 1775 1776 + static const struct qmp_phy_init_tbl sdx55_qmp_pcie_ep_pcs_lane1_tbl[] = { 1777 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 1778 QMP_PHY_INIT_CFG(QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 1779 }; ··· 1907 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG2, 0x0d), 1908 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5, 0x02), 1909 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e), 1910 + }; 1911 + 1912 + static const struct qmp_phy_init_tbl sdx65_qmp_pcie_pcs_lane1_tbl[] = { 1913 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2, 0x00), 1914 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2, 0x00), 1915 }; ··· 2582 static const struct qmp_phy_init_tbl sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl[] = { 2583 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG4, 0x16), 2584 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_EQ_CONFIG5, 0x22), 2585 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_G3S2_PRE_GAIN, 0x2e), 2586 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_RX_SIGDET_LVL, 0x66), 2587 }; ··· 2724 QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_INSIG_SW_CTRL7, 0x00), 2725 }; 2726 2727 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_rc_serdes_tbl[] = { 2728 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_EN_CENTER, 0x01), 2729 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER1, 0x31), 2730 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_PER2, 0x01), 2731 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE0, 0xff), 2732 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE0, 0x06), 2733 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE1_MODE1, 0x4c), 2734 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SSC_STEP_SIZE2_MODE1, 0x06), 2735 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_ENABLE1, 0x90), 2736 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYS_CLK_CTRL, 0x82), 2737 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_IVCO, 0x07), 2738 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE0, 0x02), 2739 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE1, 0x02), 2740 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE0, 0x16), 2741 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE1, 0x16), 2742 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE0, 0x36), 2743 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE1, 0x36), 2744 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_EN_SEL, 0x08), 2745 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BG_TIMER, 0x0e), 2746 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_EN, 0x42), 2747 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE0, 0x08), 2748 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x1a), 2749 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE1, 0x14), 2750 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x34), 2751 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE0, 0x82), 2752 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE1, 0x68), 2753 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE0, 0xab), 2754 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE0, 0xea), 2755 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE0, 0x02), 2756 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START1_MODE1, 0xab), 2757 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START2_MODE1, 0xaa), 2758 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DIV_FRAC_START3_MODE1, 0x02), 2759 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE_MAP, 0x14), 2760 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CLK_SELECT, 0x34), 2761 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_SEL_1, 0x01), 2762 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORECLK_DIV_MODE1, 0x04), 2763 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_CONFIG_1, 0x16), 2764 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_ADDITIONAL_MISC_3, 0x0f), 2765 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORE_CLK_EN, 0xa0), 2766 + }; 2767 + 2768 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_pcs_lane1_tbl[] = { 2769 + QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_LANE1_INSIG_SW_CTRL2, 0x01), 2770 + QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_LANE1_INSIG_MX_CTRL2, 0x01), 2771 + }; 2772 + 2773 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_rc_tx_tbl[] = { 2774 + QMP_PHY_INIT_CFG_LANE(QSERDES_V6_TX_BIST_MODE_LANENO, 0x00, 2), 2775 + }; 2776 + 2777 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_rc_pcs_tbl[] = { 2778 + QMP_PHY_INIT_CFG(QPHY_V6_PCS_G12S1_TXDEEMPH_M6DB, 0x17), 2779 + QMP_PHY_INIT_CFG(QPHY_V6_PCS_G3S2_PRE_GAIN, 0x2e), 2780 + }; 2781 + 2782 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_ep_serdes_tbl[] = { 2783 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYSCLK_EN_SEL, 0x00), 2784 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_BG_TIMER, 0x06), 2785 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_SYS_CLK_CTRL, 0x07), 2786 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_IVCO, 0x07), 2787 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE0, 0x28), 2788 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CP_CTRL_MODE1, 0x28), 2789 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE0, 0x0d), 2790 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_RCTRL_MODE1, 0x0d), 2791 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE0, 0x00), 2792 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_PLL_CCTRL_MODE1, 0x00), 2793 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP_EN, 0x42), 2794 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE0, 0xff), 2795 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE0, 0x04), 2796 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP1_MODE1, 0xff), 2797 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_LOCK_CMP2_MODE1, 0x09), 2798 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE0, 0x19), 2799 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_DEC_START_MODE1, 0x14), 2800 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_INTEGLOOP_GAIN0_MODE0, 0xfb), 2801 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_INTEGLOOP_GAIN1_MODE0, 0x03), 2802 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_INTEGLOOP_GAIN0_MODE1, 0xfb), 2803 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_INTEGLOOP_GAIN1_MODE1, 0x03), 2804 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_VCO_TUNE_MAP, 0x14), 2805 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_HSCLK_SEL_1, 0x01), 2806 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORECLK_DIV_MODE1, 0x04), 2807 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_CONFIG_1, 0x16), 2808 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CMN_MODE, 0x14), 2809 + QMP_PHY_INIT_CFG(QSERDES_V6_COM_CORE_CLK_EN, 0xa0), 2810 + }; 2811 + 2812 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_ep_pcs_tbl[] = { 2813 + QMP_PHY_INIT_CFG(QPHY_V6_PCS_G12S1_TXDEEMPH_M6DB, 0x17), 2814 + }; 2815 + 2816 + static const struct qmp_phy_init_tbl sar2130p_qmp_gen3x2_pcie_ep_pcs_misc_tbl[] = { 2817 + QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_EQ_CONFIG1, 0x1e), 2818 + QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_POWER_STATE_CONFIG2, 0x14), 2819 + QMP_PHY_INIT_CFG(QPHY_PCIE_V6_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), 2820 + }; 2821 + 2822 struct qmp_pcie_offsets { 2823 u16 serdes; 2824 u16 pcs; 2825 u16 pcs_misc; 2826 + u16 pcs_lane1; 2827 u16 tx; 2828 u16 rx; 2829 u16 tx2; ··· 2752 int pcs_num; 2753 const struct qmp_phy_init_tbl *pcs_misc; 2754 int pcs_misc_num; 2755 + const struct qmp_phy_init_tbl *pcs_lane1; 2756 + int pcs_lane1_num; 2757 const struct qmp_phy_init_tbl *ln_shrd; 2758 int ln_shrd_num; 2759 }; ··· 2811 void __iomem *serdes; 2812 void __iomem *pcs; 2813 void __iomem *pcs_misc; 2814 + void __iomem *pcs_lane1; 2815 void __iomem *tx; 2816 void __iomem *rx; 2817 void __iomem *tx2; ··· 2927 .serdes = 0x1000, 2928 .pcs = 0x1200, 2929 .pcs_misc = 0x1600, 2930 + .pcs_lane1 = 0x1e00, 2931 .tx = 0x0000, 2932 .rx = 0x0200, 2933 .tx2 = 0x0800, ··· 2957 .serdes = 0x1000, 2958 .pcs = 0x1200, 2959 .pcs_misc = 0x1400, 2960 + .pcs_lane1 = 0x1e00, 2961 .tx = 0x0000, 2962 .rx = 0x0200, 2963 .tx2 = 0x0800, ··· 3132 .pipe_clock_rate = 250000000, 3133 }; 3134 3135 + static const struct qmp_phy_cfg qcs615_pciephy_cfg = { 3136 + .lanes = 1, 3137 + 3138 + .offsets = &qmp_pcie_offsets_v2, 3139 + 3140 + .tbls = { 3141 + .serdes = qcs615_pcie_serdes_tbl, 3142 + .serdes_num = ARRAY_SIZE(qcs615_pcie_serdes_tbl), 3143 + .tx = qcs615_pcie_tx_tbl, 3144 + .tx_num = ARRAY_SIZE(qcs615_pcie_tx_tbl), 3145 + .rx = qcs615_pcie_rx_tbl, 3146 + .rx_num = ARRAY_SIZE(qcs615_pcie_rx_tbl), 3147 + .pcs = qcs615_pcie_pcs_tbl, 3148 + .pcs_num = ARRAY_SIZE(qcs615_pcie_pcs_tbl), 3149 + }, 3150 + .reset_list = sdm845_pciephy_reset_l, 3151 + .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 3152 + .vreg_list = qmp_phy_vreg_l, 3153 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 3154 + .regs = pciephy_v2_regs_layout, 3155 + 3156 + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 3157 + .phy_status = PHYSTATUS, 3158 + }; 3159 + 3160 static const struct qmp_phy_cfg sdm845_qmp_pciephy_cfg = { 3161 .lanes = 1, 3162 ··· 3281 .phy_status = PHYSTATUS, 3282 3283 .skip_start_delay = true, 3284 + }; 3285 + 3286 + static const struct qmp_phy_cfg sar2130p_qmp_gen3x2_pciephy_cfg = { 3287 + .lanes = 2, 3288 + 3289 + .offsets = &qmp_pcie_offsets_v5, 3290 + 3291 + .tbls = { 3292 + .tx = sm8550_qmp_gen3x2_pcie_tx_tbl, 3293 + .tx_num = ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_tx_tbl), 3294 + .rx = sm8550_qmp_gen3x2_pcie_rx_tbl, 3295 + .rx_num = ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_rx_tbl), 3296 + .pcs = sm8550_qmp_gen3x2_pcie_pcs_tbl, 3297 + .pcs_num = ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_pcs_tbl), 3298 + .pcs_lane1 = sar2130p_qmp_gen3x2_pcie_pcs_lane1_tbl, 3299 + .pcs_lane1_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_pcs_lane1_tbl), 3300 + }, 3301 + .tbls_rc = &(const struct qmp_phy_cfg_tbls) { 3302 + .serdes = sar2130p_qmp_gen3x2_pcie_rc_serdes_tbl, 3303 + .serdes_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_rc_serdes_tbl), 3304 + .tx = sar2130p_qmp_gen3x2_pcie_rc_tx_tbl, 3305 + .tx_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_rc_tx_tbl), 3306 + .pcs = sar2130p_qmp_gen3x2_pcie_rc_pcs_tbl, 3307 + .pcs_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_rc_pcs_tbl), 3308 + .pcs_misc = sm8550_qmp_gen3x2_pcie_pcs_misc_tbl, 3309 + .pcs_misc_num = ARRAY_SIZE(sm8550_qmp_gen3x2_pcie_pcs_misc_tbl), 3310 + }, 3311 + .tbls_ep = &(const struct qmp_phy_cfg_tbls) { 3312 + .serdes = sar2130p_qmp_gen3x2_pcie_ep_serdes_tbl, 3313 + .serdes_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_ep_serdes_tbl), 3314 + .pcs = sar2130p_qmp_gen3x2_pcie_ep_pcs_tbl, 3315 + .pcs_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_ep_pcs_tbl), 3316 + .pcs_misc = sar2130p_qmp_gen3x2_pcie_ep_pcs_misc_tbl, 3317 + .pcs_misc_num = ARRAY_SIZE(sar2130p_qmp_gen3x2_pcie_ep_pcs_misc_tbl), 3318 + }, 3319 + .reset_list = sdm845_pciephy_reset_l, 3320 + .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), 3321 + .vreg_list = qmp_phy_vreg_l, 3322 + .num_vregs = ARRAY_SIZE(qmp_phy_vreg_l), 3323 + .regs = pciephy_v5_regs_layout, 3324 + 3325 + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, 3326 + .phy_status = PHYSTATUS, 3327 }; 3328 3329 static const struct qmp_phy_cfg sc8180x_pciephy_cfg = { ··· 3440 .tbls_ep = &(const struct qmp_phy_cfg_tbls) { 3441 .serdes = sdx55_qmp_pcie_ep_serdes_tbl, 3442 .serdes_num = ARRAY_SIZE(sdx55_qmp_pcie_ep_serdes_tbl), 3443 + .pcs_lane1 = sdx55_qmp_pcie_ep_pcs_lane1_tbl, 3444 + .pcs_lane1_num = ARRAY_SIZE(sdx55_qmp_pcie_ep_pcs_lane1_tbl), 3445 }, 3446 3447 .reset_list = sdm845_pciephy_reset_l, ··· 3540 .pcs_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_tbl), 3541 .pcs_misc = sdx65_qmp_pcie_pcs_misc_tbl, 3542 .pcs_misc_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_misc_tbl), 3543 + .pcs_lane1 = sdx65_qmp_pcie_pcs_lane1_tbl, 3544 + .pcs_lane1_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_lane1_tbl), 3545 }, 3546 .reset_list = sdm845_pciephy_reset_l, 3547 .num_resets = ARRAY_SIZE(sdm845_pciephy_reset_l), ··· 3739 .pcs_num = ARRAY_SIZE(sa8775p_qmp_gen4x2_pcie_pcs_alt_tbl), 3740 .pcs_misc = sa8775p_qmp_gen4_pcie_pcs_misc_tbl, 3741 .pcs_misc_num = ARRAY_SIZE(sa8775p_qmp_gen4_pcie_pcs_misc_tbl), 3742 + .pcs_lane1 = sdx65_qmp_pcie_pcs_lane1_tbl, 3743 + .pcs_lane1_num = ARRAY_SIZE(sdx65_qmp_pcie_pcs_lane1_tbl), 3744 }, 3745 3746 .tbls_rc = &(const struct qmp_phy_cfg_tbls) { ··· 3945 void __iomem *rx2 = qmp->rx2; 3946 void __iomem *pcs = qmp->pcs; 3947 void __iomem *pcs_misc = qmp->pcs_misc; 3948 + void __iomem *pcs_lane1 = qmp->pcs_lane1; 3949 void __iomem *ln_shrd = qmp->ln_shrd; 3950 3951 if (!tbls) ··· 3969 3970 qmp_configure(qmp->dev, pcs, tbls->pcs, tbls->pcs_num); 3971 qmp_configure(qmp->dev, pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); 3972 + qmp_configure(qmp->dev, pcs_lane1, tbls->pcs_lane1, tbls->pcs_lane1_num); 3973 3974 if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { 3975 qmp_configure(qmp->dev, serdes, cfg->serdes_4ln_tbl, ··· 4420 } 4421 } 4422 4423 + /* 4424 + * For all platforms where legacy bindings existed, PCS_LANE1 was 4425 + * mapped as a part of the PCS_MISC region. 4426 + */ 4427 + if (!IS_ERR(qmp->pcs_misc) && cfg->offsets->pcs_lane1 != 0) 4428 + qmp->pcs_lane1 = qmp->pcs_misc + 4429 + (cfg->offsets->pcs_lane1 - cfg->offsets->pcs_misc); 4430 + 4431 clk = devm_get_clk_from_child(dev, np, NULL); 4432 if (IS_ERR(clk)) { 4433 return dev_err_probe(dev, PTR_ERR(clk), ··· 4487 qmp->serdes = base + offs->serdes; 4488 qmp->pcs = base + offs->pcs; 4489 qmp->pcs_misc = base + offs->pcs_misc; 4490 + qmp->pcs_lane1 = base + offs->pcs_lane1; 4491 qmp->tx = base + offs->tx; 4492 qmp->rx = base + offs->rx; 4493 ··· 4612 .compatible = "qcom,msm8998-qmp-pcie-phy", 4613 .data = &msm8998_pciephy_cfg, 4614 }, { 4615 + .compatible = "qcom,qcs615-qmp-gen3x1-pcie-phy", 4616 + .data = &qcs615_pciephy_cfg, 4617 + }, { 4618 .compatible = "qcom,sa8775p-qmp-gen4x2-pcie-phy", 4619 .data = &sa8775p_qmp_gen4x2_pciephy_cfg, 4620 }, { 4621 .compatible = "qcom,sa8775p-qmp-gen4x4-pcie-phy", 4622 .data = &sa8775p_qmp_gen4x4_pciephy_cfg, 4623 + }, { 4624 + .compatible = "qcom,sar2130p-qmp-gen3x2-pcie-phy", 4625 + .data = &sar2130p_qmp_gen3x2_pciephy_cfg, 4626 }, { 4627 .compatible = "qcom,sc8180x-qmp-pcie-phy", 4628 .data = &sc8180x_pciephy_cfg,
+3 -2
drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v4_20.h
··· 13 #define QPHY_V4_20_PCS_PCIE_G4_RXEQEVAL_TIME 0x0f4 14 #define QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG2 0x0fc 15 #define QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG5 0x108 16 - #define QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2 0x824 17 - #define QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2 0x828 18 19 #endif
··· 13 #define QPHY_V4_20_PCS_PCIE_G4_RXEQEVAL_TIME 0x0f4 14 #define QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG2 0x0fc 15 #define QPHY_V4_20_PCS_PCIE_G4_EQ_CONFIG5 0x108 16 + 17 + #define QPHY_V4_20_PCS_LANE1_INSIG_SW_CTRL2 0x024 18 + #define QPHY_V4_20_PCS_LANE1_INSIG_MX_CTRL2 0x028 19 20 #endif
+3 -2
drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5_20.h
··· 17 #define QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5 0x108 18 #define QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN 0x15c 19 #define QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3 0x184 20 - #define QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2 0xa24 21 - #define QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2 0xa28 22 23 #endif
··· 17 #define QPHY_V5_20_PCS_PCIE_G4_EQ_CONFIG5 0x108 18 #define QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN 0x15c 19 #define QPHY_V5_20_PCS_PCIE_RX_MARGINING_CONFIG3 0x184 20 + 21 + #define QPHY_V5_20_PCS_LANE1_INSIG_SW_CTRL2 0x024 22 + #define QPHY_V5_20_PCS_LANE1_INSIG_MX_CTRL2 0x028 23 24 #endif
+3
drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v6.h
··· 14 #define QPHY_PCIE_V6_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x20 15 #define QPHY_PCIE_V6_PCS_PCIE_OSC_DTCT_ACTIONS 0x94 16 17 #endif
··· 14 #define QPHY_PCIE_V6_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x20 15 #define QPHY_PCIE_V6_PCS_PCIE_OSC_DTCT_ACTIONS 0x94 16 17 + #define QPHY_PCIE_V6_PCS_LANE1_INSIG_SW_CTRL2 0x024 18 + #define QPHY_PCIE_V6_PCS_LANE1_INSIG_MX_CTRL2 0x028 19 + 20 #endif
+1
drivers/phy/qualcomm/phy-qcom-qmp-pcs-v2.h
··· 34 #define QPHY_V2_PCS_USB_PCS_STATUS 0x17c /* USB */ 35 #define QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME_AUXCLK_LSB 0x1a8 36 #define QPHY_V2_PCS_OSC_DTCT_ACTIONS 0x1ac 37 #define QPHY_V2_PCS_RX_SIGDET_LVL 0x1d8 38 #define QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB 0x1dc 39 #define QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB 0x1e0
··· 34 #define QPHY_V2_PCS_USB_PCS_STATUS 0x17c /* USB */ 35 #define QPHY_V2_PCS_PLL_LOCK_CHK_DLY_TIME_AUXCLK_LSB 0x1a8 36 #define QPHY_V2_PCS_OSC_DTCT_ACTIONS 0x1ac 37 + #define QPHY_V2_PCS_SIGDET_CNTRL 0x1b0 38 #define QPHY_V2_PCS_RX_SIGDET_LVL 0x1d8 39 #define QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_LSB 0x1dc 40 #define QPHY_V2_PCS_L1SS_WAKEUP_DLY_TIME_AUXCLK_MSB 0x1e0
+2
drivers/phy/qualcomm/phy-qcom-qmp-pcs-v6.h
··· 17 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG3 0x0cc 18 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG6 0x0d8 19 #define QPHY_V6_PCS_REFGEN_REQ_CONFIG1 0x0dc 20 #define QPHY_V6_PCS_RX_SIGDET_LVL 0x188 21 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 22 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194
··· 17 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG3 0x0cc 18 #define QPHY_V6_PCS_LOCK_DETECT_CONFIG6 0x0d8 19 #define QPHY_V6_PCS_REFGEN_REQ_CONFIG1 0x0dc 20 + #define QPHY_V6_PCS_G12S1_TXDEEMPH_M6DB 0x168 21 + #define QPHY_V6_PCS_G3S2_PRE_GAIN 0x170 22 #define QPHY_V6_PCS_RX_SIGDET_LVL 0x188 23 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_L 0x190 24 #define QPHY_V6_PCS_RCVR_DTCT_DLY_P1U2_H 0x194
+1
drivers/phy/qualcomm/phy-qcom-qmp-qserdes-txrx-v6.h
··· 6 #ifndef QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_ 7 #define QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_ 8 9 #define QSERDES_V6_TX_CLKBUF_ENABLE 0x08 10 #define QSERDES_V6_TX_TX_EMP_POST1_LVL 0x0c 11 #define QSERDES_V6_TX_TX_DRV_LVL 0x14
··· 6 #ifndef QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_ 7 #define QCOM_PHY_QMP_QSERDES_TXRX_USB_V6_H_ 8 9 + #define QSERDES_V6_TX_BIST_MODE_LANENO 0x00 10 #define QSERDES_V6_TX_CLKBUF_ENABLE 0x08 11 #define QSERDES_V6_TX_TX_EMP_POST1_LVL 0x0c 12 #define QSERDES_V6_TX_TX_DRV_LVL 0x14
+3
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 2298 2299 static const struct of_device_id qmp_usb_of_match_table[] = { 2300 { 2301 .compatible = "qcom,ipq6018-qmp-usb3-phy", 2302 .data = &ipq6018_usb3phy_cfg, 2303 }, {
··· 2298 2299 static const struct of_device_id qmp_usb_of_match_table[] = { 2300 { 2301 + .compatible = "qcom,ipq5424-qmp-usb3-phy", 2302 + .data = &ipq9574_usb3phy_cfg, 2303 + }, { 2304 .compatible = "qcom,ipq6018-qmp-usb3-phy", 2305 .data = &ipq6018_usb3phy_cfg, 2306 }, {
+55
drivers/phy/qualcomm/phy-qcom-qusb2.c
··· 151 QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9F), 152 }; 153 154 static const unsigned int ipq6018_regs_layout[] = { 155 [QUSB2PHY_PLL_STATUS] = 0x38, 156 [QUSB2PHY_PORT_TUNE1] = 0x80, ··· 354 .regs = ipq6018_regs_layout, 355 356 .disable_ctrl = POWER_DOWN, 357 .mask_core_ready = PLL_LOCKED, 358 /* autoresume not used */ 359 .autoresume_en = BIT(0), ··· 954 955 static const struct of_device_id qusb2_phy_of_match_table[] = { 956 { 957 .compatible = "qcom,ipq6018-qusb2-phy", 958 .data = &ipq6018_phy_cfg, 959 }, { ··· 974 }, { 975 .compatible = "qcom,msm8998-qusb2-phy", 976 .data = &msm8998_phy_cfg, 977 }, { 978 .compatible = "qcom,qcm2290-qusb2-phy", 979 .data = &sm6115_phy_cfg,
··· 151 QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9F), 152 }; 153 154 + static const struct qusb2_phy_init_tbl ipq5424_init_tbl[] = { 155 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL, 0x14), 156 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0x00), 157 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0x53), 158 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0xc3), 159 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TUNE, 0x30), 160 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL1, 0x79), 161 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL2, 0x21), 162 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE5, 0x00), 163 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00), 164 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TEST2, 0x14), 165 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TEST, 0x80), 166 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9f), 167 + }; 168 + 169 + static const struct qusb2_phy_init_tbl qcs615_init_tbl[] = { 170 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE1, 0xc8), 171 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE2, 0xb3), 172 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE3, 0x83), 173 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TUNE4, 0xc0), 174 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_TUNE, 0x30), 175 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL1, 0x79), 176 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_USER_CTL2, 0x21), 177 + QUSB2_PHY_INIT_CFG_L(QUSB2PHY_PORT_TEST2, 0x14), 178 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_AUTOPGM_CTL1, 0x9f), 179 + QUSB2_PHY_INIT_CFG(QUSB2PHY_PLL_PWR_CTRL, 0x00), 180 + }; 181 + 182 static const unsigned int ipq6018_regs_layout[] = { 183 [QUSB2PHY_PLL_STATUS] = 0x38, 184 [QUSB2PHY_PORT_TUNE1] = 0x80, ··· 326 .regs = ipq6018_regs_layout, 327 328 .disable_ctrl = POWER_DOWN, 329 + .mask_core_ready = PLL_LOCKED, 330 + /* autoresume not used */ 331 + .autoresume_en = BIT(0), 332 + }; 333 + 334 + static const struct qusb2_phy_cfg ipq5424_phy_cfg = { 335 + .tbl = ipq5424_init_tbl, 336 + .tbl_num = ARRAY_SIZE(ipq5424_init_tbl), 337 + .regs = ipq6018_regs_layout, 338 + 339 + .disable_ctrl = POWER_DOWN, 340 + .mask_core_ready = PLL_LOCKED, 341 + .autoresume_en = BIT(0), 342 + }; 343 + 344 + static const struct qusb2_phy_cfg qcs615_phy_cfg = { 345 + .tbl = qcs615_init_tbl, 346 + .tbl_num = ARRAY_SIZE(qcs615_init_tbl), 347 + .regs = ipq6018_regs_layout, 348 + 349 + .disable_ctrl = (CLAMP_N_EN | FREEZIO_N | POWER_DOWN), 350 .mask_core_ready = PLL_LOCKED, 351 /* autoresume not used */ 352 .autoresume_en = BIT(0), ··· 905 906 static const struct of_device_id qusb2_phy_of_match_table[] = { 907 { 908 + .compatible = "qcom,ipq5424-qusb2-phy", 909 + .data = &ipq5424_phy_cfg, 910 + }, { 911 .compatible = "qcom,ipq6018-qusb2-phy", 912 .data = &ipq6018_phy_cfg, 913 }, { ··· 922 }, { 923 .compatible = "qcom,msm8998-qusb2-phy", 924 .data = &msm8998_phy_cfg, 925 + }, { 926 + .compatible = "qcom,qcs615-qusb2-phy", 927 + .data = &qcs615_phy_cfg, 928 }, { 929 .compatible = "qcom,qcm2290-qusb2-phy", 930 .data = &sm6115_phy_cfg,
+279
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
··· 37 #define PHYREG8 0x1C 38 #define PHYREG8_SSC_EN BIT(4) 39 40 #define PHYREG11 0x28 41 #define PHYREG11_SU_TRIM_0_7 0xF0 42 ··· 65 #define PHYREG16 0x3C 66 #define PHYREG16_SSC_CNT_VALUE 0x5f 67 68 #define PHYREG18 0x44 69 #define PHYREG18_PLL_LOOP 0x32 70 71 #define PHYREG27 0x6C 72 #define PHYREG27_RX_TRIM_RK3588 0x4C 73 74 #define PHYREG32 0x7C 75 #define PHYREG32_SSC_MASK GENMASK(7, 4) 76 #define PHYREG32_SSC_DIR_SHIFT 4 77 #define PHYREG32_SSC_UPWARD 0 78 #define PHYREG32_SSC_DOWNWARD 1 79 #define PHYREG32_SSC_OFFSET_SHIFT 6 80 #define PHYREG32_SSC_OFFSET_500PPM 1 81 ··· 92 #define PHYREG33_PLL_KVCO_MASK GENMASK(4, 2) 93 #define PHYREG33_PLL_KVCO_SHIFT 2 94 #define PHYREG33_PLL_KVCO_VALUE 2 95 96 struct rockchip_combphy_priv; 97 ··· 112 struct combphy_reg pipe_rxterm_set; 113 struct combphy_reg pipe_txelec_set; 114 struct combphy_reg pipe_txcomp_set; 115 struct combphy_reg pipe_clk_25m; 116 struct combphy_reg pipe_clk_100m; 117 struct combphy_reg pipe_phymode_sel; ··· 599 .combphy_cfg = rk3568_combphy_cfg, 600 }; 601 602 static int rk3588_combphy_cfg(struct rockchip_combphy_priv *priv) 603 { 604 const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg; ··· 1049 { 1050 .compatible = "rockchip,rk3568-naneng-combphy", 1051 .data = &rk3568_combphy_cfgs, 1052 }, 1053 { 1054 .compatible = "rockchip,rk3588-naneng-combphy",
··· 37 #define PHYREG8 0x1C 38 #define PHYREG8_SSC_EN BIT(4) 39 40 + #define PHYREG10 0x24 41 + #define PHYREG10_SSC_PCM_MASK GENMASK(3, 0) 42 + #define PHYREG10_SSC_PCM_3500PPM 7 43 + 44 #define PHYREG11 0x28 45 #define PHYREG11_SU_TRIM_0_7 0xF0 46 ··· 61 #define PHYREG16 0x3C 62 #define PHYREG16_SSC_CNT_VALUE 0x5f 63 64 + #define PHYREG17 0x40 65 + 66 #define PHYREG18 0x44 67 #define PHYREG18_PLL_LOOP 0x32 68 + 69 + #define PHYREG21 0x50 70 + #define PHYREG21_RX_SQUELCH_VAL 0x0D 71 72 #define PHYREG27 0x6C 73 #define PHYREG27_RX_TRIM_RK3588 0x4C 74 75 + #define PHYREG30 0x74 76 + 77 #define PHYREG32 0x7C 78 #define PHYREG32_SSC_MASK GENMASK(7, 4) 79 + #define PHYREG32_SSC_DIR_MASK GENMASK(5, 4) 80 #define PHYREG32_SSC_DIR_SHIFT 4 81 #define PHYREG32_SSC_UPWARD 0 82 #define PHYREG32_SSC_DOWNWARD 1 83 + #define PHYREG32_SSC_OFFSET_MASK GENMASK(7, 6) 84 #define PHYREG32_SSC_OFFSET_SHIFT 6 85 #define PHYREG32_SSC_OFFSET_500PPM 1 86 ··· 79 #define PHYREG33_PLL_KVCO_MASK GENMASK(4, 2) 80 #define PHYREG33_PLL_KVCO_SHIFT 2 81 #define PHYREG33_PLL_KVCO_VALUE 2 82 + #define PHYREG33_PLL_KVCO_VALUE_RK3576 4 83 84 struct rockchip_combphy_priv; 85 ··· 98 struct combphy_reg pipe_rxterm_set; 99 struct combphy_reg pipe_txelec_set; 100 struct combphy_reg pipe_txcomp_set; 101 + struct combphy_reg pipe_clk_24m; 102 struct combphy_reg pipe_clk_25m; 103 struct combphy_reg pipe_clk_100m; 104 struct combphy_reg pipe_phymode_sel; ··· 584 .combphy_cfg = rk3568_combphy_cfg, 585 }; 586 587 + static int rk3576_combphy_cfg(struct rockchip_combphy_priv *priv) 588 + { 589 + const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg; 590 + unsigned long rate; 591 + u32 val; 592 + 593 + switch (priv->type) { 594 + case PHY_TYPE_PCIE: 595 + /* Set SSC downward spread spectrum */ 596 + val = FIELD_PREP(PHYREG32_SSC_MASK, PHYREG32_SSC_DOWNWARD); 597 + rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK, val, PHYREG32); 598 + 599 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con0_for_pcie, true); 600 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con1_for_pcie, true); 601 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con2_for_pcie, true); 602 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con3_for_pcie, true); 603 + break; 604 + 605 + case PHY_TYPE_USB3: 606 + /* Set SSC downward spread spectrum */ 607 + val = FIELD_PREP(PHYREG32_SSC_MASK, PHYREG32_SSC_DOWNWARD); 608 + rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK, val, PHYREG32); 609 + 610 + /* Enable adaptive CTLE for USB3.0 Rx */ 611 + val = readl(priv->mmio + PHYREG15); 612 + val |= PHYREG15_CTLE_EN; 613 + writel(val, priv->mmio + PHYREG15); 614 + 615 + /* Set PLL KVCO fine tuning signals */ 616 + rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK, BIT(3), PHYREG33); 617 + 618 + /* Set PLL LPF R1 to su_trim[10:7]=1001 */ 619 + writel(PHYREG12_PLL_LPF_ADJ_VALUE, priv->mmio + PHYREG12); 620 + 621 + /* Set PLL input clock divider 1/2 */ 622 + val = FIELD_PREP(PHYREG6_PLL_DIV_MASK, PHYREG6_PLL_DIV_2); 623 + rockchip_combphy_updatel(priv, PHYREG6_PLL_DIV_MASK, val, PHYREG6); 624 + 625 + /* Set PLL loop divider */ 626 + writel(PHYREG18_PLL_LOOP, priv->mmio + PHYREG18); 627 + 628 + /* Set PLL KVCO to min and set PLL charge pump current to max */ 629 + writel(PHYREG11_SU_TRIM_0_7, priv->mmio + PHYREG11); 630 + 631 + /* Set Rx squelch input filler bandwidth */ 632 + writel(PHYREG21_RX_SQUELCH_VAL, priv->mmio + PHYREG21); 633 + 634 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_txcomp_sel, false); 635 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_txelec_sel, false); 636 + rockchip_combphy_param_write(priv->phy_grf, &cfg->usb_mode_set, true); 637 + break; 638 + 639 + case PHY_TYPE_SATA: 640 + /* Enable adaptive CTLE for SATA Rx */ 641 + val = readl(priv->mmio + PHYREG15); 642 + val |= PHYREG15_CTLE_EN; 643 + writel(val, priv->mmio + PHYREG15); 644 + 645 + /* Set tx_rterm = 50 ohm and rx_rterm = 43.5 ohm */ 646 + val = PHYREG7_TX_RTERM_50OHM << PHYREG7_TX_RTERM_SHIFT; 647 + val |= PHYREG7_RX_RTERM_44OHM << PHYREG7_RX_RTERM_SHIFT; 648 + writel(val, priv->mmio + PHYREG7); 649 + 650 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con0_for_sata, true); 651 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con1_for_sata, true); 652 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con2_for_sata, true); 653 + rockchip_combphy_param_write(priv->phy_grf, &cfg->con3_for_sata, true); 654 + rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_con0_for_sata, true); 655 + rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_con1_for_sata, true); 656 + break; 657 + 658 + default: 659 + dev_err(priv->dev, "incompatible PHY type\n"); 660 + return -EINVAL; 661 + } 662 + 663 + rate = clk_get_rate(priv->refclk); 664 + 665 + switch (rate) { 666 + case REF_CLOCK_24MHz: 667 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_24m, true); 668 + if (priv->type == PHY_TYPE_USB3 || priv->type == PHY_TYPE_SATA) { 669 + /* Set ssc_cnt[9:0]=0101111101 & 31.5KHz */ 670 + val = FIELD_PREP(PHYREG15_SSC_CNT_MASK, PHYREG15_SSC_CNT_VALUE); 671 + rockchip_combphy_updatel(priv, PHYREG15_SSC_CNT_MASK, 672 + val, PHYREG15); 673 + 674 + writel(PHYREG16_SSC_CNT_VALUE, priv->mmio + PHYREG16); 675 + } else if (priv->type == PHY_TYPE_PCIE) { 676 + /* PLL KVCO tuning fine */ 677 + val = FIELD_PREP(PHYREG33_PLL_KVCO_MASK, PHYREG33_PLL_KVCO_VALUE_RK3576); 678 + rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK, 679 + val, PHYREG33); 680 + 681 + /* Set up rx_pck invert and rx msb to disable */ 682 + writel(0x00, priv->mmio + PHYREG27); 683 + 684 + /* 685 + * Set up SU adjust signal: 686 + * su_trim[7:0], PLL KVCO adjust bits[2:0] to min 687 + * su_trim[15:8], PLL LPF R1 adujst bits[9:7]=3'b011 688 + * su_trim[31:24], CKDRV adjust 689 + */ 690 + writel(0x90, priv->mmio + PHYREG11); 691 + writel(0x02, priv->mmio + PHYREG12); 692 + writel(0x57, priv->mmio + PHYREG14); 693 + 694 + writel(PHYREG16_SSC_CNT_VALUE, priv->mmio + PHYREG16); 695 + } 696 + break; 697 + 698 + case REF_CLOCK_25MHz: 699 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_25m, true); 700 + break; 701 + 702 + case REF_CLOCK_100MHz: 703 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_100m, true); 704 + if (priv->type == PHY_TYPE_PCIE) { 705 + /* gate_tx_pck_sel length select work for L1SS */ 706 + writel(0xc0, priv->mmio + PHYREG30); 707 + 708 + /* PLL KVCO tuning fine */ 709 + val = FIELD_PREP(PHYREG33_PLL_KVCO_MASK, PHYREG33_PLL_KVCO_VALUE_RK3576); 710 + rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK, 711 + val, PHYREG33); 712 + 713 + /* Set up rx_trim: PLL LPF C1 85pf R1 1.25kohm */ 714 + writel(0x4c, priv->mmio + PHYREG27); 715 + 716 + /* 717 + * Set up SU adjust signal: 718 + * su_trim[7:0], PLL KVCO adjust bits[2:0] to min 719 + * su_trim[15:8], bypass PLL loop divider code, and 720 + * PLL LPF R1 adujst bits[9:7]=3'b101 721 + * su_trim[23:16], CKRCV adjust 722 + * su_trim[31:24], CKDRV adjust 723 + */ 724 + writel(0x90, priv->mmio + PHYREG11); 725 + writel(0x43, priv->mmio + PHYREG12); 726 + writel(0x88, priv->mmio + PHYREG13); 727 + writel(0x56, priv->mmio + PHYREG14); 728 + } else if (priv->type == PHY_TYPE_SATA) { 729 + /* downward spread spectrum +500ppm */ 730 + val = FIELD_PREP(PHYREG32_SSC_DIR_MASK, PHYREG32_SSC_DOWNWARD); 731 + val |= FIELD_PREP(PHYREG32_SSC_OFFSET_MASK, PHYREG32_SSC_OFFSET_500PPM); 732 + rockchip_combphy_updatel(priv, PHYREG32_SSC_MASK, val, PHYREG32); 733 + 734 + /* ssc ppm adjust to 3500ppm */ 735 + rockchip_combphy_updatel(priv, PHYREG10_SSC_PCM_MASK, 736 + PHYREG10_SSC_PCM_3500PPM, 737 + PHYREG10); 738 + } 739 + break; 740 + 741 + default: 742 + dev_err(priv->dev, "Unsupported rate: %lu\n", rate); 743 + return -EINVAL; 744 + } 745 + 746 + if (priv->ext_refclk) { 747 + rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_clk_ext, true); 748 + if (priv->type == PHY_TYPE_PCIE && rate == REF_CLOCK_100MHz) { 749 + val = FIELD_PREP(PHYREG33_PLL_KVCO_MASK, PHYREG33_PLL_KVCO_VALUE_RK3576); 750 + rockchip_combphy_updatel(priv, PHYREG33_PLL_KVCO_MASK, 751 + val, PHYREG33); 752 + 753 + /* Set up rx_trim: PLL LPF C1 85pf R1 2.5kohm */ 754 + writel(0x0c, priv->mmio + PHYREG27); 755 + 756 + /* 757 + * Set up SU adjust signal: 758 + * su_trim[7:0], PLL KVCO adjust bits[2:0] to min 759 + * su_trim[15:8], bypass PLL loop divider code, and 760 + * PLL LPF R1 adujst bits[9:7]=3'b101. 761 + * su_trim[23:16], CKRCV adjust 762 + * su_trim[31:24], CKDRV adjust 763 + */ 764 + writel(0x90, priv->mmio + PHYREG11); 765 + writel(0x43, priv->mmio + PHYREG12); 766 + writel(0x88, priv->mmio + PHYREG13); 767 + writel(0x56, priv->mmio + PHYREG14); 768 + } 769 + } 770 + 771 + if (priv->enable_ssc) { 772 + val = readl(priv->mmio + PHYREG8); 773 + val |= PHYREG8_SSC_EN; 774 + writel(val, priv->mmio + PHYREG8); 775 + 776 + if (priv->type == PHY_TYPE_PCIE && rate == REF_CLOCK_24MHz) { 777 + /* Set PLL loop divider */ 778 + writel(0x00, priv->mmio + PHYREG17); 779 + writel(PHYREG18_PLL_LOOP, priv->mmio + PHYREG18); 780 + 781 + /* Set up rx_pck invert and rx msb to disable */ 782 + writel(0x00, priv->mmio + PHYREG27); 783 + 784 + /* 785 + * Set up SU adjust signal: 786 + * su_trim[7:0], PLL KVCO adjust bits[2:0] to min 787 + * su_trim[15:8], PLL LPF R1 adujst bits[9:7]=3'b101 788 + * su_trim[23:16], CKRCV adjust 789 + * su_trim[31:24], CKDRV adjust 790 + */ 791 + writel(0x90, priv->mmio + PHYREG11); 792 + writel(0x02, priv->mmio + PHYREG12); 793 + writel(0x08, priv->mmio + PHYREG13); 794 + writel(0x57, priv->mmio + PHYREG14); 795 + writel(0x40, priv->mmio + PHYREG15); 796 + 797 + writel(PHYREG16_SSC_CNT_VALUE, priv->mmio + PHYREG16); 798 + 799 + val = FIELD_PREP(PHYREG33_PLL_KVCO_MASK, PHYREG33_PLL_KVCO_VALUE_RK3576); 800 + writel(val, priv->mmio + PHYREG33); 801 + } 802 + } 803 + 804 + return 0; 805 + } 806 + 807 + static const struct rockchip_combphy_grfcfg rk3576_combphy_grfcfgs = { 808 + /* pipe-phy-grf */ 809 + .pcie_mode_set = { 0x0000, 5, 0, 0x00, 0x11 }, 810 + .usb_mode_set = { 0x0000, 5, 0, 0x00, 0x04 }, 811 + .pipe_rxterm_set = { 0x0000, 12, 12, 0x00, 0x01 }, 812 + .pipe_txelec_set = { 0x0004, 1, 1, 0x00, 0x01 }, 813 + .pipe_txcomp_set = { 0x0004, 4, 4, 0x00, 0x01 }, 814 + .pipe_clk_24m = { 0x0004, 14, 13, 0x00, 0x00 }, 815 + .pipe_clk_25m = { 0x0004, 14, 13, 0x00, 0x01 }, 816 + .pipe_clk_100m = { 0x0004, 14, 13, 0x00, 0x02 }, 817 + .pipe_phymode_sel = { 0x0008, 1, 1, 0x00, 0x01 }, 818 + .pipe_rate_sel = { 0x0008, 2, 2, 0x00, 0x01 }, 819 + .pipe_rxterm_sel = { 0x0008, 8, 8, 0x00, 0x01 }, 820 + .pipe_txelec_sel = { 0x0008, 12, 12, 0x00, 0x01 }, 821 + .pipe_txcomp_sel = { 0x0008, 15, 15, 0x00, 0x01 }, 822 + .pipe_clk_ext = { 0x000c, 9, 8, 0x02, 0x01 }, 823 + .pipe_phy_status = { 0x0034, 6, 6, 0x01, 0x00 }, 824 + .con0_for_pcie = { 0x0000, 15, 0, 0x00, 0x1000 }, 825 + .con1_for_pcie = { 0x0004, 15, 0, 0x00, 0x0000 }, 826 + .con2_for_pcie = { 0x0008, 15, 0, 0x00, 0x0101 }, 827 + .con3_for_pcie = { 0x000c, 15, 0, 0x00, 0x0200 }, 828 + .con0_for_sata = { 0x0000, 15, 0, 0x00, 0x0129 }, 829 + .con1_for_sata = { 0x0004, 15, 0, 0x00, 0x0000 }, 830 + .con2_for_sata = { 0x0008, 15, 0, 0x00, 0x80c1 }, 831 + .con3_for_sata = { 0x000c, 15, 0, 0x00, 0x0407 }, 832 + /* php-grf */ 833 + .pipe_con0_for_sata = { 0x001C, 2, 0, 0x00, 0x2 }, 834 + .pipe_con1_for_sata = { 0x0020, 2, 0, 0x00, 0x2 }, 835 + }; 836 + 837 + static const struct rockchip_combphy_cfg rk3576_combphy_cfgs = { 838 + .num_phys = 2, 839 + .phy_ids = { 840 + 0x2b050000, 841 + 0x2b060000 842 + }, 843 + .grfcfg = &rk3576_combphy_grfcfgs, 844 + .combphy_cfg = rk3576_combphy_cfg, 845 + }; 846 + 847 static int rk3588_combphy_cfg(struct rockchip_combphy_priv *priv) 848 { 849 const struct rockchip_combphy_grfcfg *cfg = priv->cfg->grfcfg; ··· 774 { 775 .compatible = "rockchip,rk3568-naneng-combphy", 776 .data = &rk3568_combphy_cfgs, 777 + }, 778 + { 779 + .compatible = "rockchip,rk3576-naneng-combphy", 780 + .data = &rk3576_combphy_cfgs, 781 }, 782 { 783 .compatible = "rockchip,rk3588-naneng-combphy",
+46 -100
drivers/phy/rockchip/phy-rockchip-pcie.c
··· 124 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 125 int err = 0; 126 127 - mutex_lock(&rk_phy->pcie_mutex); 128 129 regmap_write(rk_phy->reg_base, 130 rk_phy->phy_data->pcie_laneoff, ··· 132 PHY_LANE_IDLE_MASK, 133 PHY_LANE_IDLE_A_SHIFT + inst->index)); 134 135 - if (--rk_phy->pwr_cnt) 136 - goto err_out; 137 138 err = reset_control_assert(rk_phy->phy_rst); 139 if (err) { 140 dev_err(&phy->dev, "assert phy_rst err %d\n", err); 141 - goto err_restore; 142 } 143 144 - err_out: 145 - mutex_unlock(&rk_phy->pcie_mutex); 146 - return 0; 147 - 148 - err_restore: 149 - rk_phy->pwr_cnt++; 150 - regmap_write(rk_phy->reg_base, 151 - rk_phy->phy_data->pcie_laneoff, 152 - HIWORD_UPDATE(!PHY_LANE_IDLE_OFF, 153 - PHY_LANE_IDLE_MASK, 154 - PHY_LANE_IDLE_A_SHIFT + inst->index)); 155 - mutex_unlock(&rk_phy->pcie_mutex); 156 return err; 157 } 158 ··· 157 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 158 int err = 0; 159 u32 status; 160 - unsigned long timeout; 161 162 - mutex_lock(&rk_phy->pcie_mutex); 163 164 - if (rk_phy->pwr_cnt++) 165 - goto err_out; 166 167 err = reset_control_deassert(rk_phy->phy_rst); 168 if (err) { 169 dev_err(&phy->dev, "deassert phy_rst err %d\n", err); 170 - goto err_pwr_cnt; 171 } 172 173 regmap_write(rk_phy->reg_base, rk_phy->phy_data->pcie_conf, ··· 187 * so we make it large enough here. And we use loop-break 188 * method which should not be harmful. 189 */ 190 - timeout = jiffies + msecs_to_jiffies(1000); 191 - 192 - err = -EINVAL; 193 - while (time_before(jiffies, timeout)) { 194 - regmap_read(rk_phy->reg_base, 195 - rk_phy->phy_data->pcie_status, 196 - &status); 197 - if (status & PHY_PLL_LOCKED) { 198 - dev_dbg(&phy->dev, "pll locked!\n"); 199 - err = 0; 200 - break; 201 - } 202 - msleep(20); 203 - } 204 - 205 if (err) { 206 dev_err(&phy->dev, "pll lock timeout!\n"); 207 goto err_pll_lock; ··· 200 phy_wr_cfg(rk_phy, PHY_CFG_CLK_TEST, PHY_CFG_SEPE_RATE); 201 phy_wr_cfg(rk_phy, PHY_CFG_CLK_SCC, PHY_CFG_PLL_100M); 202 203 - err = -ETIMEDOUT; 204 - while (time_before(jiffies, timeout)) { 205 - regmap_read(rk_phy->reg_base, 206 - rk_phy->phy_data->pcie_status, 207 - &status); 208 - if (!(status & PHY_PLL_OUTPUT)) { 209 - dev_dbg(&phy->dev, "pll output enable done!\n"); 210 - err = 0; 211 - break; 212 - } 213 - msleep(20); 214 - } 215 - 216 if (err) { 217 dev_err(&phy->dev, "pll output enable timeout!\n"); 218 goto err_pll_lock; ··· 214 HIWORD_UPDATE(PHY_CFG_PLL_LOCK, 215 PHY_CFG_ADDR_MASK, 216 PHY_CFG_ADDR_SHIFT)); 217 - err = -EINVAL; 218 - while (time_before(jiffies, timeout)) { 219 - regmap_read(rk_phy->reg_base, 220 - rk_phy->phy_data->pcie_status, 221 - &status); 222 - if (status & PHY_PLL_LOCKED) { 223 - dev_dbg(&phy->dev, "pll relocked!\n"); 224 - err = 0; 225 - break; 226 - } 227 - msleep(20); 228 - } 229 230 if (err) { 231 dev_err(&phy->dev, "pll relock timeout!\n"); 232 goto err_pll_lock; 233 } 234 235 - err_out: 236 - mutex_unlock(&rk_phy->pcie_mutex); 237 - return 0; 238 239 err_pll_lock: 240 reset_control_assert(rk_phy->phy_rst); 241 - err_pwr_cnt: 242 rk_phy->pwr_cnt--; 243 - mutex_unlock(&rk_phy->pcie_mutex); 244 return err; 245 } 246 ··· 239 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 240 int err = 0; 241 242 - mutex_lock(&rk_phy->pcie_mutex); 243 244 - if (rk_phy->init_cnt++) 245 - goto err_out; 246 - 247 - err = clk_prepare_enable(rk_phy->clk_pciephy_ref); 248 - if (err) { 249 - dev_err(&phy->dev, "Fail to enable pcie ref clock.\n"); 250 - goto err_refclk; 251 } 252 253 err = reset_control_assert(rk_phy->phy_rst); 254 if (err) { 255 dev_err(&phy->dev, "assert phy_rst err %d\n", err); 256 - goto err_reset; 257 } 258 259 - err_out: 260 - mutex_unlock(&rk_phy->pcie_mutex); 261 - return 0; 262 - 263 - err_reset: 264 - 265 - clk_disable_unprepare(rk_phy->clk_pciephy_ref); 266 - err_refclk: 267 - rk_phy->init_cnt--; 268 - mutex_unlock(&rk_phy->pcie_mutex); 269 return err; 270 } 271 ··· 260 struct phy_pcie_instance *inst = phy_get_drvdata(phy); 261 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 262 263 - mutex_lock(&rk_phy->pcie_mutex); 264 265 if (--rk_phy->init_cnt) 266 goto err_init_cnt; 267 268 - clk_disable_unprepare(rk_phy->clk_pciephy_ref); 269 - 270 err_init_cnt: 271 - mutex_unlock(&rk_phy->pcie_mutex); 272 return 0; 273 } 274 ··· 321 mutex_init(&rk_phy->pcie_mutex); 322 323 rk_phy->phy_rst = devm_reset_control_get(dev, "phy"); 324 - if (IS_ERR(rk_phy->phy_rst)) { 325 - if (PTR_ERR(rk_phy->phy_rst) != -EPROBE_DEFER) 326 - dev_err(dev, 327 - "missing phy property for reset controller\n"); 328 - return PTR_ERR(rk_phy->phy_rst); 329 - } 330 331 - rk_phy->clk_pciephy_ref = devm_clk_get(dev, "refclk"); 332 - if (IS_ERR(rk_phy->clk_pciephy_ref)) { 333 - dev_err(dev, "refclk not found.\n"); 334 - return PTR_ERR(rk_phy->clk_pciephy_ref); 335 - } 336 337 /* parse #phy-cells to see if it's legacy PHY model */ 338 if (of_property_read_u32(dev->of_node, "#phy-cells", &phy_num))
··· 124 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 125 int err = 0; 126 127 + guard(mutex)(&rk_phy->pcie_mutex); 128 129 regmap_write(rk_phy->reg_base, 130 rk_phy->phy_data->pcie_laneoff, ··· 132 PHY_LANE_IDLE_MASK, 133 PHY_LANE_IDLE_A_SHIFT + inst->index)); 134 135 + if (--rk_phy->pwr_cnt) { 136 + return 0; 137 + } 138 139 err = reset_control_assert(rk_phy->phy_rst); 140 if (err) { 141 dev_err(&phy->dev, "assert phy_rst err %d\n", err); 142 + rk_phy->pwr_cnt++; 143 + regmap_write(rk_phy->reg_base, 144 + rk_phy->phy_data->pcie_laneoff, 145 + HIWORD_UPDATE(!PHY_LANE_IDLE_OFF, 146 + PHY_LANE_IDLE_MASK, 147 + PHY_LANE_IDLE_A_SHIFT + inst->index)); 148 + return err; 149 } 150 151 return err; 152 } 153 ··· 162 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 163 int err = 0; 164 u32 status; 165 166 + guard(mutex)(&rk_phy->pcie_mutex); 167 168 + if (rk_phy->pwr_cnt++) { 169 + return 0; 170 + } 171 172 err = reset_control_deassert(rk_phy->phy_rst); 173 if (err) { 174 dev_err(&phy->dev, "deassert phy_rst err %d\n", err); 175 + rk_phy->pwr_cnt--; 176 + return err; 177 } 178 179 regmap_write(rk_phy->reg_base, rk_phy->phy_data->pcie_conf, ··· 191 * so we make it large enough here. And we use loop-break 192 * method which should not be harmful. 193 */ 194 + err = regmap_read_poll_timeout(rk_phy->reg_base, 195 + rk_phy->phy_data->pcie_status, 196 + status, 197 + status & PHY_PLL_LOCKED, 198 + 200, 100000); 199 if (err) { 200 dev_err(&phy->dev, "pll lock timeout!\n"); 201 goto err_pll_lock; ··· 214 phy_wr_cfg(rk_phy, PHY_CFG_CLK_TEST, PHY_CFG_SEPE_RATE); 215 phy_wr_cfg(rk_phy, PHY_CFG_CLK_SCC, PHY_CFG_PLL_100M); 216 217 + err = regmap_read_poll_timeout(rk_phy->reg_base, 218 + rk_phy->phy_data->pcie_status, 219 + status, 220 + !(status & PHY_PLL_OUTPUT), 221 + 200, 100000); 222 if (err) { 223 dev_err(&phy->dev, "pll output enable timeout!\n"); 224 goto err_pll_lock; ··· 236 HIWORD_UPDATE(PHY_CFG_PLL_LOCK, 237 PHY_CFG_ADDR_MASK, 238 PHY_CFG_ADDR_SHIFT)); 239 240 + err = regmap_read_poll_timeout(rk_phy->reg_base, 241 + rk_phy->phy_data->pcie_status, 242 + status, 243 + status & PHY_PLL_LOCKED, 244 + 200, 100000); 245 if (err) { 246 dev_err(&phy->dev, "pll relock timeout!\n"); 247 goto err_pll_lock; 248 } 249 250 + return err; 251 252 err_pll_lock: 253 reset_control_assert(rk_phy->phy_rst); 254 rk_phy->pwr_cnt--; 255 return err; 256 } 257 ··· 272 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 273 int err = 0; 274 275 + guard(mutex)(&rk_phy->pcie_mutex); 276 277 + if (rk_phy->init_cnt++) { 278 + return 0; 279 } 280 281 err = reset_control_assert(rk_phy->phy_rst); 282 if (err) { 283 dev_err(&phy->dev, "assert phy_rst err %d\n", err); 284 + rk_phy->init_cnt--; 285 + return err; 286 } 287 288 return err; 289 } 290 ··· 307 struct phy_pcie_instance *inst = phy_get_drvdata(phy); 308 struct rockchip_pcie_phy *rk_phy = to_pcie_phy(inst); 309 310 + guard(mutex)(&rk_phy->pcie_mutex); 311 312 if (--rk_phy->init_cnt) 313 goto err_init_cnt; 314 315 err_init_cnt: 316 return 0; 317 } 318 ··· 371 mutex_init(&rk_phy->pcie_mutex); 372 373 rk_phy->phy_rst = devm_reset_control_get(dev, "phy"); 374 + if (IS_ERR(rk_phy->phy_rst)) 375 + return dev_err_probe(&pdev->dev, PTR_ERR(rk_phy->phy_rst), 376 + "missing phy property for reset controller\n"); 377 378 + rk_phy->clk_pciephy_ref = devm_clk_get_enabled(dev, "refclk"); 379 + if (IS_ERR(rk_phy->clk_pciephy_ref)) 380 + return dev_err_probe(&pdev->dev, PTR_ERR(rk_phy->clk_pciephy_ref), 381 + "failed to get phyclk\n"); 382 383 /* parse #phy-cells to see if it's legacy PHY model */ 384 if (of_property_read_u32(dev->of_node, "#phy-cells", &phy_num))
+1 -1
drivers/phy/rockchip/phy-rockchip-typec.c
··· 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 - * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 4 * Author: Chris Zhong <zyw@rock-chips.com> 5 * Kever Yang <kever.yang@rock-chips.com> 6 *
··· 1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 + * Copyright (C) Rockchip Electronics Co., Ltd. 4 * Author: Chris Zhong <zyw@rock-chips.com> 5 * Kever Yang <kever.yang@rock-chips.com> 6 *
+1
drivers/phy/samsung/Kconfig
··· 33 tristate "Exynos SoC series UFS PHY driver" 34 depends on OF && (ARCH_EXYNOS || COMPILE_TEST) 35 select GENERIC_PHY 36 help 37 Enable this to support the Samsung Exynos SoC UFS PHY driver for 38 Samsung Exynos SoCs. This driver provides the interface for UFS host
··· 33 tristate "Exynos SoC series UFS PHY driver" 34 depends on OF && (ARCH_EXYNOS || COMPILE_TEST) 35 select GENERIC_PHY 36 + select MFD_SYSCON 37 help 38 Enable this to support the Samsung Exynos SoC UFS PHY driver for 39 Samsung Exynos SoCs. This driver provides the interface for UFS host
+3 -3
drivers/phy/samsung/phy-samsung-ufs.c
··· 13 #include <linux/of.h> 14 #include <linux/io.h> 15 #include <linux/iopoll.h> 16 #include <linux/module.h> 17 #include <linux/phy/phy.h> 18 #include <linux/platform_device.h> 19 #include <linux/regmap.h> 20 - #include <linux/soc/samsung/exynos-pmu.h> 21 22 #include "phy-samsung-ufs.h" 23 ··· 268 goto out; 269 } 270 271 - phy->reg_pmu = exynos_get_pmu_regmap_by_phandle(dev->of_node, 272 - "samsung,pmu-syscon"); 273 if (IS_ERR(phy->reg_pmu)) { 274 err = PTR_ERR(phy->reg_pmu); 275 dev_err(dev, "failed syscon remap for pmu\n");
··· 13 #include <linux/of.h> 14 #include <linux/io.h> 15 #include <linux/iopoll.h> 16 + #include <linux/mfd/syscon.h> 17 #include <linux/module.h> 18 #include <linux/phy/phy.h> 19 #include <linux/platform_device.h> 20 #include <linux/regmap.h> 21 22 #include "phy-samsung-ufs.h" 23 ··· 268 goto out; 269 } 270 271 + phy->reg_pmu = syscon_regmap_lookup_by_phandle(dev->of_node, 272 + "samsung,pmu-syscon"); 273 if (IS_ERR(phy->reg_pmu)) { 274 err = PTR_ERR(phy->reg_pmu); 275 dev_err(dev, "failed syscon remap for pmu\n");
+3 -2
drivers/phy/tegra/Kconfig
··· 13 14 config PHY_TEGRA194_P2U 15 tristate "NVIDIA Tegra194 PIPE2UPHY PHY driver" 16 - depends on ARCH_TEGRA_194_SOC || COMPILE_TEST 17 select GENERIC_PHY 18 help 19 - Enable this to support the P2U (PIPE to UPHY) that is part of Tegra 19x SOCs.
··· 13 14 config PHY_TEGRA194_P2U 15 tristate "NVIDIA Tegra194 PIPE2UPHY PHY driver" 16 + depends on ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC || COMPILE_TEST 17 select GENERIC_PHY 18 help 19 + Enable this to support the P2U (PIPE to UPHY) that is part of Tegra 19x 20 + and 234 SOCs.