linux-aspeed.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v1 03/10] clk: ast2700: add clock controller
Date: Fri, 26 Jul 2024 13:13:22 +0200	[thread overview]
Message-ID: <fb3489cf-b288-426e-ace0-abf1d6b0fe0c@kernel.org> (raw)
In-Reply-To: <20240726110355.2181563-4-kevin_chen@aspeedtech.com>

On 26/07/2024 13:03, Kevin Chen wrote:
> Signed-off-by: Kevin Chen <kevin_chen@aspeedtech.com>

So you did not write commit msgs to none of the commits?

> ---
>  drivers/clk/Makefile      |    1 +
>  drivers/clk/clk-ast2700.c | 1166 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 1167 insertions(+)
>  create mode 100644 drivers/clk/clk-ast2700.c
> 
> diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
> index f793a16cad40..0d5992ea0fa4 100644
> --- a/drivers/clk/Makefile
> +++ b/drivers/clk/Makefile
> @@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI)	+= clk-fsl-sai.o
>  obj-$(CONFIG_COMMON_CLK_GEMINI)		+= clk-gemini.o
>  obj-$(CONFIG_COMMON_CLK_ASPEED)		+= clk-aspeed.o
>  obj-$(CONFIG_MACH_ASPEED_G6)		+= clk-ast2600.o
> +obj-$(CONFIG_MACH_ASPEED_G7)		+= clk-ast2700.o

...

> +
> +static const char *const pspclk_sel[] = {
> +	"soc0-mpll",
> +	"soc0-hpll",
> +};
> +
> +static const char *const soc0_uartclk_sel[] = {
> +	"soc0-clk24Mhz",
> +	"soc0-clk192Mhz",
> +};
> +
> +static const char *const emmcclk_sel[] = {
> +	"soc0-mpll_div4",
> +	"soc0-hpll_div4",
> +};
> +
> +static int ast2700_soc0_clk_init(struct device_node *soc0_node)
> +{
> +	struct clk_hw_onecell_data *clk_data;
> +	void __iomem *clk_base;
> +	struct ast2700_reset *reset;
> +	struct clk_hw **clks;
> +	int div;
> +	u32 val;
> +	int ret;
> +
> +	clk_data = kzalloc(struct_size(clk_data, hws, SOC0_NUM_CLKS), GFP_KERNEL);
> +	if (!clk_data)
> +		return -ENOMEM;
> +
> +	clk_data->num = SOC0_NUM_CLKS;
> +	clks = clk_data->hws;
> +
> +	clk_base = of_iomap(soc0_node, 0);
> +	if (WARN_ON(IS_ERR(clk_base)))

Drop WARN_ON

> +		return PTR_ERR(clk_base);
> +
> +	reset = kzalloc(sizeof(*reset), GFP_KERNEL);
> +	if (!reset)
> +		return -ENOMEM;
> +
> +	reset->base = clk_base;
> +
> +	reset->rcdev.owner = THIS_MODULE;
> +	reset->rcdev.nr_resets = SOC0_RESET_NUMS;
> +	reset->rcdev.ops = &ast2700_reset_ops;
> +	reset->rcdev.of_node = soc0_node;
> +
> +	ret = reset_controller_register(&reset->rcdev);
> +	if (ret) {
> +		pr_err("soc0 failed to register reset controller\n");
> +		return ret;
> +	}
> +
> +	//refclk

Weird comment. Please read Coding Style.


> +	clks[SCU0_CLKIN] =
> +		clk_hw_register_fixed_rate(NULL, "soc0-clkin", NULL, 0, SCU_CLK_25MHZ);
> +
> +	clks[SCU0_CLK_24M] =
> +		clk_hw_register_fixed_rate(NULL, "soc0-clk24Mhz", NULL, 0, SCU_CLK_24MHZ);
> +
> +	clks[SCU0_CLK_192M] =
> +		clk_hw_register_fixed_rate(NULL, "soc0-clk192Mhz", NULL, 0, SCU_CLK_192MHZ);
> +
> +	//hpll
> +	val = readl(clk_base + SCU0_HWSTRAP1);
> +	if ((val & GENMASK(3, 2)) != 0) {
> +		switch ((val & GENMASK(3, 2)) >> 2) {
> +		case 1:
> +			clks[SCU0_CLK_HPLL] =
> +				clk_hw_register_fixed_rate(NULL, "soc0-hpll", NULL, 0, 1900000000);
> +			break;
> +		case 2:
> +			clks[SCU0_CLK_HPLL] =
> +				clk_hw_register_fixed_rate(NULL, "soc0-hpll", NULL, 0, 1800000000);
> +			break;
> +		case 3:
> +			clks[SCU0_CLK_HPLL] =
> +				clk_hw_register_fixed_rate(NULL, "soc0-hpll", NULL, 0, 1700000000);
> +			break;
> +		}
> +	} else {
> +		val = readl(clk_base + SCU0_HPLL_PARAM);
> +		clks[SCU0_CLK_HPLL] = ast2700_soc0_hw_pll("soc0-hpll", "soc0-clkin", val);
> +	}
> +	clks[SCU0_CLK_HPLL_DIV2] = clk_hw_register_fixed_factor(NULL, "soc0-hpll_div2", "soc0-hpll", 0, 1, 2);
> +	clks[SCU0_CLK_HPLL_DIV4] = clk_hw_register_fixed_factor(NULL, "soc0-hpll_div4", "soc0-hpll", 0, 1, 4);
> +
> +	//dpll



Best regards,
Krzysztof


  reply	other threads:[~2024-07-26 11:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 11:09 [PATCH v1 00/10] Introduce ASPEED AST27XX BMC SoC Kevin Chen
2024-07-26 11:09 ` [PATCH v1 02/10] dt-binding: clk: ast2700: Add binding for Aspeed AST27xx Clock Kevin Chen
2024-07-26 11:11   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:06     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 01/10] dt-binding: mfd: aspeed,ast2x00-scu: Add binding for ASPEED AST2700 SCU Kevin Chen
2024-07-26 11:10   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-10-07 11:03       ` Krzysztof Kozlowski
2024-10-07 11:03         ` Krzysztof Kozlowski
2024-08-16  4:06     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 03/10] clk: ast2700: add clock controller Kevin Chen
2024-07-26 11:13   ` Krzysztof Kozlowski [this message]
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:06     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 04/10] dt-bindings: reset: ast2700: Add binding for ASPEED AST2700 Reset Kevin Chen
2024-07-26 11:13   ` Krzysztof Kozlowski
2024-08-16  4:07     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 05/10] dt-bindings: arm: aspeed: Add maintainer Kevin Chen
2024-07-26 11:14   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:07     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 06/10] dt-bindings: arm: aspeed: Add aspeed,ast2700-evb compatible string Kevin Chen
2024-07-26 11:15   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:08     ` Kevin Chen
2024-08-16  5:17       ` Krzysztof Kozlowski
2024-10-07  9:26         ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 07/10] arm64: aspeed: Add support for ASPEED AST2700 BMC SoC Kevin Chen
2024-07-26 11:16   ` Krzysztof Kozlowski
2024-08-15  5:51     ` 回覆: " Kevin Chen
2024-08-16  4:07     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 08/10] arm64: dts: aspeed: Add initial AST27XX device tree Kevin Chen
2024-07-26 11:19   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  5:08       ` Krzysztof Kozlowski
2024-10-07  9:26         ` Kevin Chen
2024-10-07 11:05           ` Krzysztof Kozlowski
2024-08-16  4:07     ` Kevin Chen
2024-07-26 11:09 ` [PATCH v1 10/10] arm64: defconfig: Add ASPEED AST2700 family support Kevin Chen
2024-07-26 11:09 ` [PATCH v1 09/10] arm64: dts: aspeed: Add initial AST2700 EVB device tree Kevin Chen
2024-07-26 11:16   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:07     ` Kevin Chen
2024-07-26 13:09 ` [PATCH v1 00/10] Introduce ASPEED AST27XX BMC SoC Rob Herring
2024-07-26 13:33   ` Krzysztof Kozlowski
2024-08-15  5:50     ` 回覆: " Kevin Chen
2024-08-16  4:06     ` Kevin Chen

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=fb3489cf-b288-426e-ace0-abf1d6b0fe0c@kernel.org \
    --to=krzk@kernel.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).