u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Sumit Garg <sumit.garg@linaro.org>
To: u-boot@lists.denx.de
Cc: rfried.dev@gmail.com, jorge.ramirez.ortiz@gmail.com,
	sjg@chromium.org, trini@konsulko.com, stephan@gerhold.net,
	mario.six@gdsys.cc, dsankouski@gmail.com,
	robert.marko@sartura.hr, luka.kovacic@sartura.hr,
	luka.perkov@sartura.hr, jh80.chung@samsung.com,
	nicolas.dechesne@linaro.org, vinod.koul@linaro.org,
	mworsfold@impinj.com, lgillham@impinj.com,
	daniel.thompson@linaro.org, pbrobinson@gmail.com,
	Sumit Garg <sumit.garg@linaro.org>
Subject: [PATCH 07/13] clocks: qcs404: Add support for USB clocks
Date: Thu,  4 Aug 2022 19:57:15 +0530	[thread overview]
Message-ID: <20220804142721.536556-8-sumit.garg@linaro.org> (raw)
In-Reply-To: <20220804142721.536556-1-sumit.garg@linaro.org>

Add support for USB controller and PHY clocks for QCS404 SoC.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 arch/arm/mach-snapdragon/clock-qcs404.c       | 35 +++++++++++++++++++
 .../include/mach/sysmap-qcs404.h              | 17 +++++++++
 2 files changed, 52 insertions(+)

diff --git a/arch/arm/mach-snapdragon/clock-qcs404.c b/arch/arm/mach-snapdragon/clock-qcs404.c
index 230d7779a7..6fe92afe8d 100644
--- a/arch/arm/mach-snapdragon/clock-qcs404.c
+++ b/arch/arm/mach-snapdragon/clock-qcs404.c
@@ -47,6 +47,14 @@ static struct pll_vote_clk gpll0_vote_clk = {
 	.vote_bit = BIT(0),
 };
 
+static const struct bcr_regs usb30_master_regs = {
+	.cfg_rcgr = USB30_MASTER_CFG_RCGR,
+	.cmd_rcgr = USB30_MASTER_CMD_RCGR,
+	.M = USB30_MASTER_M,
+	.N = USB30_MASTER_N,
+	.D = USB30_MASTER_D,
+};
+
 ulong msm_set_rate(struct clk *clk, ulong rate)
 {
 	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
@@ -80,5 +88,32 @@ ulong msm_set_rate(struct clk *clk, ulong rate)
 
 int msm_enable(struct clk *clk)
 {
+	struct msm_clk_priv *priv = dev_get_priv(clk->dev);
+
+	switch (clk->id) {
+	case GCC_USB30_MASTER_CLK:
+		clk_enable_cbc(priv->base + USB30_MASTER_CBCR);
+		clk_rcg_set_rate_mnd(priv->base, &usb30_master_regs, 4, 0, 0,
+				     CFG_CLK_SRC_GPLL0);
+		break;
+	case GCC_SYS_NOC_USB3_CLK:
+		clk_enable_cbc(priv->base + SYS_NOC_USB3_CBCR);
+		break;
+	case GCC_USB30_SLEEP_CLK:
+		clk_enable_cbc(priv->base + USB30_SLEEP_CBCR);
+		break;
+	case GCC_USB30_MOCK_UTMI_CLK:
+		clk_enable_cbc(priv->base + USB30_MOCK_UTMI_CBCR);
+		break;
+	case GCC_USB_HS_PHY_CFG_AHB_CLK:
+		clk_enable_cbc(priv->base + USB_HS_PHY_CFG_AHB_CBCR);
+		break;
+	case GCC_USB2A_PHY_SLEEP_CLK:
+		clk_enable_cbc(priv->base + USB_HS_PHY_CFG_AHB_CBCR);
+		break;
+	default:
+		return 0;
+	}
+
 	return 0;
 }
diff --git a/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h b/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h
index 4dc96b9fbc..e448faad2d 100644
--- a/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h
+++ b/arch/arm/mach-snapdragon/include/mach/sysmap-qcs404.h
@@ -37,4 +37,21 @@
 #define SDCC_APPS_CBCR(n)		(((n) * 0x1000) + 0x41018)
 #define SDCC_AHB_CBCR(n)		(((n) * 0x1000) + 0x4101C)
 
+/* USB-3.0 controller clock control registers */
+#define SYS_NOC_USB3_CBCR		(0x26014)
+#define USB30_BCR			(0x39000)
+#define USB3PHY_BCR			(0x39008)
+#define USB30_MASTER_CBCR		(0x3900C)
+#define USB30_SLEEP_CBCR		(0x39010)
+#define USB30_MOCK_UTMI_CBCR		(0x39014)
+#define USB30_MOCK_UTMI_CMD_RCGR	(0x3901C)
+#define USB30_MOCK_UTMI_CFG_RCGR	(0x39020)
+#define USB30_MASTER_CMD_RCGR		(0x39028)
+#define USB30_MASTER_CFG_RCGR		(0x3902C)
+#define USB30_MASTER_M			(0x39030)
+#define USB30_MASTER_N			(0x39034)
+#define USB30_MASTER_D			(0x39038)
+#define USB2A_PHY_SLEEP_CBCR		(0x4102C)
+#define USB_HS_PHY_CFG_AHB_CBCR		(0x41030)
+
 #endif
-- 
2.25.1


  parent reply	other threads:[~2022-08-04 14:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 14:27 [PATCH 00/13] USB support for QCS404 SoC Sumit Garg
2022-08-04 14:27 ` [PATCH 01/13] phy: Move qcom SoCs specific phy drivers to qcom folder Sumit Garg
2022-08-26 18:49   ` Tom Rini
2022-08-04 14:27 ` [PATCH 02/13] phy: Add support for drivers to enable USB on QCS404 SoC Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 03/13] reset: Convert ipq4019 driver to a generic Qcom driver Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 04/13] reset: qcom: Add support for QCS404 SoC reset table Sumit Garg
2022-08-06  7:41   ` Robert Marko
2022-08-09 13:25     ` Sumit Garg
2022-08-09 13:27       ` Robert Marko
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 05/13] dts: qcs404-evb: Add reset controller node Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 06/13] clocks: qcom: Add clock enable callback support Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` Sumit Garg [this message]
2022-08-26 18:50   ` [PATCH 07/13] clocks: qcs404: Add support for USB clocks Tom Rini
2022-08-04 14:27 ` [PATCH 08/13] dts: qcs404-evb: Add USB controller and PHY nodes Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 09/13] pmic: Convert pm8916 driver to a generic Qcom PMIC driver Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 10/13] gpio: qcom_pmic: Add support for GPIO LV/MV subtype Sumit Garg
2022-08-26 18:50   ` Tom Rini
2022-08-04 14:27 ` [PATCH 11/13] dts: qcs404-evb: Add PMIC GPIO controller node Sumit Garg
2022-08-26 18:51   ` Tom Rini
2022-08-04 14:27 ` [PATCH 12/13] board: qcs404-evb: Enable USB3 specific PMIC GPIO Sumit Garg
2022-08-26 18:51   ` Tom Rini
2022-08-04 14:27 ` [PATCH 13/13] qcs404evb_defconfig: Enable USB configs Sumit Garg
2022-08-26 18:51   ` Tom Rini
2022-08-16  8:09 ` [PATCH 00/13] USB support for QCS404 SoC Sumit Garg

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=20220804142721.536556-8-sumit.garg@linaro.org \
    --to=sumit.garg@linaro.org \
    --cc=daniel.thompson@linaro.org \
    --cc=dsankouski@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=jorge.ramirez.ortiz@gmail.com \
    --cc=lgillham@impinj.com \
    --cc=luka.kovacic@sartura.hr \
    --cc=luka.perkov@sartura.hr \
    --cc=mario.six@gdsys.cc \
    --cc=mworsfold@impinj.com \
    --cc=nicolas.dechesne@linaro.org \
    --cc=pbrobinson@gmail.com \
    --cc=rfried.dev@gmail.com \
    --cc=robert.marko@sartura.hr \
    --cc=sjg@chromium.org \
    --cc=stephan@gerhold.net \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vinod.koul@linaro.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;
as well as URLs for NNTP newsgroup(s).