From: Yao Zi <me@ziyao.cc>
To: alice.guo@oss.nxp.com, "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
u-boot@lists.denx.de
Cc: Stefano Babic <sbabic@nabladev.com>,
Fabio Estevam <festevam@gmail.com>, Tom Rini <trini@konsulko.com>,
Marek Vasut <marex@denx.de>,
Marek Vasut <marek.vasut@mailbox.org>, Ye Li <ye.li@nxp.com>,
Tim Harvey <tharvey@gateworks.com>, Peng Fan <peng.fan@nxp.com>,
Mattijs Korpershoek <mkorpershoek@kernel.org>,
Lukasz Majewski <lukma@denx.de>, Sherry Sun <sherry.sun@nxp.com>,
Kever Yang <kever.yang@rock-chips.com>,
Jonas Karlman <jonas@kwiboo.se>,
Quentin Schulz <quentin.schulz@cherry.de>,
George Chan <gchan9527@gmail.com>, Simon Glass <sjg@chromium.org>,
David Zang <davidzangcs@gmail.com>, Alice Guo <alice.guo@nxp.com>
Subject: Re: [PATCH v1 3/7] usb: ehci-mx6: Extract PHY initialization into reusable functionr
Date: Tue, 16 Dec 2025 09:52:41 +0000 [thread overview]
Message-ID: <aUEr6RsBi4-2yg64@pie> (raw)
In-Reply-To: <20251216-imx8ulp-v1-3-504115a53020@nxp.com>
On Tue, Dec 16, 2025 at 02:38:35PM +0800, alice.guo@oss.nxp.com wrote:
> From: Alice Guo <alice.guo@nxp.com>
>
> Extract USB PHY initialization code from ehci-mx6.c into a new function
> ehci_mx6_phy_init() that can be shared with the ChipIdea UDC driver.
>
> Signed-off-by: Alice Guo <alice.guo@nxp.com>
> ---
> drivers/usb/host/ehci-mx6.c | 73 ++++++++++++++++++++++++++++++++++++++++++++-
> include/usb/ci_udc.h | 9 ++++++
> 2 files changed, 81 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index 03ff4ce10d5..52f14e6eca0 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -12,6 +12,7 @@
> #include <asm/global_data.h>
> #include <linux/compiler.h>
> #include <linux/delay.h>
> +#include <usb/ci_udc.h>
> #include <usb/ehci-ci.h>
> #include <asm/io.h>
> #include <asm/arch/imx-regs.h>
> @@ -168,6 +169,54 @@ static void __maybe_unused
> usb_power_config_mx7ulp(void *usbphy) { }
> #endif
>
> +#if defined(CONFIG_IMX8)
> +static void usb_power_config_imx8(void __iomem *usbphy_base)
> +{
> + struct usbphy_regs __iomem *usbphy = (struct usbphy_regs __iomem *)usbphy_base;
> +
> + if (!is_imx8())
> + return;
> +
> + int timeout = 1000000;
> +
> + if (!(readl(&usbphy->usb1_pll_480_ctrl) & PLL_USB_LOCK_MASK)) {
> + /* Enable the regulator first */
> + writel(PLL_USB_REG_ENABLE_MASK,
> + &usbphy->usb1_pll_480_ctrl_set);
> +
> + /* Wait at least 25us */
> + udelay(25);
> +
> + /* Enable the power */
> + writel(PLL_USB_PWR_MASK, &usbphy->usb1_pll_480_ctrl_set);
> +
> + /* Wait lock */
> + while (timeout--) {
> + if (readl(&usbphy->usb1_pll_480_ctrl) &
> + PLL_USB_LOCK_MASK)
> + break;
> + udelay(10);
> + }
We have readX_poll_timeout() defined in include/linux/iopoll.h, I think
it could simplify the code here.
> + if (timeout <= 0) {
> + /* If timeout, we power down the pll */
> + writel(PLL_USB_PWR_MASK,
> + &usbphy->usb1_pll_480_ctrl_clr);
> + return;
> + }
> + }
> +
> + /* Clear the bypass */
> + writel(PLL_USB_BYPASS_MASK, &usbphy->usb1_pll_480_ctrl_clr);
> +
> + /* Enable the PLL clock out to USB */
> + writel((PLL_USB_EN_USB_CLKS_MASK | PLL_USB_ENABLE_MASK),
> + &usbphy->usb1_pll_480_ctrl_set);
> +}
Regards,
Yao Zi
next prev parent reply other threads:[~2025-12-16 9:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 6:38 [PATCH 0/7] Enable USB in device mode on i.MX8ULP EVK alice.guo
2025-12-16 6:38 ` [PATCH v1 1/7] usb: ehci-mx6: Move USB PHY register definitions to common header alice.guo
2025-12-16 6:38 ` [PATCH v1 2/7] usb: ehci-mx6: Fix usb_oc_config() for i.MX7/8M/9/7ULP/8 and 8ULP platforms alice.guo
2025-12-16 11:15 ` Marek Vasut
2025-12-25 10:41 ` 回复: " Alice Guo (OSS)
2025-12-25 20:56 ` Marek Vasut
2025-12-16 6:38 ` [PATCH v1 3/7] usb: ehci-mx6: Extract PHY initialization into reusable function alice.guo
2025-12-16 9:52 ` Yao Zi [this message]
2025-12-16 11:17 ` Marek Vasut
2025-12-25 10:49 ` 回复: " Alice Guo (OSS)
2025-12-16 6:38 ` [PATCH v1 4/7] usb: ci_udc: Convert driver to DM_USB_GADGET alice.guo
2025-12-16 10:00 ` Yao Zi
2025-12-16 11:19 ` Marek Vasut
2025-12-16 14:07 ` Tom Rini
2025-12-16 6:38 ` [PATCH v1 5/7] usb: Kconfig: imply DM_USB_GADGET alice.guo
2025-12-16 9:49 ` Quentin Schulz
2025-12-16 10:07 ` Yao Zi
2025-12-25 10:16 ` 回复: " Alice Guo (OSS)
2025-12-25 15:06 ` Tom Rini
2025-12-16 6:38 ` [PATCH v1 6/7] usb: gadget: ci_udc: Add i.MX8ULP support alice.guo
2025-12-16 6:38 ` [PATCH v1 7/7] imx8ulp_evk: Enable USB controller at 0x29920000 in device mode alice.guo
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=aUEr6RsBi4-2yg64@pie \
--to=me@ziyao.cc \
--cc=alice.guo@nxp.com \
--cc=alice.guo@oss.nxp.com \
--cc=davidzangcs@gmail.com \
--cc=festevam@gmail.com \
--cc=gchan9527@gmail.com \
--cc=jonas@kwiboo.se \
--cc=kever.yang@rock-chips.com \
--cc=lukma@denx.de \
--cc=marek.vasut@mailbox.org \
--cc=marex@denx.de \
--cc=mkorpershoek@kernel.org \
--cc=peng.fan@nxp.com \
--cc=quentin.schulz@cherry.de \
--cc=sbabic@nabladev.com \
--cc=sherry.sun@nxp.com \
--cc=sjg@chromium.org \
--cc=tharvey@gateworks.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-imx@nxp.com \
--cc=ye.li@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.