From patchwork Wed Apr 3 12:07:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 785418 Delivered-To: patch@linaro.org Received: by 2002:adf:f001:0:b0:33e:7753:30bd with SMTP id j1csp280693wro; Wed, 3 Apr 2024 05:09:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVpqAjV2pWcbYbgdvk/hlSlRFDMbh/xYsr0JCaYimGeOyL/2uSyhGJDO/7cDeftKDHbqLwz9Mn6rVyDLcxcnEQp X-Google-Smtp-Source: AGHT+IEqvmU2FvyFz5B4WpSiCO2JalJnYHEb1h0bWL6qT7UyyZseyzC9K5YeEqtmedqlH61sA6Nd X-Received: by 2002:a17:906:39d1:b0:a46:e0ab:40ff with SMTP id i17-20020a17090639d100b00a46e0ab40ffmr11775244eje.35.1712146147689; Wed, 03 Apr 2024 05:09:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712146147; cv=none; d=google.com; s=arc-20160816; b=pSxIkBUh2qUSuttJbUBTptBnJf0lacRGQTLk31M3N1s0LuIBFZ7sujsbne22eCENb1 Gi8hFf+BvB3iKzazdjaqQtI/x+/jY0FRbkgKWDEMSohPOaAgmZ5ZO0ubOaA1kuQ8ZdkR Zp3COpzYF9JwN+8ncY9gdemTssFPOGF4ubMDw/n0d9eoIBq3C68CHqZxBebyTqe+mxBr a4IUputIVFh5fyDT4L5FEUeeM5liWG+UNn/Pfi2BSup5DwPbGdnBpQfYz/ZKzOupA5d2 1agUpylOswE+8NJ1BOVr8UL2um2TQIlkLi56yCxZecTZDmS8j3LYu6lPCeUtDydlTUVn HZdA== 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=GewhX1AhomHs5Aohn6YwaTX+GkXafQtxsWjEwPDqGAk=; fh=gSVpyLKtvZ+QePPYgVwr0OwBuSQ/slJGUurC/y9msiw=; b=N7pj/+KuI3GYvlcuUFmyKwNK19k/XmgFbiDwcQ1Z4dlbJx/nIf3zUj1IvLrNVm7im9 BWfr/i5aMSq8nJmDS/jPWdwVDLfua8UbLDT6msYhQboeu2zsy4TXAlGfl3CqlyVNi6EQ Gm/EhtgZ57AnllkG30Unaibsybk3URtSz8W2hripscXFbqckJSYiaW7t5WR16677gB2M Rg5MkfySKDLne2yFYtBrTTGntrcmFmymSgRC+ZJ01rRUF1RwBHqLNGuJEfG7AG1krn+W O2DQxnh+GRRdD6s8LCNrLGpI+ZAHwSfAihqXZjPtxb2FtGkOh4zHop2SfiIEU+c6sJk+ OITg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QL4PZfnb; 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 s8-20020a170906bc4800b00a4e695985bdsi3105455ejv.177.2024.04.03.05.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:09:07 -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=QL4PZfnb; 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 0E868883A8; Wed, 3 Apr 2024 14:08:00 +0200 (CEST) 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="QL4PZfnb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1EEF7882E4; Wed, 3 Apr 2024 14:07:59 +0200 (CEST) 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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (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 0D31E8839A for ; Wed, 3 Apr 2024 14:07:57 +0200 (CEST) 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-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-55a179f5fa1so7368397a12.0 for ; Wed, 03 Apr 2024 05:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712146076; x=1712750876; 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=GewhX1AhomHs5Aohn6YwaTX+GkXafQtxsWjEwPDqGAk=; b=QL4PZfnbG/ZULb77vB1YzgLdNkPzzlSLr00pPUi+sLDdw2wug3hkPnw3/B8ta+2ncQ b5P53bUfvvuPppM75onmHCV+0wLbn9VW5JE32EBYPOWdRz+fq7aTBJMJ+AYBhIv929wT JVZ/s2YZzMGewz89COfvkpjulO8DjiHvbj+Xs+bDp2ouFhAIixAR1BcP04Mk+GmHD0Im a9+k0VLTgb0teMlQHYGI6tOYeRSOnZ+5RVj97l/mcc28ceaBkHICcs/lYnKU7+0sJe1a jkP1b0uyT+ZH2FHKE/zFb8VbAfwODidyM2woshyaeKwJ3zLm1rbjRfBZ/+3fXBjaMctG NEUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146076; x=1712750876; 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=GewhX1AhomHs5Aohn6YwaTX+GkXafQtxsWjEwPDqGAk=; b=DatnOvcBal+iKxyWkpsryFt6lUJjcQftl36I/eZbNVBzdj2V/uNmgswF35S4MB5FO+ Wui8LxZ0vl2Uyez4QqipFR/jSAXKChfSGd+OqTzFoQbSwXXg7pH/jHwu1ThiaktcKKjA SGGIzjLZPIP1bs0o3mGvGcq2uoYLHG2jgYBsnQA1OPP3D9IY+Yqn+1LMyibT4lJkVwgG AHBJ5cP+thtI6x1DWia1NO0wjeMEbJZi2TGeMkoDlgEd8ovmF1gIMfppZ/Sd1HTGKM31 4l5f6/YByKnNUtnskfZVxZzVjA9QqQXcbr5+nX5P1hOgGgjCJQ0MBsTpaF2ns1j3GJcS mtvg== X-Gm-Message-State: AOJu0Yzpl0kUqWCRe51dDZ05/Nhilb+55soD14lL7p7cmO/7c1ZQTvbQ oloMk80K2oddlRhPdiOq/e6oiVVkWLi/hB7IFlrDHXWQ5+sxGpNlmuK3FN21png= X-Received: by 2002:a17:906:1744:b0:a4e:2d7d:3fd5 with SMTP id d4-20020a170906174400b00a4e2d7d3fd5mr11678735eje.1.1712146076611; Wed, 03 Apr 2024 05:07:56 -0700 (PDT) Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::38e6]) by smtp.gmail.com with ESMTPSA id lr20-20020a170906fb9400b00a46a04d7dc4sm7654674ejb.61.2024.04.03.05.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:07:56 -0700 (PDT) From: Caleb Connolly Date: Wed, 03 Apr 2024 14:07:42 +0200 Subject: [PATCH v6 07/16] clk/qcom: sdm845: add USB clocks MIME-Version: 1.0 Message-Id: <20240403-b4-qcom-livetree-v6-7-130f8f50b538@linaro.org> References: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@linaro.org> In-Reply-To: <20240403-b4-qcom-livetree-v6-0-130f8f50b538@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.13-dev-4bd13 X-Developer-Signature: v=1; a=openpgp-sha256; l=2569; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=LQeBYALcRlahXsl7p+tCEbXEjlrRYAIfZnvrRJ8uguA=; b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmDUaQdpMOklPbiCYxOwt2EOYELrByP8i2WG9ed Gvn2nE+dZmJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZg1GkAAKCRAFgzErGV9k tjaMD/90afp5tmvx53pAOPulfcBcx9CBMAb5orNwDhm7/UppxBJ0uWNo4bDAsBWAw2KSMReCmLa iomFmD4Lf5NQbCFxGxZ2ow+QwSUxRpYZ3swRSOD/ax+Mj9KMiaJKhJITnODNU6t1kUM0EB3CRJc kRSvDRX8qMcB4M5mqeHzM0G0fIc1mBaZgxNGTPmA2xZq/N6LksoalGn5FR9FtwQe3KPwVsz9Ynu vQmSIEYElqZAQTTXZSAy2qH54w+c1A2khj6/+k4Y8L6bpL1h6StuoksyuuE6ThatYvzvwPK3nJI gcqjCpI/RJNgJ26VgO3Amg3bf//xYglRS/RS73lrKTzmTFmLuEI66bFk5tLNyxnJcS1POe8BUFe 7bAgubauJfLCo0DX+uW3Kjo1SYvnS9vD3HVZKsiAnhDqLKPV3vSO/bWGSRj4hsHPYPSTe3IBiBn 4Ik/NMaSdTZHd1ho+mYvJHeEp7OZNLIVIB3JFhtG6QLFnJzHX1Umxpn++n0WnEqVU8BnF0OCElF oJ//61Jl/5Dqdxbmjn2tyXaxDSUH7vvXXY/9ZjGVDYB8Vonw+JnVdYlC4kmQLlasa3g9+v6Bix6 IjwH7eARADuUB3QHJ7oflHot8zSSVP2v+cg85uy57Jt0EsXSpwn+N02JUEAbGvg/lPT3nDfNflc 8zgnIXSX3Em45rQ== 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. Reviewed-by: Sumit Garg 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; }