mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/7] usb: ehci: Handle clocks and phys
Date: Tue, 22 Jun 2021 08:47:05 +0200	[thread overview]
Message-ID: <20210622064711.14058-1-s.hauer@pengutronix.de> (raw)

The generic ehci binding also describes clocks and a phy. Add support
for these properties to the driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/host/ehci-hcd.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8c4da9fd12..4dd4d1dddb 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -32,6 +32,8 @@
 #include <usb/ehci.h>
 #include <linux/err.h>
 #include <linux/sizes.h>
+#include <linux/clk.h>
+#include <linux/phy/phy.h>
 
 #include "ehci.h"
 
@@ -1413,6 +1415,9 @@ static int ehci_probe(struct device_d *dev)
 	struct ehci_platform_data *pdata = dev->platform_data;
 	struct device_node *dn = dev->device_node;
 	struct ehci_host *ehci;
+	struct clk_bulk_data *clks;
+	int num_clocks, ret;
+	struct phy *usb2_generic_phy;
 
 	if (pdata)
 		data.flags = pdata->flags;
@@ -1440,6 +1445,27 @@ static int ehci_probe(struct device_d *dev)
 	else
 		data.hcor = NULL;
 
+	usb2_generic_phy = phy_optional_get(dev, "usb");
+	if (IS_ERR(usb2_generic_phy))
+		return PTR_ERR(usb2_generic_phy);
+
+	ret = phy_init(usb2_generic_phy);
+	if (ret)
+		return ret;
+
+	ret = phy_power_on(usb2_generic_phy);
+	if (ret)
+		return ret;
+
+	ret = clk_bulk_get_all(dev, &clks);
+	if (ret < 0)
+		return ret;
+
+	num_clocks = ret;
+	ret = clk_bulk_enable(num_clocks, clks);
+	if (ret)
+		return ret;
+
 	ehci = ehci_register(dev, &data);
 	if (IS_ERR(ehci))
 		return PTR_ERR(ehci);
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2021-06-22  6:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-22  6:47 Sascha Hauer [this message]
2021-06-22  6:47 ` [PATCH 2/7] phy: Rockchip: Add driver for usb2phy Sascha Hauer
2021-06-22  6:47 ` [PATCH 3/7] phy: rockchip: Add naneng-combphy support Sascha Hauer
2021-06-22  6:47 ` [PATCH 4/7] ARM: Rockchip: rk3568: Add USB nodes Sascha Hauer
2021-06-22  6:47 ` [PATCH 5/7] ARM: Rockchip: rk3568 EVB: Add USB support Sascha Hauer
2021-06-22  6:47 ` [PATCH 6/7] fixup! phy: Rockchip: Add driver for usb2phy Sascha Hauer
2021-06-22  6:54   ` Sascha Hauer
2021-06-22  6:47 ` [PATCH 7/7] fixup! phy: rockchip: Add naneng-combphy support Sascha Hauer

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=20210622064711.14058-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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