From patchwork Fri Mar 15 15:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 780516 Delivered-To: patch@linaro.org Received: by 2002:a5d:46c1:0:b0:33e:7753:30bd with SMTP id g1csp253210wrs; Fri, 15 Mar 2024 08:11:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXNCEfv611ZfDnVtNJRcMQId8Uc25neAxtROTlgz66Y/HhC5JreLi9C7bxP+9EWGGI/Uo3TaMGCQtE99WfLUKEh X-Google-Smtp-Source: AGHT+IGBy3jcdWkubBSe3GxbS88QsAUFoP9Abet2MtdcKJrJ3/1kJq0PddUGJTPzh6G948jWeYvu X-Received: by 2002:a05:600c:1f8c:b0:413:f7c4:f4fc with SMTP id je12-20020a05600c1f8c00b00413f7c4f4fcmr2807488wmb.15.1710515503513; Fri, 15 Mar 2024 08:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710515503; cv=none; d=google.com; s=arc-20160816; b=fGkssb8i+PPt/MNVwBJIKUR87+IS1JE6ndrSsK9ErNykqQ1RsBr0KIVhTEZAlzBQzq +1jtm4qF3sh9GkAk2u54g9NTG2E4Thc95GRL/TPLlkmHKYE5Y4PPicjPUhK1w6OENDYP WEBlDIntrbNAqgrZBx9OitSpqJ3pmbFce2TwiPrjIdop+acHm+kWaR9HaZ/278hccPUo PBJVRD1mfGNnohXpI5Q16IwGyIlwEH2eWE14y6QEjftXbJ4SaYamb3VVGB4q/4I6dWe0 8VWEbnmlpYpcSIbY4y5a4GSjgGnhw4pUiRkHQW2Om/KdQIjljqfyDIdSxonxMhgddup0 s2bA== 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=jfLF53hc+iWKNaEG+XqwdAT7GNPoDjvasnqc+fF2zyRbz7E7qm1u63ldlcD08sxyMN 9iUGb3nrDuEuxOm8tTB5fNtTLm5ppo1diZ+NklB9QHg0NHGjgH8Io98ZHuZeAebtguBc kMhQ0+3zQ/c1jcpdn8RM182XW2HitZxYk6bCSHCYhvve1pFHCHLB6uOfZBgm6VxCji9O h27KJcX8RA2jG5EJIGe5ApcaX8dOcnZ59fQmHPoioKjvObHIJ0/WNJVt30rZVFeeZZwD 4+SsntAZnKpE5z5W/NXOP7oWaokOPPSVQQ3QlEGqNVk9bCANAqVrMwpYgh4HX3OsuMm/ UBzg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LpfuP/LL"; 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 u16-20020a05600c211000b00412ea4ce549si3496703wml.211.2024.03.15.08.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:11:43 -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="LpfuP/LL"; 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 6346987FF7; Fri, 15 Mar 2024 16:10:44 +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="LpfuP/LL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F0FF88053; Fri, 15 Mar 2024 16:10:40 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (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 CBA238802E for ; Fri, 15 Mar 2024 16:10:36 +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-x432.google.com with SMTP id ffacd0b85a97d-33e9def4a6dso1461210f8f.2 for ; Fri, 15 Mar 2024 08:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710515436; x=1711120236; 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=LpfuP/LLP7VA8ChWuZn7isNoC502K5LDFiB1vAf+ni2UFpj29PY20T/2Qiw1nv2WC0 FZp7W2ilYmRF8UC0nqFNxH/lNlg8GFOcUjzodRGjomCpO1Gm5Asje7rkVZl1gowdBOtn 6Fe8a1YX06wZ+IV7KixYhenioEyR/NgkEhpyw8ivncebJ2M4SqOeUyOrMnCCp55fxEvc GQ6jO3K+AKZmTfLkvAYYlzj8/DxAJpfVyJK+FJu0vgK48VHiX02XOYtWuxX3pVnZMi0M 5z8QXDu47Pt86ngSml1ROlvllncU/82ldC/fYJAbXGHw4vhhdkTAZfyF6cq6NCJF5fCv C03w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710515436; x=1711120236; 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=GorS3fjeEKeNKtStQdiLH7yiriW/13v+697MsPJJPiG9mrjaNey4fOj5Y7LNnlIDie ucFx9DzGC7JgEk4aYr0ey3KwffUqWQYf5kYf7SG/zOGJ7gdwvFgMUTXRd+a2hGMSCOgT iT3UQpmf26ZjxH55kcKLQe/Ci397Sm4dlH17kYIFhwIaNDWQSFXL3ysT8JbZGUt7pRMa qIfMnoMv7h8K93eqja41K6BotZOTdyOPgq58WUzjHGXLxfkuWIxRhp3Q2lsUS3brF9vO fkd4qurpKwJAkGByJ9bDAJtB287DOqqremlacGE6kQZoDOoRgiMhr/iW9e0j+9zT9eX9 qu0g== X-Gm-Message-State: AOJu0Yx597GgUokF9x6n81QvkGT4C/R2YIs2O+ftT5STNA01aMwooSV2 AVdlNOEx9iewBnBhRherIF4tFQ8rNd5/+OP5r9TolUNA1j3CGgN/+5GAaDO5+7BPmQoGOHuE8w/ c X-Received: by 2002:adf:edc9:0:b0:33d:a944:54c0 with SMTP id v9-20020adfedc9000000b0033da94454c0mr2586891wro.22.1710515436184; Fri, 15 Mar 2024 08:10:36 -0700 (PDT) Received: from lion.localdomain (host-92-17-96-232.as13285.net. [92.17.96.232]) by smtp.gmail.com with ESMTPSA id n6-20020a5d4006000000b0033e699fc6b4sm3398141wrp.69.2024.03.15.08.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:10:35 -0700 (PDT) From: Caleb Connolly Date: Fri, 15 Mar 2024 15:10:16 +0000 Subject: [PATCH v2 07/14] clk/qcom: sdm845: add USB clocks MIME-Version: 1.0 Message-Id: <20240315-b4-qcom-livetree-v2-7-ab635774b2dc@linaro.org> References: <20240315-b4-qcom-livetree-v2-0-ab635774b2dc@linaro.org> In-Reply-To: <20240315-b4-qcom-livetree-v2-0-ab635774b2dc@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=owGbwMvMwCFYaeA6f6eBkTjjabUkhtQvKY99nimsap/j8FlCzk1yrdbbdRZmW182PTNwjH195 yPPppWbOkpZGAQ5GGTFFFnETyyzbFp72V5j+4ILMHNYmUCGMHBxCsBEfi1j+Gf2LCSz0P+B0QkX b7YvJTtzzy2VuDOVRe3pxUvbGs/OCeFhZJh6S7vAuuY368qy/t3+U6wLRVOmBSbcXSWvbxKz5kq echQA 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 --- 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; }