From patchwork Fri Feb 2 18:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 769275 Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76C94154C16 for ; Fri, 2 Feb 2024 18:35:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706898915; cv=none; b=h22xVg1fLOmEiaYb7cvuRiTkj4MoSJhpsE/7PktZGXIT1RNATcWZYz1BraVvamMZ5dRyT0pBUVZ5IyF78m+LAHgO7Uqus4TkdGbd62TlZ4uPvDGXOyPZzpca+1nGGH+ZLrR7zYOMpDuMQgVjs1dg5N+AJiHP/LTtsr0Cf8i0YSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706898915; c=relaxed/simple; bh=ZwiQcj5lS0YwlQcRJrJvZ7jW2ruXKWZFMHV/CbkBTmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uoFHXbXlOzbtva3mR5jJ2IShzczfONZF7ZwqKET9l6UdFn54jk0m34u6yKfEAatvRxb9OVsGyOFLtp3MtGOylZuF6HJXoPxyZHAqpki8LGVGiziOFZ9CgmmHZg+0nvA3sJMQPtwAevUQ/5YwUuD+XaqbFreJaFrH421jOy8Kyq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gGp9akML; arc=none smtp.client-ip=209.85.218.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gGp9akML" Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a271a28aeb4so356656466b.2 for ; Fri, 02 Feb 2024 10:35:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706898911; x=1707503711; darn=vger.kernel.org; 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=k91pc5EhkGw9TQ5MV8voYfFQwWkoUAgKS7iKDYSBv6o=; b=gGp9akMLqlCmflT5M2fCVtpatLMIQEoig2/cOOVTaVhrt3W8QvV6ES3eYubsFsraq9 QdjFw91fVcOPzIv4WpTzsjylocyK2h05V3HIonKTmFUmrLZofV5xVjId1j6t02bftUqF vw81AuIA13qn+5F1lhY7Kfyb/wnr8CcFshjEnH7wJlzyQqTOf0p05BayCOTyYWFnHNOj qsAGZ7/zrr14MU20s1lcr2kJGJsnAeerYxIi55soqVTt4eVUQ0w4QmnqMudBtsykmCBj riQCW/h0sNncpy8FSswY1jvQnl5HUbXr/qcyWzxpeRfdFMHxm8Mxdb1lR/OupWCGTqqO oBtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706898911; x=1707503711; 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=k91pc5EhkGw9TQ5MV8voYfFQwWkoUAgKS7iKDYSBv6o=; b=PlLN0Uy6jJdBlMeikcD3CWn+acz8yKrZdhMl8fRykgkumCPHa8V2CImrP20+2GeGYO ksqLsvwjF/a+eByutggSH7tj1ifNlql0YLmwcxvHGXydn5cWaA4wqbxpfH2flv19PX4x iHKTbHp7MCO4FGLqAm3L6c+j8SYufrpN8ecn6qEFF6SlTBTrJFk4sPH80ax7TQeDjYIp 3EFQ27j0m0YPe/m33H7Jnpnu+lRFvYqA5CGCDhLWD9mJkuL+V2WgnPBLNq8mO3GVDyMA nHxdYmYG0w2vhDwPxLnZckfhovJJQc9GgeXfoThNRE194JpqtVsJgivcvLpDtagAWjm/ LXtQ== X-Gm-Message-State: AOJu0Yz7B1ASDnZYsM0Vzt08+UQTLBqajoFY+z0tRT7xDRc0rcLQWzg7 CMPsfZ8CuvXlYHbu4rvsR5KiS6ucL4RwiP2nHEOsAX4sP0855xfutvR6wXZoals= X-Google-Smtp-Source: AGHT+IG/2TXJixQa3N39HgO96bmxq3XXkRXm0g6lvMS24WbDZ2wKmZxl7w2wj8k4fgvOsZU1OHhsoQ== X-Received: by 2002:a17:906:30d3:b0:a35:9a1e:f239 with SMTP id b19-20020a17090630d300b00a359a1ef239mr1927382ejb.12.1706898910815; Fri, 02 Feb 2024 10:35:10 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCU1DFKDzE/TEqDWHypfitm4S2AbQfQ+rSK82sW24wjFzqAG+0a79zr9R1TUWfXfKGFFvUPADbSWIWSpni9LNM7rkXVPxXvSvMMw+vs0q7iH2qoTzndHKtlboYo4ot+5L10y+1lhkn+sMUw0LnASPSgri7UrIDP31gmewQTtoU/elF+n5i0KOH4CRHzI9GSYhahQwZyJHGErFcUg8+7SiXsnoE6/DR+eshlpkvN08hknS8slJeN9KP49JBPX8E7PcAZul6zyiHxOTt4hIdHeMIqW1PNYVD0EpbweMJGjCMdmg+yIed/SsxiGqZ3/g6vYikL9avP6K3XyjPCvzbyfuDeW1edzvQmE8x3baddN9HKYBO4a8vAF8JWkkkHy+50U2tevWcmUJN6RG26H80Jp5cw3TeYj9oCWxj8nj2TR8ENT+au1rN+e8kRd4aR8Xux9RSYNGwgtrHiIykXLwAisCoLzC0+kfCQynYDvOVmuqlR7ljRxL6w0kfka29yJfZoGzwEuIy+sQOoLfJU0M8fQ6ND+BtSPc7U/4tvlmTE25ORlQ6Pymv+AF4tskQYxG0seBJ4DrVwc0x/ZAI6OxLFF0yM+mg== Received: from [127.0.1.1] ([62.231.97.49]) by smtp.gmail.com with ESMTPSA id vh10-20020a170907d38a00b00a36fa497a65sm1051328ejc.110.2024.02.02.10.35.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 10:35:10 -0800 (PST) From: Abel Vesa Date: Fri, 02 Feb 2024 20:34:44 +0200 Subject: [PATCH v4 09/10] clk: qcom: Add TCSR clock driver for x1e80100 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240202-x1e80100-clock-controllers-v4-9-7fb08c861c7c@linaro.org> References: <20240202-x1e80100-clock-controllers-v4-0-7fb08c861c7c@linaro.org> In-Reply-To: <20240202-x1e80100-clock-controllers-v4-0-7fb08c861c7c@linaro.org> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Neil Armstrong , Vladimir Zapolskiy , Dmitry Baryshkov , Rob Herring Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, Abel Vesa X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=9570; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=ZwiQcj5lS0YwlQcRJrJvZ7jW2ruXKWZFMHV/CbkBTmk=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBlvTXLCZbvei++pBsIovxE/Ikn20iFLR7W5TXA3 yL5Nph8vbuJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZb01ywAKCRAbX0TJAJUV VkZ5EACCu0jqpYXNS0WncuLkwkhXNyHcJWWesqN4jwMdYi/KvRjGemuiiWV1MYKXXNbqD9RkSy+ JjBQu+Sn0gffiSwj2nnjZgEYnfnCWjdPVB72bM0w6esUeBZjz/xaz9lSVzxQLEGH5rqt0Jxspza Winf394MPzcQCFJVUVRmoMCpfwkhX7RxaS4Q9BBOsrcRDj5tFbPkTLeISHWvj1xG3KGuSeFSTtl g1aNd8m0nUKudZtZcRmmT5olkzuZnSD+sld4/2a/rZbs9QVPj48oZ5ZKGhvw9mIe19NExMXAWdb 5RL3nr/UcYjfYvCyu3p25lhwRL7XE/Ls+OWbZ+QIq3DYiE1RzK/NNob1L380CG2Rk87AUdcb293 evAfbMF9HgRqOyk6DQQhRiCVdUDJog0to/5G2KGnF8/QRTEHmDJgfgV5NuAhJAmF24b/zQw+rdF oSxPentVbi5oR1oKFd5r2MNTYjfHagZLqY2q3WdzvekbjymKu+AT289VgwiAZdbuGw9UUWmUU1E L4J/f7sGg8U5ncpCU7gF0ctxzd0M5L5ADXmFCP6w+SQkSUvPk71UUH9zuLAZFI7rk8uaNpCA99E 0CiinwpHb5TXI/W71dQ9rcFy6rzcniMZczyLbR8MggPr06trskmxBzcllR7IOl1z89/UFQncMq3 GsLPPrafzN4yuOQ== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE The TCSR clock controller found on X1E80100 provides refclks for PCIE, USB and UFS. Add clock driver for it. Signed-off-by: Abel Vesa Reviewed-by: Konrad Dybcio --- drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/tcsrcc-x1e80100.c | 285 +++++++++++++++++++++++++++++++++++++ 3 files changed, 294 insertions(+) diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig index d66934ca5e94..0633728c870c 100644 --- a/drivers/clk/qcom/Kconfig +++ b/drivers/clk/qcom/Kconfig @@ -49,6 +49,14 @@ config CLK_X1E80100_GPUCC Say Y if you want to support graphics controller devices and functionality such as 3D graphics. +config CLK_X1E80100_TCSRCC + tristate "X1E80100 TCSR Clock Controller" + depends on ARM64 || COMPILE_TEST + select QCOM_GDSC + help + Support for the TCSR clock controller on X1E80100 devices. + Say Y if you want to use peripheral devices such as SD/UFS. + config QCOM_A53PLL tristate "MSM8916 A53 PLL" help diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile index a037a29e9d61..750b084553c6 100644 --- a/drivers/clk/qcom/Makefile +++ b/drivers/clk/qcom/Makefile @@ -24,6 +24,7 @@ obj-$(CONFIG_CLK_GFM_LPASS_SM8250) += lpass-gfm-sm8250.o obj-$(CONFIG_CLK_X1E80100_DISPCC) += dispcc-x1e80100.o obj-$(CONFIG_CLK_X1E80100_GCC) += gcc-x1e80100.o obj-$(CONFIG_CLK_X1E80100_GPUCC) += gpucc-x1e80100.o +obj-$(CONFIG_CLK_X1E80100_TCSRCC) += tcsrcc-x1e80100.o obj-$(CONFIG_IPQ_APSS_PLL) += apss-ipq-pll.o obj-$(CONFIG_IPQ_APSS_6018) += apss-ipq6018.o obj-$(CONFIG_IPQ_GCC_4019) += gcc-ipq4019.o diff --git a/drivers/clk/qcom/tcsrcc-x1e80100.c b/drivers/clk/qcom/tcsrcc-x1e80100.c new file mode 100644 index 000000000000..ff61769a0807 --- /dev/null +++ b/drivers/clk/qcom/tcsrcc-x1e80100.c @@ -0,0 +1,285 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2023, Linaro Limited + */ + +#include +#include +#include +#include +#include + +#include + +#include "clk-branch.h" +#include "clk-regmap.h" +#include "common.h" +#include "reset.h" + +enum { + DT_BI_TCXO_PAD, +}; + +static struct clk_branch tcsr_edp_clkref_en = { + .halt_reg = 0x15130, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15130, + .enable_mask = BIT(0), + .hw.init = &(const struct clk_init_data) { + .name = "tcsr_edp_clkref_en", + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_pcie_2l_4_clkref_en = { + .halt_reg = 0x15100, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15100, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_pcie_2l_4_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_pcie_2l_5_clkref_en = { + .halt_reg = 0x15104, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15104, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_pcie_2l_5_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_pcie_8l_clkref_en = { + .halt_reg = 0x15108, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15108, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_pcie_8l_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb3_mp0_clkref_en = { + .halt_reg = 0x1510c, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x1510c, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb3_mp0_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb3_mp1_clkref_en = { + .halt_reg = 0x15110, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15110, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb3_mp1_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb2_1_clkref_en = { + .halt_reg = 0x15114, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15114, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb2_1_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_ufs_phy_clkref_en = { + .halt_reg = 0x15118, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15118, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_ufs_phy_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb4_1_clkref_en = { + .halt_reg = 0x15120, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15120, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb4_1_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb4_2_clkref_en = { + .halt_reg = 0x15124, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15124, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb4_2_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_usb2_2_clkref_en = { + .halt_reg = 0x15128, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x15128, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_usb2_2_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch tcsr_pcie_4l_clkref_en = { + .halt_reg = 0x1512c, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x1512c, + .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data){ + .name = "tcsr_pcie_4l_clkref_en", + .parent_data = &(const struct clk_parent_data){ + .index = DT_BI_TCXO_PAD, + }, + .num_parents = 1, + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_regmap *tcsr_cc_x1e80100_clocks[] = { + [TCSR_EDP_CLKREF_EN] = &tcsr_edp_clkref_en.clkr, + [TCSR_PCIE_2L_4_CLKREF_EN] = &tcsr_pcie_2l_4_clkref_en.clkr, + [TCSR_PCIE_2L_5_CLKREF_EN] = &tcsr_pcie_2l_5_clkref_en.clkr, + [TCSR_PCIE_8L_CLKREF_EN] = &tcsr_pcie_8l_clkref_en.clkr, + [TCSR_USB3_MP0_CLKREF_EN] = &tcsr_usb3_mp0_clkref_en.clkr, + [TCSR_USB3_MP1_CLKREF_EN] = &tcsr_usb3_mp1_clkref_en.clkr, + [TCSR_USB2_1_CLKREF_EN] = &tcsr_usb2_1_clkref_en.clkr, + [TCSR_UFS_PHY_CLKREF_EN] = &tcsr_ufs_phy_clkref_en.clkr, + [TCSR_USB4_1_CLKREF_EN] = &tcsr_usb4_1_clkref_en.clkr, + [TCSR_USB4_2_CLKREF_EN] = &tcsr_usb4_2_clkref_en.clkr, + [TCSR_USB2_2_CLKREF_EN] = &tcsr_usb2_2_clkref_en.clkr, + [TCSR_PCIE_4L_CLKREF_EN] = &tcsr_pcie_4l_clkref_en.clkr, +}; + +static const struct regmap_config tcsr_cc_x1e80100_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, + .max_register = 0x2f000, + .fast_io = true, +}; + +static const struct qcom_cc_desc tcsr_cc_x1e80100_desc = { + .config = &tcsr_cc_x1e80100_regmap_config, + .clks = tcsr_cc_x1e80100_clocks, + .num_clks = ARRAY_SIZE(tcsr_cc_x1e80100_clocks), +}; + +static const struct of_device_id tcsr_cc_x1e80100_match_table[] = { + { .compatible = "qcom,x1e80100-tcsr" }, + { } +}; +MODULE_DEVICE_TABLE(of, tcsr_cc_x1e80100_match_table); + +static int tcsr_cc_x1e80100_probe(struct platform_device *pdev) +{ + return qcom_cc_probe(pdev, &tcsr_cc_x1e80100_desc); +} + +static struct platform_driver tcsr_cc_x1e80100_driver = { + .probe = tcsr_cc_x1e80100_probe, + .driver = { + .name = "tcsrcc-x1e80100", + .of_match_table = tcsr_cc_x1e80100_match_table, + }, +}; + +static int __init tcsr_cc_x1e80100_init(void) +{ + return platform_driver_register(&tcsr_cc_x1e80100_driver); +} +subsys_initcall(tcsr_cc_x1e80100_init); + +static void __exit tcsr_cc_x1e80100_exit(void) +{ + platform_driver_unregister(&tcsr_cc_x1e80100_driver); +} +module_exit(tcsr_cc_x1e80100_exit); + +MODULE_DESCRIPTION("QTI TCSR Clock Controller X1E80100 Driver"); +MODULE_LICENSE("GPL");