Re: [PATCH v11 3/5] clk / soc: mediatek: Move mt8173 MMSYS to platform driver

From: Matthias Brugger
Date: Wed Mar 11 2020 - 09:23:12 EST




On 11/03/2020 12:56, Enric Balletbo i Serra wrote:
> From: Matthias Brugger <mbrugger@xxxxxxxx>
>
> There is no strong reason for this to use CLK_OF_DECLARE instead of
> being a platform driver. Plus, MMSYS provides clocks but also a shared
> register space for the mediatek-drm and the mediatek-mdp
> driver. So move the MMSYS clocks to a new platform driver and also
> create a new MMSYS platform driver in drivers/soc/mediatek that
> instantiates the clock driver.
>
> Signed-off-by: Matthias Brugger <mbrugger@xxxxxxxx>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@xxxxxxxxxxxxx>
> ---
>
> Changes in v11:
> - Leave the clocks part in drivers/clk (clk-mt8173-mm)
> - Instantiate the clock driver from the mtk-mmsys driver.
> - Add default config option to not break anything.
> - Removed the Reviewed-by CK tag as changed the organization.
>
> Changes in v10:
> - Renamed to be generic mtk-mmsys
> - Add driver data support to be able to support diferent SoCs
>
> Changes in v9:
> - Move mmsys to drivers/soc/mediatek (CK)
>
> Changes in v8:
> - Be a builtin_platform_driver like other mediatek mmsys drivers.
>
> Changes in v7:
> - Free clk_data->clks as well
> - Get rid of private data structure
>
> drivers/clk/mediatek/Kconfig | 7 ++
> drivers/clk/mediatek/Makefile | 1 +
> drivers/clk/mediatek/clk-mt8173-mm.c | 146 +++++++++++++++++++++++++++
> drivers/clk/mediatek/clk-mt8173.c | 104 -------------------

I'm not sure we really need that. We can just convert the mmsys clock bits in
clk-mt8173.c to a platform driver with no need put them in a seperate file.
If you think a seperate file is worth doing, I think the approach is to put the
driver in a seperate file first and in a following patch change it to a platform
driver.

Anyway its Stephen to make the decision. If he thinks things are fine like this,
I'm happy to take the patch through my tree.

> drivers/soc/mediatek/Kconfig | 8 ++
> drivers/soc/mediatek/Makefile | 1 +
> drivers/soc/mediatek/mtk-mmsys.c | 50 +++++++++
> 7 files changed, 213 insertions(+), 104 deletions(-)
> create mode 100644 drivers/clk/mediatek/clk-mt8173-mm.c
> create mode 100644 drivers/soc/mediatek/mtk-mmsys.c
>

<snip>

> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> index 2114b563478c..e84513318725 100644
> --- a/drivers/soc/mediatek/Kconfig
> +++ b/drivers/soc/mediatek/Kconfig
> @@ -44,4 +44,12 @@ config MTK_SCPSYS
> Say yes here to add support for the MediaTek SCPSYS power domain
> driver.
>
> +config MTK_MMSYS
> + bool "MediaTek MMSYS Support"
> + depends on COMMON_CLK_MT8173_MMSYS
> + default COMMON_CLK_MT8173_MMSYS

If we don't create a new file, we would need to depend on COMMON_CLK_MT8173 or
maybe not even that. I suppose the system does not get anywhere without the
clock driver.

Regards,
Matthias