From: Frank Li <Frank.li@oss.nxp.com>
To: Xu Yang <xu.yang_2@oss.nxp.com>
Cc: Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>, Jun Li <jun.li@nxp.com>,
linux-phy@lists.infradead.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Xu Yang <xu.yang_2@nxp.com>
Subject: Re: [PATCH v6 5/6] phy: fsl-imx8mq-usb: introduce per-variant driver data structure
Date: Wed, 15 Jul 2026 10:29:19 -0500 [thread overview]
Message-ID: <alenTyMiIqxEycPK@SMW015318> (raw)
In-Reply-To: <20260715-imx8mp-usb-phy-improvement-v6-5-00d95e270e4c@nxp.com>
On Wed, Jul 15, 2026 at 07:34:00PM +0800, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
>
> Replace direct use of phy_ops pointer in of_device_id .data with a
> dedicated imx8mq_usb_phy_drvdata structure. This allows per-variant
> driver data to be extended in the future without changing the match
> table.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> ---
> Changes in v6:
> - new patch
> ---
> drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 29 ++++++++++++++++++++++-------
> 1 file changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> index 79b3958ead2f..f0bdfa75d586 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> @@ -132,6 +132,9 @@ struct imx8mq_usb_phy {
> u32 comp_dis_tune;
> };
>
> +struct imx8mq_usb_phy_drvdata {
> + const struct phy_ops *ops;
> +};
>
> static void tca_blk_orientation_set(struct tca_blk *tca,
> enum typec_orientation orientation);
> @@ -660,13 +663,25 @@ static const struct phy_ops imx8mp_usb_phy_ops = {
> .owner = THIS_MODULE,
> };
>
> +static const struct imx8mq_usb_phy_drvdata imx8mq_usb_phy_data = {
> + .ops = &imx8mq_usb_phy_ops,
> +};
> +
> +static const struct imx8mq_usb_phy_drvdata imx8mp_usb_phy_data = {
> + .ops = &imx8mp_usb_phy_ops,
> +};
> +
> +static const struct imx8mq_usb_phy_drvdata imx95_usb_phy_data = {
> + .ops = &imx8mp_usb_phy_ops,
> +};
> +
> static const struct of_device_id imx8mq_usb_phy_of_match[] = {
> {.compatible = "fsl,imx8mq-usb-phy",
> - .data = &imx8mq_usb_phy_ops,},
> + .data = &imx8mq_usb_phy_data,},
> {.compatible = "fsl,imx8mp-usb-phy",
> - .data = &imx8mp_usb_phy_ops,},
> + .data = &imx8mp_usb_phy_data,},
> {.compatible = "fsl,imx95-usb-phy",
> - .data = &imx8mp_usb_phy_ops,},
> + .data = &imx95_usb_phy_data,},
> { }
> };
> MODULE_DEVICE_TABLE(of, imx8mq_usb_phy_of_match);
> @@ -684,7 +699,7 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
> struct phy_provider *phy_provider;
> struct device *dev = &pdev->dev;
> struct imx8mq_usb_phy *imx_phy;
> - const struct phy_ops *phy_ops;
> + const struct imx8mq_usb_phy_drvdata *phy_data;
> int ret;
>
> imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL);
> @@ -720,11 +735,11 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
> if (ret)
> return dev_err_probe(dev, ret, "failed to enable runtime PM\n");
>
> - phy_ops = of_device_get_match_data(dev);
> - if (!phy_ops)
> + phy_data = of_device_get_match_data(dev);
> + if (!phy_data)
> return -EINVAL;
>
> - imx_phy->phy = devm_phy_create(dev, NULL, phy_ops);
> + imx_phy->phy = devm_phy_create(dev, NULL, phy_data->ops);
> if (IS_ERR(imx_phy->phy))
> return PTR_ERR(imx_phy->phy);
>
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-07-15 15:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 11:33 [PATCH v6 0/6] phy: fsl-imx8mq-usb: few improvements Xu Yang
2026-07-15 11:33 ` [PATCH v6 1/6] phy: fsl-imx8mq-usb: fix typec switch leak on probe error path Xu Yang
2026-07-15 11:46 ` sashiko-bot
2026-07-15 11:33 ` [PATCH v6 2/6] phy: fsl-imx8mq-usb: set usb phy to be wakeup capable Xu Yang
2026-07-15 11:33 ` [PATCH v6 3/6] phy: fsl-imx8mq-usb: add runtime PM support Xu Yang
2026-07-15 11:52 ` sashiko-bot
2026-07-15 15:28 ` Frank Li
2026-07-15 11:33 ` [PATCH v6 4/6] phy: fsl-imx8mq-usb: add control register regmap Xu Yang
2026-07-15 11:34 ` [PATCH v6 5/6] phy: fsl-imx8mq-usb: introduce per-variant driver data structure Xu Yang
2026-07-15 15:29 ` Frank Li [this message]
2026-07-15 11:34 ` [PATCH v6 6/6] phy: fsl-imx8mq-usb: keep PHY power domain runtime always-on for i.MX8MP Xu Yang
2026-07-15 11:44 ` sashiko-bot
2026-07-15 15:32 ` Frank Li
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=alenTyMiIqxEycPK@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=s.hauer@pengutronix.de \
--cc=vkoul@kernel.org \
--cc=xu.yang_2@nxp.com \
--cc=xu.yang_2@oss.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