mbox series

[0/2] samsung: exynos: convert clkout to module driver

Message ID 20201001165646.32279-1-krzk@kernel.org
Headers show
Series samsung: exynos: convert clkout to module driver | expand

Message

Krzysztof Kozlowski Oct. 1, 2020, 4:56 p.m. UTC
Hi,

The patch #2 depends on #1.  I could take it via samsung-soc or both
could go via samsung-clk tree.

The patchset is a proper solution to issue reported by Marek [1], for
which a revert was done [2].

[1] https://lore.kernel.org/linux-samsung-soc/20200906142146.21266-1-krzk@kernel.org/T/#m726edc89ff2927cf5aaf8b165128b3e3c45a677a
[2] https://lore.kernel.org/linux-samsung-soc/20200921174818.15525-1-krzk@kernel.org/T/#u

Best regards,
Krzysztof


Krzysztof Kozlowski (2):
  soc: samsung: exynos-pmu: instantiate clkout driver as MFD
  clk: samsung: exynos-clkout: convert to module driver

 drivers/clk/samsung/clk-exynos-clkout.c | 198 +++++++++++++++++-------
 drivers/soc/samsung/exynos-pmu.c        |  11 ++
 2 files changed, 152 insertions(+), 57 deletions(-)

Comments

Stephen Boyd Oct. 14, 2020, 2:44 a.m. UTC | #1
Quoting Krzysztof Kozlowski (2020-10-01 09:56:45)
> The Exynos clock output (clkout) driver uses same register address space
> (Power Management Unit address space) as Exynos PMU driver and same set
> of compatibles.  It was modeled as clock provider instantiated with
> CLK_OF_DECLARE_DRIVE().
> 
> This however brings ordering problems and lack of probe deferral,
> therefore clkout driver should be converted to a regular module and
> instantiated as a child of PMU driver to be able to use existing
> compatibles and address space.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Sylwester Nawrocki Oct. 23, 2020, 11:34 a.m. UTC | #2
Hi,

On 10/1/20 18:56, Krzysztof Kozlowski wrote:
> The Exynos clock output (clkout) driver uses same register address space
> (Power Management Unit address space) as Exynos PMU driver and same set
> of compatibles.  It was modeled as clock provider instantiated with
> CLK_OF_DECLARE_DRIVE().
> 
> This however brings ordering problems and lack of probe deferral,
> therefore clkout driver should be converted to a regular module and
> instantiated as a child of PMU driver to be able to use existing
> compatibles and address space.

It might have been cleaner to have the CLKOUT device as a PMU subnode in DT, 
then device instantiation would be already covered by devm_of_platform_populate().
But it gets a bit complicated to make such a change in a backward compatible way.

I have tested both patches on Trats2, where CLKOUT provides master clock for
the audio codec.

Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
 

> @@ -128,6 +134,11 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>   
>   	platform_set_drvdata(pdev, pmu_context);
>   
> +	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, exynos_pmu_devs,
> +				   ARRAY_SIZE(exynos_pmu_devs), NULL, 0, NULL);
> +	if (ret)
> +		return ret;
> +
>   	if (devm_of_platform_populate(dev))
>   		dev_err(dev, "Error populating children, reboot and poweroff might not work properly\n");
Krzysztof Kozlowski Oct. 23, 2020, 11:37 a.m. UTC | #3
On Fri, Oct 23, 2020 at 01:34:19PM +0200, Sylwester Nawrocki wrote:
> Hi,

> 

> On 10/1/20 18:56, Krzysztof Kozlowski wrote:

> > The Exynos clock output (clkout) driver uses same register address space

> > (Power Management Unit address space) as Exynos PMU driver and same set

> > of compatibles.  It was modeled as clock provider instantiated with

> > CLK_OF_DECLARE_DRIVE().

> > 

> > This however brings ordering problems and lack of probe deferral,

> > therefore clkout driver should be converted to a regular module and

> > instantiated as a child of PMU driver to be able to use existing

> > compatibles and address space.

> 

> It might have been cleaner to have the CLKOUT device as a PMU subnode in DT, 

> then device instantiation would be already covered by devm_of_platform_populate().

> But it gets a bit complicated to make such a change in a backward compatible way.


Yes, I agree, but the backward compatibility would be here a pain.
Optionally the driver could check for new DTB and skip adding MFD
children... but this is just simpler.

> 

> I have tested both patches on Trats2, where CLKOUT provides master clock for

> the audio codec.

> 

> Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>


Thanks!

Best regards,
Krzysztof