From: Peter Chen <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, gregkh@linuxfoundation.org,
herve.codina@bootlin.com, linux-phy@lists.infradead.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org,
jun.li@nxp.com
Subject: Re: [PATCH v2 1/6] usb: phy: mxs: enable regulator phy-3p0 to improve signal qualilty
Date: Fri, 9 Aug 2024 09:26:25 +0800 [thread overview]
Message-ID: <20240809012625.GC2673490@nchen-desktop> (raw)
In-Reply-To: <20240726113207.3393247-1-xu.yang_2@nxp.com>
On 24-07-26 19:32:02, Xu Yang wrote:
> 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>
>
> ---
> Changes in v2:
> - rewrite commit message
> - use dev_err_probe() as suggested by Frank Li
> ---
> drivers/usb/phy/phy-mxs-usb.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index 920a32cd094d..d9d29f0b37de 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -18,6 +18,7 @@
> #include <linux/regmap.h>
> #include <linux/mfd/syscon.h>
> #include <linux/iopoll.h>
> +#include <linux/regulator/consumer.h>
>
> #define DRIVER_NAME "mxs_phy"
>
> @@ -204,6 +205,7 @@ struct mxs_phy {
> int port_id;
> u32 tx_reg_set;
> u32 tx_reg_mask;
> + struct regulator *phy_3p0;
> };
>
> static inline bool is_imx6q_phy(struct mxs_phy *mxs_phy)
> @@ -288,6 +290,16 @@ static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> if (ret)
> goto disable_pll;
>
> + if (mxs_phy->phy_3p0) {
> + ret = regulator_enable(mxs_phy->phy_3p0);
> + if (ret) {
> + dev_err(mxs_phy->phy.dev,
> + "Failed to enable 3p0 regulator, ret=%d\n",
> + ret);
> + return ret;
> + }
> + }
> +
> /* Power up the PHY */
> writel(0, base + HW_USBPHY_PWD);
>
> @@ -448,6 +460,9 @@ static void mxs_phy_shutdown(struct usb_phy *phy)
> if (is_imx7ulp_phy(mxs_phy))
> mxs_phy_pll_enable(phy->io_priv, false);
>
> + if (mxs_phy->phy_3p0)
> + regulator_disable(mxs_phy->phy_3p0);
> +
> clk_disable_unprepare(mxs_phy->clk);
> }
>
> @@ -789,6 +804,17 @@ static int mxs_phy_probe(struct platform_device *pdev)
> mxs_phy->clk = clk;
> mxs_phy->data = of_device_get_match_data(&pdev->dev);
>
> + mxs_phy->phy_3p0 = devm_regulator_get(&pdev->dev, "phy-3p0");
> + if (PTR_ERR(mxs_phy->phy_3p0) == -ENODEV)
> + /* not exist */
> + mxs_phy->phy_3p0 = NULL;
> + else if (IS_ERR(mxs_phy->phy_3p0))
> + return dev_err_probe(&pdev->dev, PTR_ERR(mxs_phy->phy_3p0),
> + "Getting regulator error\n");
> +
> + if (mxs_phy->phy_3p0)
> + regulator_set_voltage(mxs_phy->phy_3p0, 3200000, 3200000);
> +
> platform_set_drvdata(pdev, mxs_phy);
>
> device_set_wakeup_capable(&pdev->dev, true);
> --
> 2.34.1
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2024-08-09 1:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 11:32 [PATCH v2 1/6] usb: phy: mxs: enable regulator phy-3p0 to improve signal qualilty Xu Yang
2024-07-26 11:32 ` [PATCH v2 2/6] usb: phy: mxs: keep USBPHY2's clk always on Xu Yang
2024-08-09 1:36 ` Peter Chen
2024-07-26 11:32 ` [PATCH v2 3/6] dt-bindings: phy: mxs-usb-phy: add nxp,sim property Xu Yang
2024-07-29 1:03 ` Peng Fan
2024-07-29 6:16 ` Krzysztof Kozlowski
2024-07-29 6:26 ` Peng Fan
2024-08-22 10:42 ` Xu Yang
2024-08-22 11:41 ` Krzysztof Kozlowski
2024-08-29 9:09 ` Xu Yang
2024-09-03 7:08 ` Greg KH
2024-09-03 7:35 ` Xu Yang
2024-07-26 11:32 ` [PATCH v2 4/6] usb: phy: mxs: add wakeup enable for imx7ulp Xu Yang
2024-08-09 1:34 ` Peter Chen
2024-07-26 11:32 ` [PATCH v2 5/6] usb: phy: mxs: enable weak 1p1 regulator for imx6ul during suspend Xu Yang
2024-08-09 1:33 ` Peter Chen
2024-07-26 11:32 ` [PATCH v2 6/6] ARM: dts: imx7ulp: add "nxp,sim" property for usbphy1 Xu Yang
2024-08-26 6:56 ` Xu Yang
2024-08-28 1:44 ` Shawn Guo
2024-08-29 8:54 ` Xu Yang
2024-08-09 1:26 ` Peter Chen [this message]
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=20240809012625.GC2673490@nchen-desktop \
--to=peter.chen@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=herve.codina@bootlin.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=kernel@pengutronix.de \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=vkoul@kernel.org \
--cc=xu.yang_2@nxp.com \
/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).