From: Caleb Connolly <caleb.connolly@linaro.org>
To: Varadarajan Narayanan <quic_varada@quicinc.com>,
trini@konsulko.com, neil.armstrong@linaro.org,
sumit.garg@linaro.org, lukma@denx.de, seanga2@gmail.com,
peng.fan@nxp.com, jh80.chung@samsung.com,
ilias.apalodimas@linaro.org, sjg@chromium.org,
Volodymyr_Babchuk@epam.com, lehmanju@devpi.de,
pbrobinson@gmail.com, marek.vasut+renesas@mailbox.org,
robert.marko@sartura.hr, u-boot@lists.denx.de,
u-boot-qcom@groups.io
Subject: Re: [PATCH v2 2/6] clk/qcom: add initial clock driver for ipq9574
Date: Wed, 12 Feb 2025 15:14:09 +0000 [thread overview]
Message-ID: <bfc6f1ee-260c-4c47-abda-46dbd12f27e9@linaro.org> (raw)
In-Reply-To: <20250130053751.3148614-3-quic_varada@quicinc.com>
On 1/30/25 05:37, Varadarajan Narayanan wrote:
> Add initial set of clocks and resets for enabling U-Boot on ipq9574
> based RDP platforms.
What is RDP?
>
> Signed-off-by: Varadarajan Narayanan <quic_varada@quicinc.com>
> ---
> v2: Combined driver file and makefile/kconfig changes into one patch
> ---
> drivers/clk/qcom/Kconfig | 8 +++
> drivers/clk/qcom/Makefile | 1 +
> drivers/clk/qcom/clock-ipq9574.c | 100 +++++++++++++++++++++++++++++++
> drivers/clk/qcom/clock-qcom.h | 1 +
> 4 files changed, 110 insertions(+)
> create mode 100644 drivers/clk/qcom/clock-ipq9574.c
>
> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
> index cb867acc48..3ea01f3c96 100644
> --- a/drivers/clk/qcom/Kconfig
> +++ b/drivers/clk/qcom/Kconfig
> @@ -31,6 +31,14 @@ config CLK_QCOM_IPQ4019
> on the Snapdragon IPQ4019 SoC. This driver supports the clocks
> and resets exposed by the GCC hardware block.
>
> +config CLK_QCOM_IPQ9574
> + bool "Qualcomm IPQ9574 GCC"
> + select CLK_QCOM
> + help
> + Say Y here to enable support for the Global Clock Controller
> + on the Snapdragon IPQ9574 SoC. This driver supports the clocks
> + and resets exposed by the GCC hardware block.
> +
> config CLK_QCOM_QCM2290
> bool "Qualcomm QCM2290 GCC"
> select CLK_QCOM
> diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
> index 1bc0f15005..e13fc8c107 100644
> --- a/drivers/clk/qcom/Makefile
> +++ b/drivers/clk/qcom/Makefile
> @@ -7,6 +7,7 @@ obj-$(CONFIG_CLK_QCOM_SDM845) += clock-sdm845.o
> obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o
> obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o
> obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o
> +obj-$(CONFIG_CLK_QCOM_IPQ9574) += clock-ipq9574.o
> obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o
> obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o
> obj-$(CONFIG_CLK_QCOM_SA8775P) += clock-sa8775p.o
> diff --git a/drivers/clk/qcom/clock-ipq9574.c b/drivers/clk/qcom/clock-ipq9574.c
> new file mode 100644
> index 0000000000..06f2d2dd45
> --- /dev/null
> +++ b/drivers/clk/qcom/clock-ipq9574.c
> @@ -0,0 +1,100 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Clock drivers for Qualcomm ipq9574
> + *
> + * (C) Copyright 2024 Linaro Ltd.
> + */
> +
> +#include <linux/types.h>
> +#include <clk-uclass.h>
> +#include <dm.h>
> +#include <linux/delay.h>
> +#include <asm/io.h>
> +#include <linux/bug.h>
> +#include <linux/bitops.h>
> +#include <dt-bindings/clock/qcom,ipq9574-gcc.h>
> +#include <dt-bindings/reset/qcom,ipq9574-gcc.h>
> +
> +#include "clock-qcom.h"
> +
> +#define GCC_BLSP1_AHB_CBCR 0x1004
> +#define GCC_BLSP1_UART3_APPS_CMD_RCGR 0x402C
> +#define GCC_BLSP1_UART3_APPS_CBCR 0x4054
> +
> +#define GCC_SDCC1_APPS_CBCR 0x3302C
> +#define GCC_SDCC1_AHB_CBCR 0x33034
> +#define GCC_SDCC1_APPS_CMD_RCGR 0x33004
> +#define GCC_SDCC1_ICE_CORE_CBCR 0x33030
> +
> +static ulong ipq9574_set_rate(struct clk *clk, ulong rate)
> +{
> + struct msm_clk_priv *priv = dev_get_priv(clk->dev);
> +
> + switch (clk->id) {
> + case GCC_BLSP1_UART3_APPS_CLK:
> + clk_rcg_set_rate_mnd(priv->base, GCC_BLSP1_UART3_APPS_CMD_RCGR,
> + 0, 144, 15625, CFG_CLK_SRC_GPLL0, 16);
> + return rate;
> + case GCC_SDCC1_APPS_CLK:
> + clk_rcg_set_rate_mnd(priv->base, GCC_SDCC1_APPS_CMD_RCGR,
> + 11, 0, 0, CFG_CLK_SRC_GPLL2, 16);
> + return rate;
> + default:
> + return -EINVAL;
> + }
> +}
> +
> +static int ipq9574_enable(struct clk *clk)
> +{
> + struct msm_clk_priv *priv = dev_get_priv(clk->dev);
> +
> + //printk("--> %s: %d\n", __func__, clk->id);
Remove or demote to debug, with gate_clk you can include the clock name
as well.
> + switch (clk->id) {
> + case GCC_BLSP1_UART3_APPS_CLK:
> + clk_enable_cbc(priv->base + GCC_BLSP1_UART3_APPS_CBCR);
> + break;
> + case GCC_BLSP1_AHB_CLK:
> + clk_enable_cbc(priv->base + GCC_BLSP1_AHB_CBCR);
> + break;
> + case GCC_SDCC1_AHB_CLK:
> + clk_enable_cbc(priv->base + GCC_SDCC1_AHB_CBCR);
> + break;
> + case GCC_SDCC1_APPS_CLK:
> + clk_enable_cbc(priv->base + GCC_SDCC1_APPS_CBCR);
> + break;
> + case GCC_SDCC1_ICE_CORE_CLK:
> + clk_enable_cbc(priv->base + GCC_SDCC1_ICE_CORE_CBCR);
> + break;
> + default:
> + return -EINVAL;
> + }
Please use the gate_clk API for these, refer to clock-sdm845.c for
reference.
With that:
Reviewed-by: Caleb Connolly <caleb.connolly@linaro.org>
Kind regards,
> +
> + return 0;
> +}
> +
> +static const struct qcom_reset_map ipq9574_gcc_resets[] = {
> + [GCC_SDCC_BCR] = { 0x33000 },
> +};
> +
> +static struct msm_clk_data ipq9574_gcc_data = {
> + .resets = ipq9574_gcc_resets,
> + .num_resets = ARRAY_SIZE(ipq9574_gcc_resets),
> + .enable = ipq9574_enable,
> + .set_rate = ipq9574_set_rate,
> +};
> +
> +static const struct udevice_id gcc_ipq9574_of_match[] = {
> + {
> + .compatible = "qcom,ipq9574-gcc",
> + .data = (ulong)&ipq9574_gcc_data,
> + },
> + { }
> +};
> +
> +U_BOOT_DRIVER(gcc_ipq9574) = {
> + .name = "gcc_ipq9574",
> + .id = UCLASS_NOP,
> + .of_match = gcc_ipq9574_of_match,
> + .bind = qcom_cc_bind,
> + .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF,
> +};
> diff --git a/drivers/clk/qcom/clock-qcom.h b/drivers/clk/qcom/clock-qcom.h
> index ff336dea39..e038dc421e 100644
> --- a/drivers/clk/qcom/clock-qcom.h
> +++ b/drivers/clk/qcom/clock-qcom.h
> @@ -11,6 +11,7 @@
> #define CFG_CLK_SRC_CXO (0 << 8)
> #define CFG_CLK_SRC_GPLL0 (1 << 8)
> #define CFG_CLK_SRC_GPLL0_AUX2 (2 << 8)
> +#define CFG_CLK_SRC_GPLL2 (2 << 8)
> #define CFG_CLK_SRC_GPLL9 (2 << 8)
> #define CFG_CLK_SRC_GPLL0_ODD (3 << 8)
> #define CFG_CLK_SRC_GPLL6 (4 << 8)
--
Caleb (they/them)
next prev parent reply other threads:[~2025-02-12 15:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 5:37 [PATCH v2 0/6] Add initial support for IPQ9574 based boards Varadarajan Narayanan
2025-01-30 5:37 ` [PATCH v2 1/6] dts: ipq9574-rdp433-u-boot: add override dtsi Varadarajan Narayanan
2025-02-12 15:08 ` Caleb Connolly
2025-01-30 5:37 ` [PATCH v2 2/6] clk/qcom: add initial clock driver for ipq9574 Varadarajan Narayanan
2025-02-12 15:14 ` Caleb Connolly [this message]
2025-01-30 5:37 ` [PATCH v2 3/6] pinctrl: qcom: Add ipq9574 pinctrl driver Varadarajan Narayanan
2025-02-12 15:52 ` Caleb Connolly
2025-01-30 5:37 ` [PATCH v2 4/6] mmc: msm_sdhci: Reset clocks before reconfiguration Varadarajan Narayanan
2025-01-30 5:37 ` [PATCH v2 5/6] qcom_defconfig: enable ipq9574 clock & pinctrl driver Varadarajan Narayanan
2025-02-12 15:52 ` Caleb Connolly
2025-01-30 5:37 ` [PATCH v2 6/6] configs: add ipq9574_mmc_defconfig Varadarajan Narayanan
2025-02-12 15:57 ` Caleb Connolly
2025-02-12 16:05 ` [PATCH v2 0/6] Add initial support for IPQ9574 based boards Caleb Connolly
2025-03-17 13:48 ` Caleb Connolly
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=bfc6f1ee-260c-4c47-abda-46dbd12f27e9@linaro.org \
--to=caleb.connolly@linaro.org \
--cc=Volodymyr_Babchuk@epam.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jh80.chung@samsung.com \
--cc=lehmanju@devpi.de \
--cc=lukma@denx.de \
--cc=marek.vasut+renesas@mailbox.org \
--cc=neil.armstrong@linaro.org \
--cc=pbrobinson@gmail.com \
--cc=peng.fan@nxp.com \
--cc=quic_varada@quicinc.com \
--cc=robert.marko@sartura.hr \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.denx.de \
/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