Re: [PATCH v2 3/3] clk: samsung: introduce Exynos2200 clock driver
From: Stephen Boyd
Date: Tue Mar 04 2025 - 13:32:42 EST
Quoting Ivaylo Ivanov (2025-02-23 03:56:00)
> diff --git a/drivers/clk/samsung/clk-exynos2200.c b/drivers/clk/samsung/clk-exynos2200.c
> new file mode 100644
> index 000000000..151bdb35a
> --- /dev/null
> +++ b/drivers/clk/samsung/clk-exynos2200.c
> @@ -0,0 +1,3928 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (C) 2025 Ivaylo Ivanov <ivo.ivanov.ivanov1@xxxxxxxxx>
> + * Author: Ivaylo Ivanov <ivo.ivanov.ivanov1@xxxxxxxxx>
> + *
> + * Common Clock Framework support for Exynos2200 SoC.
> + */
> +
> +#include <linux/clk.h>
Remove this include because this is a clk provider and not a clk
consumer.
> +#include <linux/clk-provider.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +
> +#include <dt-bindings/clock/samsung,exynos2200-cmu.h>
> +
> +#include "clk.h"
> +#include "clk-exynos-arm64.h"
> +
> +/* NOTE: Must be equal to the last clock ID increased by one */
> +#define CLKS_NR_TOP (CLK_DOUT_TCXO_DIV4 + 1)
> +#define CLKS_NR_ALIVE (CLK_DOUT_ALIVE_DSP_NOC + 1)
> +#define CLKS_NR_PERIS (CLK_DOUT_PERIS_DDD_CTRL + 1)
> +#define CLKS_NR_CMGP (CLK_DOUT_CMGP_USI6 + 1)
> +#define CLKS_NR_HSI0 (CLK_DOUT_DIV_CLK_HSI0_EUSB + 1)
[...]
> +
> +static int __init exynos2200_cmu_probe(struct platform_device *pdev)
> +{
> + const struct samsung_cmu_info *info;
> + struct device *dev = &pdev->dev;
> +
> + info = of_device_get_match_data(dev);
Use device APIs to be firmware agnostic: device_get_match_data()
> + exynos_arm64_register_cmu(dev, dev->of_node, info);
> +
> + return 0;
> +}
> +
> +static const struct of_device_id exynos2200_cmu_of_match[] = {
> + {
> + .compatible = "samsung,exynos2200-cmu-cmgp",
> + .data = &cmgp_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-hsi0",
> + .data = &hsi0_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-peric0",
> + .data = &peric0_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-peric1",
> + .data = &peric1_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-peric2",
> + .data = &peric2_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-ufs",
> + .data = &ufs_cmu_info,
> + }, {
> + .compatible = "samsung,exynos2200-cmu-vts",
> + .data = &vts_cmu_info,
> + }, { }
> +};
> +
> +static struct platform_driver exynos2200_cmu_driver __refdata = {
> + .driver = {
> + .name = "exynos2200-cmu",
> + .of_match_table = exynos2200_cmu_of_match,
> + .suppress_bind_attrs = true,
> + },
> + .probe = exynos2200_cmu_probe,
> +};
> +
> +static int __init exynos2200_cmu_init(void)
> +{
> + return platform_driver_register(&exynos2200_cmu_driver);
Was this supposed to be platform_driver_probe()? The __refdata usage
suggests that but all of the __init markings and stuff in the samsung
clk driver worry me.