From patchwork Tue Mar 19 12:22:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 781089 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp1896170wrs; Tue, 19 Mar 2024 05:23:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXBzMS+ngrALjoN9/h6nE4pVUVmt1r1GnagFSsM0GMPl6SsesZJGxswN8zK1EPKwmeWI3s8famqikVvbXR7nve3 X-Google-Smtp-Source: AGHT+IF0BtYGlKSm1cC51dgmb+54POkl5suXIlSXx41J2oI9+tm/CE4Vrv9ZZSpeWOnxQWX6YGsK X-Received: by 2002:a05:6512:280d:b0:513:dd43:a153 with SMTP id cf13-20020a056512280d00b00513dd43a153mr10341693lfb.59.1710851033398; Tue, 19 Mar 2024 05:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710851033; cv=none; d=google.com; s=arc-20160816; b=EnNpRJP1gZVOqI4oQ/hcHbipLFq7T7rd0kd73h6B7NuROyLoZinNzgSFfBTmOFK4QJ bHjKkKqQTQ/9v3CNrQ3l2wSKZuCAkvpnWVFZr8rnHy4lwhLhE9EsY5EX/ay0NFYB/ztl RkugPSJe+mzH2BfN4iUh1C7qe5+IWQA1MRRk/5wcT6PYGa9xryRJC22fkYGbmQ51GSN1 ALGZazdYCbMbo+bof5k7EPddwEcFrtG8J+svUBdS2k+TpKMzxrB6eTwrILhwh7FJfRTE ima9ozm58O9GM9Db6t4t8vXK2dpU/yygQrRKh+UEAD4XJx0XCSYHc8XozbeG2/RiSjHQ Xtfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Wsmj05dPfs1rjcVH8tp3Vc80gcGSrf4xjJcLkyvDdHQ=; fh=gSVpyLKtvZ+QePPYgVwr0OwBuSQ/slJGUurC/y9msiw=; b=ekWBPCgf8WUBNwTPWy/lgHnSKymjWq/PFhdDhfhT5GR1Bm8KROWlPuyO1vHLqtcwtQ hnM4d96PXZOiT2/Jgrft/Y8Pn36ja7LktkPv8c48WW39IfjtbO034Ef7wTrrSFwpYP1o IozRBAo0xe6+5M/uVTdZ0PbAwojHrn7AW+/RTs9P1n+iIHMfTcYhFFlPJZHw3pjlHqx9 CGHJX78D5hPd9Nd7D68mRt/4D7/cN8zcC3enNt5KpvsMOBQXOCsvDSR/8t873YFlUNSF kmtWuKyyQATxW7ZY4QB91dhFpSYMnFdQYB0ZgtLdMMmYNUhz1qbbEAfuaVUxTO0Hh6Lw Q9GQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XlaKaEr1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id n10-20020a05600c304a00b00414645edd67si787321wmh.64.2024.03.19.05.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XlaKaEr1; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A8B3C8809D; Tue, 19 Mar 2024 13:22:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="XlaKaEr1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E8F9487F8E; Tue, 19 Mar 2024 13:22:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DF96E8806F for ; Tue, 19 Mar 2024 13:22:43 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-33e570ef661so2513501f8f.1 for ; Tue, 19 Mar 2024 05:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710850963; x=1711455763; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Wsmj05dPfs1rjcVH8tp3Vc80gcGSrf4xjJcLkyvDdHQ=; b=XlaKaEr1CMmfPNaOVBap5OvlnZQ7GB0v82LjH4uQ8SwH/Z6U/JvPr05S1QpcM+azeE cNOXUJo000xLU/99qT2ABOWTfw5+PM60Yh3w8Ql22TojTDNNTNs5YGJGEQfm0RWcnICt oItpaCRY25q/Muwc0RAFZ1FE1ejDEkCrTvx4p+QRf6CiursYMNLbJi7wm8hsdAgmtcv9 pbz5eieltOev0I0pkCy4YpXd+45qsviiutjGwhvJ6QbNPtYpIYdPpFj0zyOZcsGRUzTZ /D8emtBnjHVvLnIfwBuqUKGfCyQXKCwLKN/geLhaZyzjbWxDG1cl0RQxd3tyTMoCnbeQ B9zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710850963; x=1711455763; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wsmj05dPfs1rjcVH8tp3Vc80gcGSrf4xjJcLkyvDdHQ=; b=bsVqd9l8nD//Jm8st8oDta/NMO+A5bBRepCOOnTAYvN1E60HoS1jWV+UPniyCs4GJI Q7yJKe2pkbqkRxRrMaWxx22SaE2VVt3icFqC8z/nEd0djG8/pQU+e9HVXzB0qBIbwvJJ ejLI3HJodyUjO4F3Rfl0PX+bRzohymF1jfFJ7VCN9sSnNb/UjP2xaS82JCgG0nJawOFs Ul5GAy2SlONJSXiY2vTjfXDs+wSsTweWTVm/F4I3HS4dlYOLYrvobuLMRmX+aA2xTv0f NPQVD5RmHo1txFVKFSid/yyynQUzgIdGr7J/599c/dcF+pgwSGGCN0XGesczhwdk0VZs qijA== X-Gm-Message-State: AOJu0YyBpLy8i23CpfRtMAHFCLmiElXwiQYncdSiVdhfsuq/3PYV55Gh rWxLL76CP8hl+pUnhA59yIyPEtC2DDbjLgyFuKZkL9yEbv6m9m47egu3TgrHo0PjPZKu+Mhiqz3 B X-Received: by 2002:adf:f303:0:b0:33e:c677:3278 with SMTP id i3-20020adff303000000b0033ec6773278mr10974586wro.49.1710850963203; Tue, 19 Mar 2024 05:22:43 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id du18-20020a0560000d5200b0033b7ce8b496sm12170498wrb.108.2024.03.19.05.22.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 05:22:42 -0700 (PDT) From: Caleb Connolly Date: Tue, 19 Mar 2024 12:22:06 +0000 Subject: [PATCH v3 07/14] clk/qcom: sdm845: add USB clocks MIME-Version: 1.0 Message-Id: <20240319-b4-qcom-livetree-v3-7-e1b38d9b4fa4@linaro.org> References: <20240319-b4-qcom-livetree-v3-0-e1b38d9b4fa4@linaro.org> In-Reply-To: <20240319-b4-qcom-livetree-v3-0-e1b38d9b4fa4@linaro.org> To: Tom Rini , Caleb Connolly , Neil Armstrong , Sumit Garg , Lukasz Majewski , Sean Anderson Cc: u-boot@lists.denx.de X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2520; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TPWXmjwONpVmkU2OdupRcZGhS+g7ubUhkmPEYsCZwuM=; b=owGbwMvMwCFYaeA6f6eBkTjjabUkhtSfzZ238u0vas9rP3MmjzdCdZfbAd6MUzUJjo+qfaI9c xzlMvI6SlgYBDkYZMUUWcRPLLNsWnvZXmP7ggswc1iZQIYwcHEKwETWpDIyzA4qlb6aYb0jfp3T vWrzU7N8et9dY2Xp13168MaCbfP/FzJ8s1pWxcMmlxzQUxvYMY+vd9r00hjFvfty/y9qb3ssFHE bAA== X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Most devices only initialise the USB clocks for us if we boot via "fastboot boot", add the missing clock configuration to get both USB ports working regardless of the bootloader state. Signed-off-by: Caleb Connolly Reviewed-by: Sumit Garg --- drivers/clk/qcom/clock-sdm845.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/clk/qcom/clock-sdm845.c b/drivers/clk/qcom/clock-sdm845.c index b7154360894a..e9c61eb480de 100644 --- a/drivers/clk/qcom/clock-sdm845.c +++ b/drivers/clk/qcom/clock-sdm845.c @@ -20,8 +20,12 @@ #include "clock-qcom.h" #define SE9_UART_APPS_CMD_RCGR 0x18148 +#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf018 +#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf030 +#define USB3_PRIM_PHY_AUX_CMD_RCGR 0xf05c + static const struct freq_tbl ftbl_gcc_qupv3_wrap0_s0_clk_src[] = { F(7372800, CFG_CLK_SRC_GPLL0_EVEN, 1, 384, 15625), F(14745600, CFG_CLK_SRC_GPLL0_EVEN, 1, 768, 15625), F(19200000, CFG_CLK_SRC_CXO, 1, 0, 0), @@ -56,8 +60,10 @@ static ulong sdm845_clk_set_rate(struct clk *clk, ulong rate) } } static const struct gate_clk sdm845_clks[] = { + GATE_CLK(GCC_AGGRE_USB3_SEC_AXI_CLK, 0x82020, 0x00000001), + GATE_CLK(GCC_CFG_NOC_USB3_SEC_AXI_CLK, 0x05030, 0x00000001), GATE_CLK(GCC_QUPV3_WRAP0_S0_CLK, 0x5200c, 0x00000400), GATE_CLK(GCC_QUPV3_WRAP0_S1_CLK, 0x5200c, 0x00000800), GATE_CLK(GCC_QUPV3_WRAP0_S2_CLK, 0x5200c, 0x00001000), GATE_CLK(GCC_QUPV3_WRAP0_S3_CLK, 0x5200c, 0x00002000), @@ -120,8 +126,27 @@ static int sdm845_clk_enable(struct clk *clk) struct msm_clk_priv *priv = dev_get_priv(clk->dev); debug("%s: clk %s\n", __func__, sdm845_clks[clk->id].name); + switch (clk->id) { + case GCC_USB30_PRIM_MASTER_CLK: + qcom_gate_clk_en(priv, GCC_USB_PHY_CFG_AHB2PHY_CLK); + /* These numbers are just pulled from the frequency tables in the Linux driver */ + clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, + (4.5 * 2) - 1, 0, 0, 1 << 8, 8); + clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR, + 1, 0, 0, 0, 8); + clk_rcg_set_rate_mnd(priv->base, USB3_PRIM_PHY_AUX_CMD_RCGR, + 1, 0, 0, 0, 8); + break; + case GCC_USB30_SEC_MASTER_CLK: + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_AUX_CLK); + + qcom_gate_clk_en(priv, GCC_USB3_SEC_CLKREF_CLK); + qcom_gate_clk_en(priv, GCC_USB3_SEC_PHY_COM_AUX_CLK); + break; + } + qcom_gate_clk_en(priv, clk->id); return 0; }