Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: phy: mxs: enable regulator phy-3p0 to improve signal qualilty

Enable regulator 'phy-3p0' to pass eye diagram test since it improve signal
qualilty.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20240726113207.3393247-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
966d7315 c6a6c7d0

+26
+26
drivers/usb/phy/phy-mxs-usb.c
··· 18 18 #include <linux/regmap.h> 19 19 #include <linux/mfd/syscon.h> 20 20 #include <linux/iopoll.h> 21 + #include <linux/regulator/consumer.h> 21 22 22 23 #define DRIVER_NAME "mxs_phy" 23 24 ··· 205 204 int port_id; 206 205 u32 tx_reg_set; 207 206 u32 tx_reg_mask; 207 + struct regulator *phy_3p0; 208 208 }; 209 209 210 210 static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy) ··· 289 287 ret = stmp_reset_block(base + HW_USBPHY_CTRL); 290 288 if (ret) 291 289 goto disable_pll; 290 + 291 + if (mxs_phy->phy_3p0) { 292 + ret = regulator_enable(mxs_phy->phy_3p0); 293 + if (ret) { 294 + dev_err(mxs_phy->phy.dev, 295 + "Failed to enable 3p0 regulator, ret=%d\n", 296 + ret); 297 + return ret; 298 + } 299 + } 292 300 293 301 /* Power up the PHY */ 294 302 writel(0, base + HW_USBPHY_PWD); ··· 459 447 460 448 if (is_imx7ulp_phy(mxs_phy)) 461 449 mxs_phy_pll_enable(phy->io_priv, false); 450 + 451 + if (mxs_phy->phy_3p0) 452 + regulator_disable(mxs_phy->phy_3p0); 462 453 463 454 clk_disable_unprepare(mxs_phy->clk); 464 455 } ··· 803 788 804 789 mxs_phy->clk = clk; 805 790 mxs_phy->data = of_device_get_match_data(&pdev->dev); 791 + 792 + mxs_phy->phy_3p0 = devm_regulator_get(&pdev->dev, "phy-3p0"); 793 + if (PTR_ERR(mxs_phy->phy_3p0) == -ENODEV) 794 + /* not exist */ 795 + mxs_phy->phy_3p0 = NULL; 796 + else if (IS_ERR(mxs_phy->phy_3p0)) 797 + return dev_err_probe(&pdev->dev, PTR_ERR(mxs_phy->phy_3p0), 798 + "Getting regulator error\n"); 799 + 800 + if (mxs_phy->phy_3p0) 801 + regulator_set_voltage(mxs_phy->phy_3p0, 3200000, 3200000); 806 802 807 803 platform_set_drvdata(pdev, mxs_phy); 808 804