Linux USB
 help / color / mirror / Atom feed
From: Stanley Chang <stanley_chang@realtek.com>
To: Mathias Nyman <mathias.nyman@intel.com>
Cc: <linux-usb@vger.kernel.org>
Subject: [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support
Date: Fri, 7 Apr 2023 14:07:31 +0800	[thread overview]
Message-ID: <20230407060731.20537-1-stanley_chang@realtek.com> (raw)

For Realtek SoC, the usb xhci uses different driver for u2phy and u3phy.
Therefore, add a hook to retrieve the USB 3.0 PHY to XHCI plat.

Signed-off-by: Stanley Chang <stanley_chang@realtek.com>
---
 drivers/usb/host/xhci-plat.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index b9f9625467d6..61c95349b998 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -291,6 +291,21 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 			goto dealloc_usb2_hcd;
 		}
 
+		xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev,
+			    "usb-phy", 1);
+		if (IS_ERR(xhci->shared_hcd->usb_phy)) {
+			if (PTR_ERR(xhci->shared_hcd->usb_phy) != -ENODEV)
+				dev_err(sysdev, "%s get usb3phy fail (ret=%d)\n",
+					     __func__,
+					    (int)PTR_ERR(xhci->shared_hcd->usb_phy));
+			xhci->shared_hcd->usb_phy = NULL;
+		} else {
+			ret = usb_phy_init(xhci->shared_hcd->usb_phy);
+			if (ret)
+				dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
+					    __func__, ret);
+		}
+
 		xhci->shared_hcd->tpl_support = hcd->tpl_support;
 	}
 
-- 
2.34.1


             reply	other threads:[~2023-04-07  6:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07  6:07 Stanley Chang [this message]
2023-05-09 17:33 ` [PATCH v1] usb: xhci: plat: Add USB 3.0 phy support Klaus Kudielka
2023-05-10  3:16   ` Stanley Chang[昌育德]
2023-05-10  6:11     ` Klaus Kudielka
2023-05-10  6:25       ` Stanley Chang[昌育德]

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=20230407060731.20537-1-stanley_chang@realtek.com \
    --to=stanley_chang@realtek.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.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