All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-usb@vger.kernel.org
Cc: Minas Harutyunyan <hminas@synopsys.com>,
	devicetree@vger.kernel.org, kernel@pengutronix.de,
	Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH 2/2] usb: dwc2: use clk bulk API for supporting additional clocks
Date: Mon, 25 Jan 2021 10:38:25 +0100	[thread overview]
Message-ID: <20210125093825.4292-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20210125093825.4292-1-s.hauer@pengutronix.de>

This switches to the clk bulk API for the dwc2 driver. With this
additional clocks can be supported.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/dwc2/core.h     |  2 ++
 drivers/usb/dwc2/platform.c | 18 ++++++++----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 7161344c6522..4c9e2c75f3dd 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -1075,6 +1075,8 @@ struct dwc2_hsotg {
 	spinlock_t lock;
 	void *priv;
 	int     irq;
+	struct clk_bulk_data *clocks;
+	int num_clocks;
 	struct clk *clk;
 	struct reset_control *reset;
 	struct reset_control *reset_ecc;
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 5f18acac7406..d4a1a26103da 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -143,11 +143,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
 	if (ret)
 		return ret;
 
-	if (hsotg->clk) {
-		ret = clk_prepare_enable(hsotg->clk);
-		if (ret)
-			return ret;
-	}
+	ret = clk_bulk_prepare_enable(hsotg->num_clocks, hsotg->clocks);
+	if (ret)
+		return ret;
 
 	if (hsotg->uphy) {
 		ret = usb_phy_init(hsotg->uphy);
@@ -195,8 +193,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
 	if (ret)
 		return ret;
 
-	if (hsotg->clk)
-		clk_disable_unprepare(hsotg->clk);
+	clk_bulk_disable_unprepare(hsotg->num_clocks, hsotg->clocks);
 
 	return 0;
 }
@@ -281,11 +278,12 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 	hsotg->plat = dev_get_platdata(hsotg->dev);
 
 	/* Clock */
-	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
-	if (IS_ERR(hsotg->clk)) {
+	ret = devm_clk_bulk_get_all(hsotg->dev, &hsotg->clocks);
+	if (ret < 0) {
 		dev_err(hsotg->dev, "cannot get otg clock\n");
-		return PTR_ERR(hsotg->clk);
+		return ret;
 	}
+	hsotg->num_clocks = ret;
 
 	/* Regulators */
 	for (i = 0; i < ARRAY_SIZE(hsotg->supplies); i++)
-- 
2.20.1


  parent reply	other threads:[~2021-01-26  4:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  9:38 [PATCH v2 0/2] usb: dwc2: Use clk bulk API for supporting multiple clocks Sascha Hauer
2021-01-25  9:38 ` [PATCH 1/2] dt-bindings: usb: dwc2: Add support for additional clock Sascha Hauer
2021-02-09 16:46   ` Rob Herring
2021-02-10  8:39     ` Sascha Hauer
2021-01-25  9:38 ` Sascha Hauer [this message]
2021-02-09 16:54 ` [PATCH v2 0/2] usb: dwc2: Use clk bulk API for supporting multiple clocks Rob Herring
2021-02-10  8:42   ` Sascha Hauer
  -- strict thread matches above, loose matches on Subject: below --
2021-01-11 15:13 [PATCH " Sascha Hauer
2021-01-11 15:13 ` [PATCH 2/2] usb: dwc2: use clk bulk API for supporting additional clocks 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=20210125093825.4292-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=hminas@synopsys.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-usb@vger.kernel.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 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.